FARGOS/VISTA Object Management Environment Core  ..
FARGOS/VISTA Object Management Environment Core Table of Contents
ReadBinaryLog Class Reference

Reads a binary log, expands and formats as original plain text. If provided a text file, acts like 'cat'. More...

#include <read_binary_log.hpp>

+ Inheritance diagram for ReadBinaryLog:

Public Member Functions

 ReadBinaryLog (OS_HANDLE_TYPE fd, OS_HANDLE_TYPE outputTo=_STDOUT_FD)
 
 ~ReadBinaryLog ()
 
OS_HANDLE_TYPE setNewOutputDescriptor (OS_HANDLE_TYPE newFD)
 
virtual int processBuffer (File_Buffer *bfrState) VIRTUAL_OVERRIDE
 Process buffer contents. More...
 
virtual int processLine (const unsigned char *line, size_t lineLen) VIRTUAL_OVERRIDE
 Writes data to output descriptor. More...
 
- Public Member Functions inherited from Read_And_Process_File
 Read_And_Process_File (OS_HANDLE_TYPE srcDescriptor, ReadModes mode=READ_NORMAL, const FileTypeReaderSelector *selectorTable=nullptr)
 Construct from an existing file descriptor. More...
 
 Read_And_Process_File (const char *fileName, ReadModes mode=READ_NORMAL, const FileTypeReaderSelector *selectorTable=nullptr)
 Construct given the name of a file to be opened. More...
 
virtual ~Read_And_Process_File ()
 
void setReadRoutine (ReadDataFP altRoutine) OME_ALWAYS_INLINE
 Set a new file read routine. More...
 
virtual void noteDataRead (const unsigned char *bfr, size_t bfrLen) const
 user-exit to see original copy of any data read More...
 
int readAndProcessBlocksFromFile (size_t recordLength)
 Process fixed length records. More...
 
int findAndProcessNextLine (File_Buffer *fileBfr, bool hasHeaderLine=false)
 Process next text line from buffer. More...
 
int readAndProcessTextLines (bool hasHeaderLine=false)
 Process text lines. More...
 
int readIntoFileBuffer (File_Buffer *bfr)
 
int readAndProcessFile ()
 Process file contents with no imposed structure. More...
 
virtual int beginFile ()
 
virtual int completedFile (int recordsSeen)
 
virtual int processHeaderLine (unsigned char *line, size_t lineLen)
 Interface to handle special case processing of header lines. More...
 
virtual int_fast32_t processBlock (unsigned char *block, size_t blockLen)
 

Protected Types

enum  {
  WANT_LINE_HEADER, WANT_FILENAME, WANT_FORMAT, WANT_ARG_HEADER,
  WANT_ARG_VALUE, WANT_LINE_END, CHECK_FOR_BINARY_HEADER, COPY_AS_IS
}
 

Protected Member Functions

virtual int outputAssembledLine ()
 Process a binary log message buffer and convert to a formatted log line, then invoke processLine() to write the log line to the log file. More...
 
- Protected Member Functions inherited from Read_And_Process_File
virtual int readIntoBuffer (unsigned char *bfr, size_t bfrLen)
 

Protected Attributes

uint32_t parseState
 
uint32_t processedArgCount
 
uint32_t parseOffset
 
uint32_t fileNameLen
 
uint32_t formatStringLen
 
OS_HANDLE_TYPE outputToFD
 
const char * fileName
 
const char * formatString
 
TimePointCachetimePointCache
 
LogLineBinaryHeaderlineHeader
 
LogLineBinaryValueHeaderargHeader [LogMessageRecord::LOG_MAX_ARGUMENT_TOTAL]
 
const unsigned char * argData [LogMessageRecord::LOG_MAX_ARGUMENT_TOTAL]
 
- Protected Attributes inherited from Read_And_Process_File
File_BufferintermediateBuffer
 

Additional Inherited Members

- Public Types inherited from Read_And_Process_File
enum  ReadModes {
  READ_GUESS =0, READ_NORMAL =1, READ_ZLIB =2, READ_LZ4 =4,
  READ_PCAP =8, WRITE =16, WRITE_APPEND =WRITE | 32, WRITE_TRUNCATE =WRITE | 64,
  READ_FROM_SOCKET =128
}
 
