VR-Link API Documentation for HLA Evolved
 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 | Protected Attributes
DtHlaStateEncoder Class Reference

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

+ Inheritance diagram for DtHlaStateEncoder:
+ Collaboration diagram for DtHlaStateEncoder:

Public Types

typedef void(* DtAttributeEncoder )(const DtStateRepository &stateRep, RTI::AttributeHandleValuePairSet *avList, RTI::AttributeHandle handle)
 Attribute encoding function declaration. More...
 
typedef bool(* DtAttributeChecker )(const DtStateRepository &stateRep, const DtStateRepository &asSeenByRemote)
 Attribute checking function declaration. More...
 
typedef bool(* DtAttributeCheckerWithHandle )(const DtStateRepository &stateRep, const DtStateRepository &asSeenByRemote, RTI::AttributeHandle handle)
 Attribute checking function declaration that takes a handle and checks the specific attribute pointed to by that handle. More...
 

Public Member Functions

 DtHlaStateEncoder (DtExerciseConn *exConn, DtObjClassDesc *classDesc)
 constructor More...
 
virtual ~DtHlaStateEncoder ()
 destructor More...
 
 DtHlaStateEncoder (const DtHlaStateEncoder &orig)
 copy constructor More...
 
DtHlaStateEncoderoperator= (const DtHlaStateEncoder &orig)
 assignment operator More...
 
DtAttributeEncoder addEncoder (RTI::AttributeHandle hand, DtAttributeEncoder func)
 Add/Remove an encoding function for the attribute specified by handle. More...
 
DtAttributeEncoder removeEncoder (RTI::AttributeHandle hand)
 
DtAttributeEncoder addEncoder (char *name, DtAttributeEncoder func, bool complain=true)
 Add/Remove an encoding function for the attribute specified by name. More...
 
DtAttributeEncoder removeEncoder (char *name, bool complain=true)
 
DtAttributeChecker addChecker (RTI::AttributeHandle hand, DtAttributeChecker func)
 Add/Remove a checker function for the attribute specified by handle. More...
 
DtAttributeChecker removeChecker (RTI::AttributeHandle hand)
 
DtAttributeChecker addChecker (char *name, DtAttributeChecker func, bool complain=true)
 Add/Remove a checker function for the attribute specified by name. More...
 
DtAttributeChecker removeChecker (char *name, bool complain=true)
 
DtAttributeEncoder encoder (const RTI::AttributeHandle &handle)
 Get the attribute encoder for the specified handle. More...
 
DtAttributeChecker checker (const RTI::AttributeHandle &handle)
 Get the attribute checker for the specified handle. More...
 
virtual void encode (const DtStateRepository &stateRep, const DtStateRepository &asSeenByRemote, const RTI::AttributeHandleSet &neededAttrs, const RTI::AttributeHandleSet &includeThese, DtStateMsg *msg)
 Encode necessary values from the state repository. More...
 
virtual RTI::ObjectClassHandle objectClassHandle ()
 Get the object's class handle. More...
 
virtual DtHlaStateEncoderclone (DtObjClassDesc *classDesc) const
 Returns a new-ed clone of this object which corresponds to the class description classDesc. More...
 
virtual DtHlaStateEncoderclone () const
 Returns a new-ed clone of this object. More...
 
virtual void preCalculateEligible (const RTI::AttributeHandleSet &neededAttrs)
 

Static Public Member Functions

static bool trueChecker (const DtStateRepository &stateRep, const DtStateRepository &asSeenByRemote)
 A checker function that always returns 1, meaning that the attribute for which it is being used will be deemed necessary to send on every tick. More...
 
static bool falseChecker (const DtStateRepository &stateRep, const DtStateRepository &asSeenByRemote)
 A checker function that always returns 0, meaning that the attribute for which it is being used will never be deemed necessary to send. More...
 

Protected Attributes

DtExerciseConnmyExConn
 
DtObjClassDescmyClassDesc
 
RTI::ObjectClassHandle myHandle
 
std::map< RTI::AttributeHandle,
DtAttributeEncoder
myEncoderList
 myEncoderList and myCheckerList are arrays of classDesc->maxAttrHandle() items. More...
 
std::map< RTI::AttributeHandle,
DtAttributeChecker
myCheckerList
 
std::vector< DtAttributeCheckermyCheckerCache
 This is a helper varaible that pre-lookups decoder functions in order to avoid making map calls on every update. More...
 
const RTI::AttributeHandleSet * myCachedSet
 
std::map< RTI::AttributeHandle,
bool
myReportedWarning
 myReportedWarning is an array for keeping track of which warnings have already been reported More...
 

Detailed Description

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

Member Typedef Documentation

typedef bool(* DtHlaStateEncoder::DtAttributeChecker)(const DtStateRepository &stateRep, const DtStateRepository &asSeenByRemote)

Attribute checking function declaration.

typedef bool(* DtHlaStateEncoder::DtAttributeCheckerWithHandle)(const DtStateRepository &stateRep, const DtStateRepository &asSeenByRemote, RTI::AttributeHandle handle)

Attribute checking function declaration that takes a handle and checks the specific attribute pointed to by that handle.

typedef void(* DtHlaStateEncoder::DtAttributeEncoder)(const DtStateRepository &stateRep, RTI::AttributeHandleValuePairSet *avList, RTI::AttributeHandle handle)

