9 #ifndef DtHlaStateEncoder_H_
10 #define DtHlaStateEncoder_H_
50 typedef void (*DtAttributeEncoder)(
53 RTI::AttributeHandle handle);
56 typedef bool (*DtAttributeChecker)(
62 typedef bool (*DtAttributeCheckerWithHandle)(
65 RTI::AttributeHandle handle);
73 DtAttributeEncoder addEncoder(RTI::AttributeHandle hand,
74 DtAttributeEncoder func);
75 DtAttributeEncoder removeEncoder(RTI::AttributeHandle hand);
83 DtAttributeEncoder addEncoder(
char* name,
84 DtAttributeEncoder func,
bool complain =
true);
85 DtAttributeEncoder removeEncoder(
char* name,
bool complain =
true);
92 DtAttributeChecker addChecker(RTI::AttributeHandle hand,
93 DtAttributeChecker func);
94 DtAttributeChecker removeChecker(RTI::AttributeHandle hand);
102 DtAttributeChecker addChecker(
char* name,
103 DtAttributeChecker func,
bool complain =
true);
104 DtAttributeChecker removeChecker(
char* name,
bool complain =
true);
107 inline DtAttributeEncoder encoder(
const RTI::AttributeHandle &handle) ;
110 inline DtAttributeChecker checker(
const RTI::AttributeHandle &handle) ;
121 const RTI::AttributeHandleSet& neededAttrs,
122 const RTI::AttributeHandleSet& includeThese,
126 virtual RTI::ObjectClassHandle objectClassHandle();
137 virtual void preCalculateEligible(
const RTI::AttributeHandleSet& neededAttrs);
193 #define DtADD_ATTR_ENCODER(attrName) \
194 addEncoder((char *)#attrName, (DtAttributeEncoder) encode##attrName)
197 #define DtADD_ATTR_ENCODER_QUIET(attrName) \
198 addEncoder((char *)#attrName, (DtAttributeEncoder) encode##attrName, false)
203 #define DtADD_ATTR_CHECKER(attrName) \
204 addChecker((char *)#attrName, (DtAttributeChecker) need##attrName)
207 #define DtADD_ATTR_CHECKER_QUIET(attrName) \
208 addChecker((char *)#attrName, (DtAttributeChecker) need##attrName, false)
213 #define DtDECLARE_ATTR_ENCODER(stateRepClass, attrName) \
214 static void encode##attrName(const stateRepClass& rep, \
215 RTI::AttributeHandleValuePairSet* attrs, \
216 RTI::AttributeHandle attrHandle)
220 #define DtDECLARE_ATTR_CHECKER(stateRepClass, attrName) \
221 static bool need##attrName(const stateRepClass& stateRep, \
222 const stateRepClass& asSeenByRemote)
229 #define DtDEFINE_SIMPLE_ATTR_ENCODER( \
230 encClass, stateRepClass, attrName, netType, inspector) \
231 void encClass::encode##attrName(const stateRepClass& rep, \
232 RTI::AttributeHandleValuePairSet* attrs, \
233 RTI::AttributeHandle attrHandle) \
236 netVal = rep.inspector(); \
237 attrs->add(attrHandle, (char*) &netVal, sizeof(netType)); \
240 #define DtDEFINE_SIMPLE_GLOBAL_OBJECT_DESIGNATOR_ATTR_ENCODER( \
241 encClass, stateRepClass, attrName, inspector) \
242 void encClass::encode##attrName(const stateRepClass& rep, \
243 RTI::AttributeHandleValuePairSet* attrs, \
244 RTI::AttributeHandle attrHandle) \
246 DtGlobalObjectDesignator netVal = rep.inspector(); \
247 attrs->add(attrHandle, (char*) netVal.string(), netVal.length()+1); \
255 #define DtDEFINE_SIMPLE_ATTR_CHECKER( \
256 encClass, stateRepClass, attrName, inspector) \
257 bool encClass::need##attrName(const stateRepClass& stateRep, \
258 const stateRepClass& asSeenByRemote) \
260 return (bool) !(stateRep.inspector() == asSeenByRemote.inspector()); \
DtAttributeEncoder encoder(const RTI::AttributeHandle &handle)
Get the attribute encoder for the specified handle.
Definition: hlaStateEncoder.h:180
std::map< RTI::AttributeHandle, bool > myReportedWarning
myReportedWarning is an array for keeping track of which warnings have already been reported ...
Definition: hlaStateEncoder.h:171
Instances of DtExerciseConn are used to provide an application's interface or connection to the netwo...
Definition: exerciseConnHLA.h:58
#define DT_DLL_VL
Definition: vlMachineTypes.h:108
void(* DtAttributeEncoder)(const DtStateRepository &stateRep, RTI::AttributeHandleValuePairSet *avList, RTI::AttributeHandle handle)
Attribute encoding function declaration.
Definition: hlaStateEncoder.h:50
std::vector< DtAttributeChecker > myCheckerCache
This is a helper varaible that pre-lookups decoder functions in order to avoid making map calls on ev...
Definition: hlaStateEncoder.h:165
DtHlaStateEncoder is used to provide encoding of a state repository into a state message in an HLA (a...
Definition: hlaStateEncoder.h:30
std::map< RTI::AttributeHandle, DtAttributeEncoder > myEncoderList
myEncoderList and myCheckerList are arrays of classDesc->maxAttrHandle() items.
Definition: hlaStateEncoder.h:160
An instance of DtObjClassDesc is a "class descriptor" for an HLA Object class.
Definition: objClassDesc1516.h:41
virtual RTI::ObjectClassHandle objectClassHandle()
Get the object's class handle.
Definition: hlaStateEncoder.h:174
DtStateRepository is an abstract base class for maintaining state for an object.
Definition: stateRepository.h:50
std::map< RTI::AttributeHandle, DtAttributeChecker > myCheckerList
Definition: hlaStateEncoder.h:161
DtObjClassDesc * myClassDesc
Definition: hlaStateEncoder.h:155
Used to provide backwards compatibility for VR-Link Encoders and Decoders who use either AttributeHan...
Definition: rtiCompatibility.h:154
DtExerciseConn * myExConn
Definition: hlaStateEncoder.h:154
RTI::ObjectClassHandle myHandle
Definition: hlaStateEncoder.h:156
const RTI::AttributeHandleSet * myCachedSet
Definition: hlaStateEncoder.h:166
class DtStateMsg:
Definition: stateMsgHLA.h:32
DtAttributeChecker checker(const RTI::AttributeHandle &handle)
Get the attribute checker for the specified handle.
Definition: hlaStateEncoder.h:186
bool(* DtAttributeChecker)(const DtStateRepository &stateRep, const DtStateRepository &asSeenByRemote)
Attribute checking function declaration.
Definition: hlaStateEncoder.h:56
This file contains typedefs for machine dependant types.