C12Adapter Opensource C++ Interface
|
Log file utility class to handle the log from the monitor. More...
Public Types | |
typedef Muint32 | PositionType |
Type used to denote the reader position. More... | |
![]() | |
enum | { PAGE_HEADER_SIGNATURE = 0xA2EBBAED, PAGE_OBFUSCATED_HEADER_SIGNATURE = 0xA2EBBAEC, PAGE_TOTAL_SIZE = 0x1000, PAGE_HEADER_SIZE = 16, PAGE_FOOTER_SIZE = 4, PAGE_BODY_SIZE = PAGE_TOTAL_SIZE - PAGE_HEADER_SIZE - PAGE_FOOTER_SIZE, PACKET_HEADER_SIZE = 10, NUMBER_OF_PAGES_LIMIT = 0xFFFF } |
Public Member Functions | |
MLogFileReader () | |
Constructor that creates an uninitialized log file object. | |
MLogFileReader (const MStdString &fileName) | |
Constructor that creates an existing log file with the given file name. More... | |
virtual | ~MLogFileReader () |
Object destructor, close the log file. | |
void | Open (const MStdString &fileName) |
Open an existing file to read. More... | |
void | Reset () |
Reset the current pointer, one that walks through messages. More... | |
bool | EndOfFile () const |
Tells if the current position is the End of the File. More... | |
const MLogFile::PacketHeader & | ReadPacketHeader () |
Read the packet header of the current packet. More... | |
unsigned | GetPacketBodyLength () const |
Get the length of the packet body after the reader was read successfully. More... | |
void | ReadPacketBody (char *buffer) |
Fill the given buffer with the body characters of the packet and advance the file pointer to the next packet. More... | |
void | SkipPacketBody () |
Skip the body of the packet and advance to the next packet. More... | |
PositionType | GetPosition () const |
Get the position of the current packet within an opened file. More... | |
void | SetPosition (PositionType ptr) |
Get the position of the current packet within an opened file. More... | |
![]() | |
virtual | ~MLogFile () |
Object destructor, close the log file. | |
bool | IsOpen () const |
Tells if the file is open. More... | |
const MStdString & | GetFileName () const |
Get the file name, as set for logging. More... | |
const MStdString & | GetOpenWarnings () const |
Get the warning message which might arise during opening a file and checking its contents. More... | |
void | SetListener (MMonitorFile *listener) |
Sets the listener object to start handling events. More... | |
virtual void | Close () |
Close the file, if it was open. | |
bool | GetObfuscate () const |
void | SetObfuscate (bool yes) |
Additional Inherited Members | |
![]() | |
MLogFile () | |
Constructor that creates an uninitialized log file object. | |
Log file utility class to handle the log from the monitor.
The concrete instances of this class will provide facilities for reading and writing the log files.
Reader can walk through the file sequentially. Also, it is possible to save and restore the current position within a file. Position is bound to a concrete file and it will not be valid if the file changed. For that, it is recommended to use positions only for a currently opened file.
Typical way how the file is open and read is this:
typedef Muint32 MLogFileReader::PositionType |
Type used to denote the reader position.
It allows storing and restoring the position within the file. Position pointer of NULL will point to nowhere.
|
inlineexplicit |
Constructor that creates an existing log file with the given file name.
|
inline |
Tells if the current position is the End of the File.
End of the file position pointer will be a NULL pointer.
|
inline |
Get the length of the packet body after the reader was read successfully.
|
inline |
Get the position of the current packet within an opened file.
Position is like pointer, except that it points to a place within an opened log file. It is guaranteed that the position will be of a size the same as the size of a pointer to any type (like void). Also, NULL pointer will point to no object, and referencing it its position will lead to EndOfFile condition.
void MLogFileReader::Open | ( | const MStdString & | fileName | ) |
Open an existing file to read.
void MLogFileReader::ReadPacketBody | ( | char * | buffer | ) |
Fill the given buffer with the body characters of the packet and advance the file pointer to the next packet.
const MLogFile::PacketHeader& MLogFileReader::ReadPacketHeader | ( | ) |
Read the packet header of the current packet.
|
inline |
Reset the current pointer, one that walks through messages.
Position points to the first item in a file.
void MLogFileReader::SetPosition | ( | PositionType | ptr | ) |
Get the position of the current packet within an opened file.
Position is like pointer, except that it points to a place within an opened log file. It is guaranteed that the position will be of a size the same as the size of a pointer to any type (like void). Also, NULL pointer will point to no object, and referencing it its position will lead to EndOfFile condition.
void MLogFileReader::SkipPacketBody | ( | ) |
Skip the body of the packet and advance to the next packet.