Attribute encoding function declaration.

1516 Note: In this case, the RTI::AttributeHandleValuePairSet is defined by VR-Link for backwards compatibility

Constructor & Destructor Documentation

DtHlaStateEncoder::DtHlaStateEncoder ( DtExerciseConn exConn,
DtObjClassDesc classDesc 
)

constructor

virtual DtHlaStateEncoder::~DtHlaStateEncoder ( )
virtual

destructor

DtHlaStateEncoder::DtHlaStateEncoder ( const DtHlaStateEncoder orig)

copy constructor

Member Function Documentation

DtAttributeChecker DtHlaStateEncoder::addChecker ( RTI::AttributeHandle  hand,
DtAttributeChecker  func 
)

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

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

Referenced by DtF18EntityEncoder::DtF18EntityEncoder().

DtAttributeChecker DtHlaStateEncoder::addChecker ( char *  name,
DtAttributeChecker  func,
bool  complain = true 
)

Add/Remove a checker 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 checker function which is replaced by the add/remove. Note: This is non-virtual since it is typically called by constructors.

DtAttributeEncoder DtHlaStateEncoder::addEncoder ( RTI::AttributeHandle  hand,
DtAttributeEncoder  func 
)

Add/Remove an encoding function for the attribute specified by handle.

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

Referenced by DtF18EntityEncoder::DtF18EntityEncoder().

DtAttributeEncoder DtHlaStateEncoder::addEncoder ( char *  name,
DtAttributeEncoder  func,
bool  complain = true 
)

Add/Remove an encoding 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 encoding function which is replaced by the add/remove. Note: This is non-virtual since it is typically called by constructors.

DtHlaStateEncoder::DtAttributeChecker DtHlaStateEncoder::checker ( const RTI::AttributeHandle &  handle)
inline

Get the attribute checker for the specified handle.

References myCheckerList.

virtual DtHlaStateEncoder* DtHlaStateEncoder::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 encoder as its parent

virtual DtHlaStateEncoder* DtHlaStateEncoder::clone ( ) const
virtual

Returns a new-ed clone of this object.

virtual void DtHlaStateEncoder::encode ( const DtStateRepository stateRep,
const DtStateRepository asSeenByRemote,
const RTI::AttributeHandleSet &  neededAttrs,
const RTI::AttributeHandleSet &  includeThese,
DtStateMsg msg 
)
virtual

Encode necessary values from the state repository.

The second state repository represents what is seen by remote simulators and is used to determine when things need to be sent in the state message. includeThese is a set of attributes that should be included even if their thresholds have not been exceeded. neededAttrs is the set of owned attributes that are needed by the federation (i.e. we've received turnOnUpdates messages including these attributes)

DtHlaStateEncoder::DtAttributeEncoder DtHlaStateEncoder::encoder ( const RTI::AttributeHandle &  handle)
inline

Get the attribute encoder for the specified handle.

References myEncoderList.

static bool DtHlaStateEncoder::falseChecker ( const DtStateRepository stateRep,
const DtStateRepository asSeenByRemote 
)
static

A checker function that always returns 0, meaning that the attribute for which it is being used will never be deemed necessary to send.

RTI::ObjectClassHandle DtHlaStateEncoder::objectClassHandle ( )
inlinevirtual

Get the object's class handle.

References myHandle.

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

assignment operator

virtual void DtHlaStateEncoder::preCalculateEligible ( const RTI::AttributeHandleSet &  neededAttrs)
virtual
DtAttributeChecker DtHlaStateEncoder::removeChecker ( RTI::AttributeHandle  hand)
DtAttributeChecker DtHlaStateEncoder::removeChecker ( char *  name,
bool  complain = true 
)
DtAttributeEncoder DtHlaStateEncoder::removeEncoder ( RTI::AttributeHandle  hand)
DtAttributeEncoder DtHlaStateEncoder::removeEncoder ( char *  name,
bool  complain = true 
)
static bool DtHlaStateEncoder::trueChecker ( const DtStateRepository stateRep,
const DtStateRepository asSeenByRemote 
)
static

A checker function that always returns 1, meaning that the attribute for which it is being used will be deemed necessary to send on every tick.

Member Data Documentation

const RTI::AttributeHandleSet* DtHlaStateEncoder::myCachedSet
protected
std::vector<DtAttributeChecker> DtHlaStateEncoder::myCheckerCache
protected

This is a helper varaible that pre-lookups decoder functions in order to avoid making map calls on every update.

std::map<RTI::AttributeHandle,DtAttributeChecker> DtHlaStateEncoder::myCheckerList
protected

Referenced by checker().

DtObjClassDesc* DtHlaStateEncoder::myClassDesc
protected
std::map<RTI::AttributeHandle,DtAttributeEncoder> DtHlaStateEncoder::myEncoderList
protected

myEncoderList and myCheckerList are arrays of classDesc->maxAttrHandle() items.

Referenced by encoder().

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

Referenced by objectClassHandle().

std::map<RTI::AttributeHandle,bool> DtHlaStateEncoder::myReportedWarning
protected

myReportedWarning is an array for keeping track of which warnings have already been reported


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

Document ID: Generated on Tue Aug 10 00:12:31 EDT 2021 from SVN revision 232765
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)