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 | Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions
MAKLogger::DtLgrEntityTracker Class Referenceabstract

Indexes packets in a file. More...

+ Inheritance diagram for MAKLogger::DtLgrEntityTracker:
+ Collaboration diagram for MAKLogger::DtLgrEntityTracker:

Classes

struct  NetTrackerEntryHeader
 The entries stored in the packet. More...
 
struct  NetTrackerTable
 The table stored at the beginning of the packet followed by the net entries. More...
 
struct  TrackerEntry
 An entry in the list of tracked entities Constructor used for const value. More...
 

Public Types

typedef int TrackerUpdateId
 
typedef int EntryHandle
 
typedef std::set
< DtLgrEntityTracker::EntryHandle
EntryHandleSet
 

Public Member Functions

virtual ~DtLgrEntityTracker ()
 DTOR. More...
 
virtual void simInitialize (DtLgrBaseSimManager *simMgr)
 After connecting to the simulation, perform some initialization. More...
 
virtual EntryHandle begin () const
 Returns the first valid entry handle. More...
 
virtual EntryHandle end () const
 Returns an entry handle immediately beyond the last valid entry handle. More...
 
virtual
DtLgrEntityTracker::TrackerUpdateId 
lastUpdateId () const
 Return a counter which when compared to a previously retrieved value indicates that this tracker has been updated if the values are different. More...
 
virtual EntryHandle addEntry (double firstTime, double lastTime, const DtString &name, const DtString &type, DtForceType force, const DtString &marking, DtLgrEntityTracker::EntryHandle handle=-1)
 Adds a tracked entry using the provided data. More...
 
virtual EntryHandle addEntry (const TrackerEntry &entry, DtLgrEntityTracker::EntryHandle handle=-1)
 Adds the given tracked entry. More...
 
virtual EntryHandle addTemporaryEntry (const DtString &name)
 Adds a temporary entry with the given name that will not be saved across tape loads. More...
 
virtual EntryHandle addTemporaryMarking (const DtString &marking)
 Adds a temporary entry with the given marking and since a name is necessary the marking will also be used as its name. More...
 
virtual EntryHandle findEntry (const DtString &name) const
 Looks up an entry. More...
 
virtual int entityCount () const
 Gets the number of entities currently in the tracker. More...
 
virtual void clearEntries ()
 Remove all entries. More...
 
virtual bool isPermanentEntry (EntryHandle handle) const
 Returns whether the specified index is a known non-temporary entity. More...
 
virtual const TrackerEntryentry (DtLgrEntityTracker::EntryHandle handle) const
 Return the entry with the given handle. More...
 
virtual double entityFirstTime (EntryHandle handle) const
 Returns the first time of indexed entity. More...
 
virtual double entityLastTime (EntryHandle handle) const
 Returns the last time of indexed entity. More...
 
virtual DtString entityName (EntryHandle handle) const
 Returns the name of indexed entity. More...
 
virtual DtString entityType (EntryHandle handle) const
 Returns the type of indexed entity. More...
 
virtual DtForceType entityForce (EntryHandle handle) const
 Returns the force of indexed entity. More...
 
virtual DtString entityMarking (EntryHandle handle) const
 Returns the marking of indexed entity. More...
 
virtual void parsePacket (const DtPacket &packet, const DtAbsoluteTime *time=0)
 Reads a packet to update tracked entity info Use time for packet if given; otherwise, use packet time. More...
 
virtual void parsePackets (const DtMessageBuffer &packetBuffer, const DtAbsoluteTime *time=0)
 Reads a buffer of packets to update tracked entity info Use time for packets if given. More...
 
virtual EntryHandle entityId (const DtPacket &packet) const
 Returns entry handle of the entity in the packet if packet specifies an entity and the entity is already tracked; otherwise, entry handle is invalid. More...
 
virtual int encodedSize () const
 Return size of encoded data. More...
 
virtual DtPacketencodePacket () const
 Encode tracker into packet. More...
 
virtual void decodePacket (const DtPacket *)
 Decode tracker table packet. More...
 
