VR-Link API Documentation for HLA 1516
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Private Attributes
DtHlaStateDecoder Class Reference

DtHlaStateDecoder is used to provide decoding of a state message into a state repository in an HLA (as opposed to DIS) environment. More...

+ Inheritance diagram for DtHlaStateDecoder:
+ Collaboration diagram for DtHlaStateDecoder:

Public Types

typedef void(* DtAttributeDecoder )(DtStateRepository *stateRep, const RTI::AttributeHandleValuePairSet &avlist, unsigned long pairSetIndex)
 Attribute decoding function declaration.

Public Member Functions

 DtHlaStateDecoder (DtExerciseConn *exConn, DtObjClassDesc *classDesc)
 constructor
virtual ~DtHlaStateDecoder ()
 destructor
 DtHlaStateDecoder (const DtHlaStateDecoder &orig)
 copy constructor
DtHlaStateDecoderoperator= (const DtHlaStateDecoder &orig)
 assignment operator
DtAttributeDecoder addDecoder (RTI::AttributeHandle h, DtAttributeDecoder func)
 Add/Remove a decoding function for the attribute specified by handle.
DtAttributeDecoder removeDecoder (RTI::AttributeHandle h)
DtAttributeDecoder addDecoder (char *attrName, DtAttributeDecoder func, bool complain=true)
 Add/Remove a decoding function for the attribute specified by name.
DtAttributeDecoder removeDecoder (char *attrName, bool complain=true)
virtual DtAttributeDecoder decoder (const RTI::AttributeHandle &handle) const
 Get the attribute decoder for the specified handle.
virtual void decode (const DtStateMsg &msg, DtStateRepository *stateRep) const
 Decode the state message into the state repository.
virtual RTI::ObjectClassHandle objectClassHandle () const
 Get the object's class handle.
virtual DtHlaStateDecoderclone () const
 Returns a new-ed clone of this object.
virtual DtHlaStateDecoderclone (DtObjClassDesc *classDesc) const
 Returns a new-ed clone of this object which corresponds to the class description classDesc.

Static Public Member Functions

static char * decodingBuffer (int length)
 Returns a pointer to a buffer that can be used to copy data obtained from a phvps.
static char * attributeData (const RTI::AttributeHandleValuePairSet &attrs, int index, RTI::ULong &length)
 Returns a pointer to the attribute data.
static char * attributeData (const RTI::AttributeHandleValuePairSet &attrs, int index, RTI::ULong &length, unsigned int expectedDataSize, char *attrName)
 Gets the attribute data and checks the expected size.
static DtNetEventIdeventIdAttributeData (const RTI::AttributeHandleValuePairSet &attrs, int index)
 Get the attribute data as a DtNetEventId (adds defensive null terminator) Returns a pointer to the attribute data.

Static Public Attributes

static bool theUseGetValuePointer

Protected Types

typedef std::map
< RTI::AttributeHandle,
DtAttributeDecoder
AttributeHandleDecoderMap
typedef std::map
< RTI::AttributeHandle, bool
AttributeHandleBoolMap

Protected Member Functions

virtual void decodeAttribute (DtStateRepository *stateRep, const RTI::AttributeHandleValuePairSet &attrs, unsigned long pairSetIndex) const
 Decode the attribute at the specified index in the attribute handle pair set.
virtual void copyDecFuncs (const DtHlaStateDecoder &orig)

Protected Attributes

DtExerciseConnmyExConn
DtObjClassDescmyClassDesc
RTI::ObjectClassHandle myHandle
AttributeHandleDecoderMap myDecoderList
 myDecoderList is a map of decoders for each attribute registered to this state.

Private Attributes

AttributeHandleBoolMap myMutableReportedWarning
 myReportedWarnings is an array for keeping track of which warnings have been already issued.

Detailed Description

DtHlaStateDecoder is used to provide decoding of a state message into a state repository in an HLA (as opposed to DIS) environment.

Member Typedef Documentation

typedef std::map<RTI::AttributeHandle, bool> DtHlaStateDecoder::AttributeHandleBoolMap
protected
typedef std::map<RTI::AttributeHandle, DtAttributeDecoder> DtHlaStateDecoder::AttributeHandleDecoderMap
protected
typedef void(* DtHlaStateDecoder::DtAttributeDecoder)(DtStateRepository *stateRep, const RTI::AttributeHandleValuePairSet &avlist, unsigned long pairSetIndex)

Attribute decoding function declaration.

Constructor & Destructor Documentation

DtHlaStateDecoder::DtHlaStateDecoder ( DtExerciseConn exConn,
DtObjClassDesc classDesc 
)

constructor

virtual DtHlaStateDecoder::~DtHlaStateDecoder ( )
virtual

destructor

DtHlaStateDecoder::DtHlaStateDecoder ( const DtHlaStateDecoder orig)

copy constructor

Member Function Documentation

DtAttributeDecoder DtHlaStateDecoder::addDecoder ( RTI::AttributeHandle  h,
DtAttributeDecoder  func 
)

Add/Remove a decoding function for the attribute specified by handle.

Returns the decoding function which is replaced by the add/remove. Note: This is non-virtual, since it is typically called by constructors.

