VR-Forces 5.0.1 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions
DtVrfEntityPublisher Class Reference

This class will wrap a VR-Link DtEntityPublisher to allow for easier creation of a publisher that is compatible with VR-Forces. If you want to create and publish entity objects that can be used by VR-Forces, you can use a publisher of this class to facilitate in that creation.

The way in which entities are considered compliant with VR-Forces is via the publication of the DtIfVrfDataObject message. In addition to publishing the PDU for the entity, every n seconds (default 5), a DtIfVrfDataObject message will also be sent. You can change this by setting the heartbeat values for the data object. Note that a value of < 0 will mean to not send a heartbeat

Additional note: this class is also responsible for setting up extended DI-Guy encoders, which allow the contents of DI-Guy related packets to be controlled from VrfVrlExt, so that modifications don't need to be made to code in VR-Link.

Inheritance diagram for DtVrfEntityPublisher:
Inheritance graph
[legend]

Public Member Functions

 DtVrfEntityPublisher (const DtEntityType &type, DtExerciseConn *conn, const DtGlobalObjectDesignator &glId=DtGlobalObjectDesignator::nullId(), const DtEntityIdentifier &entId=DtEntityIdentifier::nullId(), DtRwProperties *stateProps=0, DtRwProperties *paramProps=0)
 
 DtVrfEntityPublisher (const DtEntityType &type, DtExerciseConn *conn, const DtGlobalObjectDesignator &glId=DtGlobalObjectDesignator::nullId(), const DtEntityIdentifier &entId=DtEntityIdentifier::nullId(), const DtRwProperties &stateProps=DtRwProperties::emptyProperties(), const DtRwProperties &paramProps=DtRwProperties::emptyProperties())
 
virtual ~DtVrfEntityPublisher ()
 
virtual void tick ()
 
virtual DtEntPublisherDecoderdecoder ()
 
virtual DtEntPublisherEncoderencoder ()
 
virtual void setPublishesDiGuyInfo (bool has)
 
virtual bool publishesDiGuyInfo ()
 
virtual void setSendDiGuyPdus (bool yesNo)
 
virtual bool sendDiGuyPdus () const
 
virtual void createAndSendDiGuyPdus ()
 
DtStateRepositorysr ()
 
const DtStringname () const
 
virtual const DtObjectId & id () const
 
virtual const DtObjectId & localId () const
 
virtual const
DtGlobalObjectDesignator & 
globalId () const
 
virtual void forceUpdate ()
 
virtual bool sendVrfObjectData ()
 
virtual DtEntityPublisher * entityPublisher ()
 
virtual void setSendVrfObjectDataRecord (bool shouldSend)
 
virtual void processDataInteraction (DtDataInteraction *i)
 
virtual
DtExtEntityStateRepository
entityProcessStateRep ()
 
virtual
DtExtEntityStateRepository
entityStateRep ()
 
virtual
DtExtEntityStateRepository
ensr ()
 

Static Public Member Functions

static void setInitializer (DtExtendedAttributesInitializerPtr init)
 
static
DtExtendedAttributesInitializerPtr 
initializer ()
 
static void setObjectClassChooser (DtObjectClassChooserPtr chooser)
 
static DtObjectClassChooserPtr objectClassChooser ()
 
static void setVrfDataTimeThreshold (DtTime time)
 
static DtTime vrfDataTimeThreshold ()
 

Protected Member Functions

 DtVrfEntityPublisher ()
 
void initialize (const DtEntityType &type, DtExerciseConn *conn, const DtGlobalObjectDesignator &glId, const DtEntityIdentifier &entId)
 
virtual bool sendVrfDataUpdate ()
 
virtual bool needsVrfObjectDataUpdate ()
 
virtual void processSendVrfObjectDataMessage (DtDataInteraction *interaction)
 
Methods for sending out the object update

Fill out the addressing and bookkeeping data, create interaction, and send (Calls set content and send below) Returns true if content could be set (and message sent); otherwise, false

virtual bool sendMessage (const DtSimulationAddress &receiver, DtSimInterfaceContent *message)
 
virtual bool setContentForNet (DtDataInteraction *dataInter, DtSimInterfaceContent *content) const
 
virtual void sendMessageInteraction (const DtSimulationAddress &receiver, DtDataInteraction &data)
 

Static Protected Member Functions

static void dataInteractionCallback (DtDataInteraction *i, void *usr)
 

Protected Attributes

DtEntityPublisher * myPublisher
 
DtTime myTimeLastVrfDataSend
 
bool myPublishesDIGuyInfo
 
makVrfVrlinkExtToolkit::DtExtendedAttributesObjectPublishermyExtAttrPublisher
 

Static Protected Attributes

static DtTime theVrfDataTimeThreshold
 
static bool myDiGuyEncodersSetup
 
static DtObjectClassChooserPtr theObjectClassChooser
 
static
DtExtendedAttributesInitializerPtr 
theInitializer
 

