MAK Data Logger API Documentation for DIS
List of all members | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
MAKLogger::DtMessageState Class Reference

The Abstract message state maintained by the logger. More...

+ Inheritance diagram for MAKLogger::DtMessageState:
+ Collaboration diagram for MAKLogger::DtMessageState:

Public Types

enum  CheckpointProcessing { IgnoreCheckpoints, ProcessAllCheckpoints, ProcessFirstCheckpoint }

Public Member Functions

virtual ~DtMessageState ()
 DTOR Will destroy all state objects.
DtAbsoluteTime convertTime (DtAbsoluteTime inputCurrentTime, DtAbsoluteTime inputTime, DtAbsoluteTime outputCurrentTime)
 Convert the specified time.
virtual void startDiff ()
 Start difference mode, creates snapshot of existing state to be used with.
virtual void generateDiff (DtMessageBuffer &stateBuffer, const DtAbsoluteTime &time)
 Next update will generate only diff messages which are necessary to go from the backed up state to the current state.
virtual void endDiff ()
 Destroys the snapshot.
void updateState (DtMessageBuffer &stateBuffer)
 Update existing objects and add new objects.
void updateState (DtPacket *packet)
 Update existing objects and add new objects.
virtual void postUpdate ()
 Call post update after finished.
void setState (DtMessageBuffer &completeStateBuffer, const DtAbsoluteTime &time)
 Set the state with the internal messages.
virtual void clearState (DtMessageBuffer &emptyBuffer, const DtAbsoluteTime &time)
 Clear the state and returns the messages necessary to send to clear the state.
virtual void getState (DtMessageBuffer &emptyBuffer, const DtAbsoluteTime &time)
 Return a message buffer with state messages of all cached objects.
virtual void activate ()
 Activate the Message state.
virtual void deactivate ()
 Deactivate the message state.
virtual const std::list
< DtStateObject * > & 
stateObjectList () const
 Gets a list of state objects.
virtual void clearState ()
 Clear the state without creating the removals.
virtual CheckpointProcessing processCheckpoints ()
 Check to see if checkpoints affect the state.
virtual void setProcessCheckpoints (CheckpointProcessing value)
 Set whether checkpoints affect the state.
virtual void modifyMessages (DtMessageBuffer &messages)
 Calls modifyMessage for each packet in the buffer.
virtual void modifyMessage (DtPacket &packet)=0
 Modify a packet.
virtual bool isCheckpointMessage (const DtPacket &packet) const
 Check to see if the State considers this packet a checkpoint.
virtual bool isUpdateMessage (const DtPacket &packet) const =0
 Check to see if the state thinks this is an object update.
virtual bool isRemovalMessage (const DtPacket &packet) const =0
 Check to see if the state thinks this is an object removal.
virtual DtStateObjectfindObject (DtU64 uniqueId)
 Find an object.
virtual const DtStateObjectfindObject (DtU64 uniqueId) const
 Find an object.
Abstract message state interface.
virtual void setInputInfo (const DtMessageIOInfo *info)
 Sets the Input Io Info.
virtual void setOutputInfo (const DtMessageIOInfo *info)
 Sets the Input Io Info.
virtual void decodeCheckpoint (const DtPacket &packet, DtMessageBuffer &buffer)=0
 Decode a checkpoint packet into a message buffer.
virtual DtPacketgenerateCheckpoint (const DtAbsoluteTime &timestamp)=0
 Generate a checkpoint packet from the current state.
DtObserveEvent< DtMessageState > * inputChangedEvent ()
 Event accessors.
DtObserveEvent< DtMessageState > * outputChangedEvent ()
 Event accessors.
DtObserveEvent< DtMessageState > * stateModifiedEvent ()
 Event accessors.
DtObserveEvent< DtMessageState > * stateActivatedEvent ()
 Event accessors.
DtObserveEvent< DtMessageState > * stateDeactivatedEvent ()
 Event accessors.
DtObserveEvent< DtMessageState > * endDiffEvent ()
 Event accessors.
DtObserveEvent< DtStateObject > * objectAddedEvent ()
 Event accessors.
DtObserveEvent< DtStateObject > * objectToBeRemovedEvent ()
 Event accessors.
DtObserveEvent< DtStateObject > * objectUpdatedEvent ()
 Event accessors.

Protected Types

typedef std::list
< DtStateObject * > 
DtStateObjectList
 Type for the list of objects.
typedef std::map< DtU64,
DtStateObject * > 
DtStateObjectMap
 Type for lookup objects by unique id.

Protected Member Functions

virtual void activateState ()=0
 Activate the protocol specific state.
virtual void deactivateState ()=0
 Deactivate the protocol specific state.
 DtMessageState ()
 Protected CTOR since class is abstract.
 DtMessageState (const DtMessageState &)
 CopyCTOR not implemented.
