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);
154 static void wideStringToHlaUnicodeString(
const std::wstring& wideString,
156 RTI::AttributeHandle attrHandle);
199 #define DtADD_ATTR_ENCODER(attrName) \
200 addEncoder((char *)#attrName, (DtAttributeEncoder) encode##attrName)
203 #define DtADD_ATTR_ENCODER_QUIET(attrName) \
204 addEncoder((char *)#attrName, (DtAttributeEncoder) encode##attrName, false)
209 #define DtADD_ATTR_CHECKER(attrName) \
210 addChecker((char *)#attrName, (DtAttributeChecker) need##attrName)
213 #define DtADD_ATTR_CHECKER_QUIET(attrName) \
214 addChecker((char *)#attrName, (DtAttributeChecker) need##attrName, false)
219 #define DtDECLARE_ATTR_ENCODER(stateRepClass, attrName) \
220 static void encode##attrName(const stateRepClass& rep, \
221 RTI::AttributeHandleValuePairSet* attrs, \
222 RTI::AttributeHandle attrHandle)
226 #define DtDECLARE_ATTR_CHECKER(stateRepClass, attrName) \
227 static bool need##attrName(const stateRepClass& stateRep, \
228 const stateRepClass& asSeenByRemote)
235 #define DtDEFINE_SIMPLE_ATTR_ENCODER( \
236 encClass, stateRepClass, attrName, netType, inspector) \
237 void encClass::encode##attrName(const stateRepClass& rep, \
238 RTI::AttributeHandleValuePairSet* attrs, \
239 RTI::AttributeHandle attrHandle) \
242 netVal = rep.inspector(); \
243 attrs->add(attrHandle, (char*) &netVal, sizeof(netType)); \
246 #define DtDEFINE_SIMPLE_GLOBAL_OBJECT_DESIGNATOR_ATTR_ENCODER( \
247 encClass, stateRepClass, attrName, inspector) \
248 void encClass::encode##attrName(const stateRepClass& rep, \
249 RTI::AttributeHandleValuePairSet* attrs, \
250 RTI::AttributeHandle attrHandle) \
252 DtGlobalObjectDesignator netVal = rep.inspector(); \
253 attrs->add(attrHandle, (char*) netVal.string(), netVal.length()+1); \
261 #define DtDEFINE_SIMPLE_ATTR_CHECKER( \
262 encClass, stateRepClass, attrName, inspector) \
263 bool encClass::need##attrName(const stateRepClass& stateRep, \
264 const stateRepClass& asSeenByRemote) \
266 return (bool) !(stateRep.inspector() == asSeenByRemote.inspector()); \
275 #define DtDEFINE_SIMPLE_ATTR_ENCODER_WITH_PARAM( \
276 encClass, stateRepClass, attrName, netType, inspector, param) \
277 void encClass::encode##attrName(const stateRepClass& rep, \
278 RTI::AttributeHandleValuePairSet* attrs, \
279 RTI::AttributeHandle attrHandle) \
281 if (rep.hasMode(param)) { \
283 netVal = rep.inspector(param); \
284 attrs->add(attrHandle, (char*) &netVal, sizeof(netType)); \
293 #define DtDEFINE_SIMPLE_ATTR_CHECKER_WITH_PARAM( \
294 encClass, stateRepClass, attrName, inspector, param) \
295 bool encClass::need##attrName(const stateRepClass& stateRep, \
296 const stateRepClass& asSeenByRemote) \
298 return (bool) (stateRep.hasMode(param) && asSeenByRemote.hasMode(param) \
299 && !(stateRep.inspector(param) == \
300 asSeenByRemote.inspector(param))); \
DtAttributeEncoder encoder(const RTI::AttributeHandle &handle)
Get the attribute encoder for the specified handle.
Definition: hlaStateEncoder.h:186
std::map< RTI::AttributeHandle, bool > myReportedWarning
myReportedWarning is an array for keeping track of which warnings have already been reported ...
Definition: hlaStateEncoder.h:177
Instances of DtExerciseConn are used to provide an application's interface or connection to the netwo...
Definition: exerciseConnHLA.h:61
#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 variable that pre-lookups decoder functions in order to avoid making map calls on ev...
Definition: hlaStateEncoder.h:171
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:166
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:180
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:167
DtObjClassDesc * myClassDesc
Definition: hlaStateEncoder.h:161
Used to provide backwards compatibility for VR-Link Encoders and Decoders who use either AttributeHan...
Definition: rtiCompatibility.h:237
DtExerciseConn * myExConn
Definition: hlaStateEncoder.h:160
RTI::ObjectClassHandle myHandle
Definition: hlaStateEncoder.h:162
const RTI::AttributeHandleSet * myCachedSet
Definition: hlaStateEncoder.h:172
class DtStateMsg:
Definition: stateMsgHLA.h:32
DtAttributeChecker checker(const RTI::AttributeHandle &handle)
Get the attribute checker for the specified handle.
Definition: hlaStateEncoder.h:192
bool(* DtAttributeChecker)(const DtStateRepository &stateRep, const DtStateRepository &asSeenByRemote)
Attribute checking function declaration.
Definition: hlaStateEncoder.h:56
This file contains typedefs for machine dependant types.