These routines will be used to encode and decode the new mass member for transport over the network
Header file:
#ifndef configFomMapper_H_
#define configFomMapper_H_ 1
#if DtHLA
#include <vl/fomMapper.h>
RTI::AttributeHandleValuePairSet* avList,
RTI::AttributeHandle handle);
const RTI::AttributeHandleValuePairSet& avlist,
int pairSetIndex);
#endif
#endif
Implementation:
#if DtHLA
#include "configFomMap.h"
#include <vl/encFactory.h>
#include <vl/decFactory.h>
{
mapper->stateEncoderFactory()->addAttributeEncoder(
"BaseEntity.PhysicalEntity", "Mass",
(DtHlaStateEncoder::DtAttributeEncoder)
encodeMass,
true);
mapper->stateDecoderFactory()->addAttributeDecoder(
"BaseEntity.PhysicalEntity", "Mass",
(DtHlaStateDecoder::DtAttributeDecoder)
decodeMass,
true);
mapper->stateEncoderFactory()->addAttributeChecker(
"BaseEntity.PhysicalEntity", "Mass",
(DtHlaStateEncoder::DtAttributeChecker)
needMass,
true);
}
RTI::AttributeHandleValuePairSet* avList,
RTI::AttributeHandle handle)
{
double mass = stateRep.
mass();
DtNetFloat64 netVal(mass);
avList->add(handle, (char*) &netVal, sizeof(DtNetFloat64));
}
const RTI::AttributeHandleValuePairSet& avlist,
int pairSetIndex)
{
DtNetFloat64 netVal;
RTI::ULong length = 0;
avlist.getValue(pairSetIndex, (char* )&netVal, length);
stateRep->
setMass((
double) netVal);
}
{
return (
bool) (stateRep.
mass() != asSeenByRemote.
mass());
}
#endif