virtual void deserializeFromString (const DtString &data)
 Replace current state with serialized state in string. More...
 
virtual DtString serialize ()
 Return a serialized representation of current state. More...
 
virtual DtString serializeAdded ()
 Return a serialized representation of current state. More...
 
virtual DtLgrEntityTrackercreateFromPacket (const DtPacket &packet)=0
 Data extractors to be implemented by protocol specific derivations. More...
 
virtual DtString entityName (const DtPacket &packet) const =0
 Returns unique entity name of a packet – protocol-specific. More...
 
virtual DtString entityType (const DtPacket &packet) const =0
 Returns entity type of a packet – protocol-specific. More...
 
virtual DtForceType entityForce (const DtPacket &packet) const =0
 Returns force of a packet – protocol-specific. More...
 
virtual DtString entityMarking (const DtPacket &packet) const =0
 Returns entity marking of a packet – protocol-specific. More...
 

Protected Types

enum  TrackedDataIndex { DtTrackName = 0, DtTrackType = 1, DtTrackMarking = 2 }
 
typedef std::vector< TrackerEntryTrackerEntryList
 The format encoded in the entity table packet (all in network byte order) is as follows: More...
 
typedef std::map< DtString,
EntryHandle
TrackerEntryIndex
 

Protected Member Functions

virtual TrackerEntry makeInvalidEntry () const
 Makes an empty tracker entry. More...
 
virtual unsigned encodedEntrySize (const TrackerEntry &entry, bool includePadding=true) const
 Return the size required to encode the given entry. Size of padding is included by default. More...
 
virtual char * encodeEntry (char *entryData, const TrackerEntry &entry) const
 Encode tracker entry into the given data buffer. More...
 
virtual const char * decodeEntry (const char *entryData)
 Decode tracker entry data and add the entry to the table. More...
 
virtual void advanceToNextToken (const char *&data, const char *dataEnd)
 Skip over current token and get pointer to the next token in serialized buffer. More...
 
bool getFloat (const char *&token, const char *dataEnd, const DtString &tokenName, float &value)
 
bool getInt (const char *&token, const char *dataEnd, const DtString &tokenName, int &value)
 
bool getString (const char *&token, const char *dataEnd, const DtString &tokenName, DtString &value)
 
virtual void deserializeEntryFromString (const char **data, const char *dataEnd)
 Deserialize an entry from the given data up to the given end. More...
 
virtual void serializeEntry (DtString &serialized, unsigned index, const TrackerEntry &entry)
 Append the entry with the given index to the given serialized data. More...
 

Protected Attributes

DtLgrBaseSimManagermySimMgr
 The simulation manager. More...
 
TrackerEntryList myTrackedEntities
 The tracked entities. More...
 
std::map< unsigned int,
TrackerEntry
myAddedEntities
 Recently added tracked entities (as of last serialize) Includes temporary entities. More...
 
TrackerEntryIndex myEntityIndex
 Map of tracked entity handles by name. More...
 
TrackerUpdateId myLastUpdateId
 The update ID counter. More...
 
int myNumberTrackedData
 Number of variable tracked data in an encoded entry. More...
 
int myAlignmentSize
 Byte alignment size. More...
 
const TrackerEntry myInvalidEntry
 An invalid entry. More...
 
const char myFieldSeparator
 Serialize field separator. More...
 
const DtString myFieldSeparatorString
 Serialize field separator. More...
 

Static Protected Attributes

static DtString theSerializeLabel
 

Private Member Functions

 DtLgrEntityTracker (const DtLgrEntityTracker &)
 Not Implemented. More...
 
DtLgrEntityTrackeroperator= (const DtLgrEntityTracker &)
 Not Implemented. More...
 

Detailed Description

Indexes packets in a file.

Member Typedef Documentation

The format encoded in the entity table packet (all in network byte order) is as follows:

Header:

DtNetU32 numEntries: total number of entities in the tracker DtNetU32 unused: number of blank entities at the end

Entries:

DtNetFloat64 firstTime: the first time the entity appears DtNetFloat64 lastTime: the last time the entity appears DtNetInt32 entrySize: total size in bytes of this entry, also the offset to the next entry DtNetInt32 force: the force ID of the entity DtNetInt32 dataSizes[3] - name, type, marking char[nameSize] name: the name as a C string char[typeSize] type: the type as a C string char[markingSize] marking: the type as a C string char[0-8] padding: padding to bring entrySize to a multiple of eight, all zeroes

Member Enumeration Documentation

Enumerator
DtTrackName 
DtTrackType 
DtTrackMarking 

Constructor & Destructor Documentation

virtual MAKLogger::DtLgrEntityTracker::~DtLgrEntityTracker ( )
virtual

DTOR.

MAKLogger::DtLgrEntityTracker::DtLgrEntityTracker ( const DtLgrEntityTracker )
private

Not Implemented.

Member Function Documentation

virtual EntryHandle MAKLogger::DtLgrEntityTracker::addEntry ( double  firstTime,
double  lastTime,
const DtString name,
const DtString type,
DtForceType  force,
const DtString marking,
DtLgrEntityTracker::EntryHandle  handle = -1 
)
virtual

Adds a tracked entry using the provided data.

If entry handle is provided and valid, the entry replaces the existing one; otherwise entry is appended to end.

Returns
the handle of the entry.
virtual EntryHandle MAKLogger::DtLgrEntityTracker::addEntry ( const TrackerEntry entry,
DtLgrEntityTracker::EntryHandle  handle = -1 
)
virtual

Adds the given tracked entry.

If entry handle is provided and valid, the entry replaces the existing one; otherwise entry is appended to end.

Returns
the handle of the entry.
virtual EntryHandle MAKLogger::DtLgrEntityTracker::addTemporaryEntry ( const DtString name)
virtual

Adds a temporary entry with the given name that will not be saved across tape loads.

If it already exists as either a normal or temporary entry, the existing handle will be returned.

Returns
the handle of the entry.
virtual EntryHandle MAKLogger::DtLgrEntityTracker::addTemporaryMarking ( const DtString marking)
virtual

Adds a temporary entry with the given marking and since a name is necessary the marking will also be used as its name.

The entry will not be saved across tape loads. If it already exists as either a normal or temporary entry, the existing handle will be returned.

Returns
the handle of the entry.
virtual void MAKLogger::DtLgrEntityTracker::advanceToNextToken ( const char *&  data,
const char *  dataEnd 
)
protectedvirtual

Skip over current token and get pointer to the next token in serialized buffer.

virtual EntryHandle MAKLogger::DtLgrEntityTracker::begin ( ) const
virtual

Returns the first valid entry handle.

virtual void MAKLogger::DtLgrEntityTracker::clearEntries ( )
virtual

Remove all entries.

virtual DtLgrEntityTracker* MAKLogger::DtLgrEntityTracker::createFromPacket ( const DtPacket packet)
pure virtual

Data extractors to be implemented by protocol specific derivations.

Create a tracker from table packet. A new tracker with the decoded data will be returned. throw DtInvalidInput if the packet is not an entity tracker table packet.

Implemented in MAKLogger::DtLgrHlaEntityTracker, MAKLogger::DtLgrDisEntityTracker, and MAKLogger::DtLgrHlaLegacyEntityTracker.

virtual const char* MAKLogger::DtLgrEntityTracker::decodeEntry ( const char *  entryData)
protectedvirtual

Decode tracker entry data and add the entry to the table.

Return the end of the encoded entry data.

Reimplemented in MAKLogger::DtLgrHlaLegacyEntityTracker.

virtual void MAKLogger::DtLgrEntityTracker::decodePacket ( const DtPacket )
virtual

Decode tracker table packet.

The existing entries will be cleared and replaced with the entries stored in the packet. throw DtInvalidInput if the packet is not an entity tracker table packet.

virtual void MAKLogger::DtLgrEntityTracker::deserializeEntryFromString ( const char **  data,
const char *  dataEnd 
)
protectedvirtual

Deserialize an entry from the given data up to the given end.

Data is advanced past entry.

virtual void MAKLogger::DtLgrEntityTracker::deserializeFromString ( const DtString data)
virtual