DtMessageStateoperator= (const DtMessageState &)
 Assignment operator not implemented.
virtual bool updateStateObjects (DtPacket &packet)
 Used to update state objects using the packet.
virtual void createUpdate (DtStateObject &object, const DtAbsoluteTime &time, std::list< DtPacket * > &packetlist)=0
 Create an update packet for the object at the given time.
virtual DtPacketcreateRemoval (DtStateObject &object, const DtAbsoluteTime &time)=0
 Create an removal packet for the object at the given time.
virtual DtStateObjectcreateStateObject (DtPacket &packet)
 Create the state object based upon the packet.
virtual DtStateObjectupdateStateObject (DtPacket &packet)
 Update the state object based upon the packet.
virtual DtStateObjectfindStateObject (DtPacket &packet)
 Find a state object for a packet.
virtual bool removeStateObject (DtPacket &packet)
 Remove the state object based upon the packet.
void removeStateObject (DtStateObject *object)
 Remove the state object.

Protected Attributes

DtStateObjectList myObjects
 List of state objects.
DtStateObjectMap myObjectLookupMap
 Map to lookup state objects.
DtStateObjectList mySnapshotOfObjects
 List of objects used when diffing two different states.
CheckpointProcessing myCheckpointProcessing
bool myStateChanged
DtObserveEvent< DtMessageStatemyInputChangedEvent
 Events called on certain actions of the messageState.
DtObserveEvent< DtMessageStatemyOutputChangedEvent
 Events called on certain actions of the messageState.
DtObserveEvent< DtMessageStatemyStateModifiedEvent
 Events called on certain actions of the messageState.
DtObserveEvent< DtMessageStatemyStateActivatedEvent
 Events called on certain actions of the messageState.
DtObserveEvent< DtMessageStatemyStateDeactivetedEvent
 Events called on certain actions of the messageState.
DtObserveEvent< DtMessageStatemyEndDiffEvent
 Events called on certain actions of the messageState.
DtObserveEvent< DtStateObjectmyObjectAddedEvent
 Events called on certain actions of the messageState.
DtObserveEvent< DtStateObjectmyObjectToBeRemovedEvent
 Events called on certain actions of the messageState.
DtObserveEvent< DtStateObjectmyObjectUpdatedEvent
 Events called on certain actions of the messageState.

Detailed Description

The Abstract message state maintained by the logger.

The message state takes in messages from the input and maintains a state of all 'statefull objects' in the simulation.

Member Typedef Documentation

Type for the list of objects.

typedef std::map<DtU64,DtStateObject*> MAKLogger::DtMessageState::DtStateObjectMap
protected

Type for lookup objects by unique id.

Member Enumeration Documentation

Enumerator:
IgnoreCheckpoints 
ProcessAllCheckpoints 
ProcessFirstCheckpoint 

Constructor & Destructor Documentation

virtual MAKLogger::DtMessageState::~DtMessageState ( )
virtual

DTOR Will destroy all state objects.

MAKLogger::DtMessageState::DtMessageState ( )
protected

Protected CTOR since class is abstract.

MAKLogger::DtMessageState::DtMessageState ( const DtMessageState )
protected

CopyCTOR not implemented.

Member Function Documentation

virtual void MAKLogger::DtMessageState::activate ( )
virtual

Activate the Message state.

virtual void MAKLogger::DtMessageState::activateState ( )
protectedpure virtual

Activate the protocol specific state.

Implemented in MAKLogger::DtLgrDisMessageState.

virtual void MAKLogger::DtMessageState::clearState ( DtMessageBuffer emptyBuffer,
const DtAbsoluteTime time 
)
virtual

Clear the state and returns the messages necessary to send to clear the state.

Note message buffer passed in will be emptied before filled.

Parameters
Output
emptyBufferContains the modified messages to send to clear the state.
virtual void MAKLogger::DtMessageState::clearState ( )
virtual

Clear the state without creating the removals.

DtAbsoluteTime MAKLogger::DtMessageState::convertTime ( DtAbsoluteTime  inputCurrentTime,
DtAbsoluteTime  inputTime,
DtAbsoluteTime  outputCurrentTime 
)

Convert the specified time.

virtual DtPacket* MAKLogger::DtMessageState::createRemoval ( DtStateObject object,
const DtAbsoluteTime time 
)
protectedpure virtual

Create an removal packet for the object at the given time.

Implemented in MAKLogger::DtLgrDisMessageState.

virtual DtStateObject* MAKLogger::DtMessageState::createStateObject ( DtPacket packet)
protectedvirtual

Create the state object based upon the packet.

Return values
ValidPointer If object was created.
NULLIf object was not created.
virtual void MAKLogger::DtMessageState::createUpdate ( DtStateObject object,
const DtAbsoluteTime time,
std::list< DtPacket * > &  packetlist 
)
protectedpure virtual

