9 #ifndef DtInteractionDecoder_H_
10 #define DtInteractionDecoder_H_
41 typedef void (*DtParameterDecoder)(DtInteractionRep* inter,
42 const RTI::ParameterHandleValuePairSet& pvlist,
59 DtParameterDecoder addDecoder(RTI::ParameterHandle handle,
60 DtParameterDecoder proc);
67 DtParameterDecoder addDecoder(
char* name,
68 DtParameterDecoder proc);
71 virtual DtParameterDecoder decoder(RTI::ParameterHandle handle)
const;
75 DtInteractionRep* interaction,
77 const RTI::ParameterHandleValueMap& pvMap
79 const RTI::ParameterHandleValuePairSet& pvList
84 virtual RTI::InteractionClassHandle interactionClassHandle();
101 static char* decodingBuffer(
int length);
112 virtual void decodeParameter(DtInteractionRep* inter,
113 const RTI::ParameterHandleValuePairSet& pvList,
int index);
123 std::map<RTI::ParameterHandle, DtParameterDecoder>
myList;
127 inline RTI::InteractionClassHandle
141 #define DtADD_PARAM_DECODER(attrName) \
142 addDecoder((char *)#attrName, (DtParameterDecoder) decode##attrName)
146 #define DtDECLARE_PARAM_DECODER(RepT, paramName) \
147 static void decode##paramName(RepT* inter, \
148 const RTI::ParameterHandleValuePairSet& params, int pairSetIndex)
150 #define DtDEFINE_SIMPLE_PARAM_DECODER_WITH_CAST(decClass, interClass, \
151 paramName, netType, mutator, castExpr) \
152 void decClass::decode##paramName(interClass* inter, \
153 const RTI::ParameterHandleValuePairSet& params, \
156 RTI::ULong length = params.getValueLength(index); \
157 if (length > sizeof(netType)) \
159 DtWarn("Size of value decoded for parameter %s (%d)\n", \
160 #paramName, length); \
161 DtWarn(" is larger than size of %s (%d)\n", #netType, sizeof(netType)); \
165 params.getValue(index, (char*) &netVal, length); \
166 inter->mutator(castExpr netVal); \
169 #define DtDEFINE_SIMPLE_GLOBAL_OBJECT_DESIGNATOR_PARAM_DECODER( \
170 decClass, interClass, paramName, mutator) \
171 void decClass::decode##paramName(interClass* inter, \
172 const RTI::ParameterHandleValuePairSet& params, \
175 RTI::ULong length = 0; \
176 DtGlobalObjectDesignator objName = \
177 (char*) params.getValuePointer(index, length); \
178 inter->mutator(objName); \
182 #define DtDEFINE_SIMPLE_PARAM_DECODER(decClass, interClass, \
183 paramName, netType, mutator) \
184 DtDEFINE_SIMPLE_PARAM_DECODER_WITH_CAST(decClass, interClass, \
185 paramName, netType, mutator, (netType))