Replace current state with serialized state in string.

virtual unsigned MAKLogger::DtLgrEntityTracker::encodedEntrySize ( const TrackerEntry entry,
bool  includePadding = true 
) const
protectedvirtual

Return the size required to encode the given entry. Size of padding is included by default.

Reimplemented in MAKLogger::DtLgrHlaLegacyEntityTracker.

virtual int MAKLogger::DtLgrEntityTracker::encodedSize ( ) const
virtual

Return size of encoded data.

virtual char* MAKLogger::DtLgrEntityTracker::encodeEntry ( char *  entryData,
const TrackerEntry entry 
) const
protectedvirtual

Encode tracker entry into the given data buffer.

Return the end of the encoded entry data.

Reimplemented in MAKLogger::DtLgrHlaLegacyEntityTracker.

virtual DtPacket* MAKLogger::DtLgrEntityTracker::encodePacket ( ) const
virtual

Encode tracker into packet.

virtual EntryHandle MAKLogger::DtLgrEntityTracker::end ( ) const
virtual

Returns an entry handle immediately beyond the last valid entry handle.

virtual int MAKLogger::DtLgrEntityTracker::entityCount ( ) const
virtual

Gets the number of entities currently in the tracker.

virtual double MAKLogger::DtLgrEntityTracker::entityFirstTime ( EntryHandle  handle) const
virtual

Returns the first time of indexed entity.

virtual DtForceType MAKLogger::DtLgrEntityTracker::entityForce ( EntryHandle  handle) const
virtual

Returns the force of indexed entity.

virtual DtForceType MAKLogger::DtLgrEntityTracker::entityForce ( const DtPacket packet) const
pure virtual

Returns force of a packet – protocol-specific.

Implemented in MAKLogger::DtLgrHlaEntityTracker, and MAKLogger::DtLgrDisEntityTracker.

virtual EntryHandle MAKLogger::DtLgrEntityTracker::entityId ( const DtPacket packet) const
virtual

Returns entry handle of the entity in the packet if packet specifies an entity and the entity is already tracked; otherwise, entry handle is invalid.

virtual double MAKLogger::DtLgrEntityTracker::entityLastTime ( EntryHandle  handle) const
virtual

Returns the last time of indexed entity.

virtual DtString MAKLogger::DtLgrEntityTracker::entityMarking ( EntryHandle  handle) const
virtual

Returns the marking of indexed entity.

virtual DtString MAKLogger::DtLgrEntityTracker::entityMarking ( const DtPacket packet) const
pure virtual

Returns entity marking of a packet – protocol-specific.

Implemented in MAKLogger::DtLgrHlaEntityTracker, and MAKLogger::DtLgrDisEntityTracker.

virtual DtString MAKLogger::DtLgrEntityTracker::entityName ( EntryHandle  handle) const
virtual

Returns the name of indexed entity.

virtual DtString MAKLogger::DtLgrEntityTracker::entityName ( const DtPacket packet) const
pure virtual

Returns unique entity name of a packet – protocol-specific.

Implemented in MAKLogger::DtLgrHlaEntityTracker, and MAKLogger::DtLgrDisEntityTracker.

virtual DtString MAKLogger::DtLgrEntityTracker::entityType ( EntryHandle  handle) const
virtual

Returns the type of indexed entity.

virtual DtString MAKLogger::DtLgrEntityTracker::entityType ( const DtPacket packet) const
pure virtual

Returns entity type of a packet – protocol-specific.

Implemented in MAKLogger::DtLgrHlaEntityTracker, and MAKLogger::DtLgrDisEntityTracker.

virtual const TrackerEntry& MAKLogger::DtLgrEntityTracker::entry ( DtLgrEntityTracker::EntryHandle  handle) const
virtual

Return the entry with the given handle.

Invalid entry is returned if handle is invalid.

virtual EntryHandle MAKLogger::DtLgrEntityTracker::findEntry ( const DtString name) const
virtual

Looks up an entry.