Create an update packet for the object at the given time.

Implemented in MAKLogger::DtLgrDisMessageState.

virtual void MAKLogger::DtMessageState::deactivate ( )
virtual

Deactivate the message state.

virtual void MAKLogger::DtMessageState::deactivateState ( )
protectedpure virtual

Deactivate the protocol specific state.

Implemented in MAKLogger::DtLgrDisMessageState.

virtual void MAKLogger::DtMessageState::decodeCheckpoint ( const DtPacket packet,
DtMessageBuffer buffer 
)
pure virtual

Decode a checkpoint packet into a message buffer.

Implemented in MAKLogger::DtLgrDisMessageState.

virtual void MAKLogger::DtMessageState::endDiff ( )
virtual

Destroys the snapshot.

DtObserveEvent<DtMessageState>* MAKLogger::DtMessageState::endDiffEvent ( )

Event accessors.

virtual DtStateObject* MAKLogger::DtMessageState::findObject ( DtU64  uniqueId)
virtual

Find an object.

Return values
0If no object with the uniqueId is found.
virtual const DtStateObject* MAKLogger::DtMessageState::findObject ( DtU64  uniqueId) const
virtual

Find an object.

Return values
0If no object with the uniqueId is found.
virtual DtStateObject* MAKLogger::DtMessageState::findStateObject ( DtPacket packet)
protectedvirtual

Find a state object for a packet.

Return values
ValidPointer If object was found.
NULLIf object was not updated (due to not being found).
virtual DtPacket* MAKLogger::DtMessageState::generateCheckpoint ( const DtAbsoluteTime timestamp)
pure virtual

Generate a checkpoint packet from the current state.

Implemented in MAKLogger::DtLgrDisMessageState.

virtual void MAKLogger::DtMessageState::generateDiff ( DtMessageBuffer stateBuffer,
const DtAbsoluteTime time 
)
virtual

Next update will generate only diff messages which are necessary to go from the backed up state to the current state.

virtual void MAKLogger::DtMessageState::getState ( DtMessageBuffer emptyBuffer,
const DtAbsoluteTime time 
)
virtual

Return a message buffer with state messages of all cached objects.

Parameters
Output
emptyBufferContains the modified messages to send to recreate the state.
DtObserveEvent<DtMessageState>* MAKLogger::DtMessageState::inputChangedEvent ( )

Event accessors.

virtual bool MAKLogger::DtMessageState::isCheckpointMessage ( const DtPacket packet) const
virtual

Check to see if the State considers this packet a checkpoint.

Checkpoint messages are decoded to modify all objects.

virtual bool MAKLogger::DtMessageState::isRemovalMessage ( const DtPacket packet) const
pure virtual

Check to see if the state thinks this is an object removal.

Implemented in MAKLogger::DtLgrDisMessageState.

virtual bool MAKLogger::DtMessageState::isUpdateMessage ( const DtPacket packet) const
pure virtual

Check to see if the state thinks this is an object update.

Implemented in MAKLogger::DtLgrDisMessageState.

virtual void MAKLogger::DtMessageState::modifyMessage ( DtPacket packet)
pure virtual

Modify a packet.

This typically does not need to be called since it is internally called by update state.

Parameters
Output

Implemented in MAKLogger::DtLgrDisMessageState.

virtual void MAKLogger::DtMessageState::modifyMessages ( DtMessageBuffer messages)
virtual

Calls modifyMessage for each packet in the buffer.

Modifies the messages. This typically does not need to be called since it is internally called by update state.

Parameters
Output

Reimplemented in MAKLogger::DtLgrDisMessageState.

DtObserveEvent<DtStateObject>* MAKLogger::DtMessageState::objectAddedEvent ( )

Event accessors.

DtObserveEvent<DtStateObject>* MAKLogger::DtMessageState::objectToBeRemovedEvent ( )

Event accessors.

DtObserveEvent<DtStateObject>* MAKLogger::DtMessageState::objectUpdatedEvent ( )

Event accessors.

DtMessageState& MAKLogger::DtMessageState::operator= ( const DtMessageState )
protected

Assignment operator not implemented.

DtObserveEvent<DtMessageState>* MAKLogger::DtMessageState::outputChangedEvent ( )

Event accessors.

virtual void MAKLogger::DtMessageState::postUpdate ( )
virtual

Call post update after finished.

virtual CheckpointProcessing MAKLogger::DtMessageState::processCheckpoints ( )
virtual

Check to see if checkpoints affect the state.

virtual bool MAKLogger::DtMessageState::removeStateObject ( DtPacket packet)
protectedvirtual

Remove the state object based upon the packet.

