![]() |
VR-Link API Documentation for HLA Evolved
|
shootEnc encodes Shoot interactions.
/********************************************************************* ** Copyright (c) 1999 MaK Technologies, Inc. ** All rights reserved. *********************************************************************/ #ifndef ShootEncoder_H_ #define ShootEncoder_H_ #if DtHLA #include "myFomMap.h" #include <vl/interEncoder.h> class DT_DLL_VL DtFireInteraction; #define DtDECLARE_SHOOT_PARAM_ENCODER(paramName) \ DtDECLARE_PARAM_ENCODER(DtFireInteraction, paramName) class DT_DLL_FOMMAP ShootEncoder : public DtInteractionEncoder { public: ShootEncoder(DtExerciseConn* exConn, DtInterClassDesc* classDesc); virtual ~ShootEncoder(); protected: DtDECLARE_SHOOT_PARAM_ENCODER(Shooter); DtDECLARE_SHOOT_PARAM_ENCODER(Shootee); }; #endif #endif
/********************************************************************* ** Copyright (c) 1997 MAK Technologies, Inc. ** All rights reserved. *********************************************************************/ /********************************************************************* ** $RCSfile: shootEnc.cxx,v $ $Revision: 1.3 $ $State: Exp $ *********************************************************************/ #if DtHLA #include "shootEnc.h" #include <vl/hFireInter.h> // Constructor. ShootEncoder::ShootEncoder( DtExerciseConn* exConn, DtInterClassDesc* classDesc) : DtInteractionEncoder(exConn, classDesc) { // Register the individual encoding functions for Shoot's parameters with // object. The encoding functions have names like encodeShooter and // encodeShootee. The macro expands to look like this: // addEncoder("Shooter", (DtParameterEncoder) encodeShooter); // addEncoder("Shootee", (DtParameterEncoder) encodeShootee); DtADD_PARAM_ENCODER(Shooter); DtADD_PARAM_ENCODER(Shootee); } ShootEncoder::~ShootEncoder() { } // Decoding functions // Macros can help with definitions of simple encoding functions, as in in // examples/extend/testObj/testEnc.cxx but here we do not rely on them. void ShootEncoder::encodeShooter(const DtFireInteraction& inter, RTI::ParameterHandleValuePairSet* params, RTI::ParameterHandle paramHandle) { // Get the value from the inspector function, convert to FOM representation // (in this case, a trivial conversion), and add it to the phvps. const char* val = inter.attackerId().string(); params->add(paramHandle, val, strlen(val)); } void ShootEncoder::encodeShootee(const DtFireInteraction& inter, RTI::ParameterHandleValuePairSet* params, RTI::ParameterHandle paramHandle) { // Get the value from the inspector function, convert to FOM representation // (in this case, a trivial conversion), and add it to the phvps. const char* val = inter.targetId().string(); params->add(paramHandle, val, strlen(val)); } #endif