9 #ifndef DtHlaStateEncoder_H_
10 #define DtHlaStateEncoder_H_
36 DtObjClassDesc* classDesc);
39 virtual ~DtHlaStateEncoder();
42 DtHlaStateEncoder(
const DtHlaStateEncoder& orig);
45 DtHlaStateEncoder& operator=(
const DtHlaStateEncoder& orig);
50 typedef void (*DtAttributeEncoder)(
52 RTI::AttributeHandleValuePairSet* avList,
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();
132 virtual DtHlaStateEncoder* clone(DtObjClassDesc* classDesc)
const;
135 virtual DtHlaStateEncoder* clone()
const;
137 virtual void preCalculateEligible(
const RTI::AttributeHandleSet& neededAttrs);
154 static void wideStringToHlaUnicodeString(
const std::wstring& wideString,
155 RTI::AttributeHandleValuePairSet* avList,
156 RTI::AttributeHandle attrHandle);
161 DtObjClassDesc* myClassDesc;
162 RTI::ObjectClassHandle myHandle;
166 std::map<RTI::AttributeHandle,DtAttributeEncoder> myEncoderList;
167 std::map<RTI::AttributeHandle,DtAttributeChecker> myCheckerList;
171 std::vector<DtAttributeChecker> myCheckerCache;
172 const RTI::AttributeHandleSet* myCachedSet;
177 std::map<RTI::AttributeHandle,bool> myReportedWarning;
180 inline RTI::ObjectClassHandle DtHlaStateEncoder::objectClassHandle()
185 inline DtHlaStateEncoder::DtAttributeEncoder
186 DtHlaStateEncoder::encoder(
const RTI::AttributeHandle &hand)
188 return myEncoderList[hand];
191 inline DtHlaStateEncoder::DtAttributeChecker
192 DtHlaStateEncoder::checker(
const RTI::AttributeHandle &hand)
194 return myCheckerList[hand];
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))); \
Instances of DtExerciseConn are used to provide an application's interface or connection to the netwo...
Definition: exerciseConnDIS.h:62
#define DT_DLL_VL
Definition: vlMachineTypes.h:108
DtStateRepository is an abstract base class for maintaining state for an object.
Definition: stateRepository.h:50
Instances of DtStateMsg are used to represent state data communicated via the network in a DIS (as op...
Definition: stateMsgDIS.h:21
This file contains typedefs for machine dependant types.