VR-Link API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Test Interaction Encoder

TestEncoder, defined in testEnc.cxx, is derived from DtInteractionEncoder.

Macros help out in the declaration and definition of the encoding functions for individual parameters. (Again, encoding functions are provided as static members of the TestEncoder class.)

The "simple" implementation provided by the macros for an encoding function is to obtain a value from a particular interaction class inspector function, cast it to the appropriate "Net" type, which performs byte swapping if necessary, and adds the value to an RTI::ParameterHandleValuePairSet for sending.

The TestEncoder constructor just adds its encoding functions to the base class's table using addEncoder().


/*********************************************************************
** Copyright (c) 1992-2010 VT MAK
** All rights reserved.
*********************************************************************/
#pragma once
#if DtHLA
class DT_DLL_VL TestStateRepository;
#define DtDECLARE_TEST_ATTR_CHECKER(attrName) \
DtDECLARE_ATTR_CHECKER(TestStateRepository, attrName)
#define DtDECLARE_TEST_ATTR_ENCODER(attrName) \
DtDECLARE_ATTR_ENCODER(TestStateRepository, attrName)
#define DtDEFINE_SIMPLE_TEST_ATTR_ENCODER( \
attrName, netType, inspector) \
DtDEFINE_SIMPLE_ATTR_ENCODER(TestEncoder, \
TestStateRepository, attrName, netType, inspector)
#define DtDEFINE_SIMPLE_TEST_ATTR_CHECKER( \
attrName, inspector) \
DtDEFINE_SIMPLE_ATTR_CHECKER(TestEncoder, \
TestStateRepository, \
attrName, inspector)
class TestEncoder : public DtHlaStateEncoder
{
public:
TestEncoder(
DtExerciseConn* exConn,
DtObjClassDesc* classDesc);
virtual ~TestEncoder();
protected:
DtDECLARE_TEST_ATTR_ENCODER(Number);
DtDECLARE_TEST_ATTR_ENCODER(Vector);
DtDECLARE_TEST_ATTR_CHECKER(Number);
DtDECLARE_TEST_ATTR_CHECKER(Vector);
};
#endif

/*********************************************************************
** Copyright (c) 1992-2010 VT MAK
** All rights reserved.
*********************************************************************/
#if DtHLA
#include "testEnc.h"
#include "testSR.h"
TestEncoder::TestEncoder(
DtExerciseConn* exConn,
DtObjClassDesc* classDesc) :
DtHlaStateEncoder(exConn, classDesc)
{
// Register the individual encoding and checking functions for Test's
// attributes with the object. The encoding functions have names like
// encodeNumber, while checking functions have names like needNumber. The
// macros expands to look like this:
// addEncoder("Number", (DtAttributeEncoder) encodeNumber);
// addChecker("Number", (DtAttributeChecker) needNumber);
DtADD_ATTR_ENCODER(Number);
DtADD_ATTR_ENCODER(Vector);
DtADD_ATTR_CHECKER(Number);
DtADD_ATTR_CHECKER(Vector);
}
TestEncoder::~TestEncoder()
{
}
// Encoding functions
DtDEFINE_SIMPLE_TEST_ATTR_ENCODER(
Number, DtNetU32, number);
DtDEFINE_SIMPLE_TEST_ATTR_ENCODER(
Vector, DtNet64Vector, vector);
// Checking functions
DtDEFINE_SIMPLE_TEST_ATTR_CHECKER(
Number, number);
DtDEFINE_SIMPLE_TEST_ATTR_CHECKER(
Vector, vector);
#endif

Document ID: Generated on Mon Feb 6 18:36:34 EST 2017 from SVN revision 173107
Copyright © 2005-2016 VT MÄK. All Rights Reserved (www.mak.com)