MAK Data Logger API Documentation for HLA
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
MAKLogger::DtLgrFileFormatter Class Referenceabstract

An abstract logger file formatter. More...

+ Inheritance diagram for MAKLogger::DtLgrFileFormatter:
+ Collaboration diagram for MAKLogger::DtLgrFileFormatter:

Public Member Functions

virtual ~DtLgrFileFormatter ()
 DTOR. More...
 
virtual void setSerialMode (bool enable)
 Get whether the formatter is in serial mode. More...
 
virtual bool serialMode () const
 Get whether the formatter is in serial mode. More...
 
virtual void copyMetaData (const DtLgrFileFormatter *formatter)
 Copy the meta data from the given formatter. More...
 
virtual DtLgrEntityTrackerentityTracker () const
 Get the formatter's entity tracker, or null if it does not have one. More...
 
virtual void setTimeLimit (double limit)
 Set the time limit on reads during playback. More...
 
virtual DtLoggerFileloggerFile ()
 Get the logger file the formatter is operating on. More...
 
virtual const DtLoggerFileloggerFile () const
 Get the logger file the formatter is operating on. More...
 
DtLoggerFileMetaDatametaData ()
 Get the meta data for the file. More...
 
const DtLoggerFileMetaDatametaData () const
 Get the meta data for the file. More...
 
Abstract File Formatter interface.
virtual void initializeSerialMode (DtFilePosition firstPacket=0, DtFilePosition lastPacket=0, bool skipCheckpointRead=false)=0
 Initialize serial mode, this function must be called once to properly set the first and last serial packets. More...
 
virtual bool isEofValid () const =0
 Returns whether EOF is valid. More...
 
virtual bool hasLastPacket () const =0
 Returns whether the file has set its last packet. More...
 
virtual bool recoverLastPacket ()=0
 Recover the last packet by seeking from the beginning of the file Return - Last packet found? More...
 
virtual double firstPacketTime () const =0
 The time of the first packet. More...
 
virtual size_t firstPacketSize () const =0
 The size of the first packet. More...
 
virtual double lastPacketTime () const =0
 The time of the last packet. More...
 
virtual size_t lastPacketSize () const =0
 The size of the last packet. More...
 
virtual bool atEndOfFile ()=0
 Check to see if after all packets. More...
 
virtual bool seekToFirstPacket ()=0
 Seek to first packet in the file. More...
 
virtual bool seekToFirstPacket (int type)=0
 Seek to first packet of a given type in the file. More...
 
virtual bool seekToLastPacket ()=0
 Seek to the last packet in the file. More...
 
virtual bool seekToLastPacket (int type)=0
 Seek to the last packet of a given type in the file. More...
 
virtual bool seekToFirstPacketBeforeTime (double time)=0
 Seek to the first packet before the given time. More...
 
virtual bool seekToFirstPacketBeforeTime (int type, double time)=0
 Seek to the first packet of a given type before the given time. More...
 
virtual bool seekToFirstPacketAfterTime (double time)=0
 Seek to the first packet after the given time. More...
 
virtual bool seekToFirstPacketAfterTime (int type, double time)=0
 Seek to the first packet of a given type after the given time. More...
 
virtual bool seekToNextSerialPacket ()=0
 Seek to the next serial packet. More...
 
virtual bool seekToNextPacket ()=0
 Seek to the next packet. More...
 
virtual bool seekToNextPacket (int type)=0
 Seek to the next packet of a given type. More...
 
virtual bool seekToPreviousPacket ()=0
 Seek to the previous packet. More...
 
virtual bool seekToPreviousPacketOfType (int type)=0
 Seek to the previous packet of a given type. More...
 
virtual void seekToPosition (DtFilePosition)=0
 Seek to a specific position. More...
 
virtual double currentPacketTime ()=0
 Get the current packet time. More...
 
virtual int currentPacketType ()=0
 Get the current packet type. More...
 
virtual size_t currentPacketSize ()=0
 Get the current packet size. More...
 
virtual DtFilePosition currentPosition ()=0
 Get the current file position. More...
 
virtual bool hasCheckpoints () const =0
 Get whether the format supports checkpoints. More...
 
virtual void readMetaData ()=0
 Read the metadata from the file. More...
 
virtual void readMetaData (DtLoggerFileMetaData::DataPosition position)=0
 Reads the specified meta data from the file. More...
 
