Garmin Fleet Management Controller  2.19.0
LogParser Class Referenceabstract

Abstract base class for log item parsers. More...

#include <LogParser.h>

+ Inheritance diagram for LogParser:

Public Member Functions

 LogParser ()
 Constructor. More...
 
virtual ~LogParser ()
 Destructor. More...
 
CString getFilename ()
 Get the path of the log file being parsed. More...
 
int getLineCount () const
 Return the number of lines parsed so far. More...
 
virtual CString getPacketDetail (int aLineNumber)=0
 Return the packet detail as a formatted string. More...
 
virtual CString getPacketTitle (int aLineNumber)=0
 Return the packet title as a formatted string. More...
 
void init (const CString &aFilename)
 Initialize the LogParser to read a particular file. More...
 
BOOL readLog ()
 Reads from the log file starting from the end of the last read position and adds it to the display. More...
 
virtual void resendPacket (int aLineNumber)=0
 Resend the packet at this line number. More...
 
void reset ()
 Reset the log parser to initial state. More...
 
void setRenderWidth (int aWidth)
 Set the number of pixels available for rendering text. More...
 

Protected Member Functions

CString formatMultiLineHex (int aSize, uint8 *aData)
 Format bytes into a multi logLine hex dump format. More...
 

Protected Attributes

BOOL mIsMorning
 If TRUE, the log was started in the mIsMorning (computed from log header) More...
 
int mLineCount
 Number of lines that have been parsed so far. More...
 
std::map< int, std::streamoff > mLineOffset
 Map of log items to the offset in the log file where the text line starts. More...
 
CString mLogFilename
 File name of the currently open log file. More...
 
int mLogStartHr
 Hour of the time when the log file was created (from log header) More...
 
int mLogStartMillis
 Milliseconds of the time when the log file was created (from log header) More...
 
int mLogStartMin
 Minutes of the time when the log file was created (from log header) More...
 
int mLogStartSec
 Seconds of the time when the log file was created (from log header) More...
 
std::streamoff mParseEndOffset
 Offset of the log file where parsing stopped. More...
 
int mRenderWidth
 Available width in pixels to render the packet detail. More...
 

Detailed Description

Abstract base class for log item parsers.

The LogParser is used by the LogViewer to perform the work associated with parsing the log.

Definition at line 23 of file LogParser.h.

Constructor & Destructor Documentation

LogParser::LogParser ( )

Constructor.

Does nothing special

Definition at line 23 of file LogParser.cpp.

LogParser::~LogParser ( )
virtual

Destructor.

Does nothing special

Definition at line 31 of file LogParser.cpp.

Member Function Documentation

CString LogParser::formatMultiLineHex ( int  aSize,
uint8 aData 
)
protected

Format bytes into a multi logLine hex dump format.

Parameters
aSizeThe number of bytes to format
aDataThe bytes to format
Returns
A string containing the hex dump

Definition at line 165 of file LogParser.cpp.

Referenced by setRenderWidth().

CString LogParser::getFilename ( )

Get the path of the log file being parsed.

Returns
The path of the log file being parsed

Definition at line 204 of file LogParser.cpp.

int LogParser::getLineCount ( ) const

Return the number of lines parsed so far.

Returns
The number of lines parsed.

Definition at line 141 of file LogParser.cpp.

References setRenderWidth().

virtual CString LogParser::getPacketDetail ( int  aLineNumber)
pure virtual

Return the packet detail as a formatted string.

Parameters
aLineNumberthe line number of the packet to parse

Implemented in FmiLogParser.

virtual CString LogParser::getPacketTitle ( int  aLineNumber)
pure virtual

Return the packet title as a formatted string.

Parameters
aLineNumberthe line number of the packet to parse

Implemented in FmiLogParser.

void LogParser::init ( const CString &  aFilename)

Initialize the LogParser to read a particular file.

Parameters
aFilenameThe file to read

Definition at line 193 of file LogParser.cpp.

BOOL LogParser::readLog ( )

Reads from the log file starting from the end of the last read position and adds it to the display.

The display text is normally the Garmin packet name, but for FMI packets the FMI packet name is used, and for Garmin commands the Garmin command name is used.

Returns
TRUE if the log file was updated, FALSE if not (or an error occurred)

Definition at line 44 of file LogParser.cpp.

References cnt_of_array, FALSE, and TRUE.

virtual void LogParser::resendPacket ( int  aLineNumber)
pure virtual

Resend the packet at this line number.

Parameters
aLineNumberthe line number of the packet to resend

Implemented in FmiLogParser.

void LogParser::reset ( )

Reset the log parser to initial state.

Definition at line 130 of file LogParser.cpp.

void LogParser::setRenderWidth ( int  aWidth)

Set the number of pixels available for rendering text.

Parameters
aWidthThe width of the packet detail area, in pixels

Definition at line 151 of file LogParser.cpp.

References formatMultiLineHex().

Referenced by getLineCount().

Member Data Documentation

BOOL LogParser::mIsMorning
protected

If TRUE, the log was started in the mIsMorning (computed from log header)

Definition at line 89 of file LogParser.h.

int LogParser::mLineCount
protected

Number of lines that have been parsed so far.

Definition at line 98 of file LogParser.h.

std::map<int, std::streamoff> LogParser::mLineOffset
protected

Map of log items to the offset in the log file where the text line starts.

Definition at line 95 of file LogParser.h.

CString LogParser::mLogFilename
protected

File name of the currently open log file.

Definition at line 74 of file LogParser.h.

int LogParser::mLogStartHr
protected

Hour of the time when the log file was created (from log header)

Definition at line 77 of file LogParser.h.

int LogParser::mLogStartMillis
protected

Milliseconds of the time when the log file was created (from log header)

Definition at line 86 of file LogParser.h.

int LogParser::mLogStartMin
protected

Minutes of the time when the log file was created (from log header)

Definition at line 80 of file LogParser.h.

int LogParser::mLogStartSec
protected

Seconds of the time when the log file was created (from log header)

Definition at line 83 of file LogParser.h.

std::streamoff LogParser::mParseEndOffset
protected

Offset of the log file where parsing stopped.

Definition at line 92 of file LogParser.h.

int LogParser::mRenderWidth
protected

Available width in pixels to render the packet detail.

Definition at line 101 of file LogParser.h.


The documentation for this class was generated from the following files: