C12Adapter Opensource C++ Interface
MLogFile Class Reference

Abstract log file utility class to handle the log from the monitor. More...

Inheritance diagram for MLogFile:

Classes

struct  LogFilePage
 Page format of the monitor file. More...
 
struct  PacketHeader
 Packet header structure. More...
 

Public Types

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

virtual ~MLogFile ()
 Object destructor, close the log file.
 
bool IsOpen () const
 Tells if the file is open. More...
 
const MStdStringGetFileName () const
 Get the file name, as set for logging. More...
 
const MStdStringGetOpenWarnings () 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)
 

Protected Member Functions

 MLogFile ()
 Constructor that creates an uninitialized log file object.
 

Detailed Description

Abstract 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.

Member Enumeration Documentation

anonymous enum
Enumerator
PAGE_HEADER_SIGNATURE 

Monitor file header and page header signature (also tells about version).

PAGE_OBFUSCATED_HEADER_SIGNATURE 

Monitor file header and page header signature that tells the page contents are obfuscated (also tells about version).

PAGE_TOTAL_SIZE 

Total page size, shall be efficient for most architectures.

PAGE_HEADER_SIZE 

Page header size.

PAGE_FOOTER_SIZE 

Page footer size.

PAGE_BODY_SIZE 

Body size of the page.

PACKET_HEADER_SIZE 

Size of the packet header.

NUMBER_OF_PAGES_LIMIT 

Still limit the number of pages in the file with no size limit, the file size is about 100 megabytes.

Member Function Documentation

const MStdString& MLogFile::GetFileName ( ) const
inline

Get the file name, as set for logging.

If the file exists, the full file name will be returned, made from the user file name by the operating system.

bool MLogFile::GetObfuscate ( ) const
inline

Whether to obfuscate the monitor file so it does not clearly present text chunks of data. This option is not any sort of secure encryption.

const MStdString& MLogFile::GetOpenWarnings ( ) const
inline

Get the warning message which might arise during opening a file and checking its contents.

It will return an empty string if there were no warnings during opening. The warnings are kept until a new open is called.

bool MLogFile::IsOpen ( ) const
inline

Tells if the file is open.

Normally the error is thrown at the constructor if there is a problem with the file at opening, however if the problem appears later on use, the object will exist, throw exceptions on attempts to operate the file, and IsOpen will become false.

void MLogFile::SetListener ( MMonitorFile listener)
inline

Sets the listener object to start handling events.

Note that new pointer replaces previous one without destroying it.

void MLogFile::SetObfuscate ( bool  yes)
inline

Whether to obfuscate the monitor file so it does not clearly present text chunks of data. This option is not any sort of secure encryption.