virtual void writeMetaData (DtLoggerFileMetaData::DataPosition position)=0
 Writes meta data at a specific position in the file. More...
 
virtual void readPacketsUptoCount (DtMessageBuffer &, DtMemoryBufferSP, int packetCount)=0
 Read the given number of packets or up to the size of the smart buffer which ever comes first. More...
 
virtual void readPacketsUptoSize (DtMessageBuffer &, DtMemoryBufferSP)=0
 Read packets to fill the smart buffer. More...
 
virtual double readPacketsUpToTime (DtMessageBuffer &, DtMemoryBufferSP, double time, bool inclusive=true)=0
 Read all packets up to a time or up to the size of the smart buffer which ever comes first. More...
 
virtual void writePackets (const DtMessageBuffer &)=0
 Write all the packets into the end of the file. More...
 
virtual void writePacket (const DtPacket &packet)=0
 Write a single packet to the file. More...
 
virtual size_t writePacket (const DtPacket &, void *memory, size_t memorySize, int fileWriteBufferOffset=-1)=0
 Write a packet into the provided memory. More...
 
virtual void setDuration (double duration)=0
 Set the duration. More...
 
virtual void setStartEndTimes (double start, double end)=0
 Set the start and end times (first and last packet). More...
 
virtual double duration () const =0
 Get the current duration of the file. More...
 
virtual void setDescription (DtString description)=0
 Set the duration. More...
 
virtual DtString description () const =0
 Get the current description of the file. More...
 
virtual size_t headerSize () const =0
 Returns size in bytes of a packet header. More...
 
virtual size_t tailSize () const =0
 Returns size in bytes of a packet tail. More...
 

Protected Member Functions

 DtLgrFileFormatter (DtLoggerFile *)
 CTOR which stores a copy of the file to operate on. More...
 

Protected Attributes

DtLoggerFilemyLoggerFile
 
DtLoggerFileMetaDatamyLoggerMetaData
 
bool mySerialMode
 
double myReadTimeLimit
 

Private Member Functions

 DtLgrFileFormatter (const DtLgrFileFormatter &)
 Not Implemented. More...
 
DtLgrFileFormatteroperator= (const DtLgrFileFormatter &)
 Not Implemented. More...
 

Detailed Description

An abstract logger file formatter.

The DtLgrFileFormatter is responsible for defining the interface which various Logger File formats can be written against. The implementations are registered with the DtLgrFileFormatProvider which is used to create the necessary formatter.

See Also
DtLgrFileFormatProvider

Constructor & Destructor Documentation

MAKLogger::DtLgrFileFormatter::DtLgrFileFormatter ( DtLoggerFile )
protected

CTOR which stores a copy of the file to operate on.

This constructor is protected as it will be implemented by a sub class, via a static construct. This static constructor should be registered with the file version with the DtLgrFileFormaProvider which creates formatters.

virtual MAKLogger::DtLgrFileFormatter::~DtLgrFileFormatter ( )
virtual

DTOR.

MAKLogger::DtLgrFileFormatter::DtLgrFileFormatter ( const DtLgrFileFormatter )
private

Not Implemented.

Member Function Documentation

virtual bool MAKLogger::DtLgrFileFormatter::atEndOfFile ( )
pure virtual

Check to see if after all packets.

If at the end of file add further reads will fail. Writes however will succeed as the end of the file will be extended. The end of the file differs from the last packet position. A seek to the last packet and a read of 1 packet will result at being at the end of the file.

Warning
This 'EOF' concept is only the end of the packet stream file. Depending on the file format additional meta data may be stored afterwards, however no packets will be stored after.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat.

virtual void MAKLogger::DtLgrFileFormatter::copyMetaData ( const DtLgrFileFormatter formatter)
virtual
virtual size_t MAKLogger::DtLgrFileFormatter::currentPacketSize ( )
pure virtual

Get the current packet size.

Exceptions
DtFileReadErrorfile read error.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat, and MAKLogger::DtLgrGenericFileFormat.

virtual double MAKLogger::DtLgrFileFormatter::currentPacketTime ( )
pure virtual

Get the current packet time.

Exceptions
DtFileReadErrorfile read error.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat, and MAKLogger::DtLgrGenericFileFormat.

virtual int MAKLogger::DtLgrFileFormatter::currentPacketType ( )
pure virtual

