VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Add Attribute (addAttrSim)

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 VrfExtend.fed, VrfExtend.xml, and VrfExtend_evolved.xml from examples to the bin directory.
  2. Since this example is loaded as a plugin, it can be used in conjunction with the released VR-Forces application

Usage

In the Launcher:

  1. Set the addAttribute plugin to load
  2. set Federation Name to "VrfExtend"
  3. Set the FED File Name to VrfExtend.fed if using HLA 1.3, VrfExtend.xml if using HLA 1516-2000, or VrfExtend_evolved.xml if using HLA Evolved
  4. Set the RPR FOM version to 1.0
  5. 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 State Data 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 <vl/exerciseConn.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 Mon Jul 4 01:00:18 EDT 2016 from SVN revision 166489
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)