VR-Link API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Shoot Interaction Decoder

shootDec decodes Shoot interactions.


/*********************************************************************
** Copyright (c) 1999 MaK Technologies, Inc.
** All rights reserved.
*********************************************************************/
#ifndef ShootDecoder_H_
#define ShootDecoder_H_
#if DtHLA
#include "myFomMap.h"
#define DtDECLARE_SHOOT_PARAM_DECODER(paramName) \
DtDECLARE_PARAM_DECODER(DtFireInteraction, paramName)
{
public:
virtual ~ShootDecoder();
protected:
};
#endif
#endif

/*********************************************************************
** Copyright (c) 1997 MaK Technologies, Inc.
** All rights reserved.
*********************************************************************/
/*********************************************************************
** $RCSfile: shootDec.cxx,v $ $Revision: 1.3 $ $State: Exp $
*********************************************************************/
#if DtHLA
#include "shootDec.h"
#include <stdio.h>
#include <string.h>
// Constructor.
DtExerciseConn* exConn,
DtInterClassDesc* classDesc) :
DtInteractionDecoder(exConn, classDesc)
{
// Register the individual decoding functions for Shoot's parameters with
// object. The decoding functions have names like decodeShooter and
// decodeShootee. The macro expands to look like this:
// addDecoder("Shooter", (DtParameterDecoder) decodeShooter);
}
{
}
// Decoding functions
// Macros can help with definitions of simple decoding functions, as in in
// examples/extend/testInter/testDec.cxx but here we do not rely on them.
void ShootDecoder::decodeShooter(DtFireInteraction* inter,
const RTI::ParameterHandleValuePairSet& params,
int index)
{
RTI::ULong length = 0;
// Get value in RTI representation into netVal.
char* netVal = (char*)
params.getValuePointer(index, length);
// Must copy to a buffer, because string returned by getValuePointer may
// not be NULL terminated.
static char buff[100];
strncpy(buff, netVal, length);
buff[length] = 0;
// In this case, we can implicitly convert from FOM representation (char*)
// to VR-Link representation (DtGlobalObjectDesignator). No explicit
// conversion is necessary. Just pass the value to the mutator function.
inter->setAttackerId(buff);
}
void ShootDecoder::decodeShootee(DtFireInteraction* inter,
const RTI::ParameterHandleValuePairSet& params,
int index)
{
RTI::ULong length = 0;
// Get value in RTI representation into netVal.
char* netVal = (char*)
params.getValuePointer(index, length);
// Must copy to a buffer, because string returned by getValuePointer may
// not be NULL terminated.
static char buff[100];
strncpy(buff, netVal, length);
buff[length] = 0;
// In this case, we can implicitly convert from FOM representation (char*)
// to VR-Link representation (DtGlobalObjectDesignator). No explicit
// conversion is necessary. Just pass the value to the mutator function.
inter->setTargetId(buff);
}
#endif

Document ID: Generated on Fri Dec 2 02:42:08 EST 2016 from SVN revision 171416
Copyright © 2005-2016 VT MÄK. All Rights Reserved (www.mak.com)