Get the current packet type.

Exceptions
DtFileReadErrorfile read error.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat, and MAKLogger::DtLgrGenericFileFormat.

virtual DtFilePosition MAKLogger::DtLgrFileFormatter::currentPosition ( )
pure virtual

Get the current file position.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat.

virtual DtString MAKLogger::DtLgrFileFormatter::description ( ) const
pure virtual
virtual double MAKLogger::DtLgrFileFormatter::duration ( ) const
pure virtual

Get the current duration of the file.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat, and MAKLogger::DtLgrLegacyCheckpointedFormat.

virtual DtLgrEntityTracker* MAKLogger::DtLgrFileFormatter::entityTracker ( ) const
virtual

Get the formatter's entity tracker, or null if it does not have one.

Reimplemented in MAKLogger::DtLgrHla4_3Format, MAKLogger::DtLgrEntityTrackingFormat, and MAKLogger::DtLgrGenericFileFormat.

virtual size_t MAKLogger::DtLgrFileFormatter::firstPacketSize ( ) const
pure virtual

The size of the first packet.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat.

virtual double MAKLogger::DtLgrFileFormatter::firstPacketTime ( ) const
pure virtual

The time of the first packet.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat.

virtual bool MAKLogger::DtLgrFileFormatter::hasCheckpoints ( ) const
pure virtual

Get whether the format supports checkpoints.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat, and MAKLogger::DtLgrLegacyCheckpointedFormat.

virtual bool MAKLogger::DtLgrFileFormatter::hasLastPacket ( ) const
pure virtual

Returns whether the file has set its last packet.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat.

virtual size_t MAKLogger::DtLgrFileFormatter::headerSize ( ) const
pure virtual
virtual void MAKLogger::DtLgrFileFormatter::initializeSerialMode ( DtFilePosition  firstPacket = 0,
DtFilePosition  lastPacket = 0,
bool  skipCheckpointRead = false 
)
pure virtual

Initialize serial mode, this function must be called once to properly set the first and last serial packets.

The optional parameters should not be used unless required to set the range of the file.

Parameters
Input
firstPacketthe absolute position of the first serial packet.
lastPacketthe absolute position of the last serial packet.
skipCheckpointReadskip reading checkpoints for incomplete file (i.e., if not needed)
Exceptions
DtInvalidLoggerFileIf it is unable to set the first and last serial packets.

Implemented in MAKLogger::DtLgrLegacyCheckpointedFormat, and MAKLogger::DtLgrLegacyUncheckpointedFormat.

virtual bool MAKLogger::DtLgrFileFormatter::isEofValid ( ) const
pure virtual
virtual size_t MAKLogger::DtLgrFileFormatter::lastPacketSize ( ) const
pure virtual

The size of the last packet.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat.

virtual double MAKLogger::DtLgrFileFormatter::lastPacketTime ( ) const
pure virtual

The time of the last packet.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat.

virtual DtLoggerFile* MAKLogger::DtLgrFileFormatter::loggerFile ( )
virtual

Get the logger file the formatter is operating on.

virtual const DtLoggerFile* MAKLogger::DtLgrFileFormatter::loggerFile ( ) const
virtual

Get the logger file the formatter is operating on.

DtLoggerFileMetaData* MAKLogger::DtLgrFileFormatter::metaData ( )

Get the meta data for the file.

const DtLoggerFileMetaData* MAKLogger::DtLgrFileFormatter::metaData ( ) const

Get the meta data for the file.

DtLgrFileFormatter& MAKLogger::DtLgrFileFormatter::operator= ( const DtLgrFileFormatter )
private

Not Implemented.

virtual void MAKLogger::DtLgrFileFormatter::readMetaData ( )
pure virtual

Read the metadata from the file.

Reading the metadata initializes the first and last markers for reading normal serial packets and it should be performed before reading normal packets.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat.

virtual void MAKLogger::DtLgrFileFormatter::readMetaData ( DtLoggerFileMetaData::DataPosition  position)
pure virtual

Reads the specified meta data from the file.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat.

virtual void MAKLogger::DtLgrFileFormatter::readPacketsUptoCount ( DtMessageBuffer ,
DtMemoryBufferSP  ,
int  packetCount 
)
pure virtual

Read the given number of packets or up to the size of the smart buffer which ever comes first.

