TestDecoder, defined in testDec.cxx, is derived from DtInteractionDecoder.
Macros help out in the declaration and definition of the decoding functions for individual parameters. The "simple" implementation provided by the macros for a decoding function is to get a pointer to the parameter data from an RTI::ParameterHandleValuePairSet, cast it to a pointer to an appropriate "Net" type, then pass it to one of the interaction class's mutator functions. The implicit cast from the "Net" type to the type expected by the mutator functions will perform byte swapping if necessary.
The TestDecoder constructor just adds its decoding functions to the base class's table using addDecoder().
- Note
- While decoding functions are implemented as static member functions of the TestDecoder class, this was not strictly necessary - we could have written them as ordinary global function instead. But by implementing them as static members of the class, we can take advantage of some VR-Link macros.
#if DtHLA
#pragma once
#define DtDECLARE_TEST_ATTR_DECODER(attrName) \
DtDECLARE_ATTR_DECODER(TestStateRepository, attrName)
#define DtDEFINE_SIMPLE_TEST_ATTR_DECODER( \
attrName, netType, inspector) \
DtDEFINE_SIMPLE_TEST_ATTR_DECODER_WITH_CAST( \
attrName, netType, inspector, (netType))
#define DtDEFINE_SIMPLE_TEST_ATTR_DECODER_WITH_CAST( \
attrName, netType, mutator, castExpr) \
DtDEFINE_SIMPLE_ATTR_DECODER_WITH_CAST( \
TestDecoder, TestStateRepository, \
attrName, netType, mutator, castExpr)
{
public:
protected:
};
#endif
#if DtHLA
#include "testDec.h"
{
}
{
}
#endif