Referenced by DtF18EntityDecoder::DtF18EntityDecoder().

DtAttributeDecoder DtHlaStateDecoder::addDecoder ( char *  attrName,
DtAttributeDecoder  func,
bool  complain = true 
)

Add/Remove a decoding function for the attribute specified by name.

Complain flag determines whether to print a warning if the attribute does not exist in the FOM. Returns the decoding function which is replaced by the add/remove. Note: This is non-virtual, since it is typically called by constructors.

char * DtHlaStateDecoder::attributeData ( const RTI::AttributeHandleValuePairSet attrs,
int  index,
RTI::ULong length 
)
inlinestatic
char * DtHlaStateDecoder::attributeData ( const RTI::AttributeHandleValuePairSet attrs,
int  index,
RTI::ULong length,
unsigned int  expectedDataSize,
char *  attrName 
)
inlinestatic

Gets the attribute data and checks the expected size.

If the data length is too small, no data is collected (0 returned and length set to 0) and a warning is printed. A message is printed if the data length is too large. Returns a pointer to the attribute data (or 0 if length < expected size).

References decodingBuffer(), DtNlVerbose, DtNotifyLevel, DtVerbose, DtWarn, rti1516::CompatibleHandleValuePairSet< HandleType, MapType >::getValue(), rti1516::CompatibleHandleValuePairSet< HandleType, MapType >::getValueLength(), rti1516::CompatibleHandleValuePairSet< HandleType, MapType >::getValuePointer(), and theUseGetValuePointer.

virtual DtHlaStateDecoder* DtHlaStateDecoder::clone ( ) const
virtual

Returns a new-ed clone of this object.

Reimplemented in DtBaseEntityDecoder.

virtual DtHlaStateDecoder* DtHlaStateDecoder::clone ( DtObjClassDesc classDesc) const
virtual

Returns a new-ed clone of this object which corresponds to the class description classDesc.

Use this function if you want a subclass in the FOM to use the same decoder as its parent

Reimplemented in DtBaseEntityDecoder.

virtual void DtHlaStateDecoder::copyDecFuncs ( const DtHlaStateDecoder orig)
protectedvirtual
virtual void DtHlaStateDecoder::decode ( const DtStateMsg msg,
DtStateRepository stateRep 
) const
virtual

Decode the state message into the state repository.

Reimplemented in DtBaseEntityDecoder, and DtPhysicalEntityDecoder.

virtual void DtHlaStateDecoder::decodeAttribute ( DtStateRepository stateRep,
const RTI::AttributeHandleValuePairSet attrs,
unsigned long  pairSetIndex 
) const
protectedvirtual

Decode the attribute at the specified index in the attribute handle pair set.

DtHlaStateDecoder::DtAttributeDecoder DtHlaStateDecoder::decoder ( const RTI::AttributeHandle &  handle) const
inlinevirtual

Get the attribute decoder for the specified handle.

References myDecoderList.

char * DtHlaStateDecoder::decodingBuffer ( int  length)
inlinestatic

Returns a pointer to a buffer that can be used to copy data obtained from a phvps.

If the buffer isn't large enough to contain the data, more space will be allocated to it.

References DtDecodingBuffer().

Referenced by attributeData(), and eventIdAttributeData().

DtNetEventId * DtHlaStateDecoder::eventIdAttributeData ( const RTI::AttributeHandleValuePairSet attrs,
int  index 
)
inlinestatic

Get the attribute data as a DtNetEventId (adds defensive null terminator) Returns a pointer to the attribute data.

References decodingBuffer(), rti1516::CompatibleHandleValuePairSet< HandleType, MapType >::getValue(), and rti1516::CompatibleHandleValuePairSet< HandleType, MapType >::getValueLength().

RTI::ObjectClassHandle DtHlaStateDecoder::objectClassHandle ( ) const
inlinevirtual

Get the object's class handle.

References myHandle.

DtHlaStateDecoder& DtHlaStateDecoder::operator= ( const DtHlaStateDecoder orig)

assignment operator

DtAttributeDecoder DtHlaStateDecoder::removeDecoder ( RTI::AttributeHandle  h)
DtAttributeDecoder DtHlaStateDecoder::removeDecoder ( char *  attrName,
bool  complain = true 
)

Member Data Documentation

DtObjClassDesc* DtHlaStateDecoder::myClassDesc
protected
AttributeHandleDecoderMap DtHlaStateDecoder::myDecoderList
protected

myDecoderList is a map of decoders for each attribute registered to this state.

Referenced by decoder().

DtExerciseConn* DtHlaStateDecoder::myExConn
protected
RTI::ObjectClassHandle DtHlaStateDecoder::myHandle
protected

Referenced by objectClassHandle().

AttributeHandleBoolMap DtHlaStateDecoder::myMutableReportedWarning
mutableprivate

myReportedWarnings is an array for keeping track of which warnings have been already issued.

This variable is set in const functions. The Decoders need to be const, but we would like to warn people only once.

bool DtHlaStateDecoder::theUseGetValuePointer
static

Referenced by attributeData().


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

Document ID: Generated on Tue Mar 1 02:56:17 EST 2016 from SVN revision 162687
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)