Return values
trueIf object was removed.
falseIf object was not removed (due to not being found).
void MAKLogger::DtMessageState::removeStateObject ( DtStateObject object)
protected

Remove the state object.

virtual void MAKLogger::DtMessageState::setInputInfo ( const DtMessageIOInfo info)
virtual

Sets the Input Io Info.

virtual void MAKLogger::DtMessageState::setOutputInfo ( const DtMessageIOInfo info)
virtual

Sets the Input Io Info.

virtual void MAKLogger::DtMessageState::setProcessCheckpoints ( CheckpointProcessing  value)
virtual

Set whether checkpoints affect the state.

void MAKLogger::DtMessageState::setState ( DtMessageBuffer completeStateBuffer,
const DtAbsoluteTime time 
)

Set the state with the internal messages.

All objects not in the buffer are removed from the state.

Parameters
Input
completeStateBufferContains the messages used to create a specific state.
Output
completeStateBufferContains the modified messages to send to create the state.
virtual void MAKLogger::DtMessageState::startDiff ( )
virtual

Start difference mode, creates snapshot of existing state to be used with.

DtObserveEvent<DtMessageState>* MAKLogger::DtMessageState::stateActivatedEvent ( )

Event accessors.

DtObserveEvent<DtMessageState>* MAKLogger::DtMessageState::stateDeactivatedEvent ( )

Event accessors.

DtObserveEvent<DtMessageState>* MAKLogger::DtMessageState::stateModifiedEvent ( )

Event accessors.

virtual const std::list<DtStateObject*>& MAKLogger::DtMessageState::stateObjectList ( ) const
virtual

Gets a list of state objects.

void MAKLogger::DtMessageState::updateState ( DtMessageBuffer stateBuffer)

Update existing objects and add new objects.

Calls updateState for each packet in the message buffer.

Parameters
Input
stateBufferContains the messages used to create a specific state.
Output
stateBufferContains the modified messages to send to create the state.
void MAKLogger::DtMessageState::updateState ( DtPacket packet)

Update existing objects and add new objects.

Calls udpateStateObjects on message. This function will not send event notifications. Call post update to send this value.

Parameters
Input
packetA packet to be added to the state.
Output
messageThe packet may be modified depending on the state's output.
virtual DtStateObject* MAKLogger::DtMessageState::updateStateObject ( DtPacket packet)
protectedvirtual

Update the state object based upon the packet.

Return values
ValidPointer If object was updated.
NULLIf object was not updated (due to not being found).
virtual bool MAKLogger::DtMessageState::updateStateObjects ( DtPacket packet)
protectedvirtual

Used to update state objects using the packet.

Packet specific functions will be called here depending on the type of message.

Returns
Returns whether the state was modified.
Return values
trueIf state was modified.
falseIf state was not modified.

Member Data Documentation

CheckpointProcessing MAKLogger::DtMessageState::myCheckpointProcessing
protected
DtObserveEvent<DtMessageState> MAKLogger::DtMessageState::myEndDiffEvent
protected

Events called on certain actions of the messageState.

DtObserveEvent<DtMessageState> MAKLogger::DtMessageState::myInputChangedEvent
protected

Events called on certain actions of the messageState.

DtObserveEvent<DtStateObject> MAKLogger::DtMessageState::myObjectAddedEvent
protected

Events called on certain actions of the messageState.

DtStateObjectMap MAKLogger::DtMessageState::myObjectLookupMap
protected

Map to lookup state objects.

DtStateObjectList MAKLogger::DtMessageState::myObjects
protected

List of state objects.

DtObserveEvent<DtStateObject> MAKLogger::DtMessageState::myObjectToBeRemovedEvent
protected

Events called on certain actions of the messageState.

DtObserveEvent<DtStateObject> MAKLogger::DtMessageState::myObjectUpdatedEvent
protected

Events called on certain actions of the messageState.

DtObserveEvent<DtMessageState> MAKLogger::DtMessageState::myOutputChangedEvent
protected

Events called on certain actions of the messageState.

DtStateObjectList MAKLogger::DtMessageState::mySnapshotOfObjects
protected

List of objects used when diffing two different states.

DtObserveEvent<DtMessageState> MAKLogger::DtMessageState::myStateActivatedEvent
protected

Events called on certain actions of the messageState.

bool MAKLogger::DtMessageState::myStateChanged
protected
DtObserveEvent<DtMessageState> MAKLogger::DtMessageState::myStateDeactivetedEvent
protected

Events called on certain actions of the messageState.

DtObserveEvent<DtMessageState> MAKLogger::DtMessageState::myStateModifiedEvent
protected

Events called on certain actions of the messageState.


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

Document ID: Generated on Sun Dec 15 18:04:30 EST 2013 from SVN revision 134418
Copyright © 2005-2012 VT MÄK. All Rights Reserved (www.mak.com)