Exceptions
DtFileReadErrorfile read error.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat.

virtual void MAKLogger::DtLgrFileFormatter::readPacketsUptoSize ( DtMessageBuffer ,
DtMemoryBufferSP   
)
pure virtual

Read packets to fill the smart buffer.

Exceptions
DtFileReadErrorfile read error.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat.

virtual double MAKLogger::DtLgrFileFormatter::readPacketsUpToTime ( DtMessageBuffer ,
DtMemoryBufferSP  ,
double  time,
bool  inclusive = true 
)
pure virtual

Read all packets up to a time or up to the size of the smart buffer which ever comes first.

Optionally inclusive or exclusive of the last time. Return the next packet time if known and all packets up to the time have been read; otherwise, -1.0

Exceptions
DtFileReadErrorfile read error.
DtInvalidInputinvalid time input.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat.

virtual bool MAKLogger::DtLgrFileFormatter::recoverLastPacket ( )
pure virtual

Recover the last packet by seeking from the beginning of the file Return - Last packet found?

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat.

virtual bool MAKLogger::DtLgrFileFormatter::seekToFirstPacket ( )
pure virtual

Seek to first packet in the file.

Returns
Returns whether the seek was executed.
Exceptions
DtFileReadErrorfile read error.
DtInvalidInputinvalid type input.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat.

virtual bool MAKLogger::DtLgrFileFormatter::seekToFirstPacket ( int  type)
pure virtual

Seek to first packet of a given type in the file.

Returns
Returns whether the seek was executed.
Exceptions
DtFileReadErrorfile read error.
DtInvalidInputinvalid type input.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat, and MAKLogger::DtLgrLegacyCheckpointedFormat.

virtual bool MAKLogger::DtLgrFileFormatter::seekToFirstPacketAfterTime ( double  time)
pure virtual

Seek to the first packet after the given time.

Returns
Returns whether the seek was executed.
Exceptions
DtFileReadErrorfile read error.
DtInvalidInputinvalid time input.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat.

virtual bool MAKLogger::DtLgrFileFormatter::seekToFirstPacketAfterTime ( int  type,
double  time 
)
pure virtual

Seek to the first packet of a given type after the given time.

Returns
Returns whether the seek was executed.
Exceptions
DtFileReadErrorfile read error.
DtInvalidInputinvalid type or time input.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat, and MAKLogger::DtLgrLegacyCheckpointedFormat.

virtual bool MAKLogger::DtLgrFileFormatter::seekToFirstPacketBeforeTime ( double  time)
pure virtual

Seek to the first packet before the given time.

Returns
Returns whether the seek was executed.
Exceptions
DtFileReadErrorfile read error.
DtInvalidInputinvalid time input.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat.

virtual bool MAKLogger::DtLgrFileFormatter::seekToFirstPacketBeforeTime ( int  type,
double  time 
)
pure virtual

Seek to the first packet of a given type before the given time.

Returns
Returns whether the seek was executed.
Exceptions
DtFileReadErrorfile read error.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat, and MAKLogger::DtLgrLegacyCheckpointedFormat.

virtual bool MAKLogger::DtLgrFileFormatter::seekToLastPacket ( )
pure virtual

Seek to the last packet in the file.

Returns
Returns whether the seek was executed.
Exceptions
DtFileReadErrorfile read error.
DtInvalidInputinvalid type input.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat.

virtual bool MAKLogger::DtLgrFileFormatter::seekToLastPacket ( int  type)
pure virtual

Seek to the last packet of a given type in the file.

Returns
Returns whether the seek was executed.
Exceptions
DtFileReadErrorfile read error.
DtInvalidInputinvalid type input.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat, and MAKLogger::DtLgrLegacyCheckpointedFormat.

virtual bool MAKLogger::DtLgrFileFormatter::seekToNextPacket ( )
pure virtual

Seek to the next packet.

Returns
Returns whether the seek was executed.
Exceptions
DtFileReadErrorfile read error.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat.

virtual bool MAKLogger::DtLgrFileFormatter::seekToNextPacket ( int  type)
pure virtual

Seek to the next packet of a given type.

Returns
Returns whether the seek was executed.
Exceptions
DtFileReadErrorfile read error.
DtInvalidInputinvalid type input.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat, and MAKLogger::DtLgrLegacyCheckpointedFormat.