Private Member Functions

 DtVrfEntityPublisher (const DtVrfEntityPublisher &)
 
DtVrfEntityPublisheroperator= (const DtVrfEntityPublisher &)
 

Constructor & Destructor Documentation

DtVrfEntityPublisher::DtVrfEntityPublisher ( const DtEntityType &  type,
DtExerciseConn *  conn,
const DtGlobalObjectDesignator &  glId = DtGlobalObjectDesignator::nullId(),
const DtEntityIdentifier &  entId = DtEntityIdentifier::nullId(),
DtRwProperties stateProps = 0,
DtRwProperties paramProps = 0 
)

Create a new instance of the VRF entity publisher which will, in turn, create the VR-Link entity publisher, given a object id (DIS) or name (HLA). This class will use the default factory as supplied in the DtVrfObjectIdGenerator class.

The state repository will initially be set to the DtExtEntityStateRepository class. You can change it in the global DtVrfEntityPublisher class before calling this creator

If supplied, initializes the state repository to publish extended attributes from the supplied state properties.

DtVrfEntityPublisher::DtVrfEntityPublisher ( const DtEntityType &  type,
DtExerciseConn *  conn,
const DtGlobalObjectDesignator &  glId = DtGlobalObjectDesignator::nullId(),
const DtEntityIdentifier &  entId = DtEntityIdentifier::nullId(),
const DtRwProperties stateProps = DtRwProperties::emptyProperties(),
const DtRwProperties paramProps = DtRwProperties::emptyProperties() 
)

Create a new instance of the VRF entity publisher which will, in turn, create the VR-Link entity publisher, given a object id (DIS) or name (HLA). This class will use the default factory as supplied in the DtVrfObjectIdGenerator class.

The state repository will initially be set to the DtExtEntityStateRepository class. You can change it in the global DtVrfEntityPublisher class before calling this creator

If supplied, initializes the state repository with the provided state properties.

virtual DtVrfEntityPublisher::~DtVrfEntityPublisher ( )
virtual

Destructor. Also destroys publisher.

DtVrfEntityPublisher::DtVrfEntityPublisher ( const DtVrfEntityPublisher )
private

Unimplemented.

DtVrfEntityPublisher::DtVrfEntityPublisher ( )
protected

Alternate constructor that performs no initialization. Can be used in subclasses to override how initialization is performed. If this constructor is used, the initialize function (or a equivalent replacement) must be called before this class will publish anything.

Member Function Documentation

virtual void DtVrfEntityPublisher::tick ( )
virtual

Class method taken from publisher class for entities at VR-Link level. This will simply call down to the publisher's tick method. This function should be called once per frame for each entity object. It determines if any data needs to be sent to the other exercise participants, and sends that data.

virtual DtExtEntityStateRepository* DtVrfEntityPublisher::entityProcessStateRep ( )
virtual

Returns a pointer to the DtExtEntityStateRepository - through which you can set or inspect current state information.

virtual DtExtEntityStateRepository* DtVrfEntityPublisher::entityStateRep ( )
virtual

Returns a pointer to the DtExtEntityStateRepository - through which you can set or inspect current state information.

virtual DtExtEntityStateRepository* DtVrfEntityPublisher::ensr ( )
virtual

Returns a pointer to the DtExtEntityStateRepository - through which you can set or inspect current state information.

virtual DtEntPublisherDecoder* DtVrfEntityPublisher::decoder ( )
virtual

Returns a pointer to the Decoder being used to decode PDUs/updates that we send back into the asSeenByRemote state rep.

virtual DtEntPublisherEncoder* DtVrfEntityPublisher::encoder ( )
virtual

Returns a pointer to the Encoder being used to encode current state into a PDU/update.

virtual void DtVrfEntityPublisher::setPublishesDiGuyInfo ( bool  has)
virtual

Indicates that DI-Guy data should be published.

virtual bool DtVrfEntityPublisher::publishesDiGuyInfo ( )
virtual

Whether or not DI-Guy data will be published.

virtual void DtVrfEntityPublisher::setSendDiGuyPdus ( bool  yesNo)
virtual

Tell the publisher to send DI Guy Attributes in Attribute PDU for DIS 7. DIS 6 and lower will send custom DI Guy PDUS.

virtual bool DtVrfEntityPublisher::sendDiGuyPdus ( ) const
virtual

Determine whether this publisher will send DI Guy Attributes in Attribute PDU for DIS 7. DIS 6 and lower returns wheter the publisher will send DI Guy PDUs.

virtual void DtVrfEntityPublisher::createAndSendDiGuyPdus ( )
virtual

Override this to have your own custom marshalling of DI-Guy PDUs.

DtStateRepository* DtVrfEntityPublisher::sr ( )
inline

VRL support for common functions.

const DtString& DtVrfEntityPublisher::name ( void  ) const
inline
virtual const DtObjectId& DtVrfEntityPublisher::id ( ) const
virtual

Get the entity's identifier.

