VR-Forces 4.2 Class Documentation
Add Attribute

Table of Contents

The Add Attribute example demonstrates the following:

The Add Attribute example adds a new member (mass) to the entity state repository. It also adds encoders and decoders to send/receive that information over the network. When running the example, make sure to copy the VrfExtend.fed to the bin directory. When running in HLA1516, make sure RTI_forceFullCompliance is not on in your rid.mtl and that you're not turning it on using the RTI Assistant. In the launcher, set Federation Name to "VrfExtend" and set FED File Name to "VrfExtend.fed".

Since this example is loaded as a plugin, it can be used in conjunction with the released VR-Forces application

How to Run the Example

  1. Copy examples\addAttr\VrfExtend.fed to the bin directory.
  2. Since this example is loaded as a plugin, it can be used in conjunctionwith the released VR-Forces application

Usage

In the launcher, set the addAttribute plugin to load, set Federation Name to "VrfExtend", and set the FED File Name to "VrfExtend.fed", then start VR Forces.

To view the new behavior:

  1. New Scenario
  2. Create a M1A2
  3. Right-click on entity and select Information... to open its information window.
  4. See the "Mass" entry on the Entity State page.

The new attribute, 'Mass' will appear under this tab.

Classes

configFomMapperThe routines that encode/decode the mass that is sent as part of the new state repository.
MyEntityStateRepThe extended entity state repository that contains the new mass variable.
MyIndividualLocalEntityNetInterfaceThis extension of the local net inferface takes the mass from the VRF entity state repository and puts it into the new MyEntityStateRep state repository.
MyIndividualRemoteEntityNetInterfaceThis extension of the remote net interface takes information read from the network and put into the new MyEntityStateRep and places it into the VRF entity state repository.

Plugin Entry Points

/*******************************************************************************
** Copyright (c) 2003 MAK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
/*******************************************************************************
** $RCSfile: plugin.cxx,v $ $Revision: 1.4 $ $State: Exp $
*******************************************************************************/
#include "myEsr.h"
#include "configFomMap.h"
#include "myIndRemNetIf.h"
#include "myIndLclNetIf.h"
//VR-Forces includes
#include "vrfcgf/cgf.h"
//VR-Link includes
#include <vrfExtObjects/vrfEntityPub.h>
#include <vl/exerciseConn.h>
#include <vrfExtObjects/reflExtEnt.h>
extern "C" {
{
info.pluginName = "addAttrSim";
info.pluginDescription = "This is an example of how to add an attribute to the entity repository and publish it on the network. Note that only one plugin can add an attribute.";
info.pluginVersion = "1.00";
info.pluginCreator = "MAK Technologies";
info.pluginCreatorEmail = "sales@mak.com";
info.pluginContactWebPage = "www.mak.com";
info.pluginContactMailingAddress = "150 Cambridge Park Drive 3rd Floor - Cambridge, MA 02140 USA";
info.pluginContactPhone = "(617) 876 8085";
}
DT_VRF_DLL_PLUGIN bool DtInitializeVrfPlugin(DtCgf* cgf)
{
//Call configFomMapper to register functions to handle the new attribute
//and parameter.
configFomMapper(cgf->exerciseConn()->fomMapper());
return true;
}
//Need to set the creator here so it does not get overwritten by the default creators at VRF level
DT_VRF_DLL_PLUGIN bool DtPostInitializeVrfPlugin(DtCgf* cgf)
{
//Tell reflected entity and entity publisher that they should create
//instances of MyEntityStateRep rather than the base
//DtEntityStateRepository to store state of objects.
DtReflectedEntity::setStateRepCreator((DtReflectedEntity::DtStateRepCreator)MyEntityStateRep::create);
DtEntityPublisher::setStateRepCreator((DtEntityPublisher::DtStateRepCreator)MyEntityStateRep::create);
return true;
}
}

Document ID: Generated on Sun Nov 24 19:49:21 EST 2013 from SVN revision 133924
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)