virtual bool MAKLogger::DtLgrFileFormatter::seekToNextSerialPacket ( )
pure virtual

Seek to the next serial packet.

Returns
Returns whether the seek was executed.
Exceptions
DtFileReadErrorfile read error.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat.

virtual void MAKLogger::DtLgrFileFormatter::seekToPosition ( DtFilePosition  )
pure virtual

Seek to a specific position.

This function is dangerous as it can seek to an improper position.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat.

virtual bool MAKLogger::DtLgrFileFormatter::seekToPreviousPacket ( )
pure virtual

Seek to the previous packet.

Returns
Returns whether the seek was executed.
Exceptions
DtFileReadErrorfile read error.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat.

virtual bool MAKLogger::DtLgrFileFormatter::seekToPreviousPacketOfType ( int  type)
pure virtual

Seek to the previous packet of a given type.

Returns
Returns whether the seek was executed.
Exceptions
DtFileReadErrorfile read error.
DtInvalidInputinvalid type input.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat, and MAKLogger::DtLgrLegacyCheckpointedFormat.

virtual bool MAKLogger::DtLgrFileFormatter::serialMode ( ) const
virtual

Get whether the formatter is in serial mode.

virtual void MAKLogger::DtLgrFileFormatter::setDescription ( DtString  description)
pure virtual
virtual void MAKLogger::DtLgrFileFormatter::setDuration ( double  duration)
pure virtual
virtual void MAKLogger::DtLgrFileFormatter::setSerialMode ( bool  enable)
virtual

Get whether the formatter is in serial mode.

In serial mode the reads respect the first and last tape positions. Also writes will fail unless in serial mode.

virtual void MAKLogger::DtLgrFileFormatter::setStartEndTimes ( double  start,
double  end 
)
pure virtual

Set the start and end times (first and last packet).

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat, and MAKLogger::DtLgrEntityTrackingFormat.

virtual void MAKLogger::DtLgrFileFormatter::setTimeLimit ( double  limit)
virtual

Set the time limit on reads during playback.

Units are seconds. A value less than zero indicates no limit.

virtual size_t MAKLogger::DtLgrFileFormatter::tailSize ( ) const
pure virtual

Returns size in bytes of a packet tail.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat.

virtual void MAKLogger::DtLgrFileFormatter::writeMetaData ( DtLoggerFileMetaData::DataPosition  position)
pure virtual

Writes meta data at a specific position in the file.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat.

virtual void MAKLogger::DtLgrFileFormatter::writePacket ( const DtPacket packet)
pure virtual

Write a single packet to the file.

Override this function to change how packets are written to the file.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat, MAKLogger::DtLgrLegacyCheckpointedFormat, and MAKLogger::DtLgrEntityTrackingFormat.

virtual size_t MAKLogger::DtLgrFileFormatter::writePacket ( const DtPacket ,
void *  memory,
size_t  memorySize,
int  fileWriteBufferOffset = -1 
)
pure virtual

Write a packet into the provided memory.

Parameters
Input
fileWriteBufferOffset,certainpackets such as checkpoints require the position in the file where it will be written to. In cases where the memory written is for a write buffer (which once full will be written to a file) the fileWriteBufferOffset can be used to calculate it's position in the file.
Returns
The number of bytes written to memory.
Exceptions
DtInvalidInputif memorySize is insufficient or memory is null.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat, MAKLogger::DtLgrLegacyCheckpointedFormat, and MAKLogger::DtLgrEntityTrackingFormat.

virtual void MAKLogger::DtLgrFileFormatter::writePackets ( const DtMessageBuffer )
pure virtual

Write all the packets into the end of the file.

Exceptions
DtFileWriteErrorfile write error.

Implemented in MAKLogger::DtLgrLegacyUncheckpointedFormat.

Member Data Documentation

DtLoggerFile* MAKLogger::DtLgrFileFormatter::myLoggerFile
protected
DtLoggerFileMetaData* MAKLogger::DtLgrFileFormatter::myLoggerMetaData
protected
double MAKLogger::DtLgrFileFormatter::myReadTimeLimit
protected
bool MAKLogger::DtLgrFileFormatter::mySerialMode
protected

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

Document ID: Generated on Thu Dec 18 15:35:09 EST 2025 from SVN revision 282494
Copyright © 2024 MAK Technologies. All Rights Reserved (www.mak.com)