VR-Forces 4.1.1 Class Documentation
Local Net Interface

The MyIndividualLocalEntityNetInterface class takes the mass from the DtVrfObjectStateRepository class and puts it into the new MyEntityStateRep for transmission over the network


Header file:

/*******************************************************************************
** Copyright (c) 2004 MAK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
/*******************************************************************************
** $RCSfile: myIndLclNetIf.h,v $ $Revision: 1.5 $ $State: Exp $
*******************************************************************************/
#ifndef MyIndividualLocalEntityNetInterface_H_
#define MyIndividualLocalEntityNetInterface_H_
{
public:
//read/writable contructor
DtReaderWriterRegistry * parentRegistry = 0,
bool publishObject = true);
//destructor
//Copies the mass from the VR-Forces state repository into the
//VR-Link state repository for publication.
virtual void updatePublisher();
//Overridden to completely replace the default VR-Forces interface.
//See the comment in the definition.
virtual DtString type() const;
//Creates a new MyIndividualLocalEntityNetInterface
DtReaderWriterRegistry * parentRegistry,
bool publishObject);
protected:
//default constructor; not implemented
//copy constructor; not implemented
DtReaderWriterRegistry * parentRegistry = 0);
//assignment operator; not implemented
};
#endif

Implementation:

/*******************************************************************************
** Copyright (c) 2004 MAK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
/*******************************************************************************
** $RCSfile: myIndLclNetIf.cxx,v $ $Revision: 1.6 $ $State: Exp $
*******************************************************************************/
#include "myIndLclNetIf.h"
#include "myEsr.h"
//read/writable contructor
DtVrfObject * simObject,
DtReaderWriterRegistry * parentRegistry,
bool publishObject) :
parentRegistry, publishObject)
{
}
//destructor
{
}
{
MyEntityStateRep* massState = dynamic_cast<MyEntityStateRep*>(netState);
if (!massState)
{
DtWarn("Cannot cast net state to MyEntityStateRep\n");
return;
}
if (!localState)
{
DtWarn("Cannot find DtVrfObjectStateRepository\n");
return;
}
//Copy the mass value to the network state from the vrf state.
//In this case, the vrf state already has a value which corresponds
//to the one added to the FOM. If extending the FOM with a value which
//doesn't already exist in the vrf state, a new subclass must be created.
//For an example of creating a new vrf state, see the "addEntity" example.
massState->setMass(localState->mass());
}
{
//Registering this VR-Forces default string (defined in vrfNetIfTypes.h)
//has the effect of changing the net interface for all OPE entries which
//use this string for their "net-interface" parameter.
}
const DtString & name, DtVrfObject * simObject,
DtReaderWriterRegistry * parentRegistry, bool publishObject)
{
return new MyIndividualLocalEntityNetInterface(name, simObject,
parentRegistry, publishObject);
}

Document ID: Generated on Mon Apr 8 19:24:01 EDT 2013 from SVN revision 125877
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)