typedef int(* ReadDataFP) (class Read_And_Process_File *input, unsigned char *bfr, uint32_t bfrLen)
 
- Static Public Member Functions inherited from Read_And_Process_File
static int defaultReadRoutine (Read_And_Process_File *input, unsigned char *bfr, uint32_t bfrLen)
 Default read routine. More...
 
static const FileTypeReaderSelectorfindTypeOfFile (const char *fileName, const FileTypeReaderSelector *selectorTable)
 
static OS_HANDLE_TYPE openFile (const char *fileName, ReadModes mode=READ_NORMAL)
 Open the indicated file. More...
 
static int closeFile (OS_HANDLE_TYPE fd, ReadModes mode=READ_NORMAL)
 Close an native operating system file handle. More...
 
static int findFileInPathsWithSuffixes (char *path, uint_fast32_t pathLen, const char *searchRootPaths, const char *possibleFilenames="", const char *possibleSuffixes="")
 Search for a file using a combination of directory roots and file suffixes. More...
 
- Public Attributes inherited from Read_And_Process_File
ReadDataFP readRoutine
 
void * auxData
 
OS_HANDLE_TYPE descriptor
 
uint32_t recordsProcessed
 
enum ReadModes readMode
 
uint32_t _explicitAlignmentPadding
 
- Static Protected Member Functions inherited from Read_And_Process_File
static uint32_t matchFileHeader (const FileTypeReaderSelector *criteria, const unsigned char *fileHdr, const size_t hdrLen)
 

Detailed Description

Reads a binary log, expands and formats as original plain text. If provided a text file, acts like 'cat'.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected
Enumerator
WANT_LINE_HEADER 
WANT_FILENAME 
WANT_FORMAT 
WANT_ARG_HEADER 
WANT_ARG_VALUE 
WANT_LINE_END 
CHECK_FOR_BINARY_HEADER 
COPY_AS_IS 

Constructor & Destructor Documentation

◆ ReadBinaryLog()

◆ ~ReadBinaryLog()

ReadBinaryLog::~ReadBinaryLog ( )
inline

References timePointCache.

Member Function Documentation

◆ outputAssembledLine()

◆ processBuffer()

◆ processLine()

int ReadBinaryLog::processLine ( const unsigned char *  line,
size_t  lineLen 
)
virtual

Writes data to output descriptor.

Output a line to the log file.

Parameters
linepoints to the start of the log line.
lineLenindicates the length of the log line.
Return values
0indicates the log line was written successfully
-1indicates the log line was not completely written.

Reimplemented from Read_And_Process_File.

References outputToFD.

Referenced by outputAssembledLine(), and processBuffer().

◆ setNewOutputDescriptor()

OS_HANDLE_TYPE ReadBinaryLog::setNewOutputDescriptor ( OS_HANDLE_TYPE  newFD)
inline

References OS_HANDLE_TYPE, and outputToFD.

Member Data Documentation

◆ argData

const unsigned char* ReadBinaryLog::argData[LogMessageRecord::LOG_MAX_ARGUMENT_TOTAL]
protected

◆ argHeader

◆ fileName

const char* ReadBinaryLog::fileName
protected

◆ fileNameLen

uint32_t ReadBinaryLog::fileNameLen
protected

◆ formatString

const char* ReadBinaryLog::formatString
protected

◆ formatStringLen

uint32_t ReadBinaryLog::formatStringLen
protected

Referenced by processBuffer().

◆ lineHeader

LogLineBinaryHeader* ReadBinaryLog::lineHeader
protected

◆ outputToFD

OS_HANDLE_TYPE ReadBinaryLog::outputToFD
protected

◆ parseOffset

uint32_t ReadBinaryLog::parseOffset
protected

Referenced by processBuffer(), and ReadBinaryLog().

◆ parseState

uint32_t ReadBinaryLog::parseState
protected

Referenced by processBuffer(), and ReadBinaryLog().

◆ processedArgCount

uint32_t ReadBinaryLog::processedArgCount
protected

Referenced by processBuffer().

◆ timePointCache

TimePointCache* ReadBinaryLog::timePointCache
protected

The documentation for this class was generated from the following files:
Generated: Fri Jul 31 2020 18:19:16
Support Information