Returns
the handle of the entry or -1 on failure
bool MAKLogger::DtLgrEntityTracker::getFloat ( const char *&  token,
const char *  dataEnd,
const DtString tokenName,
float &  value 
)
protected
bool MAKLogger::DtLgrEntityTracker::getInt ( const char *&  token,
const char *  dataEnd,
const DtString tokenName,
int &  value 
)
protected
bool MAKLogger::DtLgrEntityTracker::getString ( const char *&  token,
const char *  dataEnd,
const DtString tokenName,
DtString value 
)
protected
virtual bool MAKLogger::DtLgrEntityTracker::isPermanentEntry ( EntryHandle  handle) const
virtual

Returns whether the specified index is a known non-temporary entity.

virtual DtLgrEntityTracker::TrackerUpdateId MAKLogger::DtLgrEntityTracker::lastUpdateId ( ) const
virtual

Return a counter which when compared to a previously retrieved value indicates that this tracker has been updated if the values are different.

virtual TrackerEntry MAKLogger::DtLgrEntityTracker::makeInvalidEntry ( ) const
protectedvirtual

Makes an empty tracker entry.

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

Not Implemented.

virtual void MAKLogger::DtLgrEntityTracker::parsePacket ( const DtPacket packet,
const DtAbsoluteTime time = 0 
)
virtual

Reads a packet to update tracked entity info Use time for packet if given; otherwise, use packet time.

Reimplemented in MAKLogger::DtLgrHlaEntityTracker, and MAKLogger::DtLgrDisEntityTracker.

virtual void MAKLogger::DtLgrEntityTracker::parsePackets ( const DtMessageBuffer packetBuffer,
const DtAbsoluteTime time = 0 
)
virtual

Reads a buffer of packets to update tracked entity info Use time for packets if given.

virtual DtString MAKLogger::DtLgrEntityTracker::serialize ( )
virtual

Return a serialized representation of current state.

virtual DtString MAKLogger::DtLgrEntityTracker::serializeAdded ( )
virtual

Return a serialized representation of current state.

virtual void MAKLogger::DtLgrEntityTracker::serializeEntry ( DtString serialized,
unsigned  index,
const TrackerEntry entry 
)
protectedvirtual

Append the entry with the given index to the given serialized data.

virtual void MAKLogger::DtLgrEntityTracker::simInitialize ( DtLgrBaseSimManager simMgr)
virtual

After connecting to the simulation, perform some initialization.

Must be called after each connection. Only required with derived trackers that need to decode info e.g., HLA tracker using FOM to find type and force attribute handles

Reimplemented in MAKLogger::DtLgrHlaEntityTracker.

Member Data Documentation

std::map<unsigned int, TrackerEntry> MAKLogger::DtLgrEntityTracker::myAddedEntities
protected

Recently added tracked entities (as of last serialize) Includes temporary entities.

int MAKLogger::DtLgrEntityTracker::myAlignmentSize
protected

Byte alignment size.

TrackerEntryIndex MAKLogger::DtLgrEntityTracker::myEntityIndex
protected

Map of tracked entity handles by name.

const char MAKLogger::DtLgrEntityTracker::myFieldSeparator
protected

Serialize field separator.

const DtString MAKLogger::DtLgrEntityTracker::myFieldSeparatorString
protected

Serialize field separator.

const TrackerEntry MAKLogger::DtLgrEntityTracker::myInvalidEntry
protected

An invalid entry.

TrackerUpdateId MAKLogger::DtLgrEntityTracker::myLastUpdateId
protected

The update ID counter.

int MAKLogger::DtLgrEntityTracker::myNumberTrackedData
protected

Number of variable tracked data in an encoded entry.

DtLgrBaseSimManager* MAKLogger::DtLgrEntityTracker::mySimMgr
protected

The simulation manager.

TrackerEntryList MAKLogger::DtLgrEntityTracker::myTrackedEntities
protected

The tracked entities.

DtString MAKLogger::DtLgrEntityTracker::theSerializeLabel
staticprotected

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

Document ID: Generated on Thu Jul 14 15:45:33 EDT 2022 from SVN revision 244827
Copyright © 2021 MAK Technologies. All Rights Reserved (www.mak.com)