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:

List of all members.

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.


Constructor & Destructor Documentation

virtual MAKLogger::DtMessageState::~DtMessageState ( ) [virtual]

DTOR Will destroy all state objects.


Member Function Documentation

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 DtStateObject* MAKLogger::DtMessageState::createStateObject ( DtPacket packet) [protected, virtual]

Create the state object based upon the packet.

Return values:
ValidPointer If object was created.
NULLIf object was not created.
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) [protected, virtual]

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

virtual bool MAKLogger::DtMessageState::removeStateObject ( DtPacket packet) [protected, virtual]

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::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.
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) [protected, virtual]

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) [protected, virtual]

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.

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

Document ID: Generated on Tue Oct 11 19:41:03 EDT 2011 from SVN revision 107422
Copyright © 2005-2011 VT MÄK Inc. All Rights Reserved (www.mak.com)