virtual const DtObjectId& DtVrfEntityPublisher::localId ( ) const
virtual

Get the entity's localId - same as id for DIS.

virtual const DtGlobalObjectDesignator& DtVrfEntityPublisher::globalId ( ) const
virtual

Get the global object designator - same as id for DIS.

virtual void DtVrfEntityPublisher::forceUpdate ( )
virtual

Force a state update to be sent during the next call to tick, even if nothing would normally cause a send.

virtual bool DtVrfEntityPublisher::sendVrfObjectData ( )
virtual

Sends vrf object data update from the ensr() to the network.

virtual DtEntityPublisher* DtVrfEntityPublisher::entityPublisher ( )
virtual

Returns a pointer to myPublisher (the VR-Link DtEntityPublisher)

virtual void DtVrfEntityPublisher::setSendVrfObjectDataRecord ( bool  shouldSend)
virtual

Sets whether a separate VrfObjectData message should be sent to convey additional VRF object information.

static void DtVrfEntityPublisher::setInitializer ( DtExtendedAttributesInitializerPtr  init)
static

Sets the extended attributes initializer used by all publishers of this type.

static DtExtendedAttributesInitializerPtr DtVrfEntityPublisher::initializer ( )
static

Returns the extended attributes initializer used by all publishers of this type.

static void DtVrfEntityPublisher::setObjectClassChooser ( DtObjectClassChooserPtr  chooser)
static

Sets the object class chooser used by all publishers of this type.

static DtObjectClassChooserPtr DtVrfEntityPublisher::objectClassChooser ( )
static

Returns the object class chooser used by all publishers of this type.

static void DtVrfEntityPublisher::setVrfDataTimeThreshold ( DtTime  time)
static

Sets the time to update the vrf data message. The message will be sent on this time (default is five seconds) or if the data as seen by remote is different that the current time. If time is set to be -1, it will only be sent if the data is different.

static DtTime DtVrfEntityPublisher::vrfDataTimeThreshold ( )
static

Sets the time to update the vrf data message. The message will be sent on this time (default is five seconds) or if the data as seen by remote is different that the current time. If time is set to be -1, it will only be sent if the data is different.

DtVrfEntityPublisher& DtVrfEntityPublisher::operator= ( const DtVrfEntityPublisher )
private

Unimplemented.

void DtVrfEntityPublisher::initialize ( const DtEntityType &  type,
DtExerciseConn *  conn,
const DtGlobalObjectDesignator &  glId,
const DtEntityIdentifier &  entId 
)
protected

Called by the constructor to initialize the publisher.

virtual bool DtVrfEntityPublisher::sendVrfDataUpdate ( )
protectedvirtual

Sends out a vrf data update message if needed.

virtual bool DtVrfEntityPublisher::needsVrfObjectDataUpdate ( )
protectedvirtual

Return true if the vrf object data message needs to be updated from a heartbeat or if the object data has changed. If it does, then the heartbeat time for the next update will also be updated.

virtual bool DtVrfEntityPublisher::sendMessage ( const DtSimulationAddress &  receiver,
DtSimInterfaceContent message 
)
protectedvirtual

Fill out the payload data.

virtual bool DtVrfEntityPublisher::setContentForNet ( DtDataInteraction *  dataInter,
DtSimInterfaceContent content 
) const
protectedvirtual

Fill out the payload data.

virtual void DtVrfEntityPublisher::sendMessageInteraction ( const DtSimulationAddress &  receiver,
DtDataInteraction &  data 
)
protectedvirtual

Send the message interaction.

static void DtVrfEntityPublisher::dataInteractionCallback ( DtDataInteraction *  i,
void *  usr 
)
staticprotected

Used internally to see if a request is made of this object to send a VRF object update.

virtual void DtVrfEntityPublisher::processSendVrfObjectDataMessage ( DtDataInteraction *  interaction)
protectedvirtual

Send message if interaction is requesting the entity id we are publishing.

virtual void DtVrfEntityPublisher::processDataInteraction ( DtDataInteraction *  i)
virtual

Used internally. Should not be directly called.

Member Data Documentation

DtEntityPublisher* DtVrfEntityPublisher::myPublisher
protected
DtTime DtVrfEntityPublisher::myTimeLastVrfDataSend
protected
DtTime DtVrfEntityPublisher::theVrfDataTimeThreshold
staticprotected
bool DtVrfEntityPublisher::myPublishesDIGuyInfo
protected
bool DtVrfEntityPublisher::myDiGuyEncodersSetup
staticprotected
makVrfVrlinkExtToolkit::DtExtendedAttributesObjectPublisher* DtVrfEntityPublisher::myExtAttrPublisher
protected
DtObjectClassChooserPtr DtVrfEntityPublisher::theObjectClassChooser
staticprotected
DtExtendedAttributesInitializerPtr DtVrfEntityPublisher::theInitializer
staticprotected

The documentation for this class was generated from the following file:

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)