9 #ifndef DtInteractionDecoder_H_
10 #define DtInteractionDecoder_H_
42 typedef void (*DtParameterDecoder)(DtInteractionRep* inter,
43 const RTI::ParameterHandleValuePairSet& pvlist,
60 DtParameterDecoder addDecoder(RTI::ParameterHandle handle,
61 DtParameterDecoder proc);
68 DtParameterDecoder addDecoder(
char* name,
69 DtParameterDecoder proc);
72 virtual DtParameterDecoder decoder(RTI::ParameterHandle handle)
const;
76 DtInteractionRep* interaction,
78 const RTI::ParameterHandleValueMap& pvMap
80 const RTI::ParameterHandleValuePairSet& pvList
85 virtual RTI::InteractionClassHandle interactionClassHandle();
102 static char* decodingBuffer(
int length);
105 static char* parameterData(
const RTI::ParameterHandleValuePairSet& pvList,
106 int index, RTI::ULong& length);
113 static char* parameterData(
114 const RTI::ParameterHandleValuePairSet& pvList,
int index, RTI::ULong& length,
115 unsigned int expectedDataSize,
char* paramName);
120 const RTI::ParameterHandleValuePairSet& params,
int index);
127 const RTI::ParameterHandleValuePairSet& pvlist,
int i);
139 virtual void decodeParameter(DtInteractionRep* inter,
140 const RTI::ParameterHandleValuePairSet& pvList,
int index);
150 std::map<RTI::ParameterHandle, DtParameterDecoder>
myList;
154 inline RTI::InteractionClassHandle
166 const RTI::ParameterHandleValuePairSet& pvList,
int index, RTI::ULong& length)
171 dataPtr = pvList.getValuePointer(index, length);
175 length = pvList.getValueLength(index);
179 pvList.getValue(index, dataPtr, length);
186 const RTI::ParameterHandleValuePairSet& pvList,
int index, RTI::ULong& length,
187 unsigned int expectedDataSize,
char* paramName)
189 char* outDataPtr = 0;
192 outDataPtr = pvList.getValuePointer(index, length);
196 length = pvList.getValueLength(index);
197 if (length > 0 && length >= expectedDataSize)
200 pvList.getValue(index, outDataPtr, length);
204 if (length != expectedDataSize)
206 if (length < expectedDataSize)
208 DtWarn(
"Cannot decode parameter %s.\n"
209 "Size of data (%d) is smaller than expected (%d).\n",
210 paramName, length, expectedDataSize);
216 DtVerbose(
"When decoding parameter %s,\n"
217 "found size of data (%d) is larger than expected (%d).\n",
218 paramName, length, expectedDataSize);
226 const RTI::ParameterHandleValuePairSet& params,
int index)
228 RTI::ULong length = 0;
230 length = params.getValueLength(index);
234 params.getValue(index, dataPtr, length);
243 #define DtADD_PARAM_DECODER(paramName) \
244 addDecoder((char *)#paramName, (DtParameterDecoder) decode##paramName)
248 #define DtDECLARE_PARAM_DECODER(RepT, paramName) \
249 static void decode##paramName(RepT* inter, \
250 const RTI::ParameterHandleValuePairSet& params, int pairSetIndex)
259 #define DtDEFINE_SIMPLE_PARAM_DECODER_WITH_CAST(decClass, interClass, \
260 paramName, netType, mutator, castExpr) \
261 void decClass::decode##paramName(interClass* inter, \
262 const RTI::ParameterHandleValuePairSet& params, \
265 RTI::ULong length = 0; \
266 netType* netValPtr = (netType*)parameterData(params, index, length, sizeof(netType), #paramName); \
269 inter->mutator(castExpr *netValPtr); \
280 #define DtDEFINE_SIMPLE_PARAM_DECODER_WITH_CAST_SET(decClass, interClass, \
281 paramName, netType, castExpr) \
282 DtDEFINE_SIMPLE_PARAM_DECODER_WITH_CAST(decClass, interClass, \
283 paramName, netType, set##paramName, castExpr)
291 #define DtDEFINE_SIMPLE_PARAM_DECODER_MUTATOR(decClass, interClass, \
292 paramName, netType, mutator) \
293 void decClass::decode##paramName(interClass* inter, \
294 const RTI::ParameterHandleValuePairSet& params, \
297 RTI::ULong length = 0; \
298 netType* netValPtr = (netType*)parameterData(params, index, length, sizeof(netType), #paramName); \
301 inter->mutator(*netValPtr); \
311 #define DtDEFINE_SIMPLE_PARAM_DECODER_MUTATOR_SET(decClass, interClass, \
312 paramName, netType) \
313 DtDEFINE_SIMPLE_PARAM_DECODER_MUTATOR(decClass, interClass, \
314 paramName, netType, set##paramName)
316 #define DtDEFINE_SIMPLE_GLOBAL_OBJECT_DESIGNATOR_PARAM_DECODER( \
317 decClass, interClass, paramName, mutator) \
318 void decClass::decode##paramName(interClass* inter, \
319 const RTI::ParameterHandleValuePairSet& params, \
322 RTI::ULong length = 0; \
323 DtGlobalObjectDesignator objName = (char*) params.getValuePointer(index, length); \
324 inter->mutator(objName); \
331 #define DtDEFINE_SIMPLE_PARAM_DECODER_BUFF(decClass, interClass, \
332 paramName, mutator) \
333 void decClass::decode##paramName(interClass* inter, \
334 const RTI::ParameterHandleValuePairSet& params, \
337 RTI::ULong length = 0; \
338 char* buff = parameterData(params, index, length); \
341 inter->mutator(buff, length); \
345 #define DtDEFINE_SIMPLE_PARAM_DECODER(decClass, interClass, \
346 paramName, netType, mutator) \
347 DtDEFINE_SIMPLE_PARAM_DECODER_MUTATOR(decClass, interClass, \
348 paramName, netType, mutator)
static char * decodingBuffer(int length)
Returns a pointer to a buffer that can be used to copy data obtained from a phvps.
Definition: interactionDecoder.h:160
Declares a function for managing decoding buffers.
DtExerciseConn * myExConn
Definition: interactionDecoder.h:144
Instances of DtExerciseConn are used to provide an application's interface or connection to the netwo...
Definition: exerciseConnHLA.h:61
virtual RTI::InteractionClassHandle interactionClassHandle()
Get the interaction's class handle.
Definition: interactionDecoder.h:155
#define DT_DLL_VL
Definition: vlMachineTypes.h:108
Instances of DtInterClassDesc are used to represent HLA Object and Interaction classes.
Definition: interClassDesc.h:33
DT_DLL_VLPROTIND char * DtDecodingBuffer(unsigned int requestedLength)
DtDecodingBuffer returns a pointer to a chunk of memory requestedLength long which can be used for de...
Functions in vlPrint.h provide an error and print facility for vrlink.
static DtNetEventId * eventIdParameterData(const RTI::ParameterHandleValuePairSet ¶ms, int index)
Get the parameter data as a DtNetEventId (adds defensive null terminator) Returns a pointer to the pa...
Definition: interactionDecoder.h:225
static bool theUseGetValuePointer
Definition: interactionDecoder.h:122
static char * parameterData(const RTI::ParameterHandleValuePairSet &pvList, int index, RTI::ULong &length)
Returns a pointer to a buffer containing the parameter data.
Definition: interactionDecoder.h:165
std::map< RTI::ParameterHandle, DtParameterDecoder > myList
myList is an array of classDesc->maxParamHandle() items.
Definition: interactionDecoder.h:150
RTI::InteractionClassHandle myClassHandle
Definition: interactionDecoder.h:147
int DtNotifyLevel
DtNotifyLevel is used to control the level of diagnostics output by VR-Link.
DtInterClassDesc * myClassDesc
Definition: interactionDecoder.h:145
DtOutputStream DtVerbose
These DtOutputStream instances are used for all print messaging in VR-Link.
DtOutputStream DtWarn
These DtOutputStream instances are used for all print messaging in VR-Link.
This file provides a declaration of the class DtInteractionWithEncDec.
Instances of DtInteractionDecoder are used to decode interactions from the network.
Definition: interactionDecoder.h:37
class DtInteractionWithEncDec:
Definition: interactionWithEncDec.h:44
This file contains typedefs for machine dependant types.