![]() |
VR-Link API Documentation for HLA 1516
|
Instances of DtHlaObject are used to represent HLA objects which are communicated across the network. More...
Inheritance diagram for DtHlaObject:
Collaboration diagram for DtHlaObject:Public Member Functions | |
| DtHlaObject (DtExerciseConn *conn, RTI::ObjectInstanceHandle id, const char *name, DtObjClassDesc &classDesc, bool reflecting=false) | |
| Constructor - used to construct a DtHlaObject to represent an object that we discover through an RTI callback. | |
| DtHlaObject (DtExerciseConn *conn, const char *name, DtObjClassDesc &classDesc, bool reflecting=false) | |
| Constructor - used to construct a DtHlaObject to represent an object that will be registered locally. | |
| virtual | ~DtHlaObject () |
| Destructor. | |
| virtual const RTI::ObjectInstanceHandle & | objectId () const |
| Get the object's handle. | |
| virtual const RTI::AttributeHandleSet & | attrHandleSet () |
| Get the set of attributes associated with this object's FOM class. | |
| virtual const RTI::AttributeHandleSet & | requestedAttributes () |
| Returns the union of all sets of attributes requested since the last call to clearRequestedAttributes. | |
| virtual RTI::ObjectClassHandle | objectClassHandle () const |
| Get the object's class handle. | |
| virtual const char * | name () const |
| Get the object's name. | |
| int | numAttributes () const |
| Get the number of attributes associated with this object's FOM class. | |
| virtual DtExerciseConn * | exerciseConn () const |
| Get the exercise connection for this object. | |
| virtual DtObjClassDesc & | classDesc () const |
| Get the class descriptor for the object's class. | |
| virtual void | setupUpdating () |
| Local Object specific functions. | |
| virtual void | update () |
| Generate and send any necessary attribute updates through the RTI. | |
| virtual void | generateUpdate (const RTI::AttributeHandleSet &eligibileAttrs, const RTI::AttributeHandleSet &requiredAttrs, DtStateMsg *msg) |
| Called by update to actually generate an outgoing message. | |
| virtual void | cleanupFromUpdating () |
| Do the deinitialization required to stop updating attributes of this object. | |
| virtual void | processProvideUpdate (const RTI::AttributeHandleSet &set) |
| Set yourself up so that on the next tick, you send an update for the appropriate attributes. | |
| virtual void | clearRequestedAttributes () |
| Clears the set of requested attributes. | |
| virtual const RTI::AttributeHandleSet & | ownedAttributes () |
| Returns the set of attributes of this object that are owned by the local federate. | |
| virtual void | forceUpdate () |
| Specify a set of attributes that should be included in the ahvps the next time update is called, even if they would not otherwise need to be sent. | |
| virtual void | forceUpdate (const RTI::AttributeHandleSet &set) |
| virtual void | clearForcedAttributes () |
| Clear (empty) the set of forced attributes. | |
| virtual const RTI::AttributeHandleSet & | attributesNeededByFederation () |
| Returns the set of attributes that are currently needed by the federation, i.e. | |
| virtual const RTI::AttributeHandleSet & | eligibleAttributes () |
| Returns the set of attributes that eligible for sending. | |
| virtual const RTI::AttributeHandleSet & | requiredAttributes () |
| Returns the set of attributes that should be included in the next update regardless of whether their update conditions have been met. | |
| bool | classNeededByFederation () |
| Returns true if the class is needed by the federation, i.e. | |
| void | setupClassForUpdating () |
| If the class has never been published, publish it with all attributes using DtObjClassDesc::publish. | |
| virtual void | setupReflecting () |
| Remote Object specific functions. | |
| virtual void | callReflect (const DtStateMsg &msg) |
| Calls reflect, and any postReflect callbacks. | |
| virtual void | callReflectLocal (const DtStateMsg &msg) |
| Calls reflectLocal, and any postReflect callbacks. | |
| virtual void | reflectLocal (const DtStateMsg &msg)=0 |
| Called by callReflectLocal to handle the reflection of updates that we are sending locally. | |
| virtual void | cleanupFromReflecting () |
| Do the deinitialization required to stop handling reflection of object. | |
| virtual void | requestUpdate (RTI::AttributeHandleSet *attrs=0) |
| Request an update for the object for the set of attributes indicated by attrs (or all subscribed attributes if attrs is NULL). | |
| virtual void | addRemoveObjectCb (DtRemoveObjectCb cb, void *usr) |
| Add (register) function to be called when object is about to be removed. | |
| virtual void | removeRemoveObjectCb (DtRemoveObjectCb cb, void *usr) |
| Remove (deregister) function to be called when object is about to be removed. | |
| virtual void | addPostReflectCb (DtObjectReflectAttributeValuesCb cb, void *usr) |
| Add (register) function to be called after each reflectAttrValues. | |
| virtual void | removePostReflectCb (DtObjectReflectAttributeValuesCb cb, void *usr) |
| Remove (deregister) function to be called after each reflectAttrValues. | |
| virtual void | processRemoveObject () |
| Process notification of removal of the object from the network. | |
| virtual DtOwnershipHandler * | setOwnershipHandler (DtOwnershipHandler *handler) |
| Ownership-Management-related functions. | |
| virtual void | unconditionalDivest (const RTI::AttributeHandleSet &attrs) |
| Unconditionally divest ownership of attrs. | |
| virtual void | negotiatedDivest (const RTI::AttributeHandleSet &attrs) |
| Try to divest ownership of attrs. | |
| virtual void | cancelNegotiatedDivest (const RTI::AttributeHandleSet &attrs) |
| Cancel a negotiated divestiture of attributes. | |
| virtual void | acquireAttributes (const RTI::AttributeHandleSet &attrs, bool ifAvailable=false) |
| Attempt to acquire ownership of attributes. | |
| virtual void | cancelAcquireAttributes (const RTI::AttributeHandleSet &attrs) |
| Cancel the request to acquire ownership of attrs. | |
| virtual DtTime | lastSimTimeUpdateReceived () const |
| Returns the value of VR-Link simulation time at the time the last attribute update was received for this object. | |
| virtual DtTime | lastReceivedTimeStamp () const |
| virtual void | printMsg (const DtStateMsg &msg, bool fullReport=false) const |
| Prints contents of a state msg. | |
| virtual void | localSubscriptionChanged () |
| Called when local object class subscriptions change. | |
| virtual void | publicationChanged () |
| Called when there is a change in the publication status of this object's object class. | |
| virtual const std::set < DtDDMRegion > & | lastRegionInformation () const |
| Obtain the region handle set of the last update. | |
| virtual void | processRequestAssumption (const RTI::AttributeHandleSet &attrs, const RTI::VariableLengthData &tag) |
| Process RTI's requestAttributeOwnershipAssumption service. | |
| virtual void | processRequestRelease (const RTI::AttributeHandleSet &attrs, const RTI::VariableLengthData &tag) |
| Process RTI's requestAttributeOwnershipRelease service. | |
| virtual void | processAttributeAcquisition (const RTI::AttributeHandleSet &attrs) |
| Handle an invocation of the attributeOwnershipAcquisitionNotification service. | |
| virtual void | processAttributeDivestiture (const RTI::AttributeHandleSet &attrs) |
| Handle an invocation of the attributeOwnershipDivestitureNotification service. | |
| virtual void | processConfirmAcquisitionCancellation (const RTI::AttributeHandleSet &attrs) |
| Process RTI's conformAttributeOwnershipAcquisitionCancellation service. | |
Static Public Member Functions | |
| static void | ownerAcquisitionIfAvailableCb (void *usr) |
| The following four static fns are for use within ownership msg callbacks. | |
| static void | ownerAcquisitionCb (void *usr) |
| static void | negotiatedDivestitureCb (void *usr) |
| static void | unconditionalDivestitureCb (void *usr) |
Protected Member Functions | |
| DtHlaObject () | |
| Default constructor: not implemented; do not call. | |
| DtHlaObject (const DtHlaObject &src) | |
| Copy constructor: not implemented; do not call. | |
| DtHlaObject & | operator= (const DtHlaObject &src) |
| Assignment operator: not implemented; do not call. | |
| virtual void | setLastSimTimeUpdateReceived (DtTime tm) |
| Set the time an update was last received or sent. | |
| virtual void | setLastReceivedTimeStamp (DtTime tm) |
| virtual void | reflect (const DtStateMsg &msg)=0 |
| Handle reflection of object (receipt of state message) from the network. | |
| void | wipeRemoveList () |
| Remove all callbacks from the remove callback list. | |
| virtual void | clearRemoveList () |
| Virtual version of above. | |
| void | wipeReflectList () |
| Remove all callbacks from the reflect callback list. | |
| virtual void | applyPostReflectCallbacks (const DtStateMsg &msg) |
| Apply callbacks after a state msg is reflected. | |
| virtual void | loseOwnership (const RTI::AttributeHandleSet &attrs) |
| Gets called whenever we lose ownership of a set of attributes. | |
| virtual void | gainOwnership (const RTI::AttributeHandleSet &attrs) |
| Gets called whenever we gain ownership of a set of attributes. | |
| virtual void | processUpdatesOff (const RTI::AttributeHandleSet &set) |
| Callback for handling turnUpdatesOffForObjectInstance RTI call. | |
| void | processUpdatesOn (const RTI::AttributeHandleSet &set) |
| Callback for handling turnUpdatesOnForObjectInstance RTI call. | |
| void | dumpRtiException (const char *functionName, const RTI::Exception *exc) const |
| Returns true if the object has been registered with, or discovered via the RTI. | |
| virtual void | computeEligible () |
| Recomputes the set of attrs that are eligible for sending. | |
| virtual void | justRegistered () |
| Called by DtHlaObjectManager right after a DtHlaObject is created, if it was created to represent a newly registered object. | |
| virtual void | setRegionInformation (const std::set< DtDDMRegion > ®ions) |
| Set the Region set that the last update was sent with. | |
Static Protected Member Functions | |
| static void | reflectAttributeValuesCb (const DtStateMsg &stateMsg, void *hlaObj) |
| Callback for handling state messages for the HLA object. | |
| static void | updatesOnCb (RTI::ObjectInstanceHandle handle, const RTI::AttributeHandleSet &attributeSet, void *usr) |
| Callback for handling turnUpdatesOnForObjectInstance RTI call. | |
| static void | updatesOffCb (RTI::ObjectInstanceHandle handle, const RTI::AttributeHandleSet &attributeSet, void *usr) |
| Callback for handling turnUpdatesOffForObjectInstance RTI call. | |
Protected Attributes | |
| char * | myName |
| DtExerciseConn * | myExConn |
| bool | myReflecting |
| bool | myUpdating |
| DtList | myRemoveCbList |
| DtList | myReflectCbList |
| DtListItem * | myRemoveCbListNextPtr |
| DtListItem * | myReflectCbListNextPtr |
| DtTime | myLastSimTimeUpdateReceived |
| DtTime | myLastReceivedTimeStamp |
| DtObjClassDesc & | myClassDesc |
| std::set< DtDDMRegion > | myLastRegionInformation |
| Contains the region information of the last update that contained it. | |
| RTI::ObjectInstanceHandle | myObjectId |
| RTI::AttributeHandleSet * | myEligibleAttrs |
| Attributes that are eligible to be sent from within update() - passed to generateUpdate. | |
| RTI::AttributeHandleSet * | myNeededAttrs |
| Set of owned attributes for which we have received a turnUpdatesOn more recently than a turnUpdatesOff. | |
| RTI::AttributeHandleSet * | myOwnedAttributes |
| Set of attributes owned by the local federate. | |
| RTI::AttributeHandleSet * | myRequestedAttributes |
| Requested by other federates. | |
| RTI::AttributeHandleSet * | myForcedAttributes |
| Requested by a call to setForcedUpdate. | |
| RTI::AttributeHandleSet * | myRequiredAttributes |
| Union of forced and requested - not computed until needed. | |
| DtOwnershipHandler * | myOwnershipHandler |
Friends | |
| class | DtHlaObjectManager |
Instances of DtHlaObject are used to represent HLA objects which are communicated across the network.
There should be one DtHlaObject instance for each "known" object in the federation execution. To enforce this restriction, only the DtHlaObjectManager can create DtHlaObjects. DtHlaObject keeps track of which attributes are locally owned. It also defines the interface for the virtual functions reflect, and generateUpdate which are using when receiving or sending updates through the RTI respectively. DtHlaObject is used by DtObjectPublisher and DtReflectedObject, so many applications will not need to deal directly with DtHlaObjects.
| DtHlaObject::DtHlaObject | ( | DtExerciseConn * | conn, |
| RTI::ObjectInstanceHandle | id, | ||
| const char * | name, | ||
| DtObjClassDesc & | classDesc, | ||
| bool | reflecting = false |
||
| ) |
Constructor - used to construct a DtHlaObject to represent an object that we discover through an RTI callback.
The RTI provides us with the handle, name and class. Object is not ready to use until setupReflecting is called.
| DtHlaObject::DtHlaObject | ( | DtExerciseConn * | conn, |
| const char * | name, | ||
| DtObjClassDesc & | classDesc, | ||
| bool | reflecting = false |
||
| ) |
Constructor - used to construct a DtHlaObject to represent an object that will be registered locally.
We provide a name and class, and the RTI chooses a handle after the register call. Object is not ready to use until setupUpdating is called.
|
virtual |
Destructor.
Make sure to call cleanupFromUpdating and/or cleanupFromReflecting before deleting the object.
|
protected |
Default constructor: not implemented; do not call.
|
protected |
Copy constructor: not implemented; do not call.
|
virtual |
Attempt to acquire ownership of attributes.
If ifAvailable is true, use the RTI's "IfAvailable" version of attributeOwnershipAcquisition. You have not actually gained ownership of the attributes until you receive an attributeOwnershipAcquisitionNotification callback from the RTI. Caller needs to handle RTI-generated exceptions.
|
virtual |
Add (register) function to be called after each reflectAttrValues.
|
virtual |
Add (register) function to be called when object is about to be removed.
|
protectedvirtual |
Apply callbacks after a state msg is reflected.
|
inlinevirtual |
Get the set of attributes associated with this object's FOM class.
References DtObjClassDesc::attrHandleSet(), and myClassDesc.
|
virtual |
Returns the set of attributes that are currently needed by the federation, i.e.
those that have been specified in startUpdates calls more recently than in stopUpdates calls. This set may contain attributes that are not locally owned.
|
virtual |
Calls reflect, and any postReflect callbacks.
Override reflect rather than this function to change the way an HLA object reflects a stateMsg. This function is called when we receive an update from the RTI.
|
virtual |
Calls reflectLocal, and any postReflect callbacks.
Override reflectLocal rather than this function to change the way an HLA object reflects a stateMsg that we generate locally. This function is called from within update() when the exercise connection's reflecting flag is set.
|
virtual |
Cancel the request to acquire ownership of attrs.
If the cancel goes through, you will receive a confirmAttributeOwnershipAcquisitionCancellation RTI callback. Caller must handle RTI-generated exceptions.
|
virtual |
Cancel a negotiated divestiture of attributes.
Caller needs to handle RTI-generated exceptions.
|
inlinevirtual |
Get the class descriptor for the object's class.
References myClassDesc.
| bool DtHlaObject::classNeededByFederation | ( | ) |
Returns true if the class is needed by the federation, i.e.
we've received a startRegistration or startUpdates service call from the RTI for the object's class.
|
virtual |
Do the deinitialization required to stop handling reflection of object.
Call before deleting a DtHlaObject.
|
virtual |
Do the deinitialization required to stop updating attributes of this object.
|
virtual |
Clear (empty) the set of forced attributes.
|
protectedvirtual |
Virtual version of above.
|
virtual |
Clears the set of requested attributes.
Should be called after request has been serviced.
|
protectedvirtual |
Recomputes the set of attrs that are eligible for sending.
Called any time we lose or gain ownership of attributes, when we get update on/off advisories, and when local subscription changes.
|
protected |
Returns true if the object has been registered with, or discovered via the RTI.
Should always return true once the DtHlaObject has been set up for receiving or updating. Print message to explain the RTI Exception. Both functionName and the exception can be Null.
|
virtual |
Returns the set of attributes that eligible for sending.
That is, the intersection of owned attributes and attributes needed by federation.
|
inlinevirtual |
Get the exercise connection for this object.
References myExConn.
|
virtual |
Specify a set of attributes that should be included in the ahvps the next time update is called, even if they would not otherwise need to be sent.
The call with no arguments, indicates the set of all of the object's published attributes. Multiple calls are cumulative, until the set is cleared with clearForcedAttributes, which should happen within update.
|
virtual |
|
protectedvirtual |
Gets called whenever we gain ownership of a set of attributes.
|
virtual |
Called by update to actually generate an outgoing message.
Derived class implementations should keep track of which attributes are updated when, should check update conditions, and add values to stateMsg for only those attributes that currently need to be sent. eligibleAttrs is the set of owned attributes to which remote federates have subscribed. requiredAttrs is the set of attributes that have been requested or forced by application code since the attribute was last sent. stateMsg is the message to fill out. Default implementation is null, but the function is not pure virtual since some subclasses might want to override update rather than overriding generateUpdate.
Reimplemented in DtHlaObjectWithStateRep.
|
protectedvirtual |
Called by DtHlaObjectManager right after a DtHlaObject is created, if it was created to represent a newly registered object.
Implementation gains ownership of all published attributes.
|
inlinevirtual |
References myLastReceivedTimeStamp.
|
virtual |
Obtain the region handle set of the last update.
|
inlinevirtual |
Returns the value of VR-Link simulation time at the time the last attribute update was received for this object.
References myLastSimTimeUpdateReceived.
|
virtual |
Called when local object class subscriptions change.
As a result, we update the set of eligible attributes to include remotely subscribed attributes, plus locally subscribed attributes.
|
protectedvirtual |
Gets called whenever we lose ownership of a set of attributes.
|
inlinevirtual |
Get the object's name.
References myName.
|
virtual |
Try to divest ownership of attrs.
Divesting is not complete (i.e. you still own the attributes) until you receive an attributeOwnershipDivestitureNotification callback from the RTI. Elements of attrs that are not currently owned are ignored. Caller needs to handle other RTI-generated exceptions.
|
static |
|
inline |
Get the number of attributes associated with this object's FOM class.
Non Virtual – called from Ctor
References myClassDesc, and DtObjClassDesc::numAttributes().
|
inlinevirtual |
Get the object's class handle.
References DtObjClassDesc::handle(), and myClassDesc.
|
inlinevirtual |
Get the object's handle.
|
protected |
Assignment operator: not implemented; do not call.
|
inlinevirtual |
Returns the set of attributes of this object that are owned by the local federate.
References myOwnedAttributes.
|
static |
|
static |
The following four static fns are for use within ownership msg callbacks.
|
virtual |
Prints contents of a state msg.
Base class prints only header info. If fullReport set to true, printMsg requests a full status print out for objects with a state repository.
Reimplemented in DtHlaObjectWithStateRep.
|
virtual |
Handle an invocation of the attributeOwnershipAcquisitionNotification service.
|
virtual |
Handle an invocation of the attributeOwnershipDivestitureNotification service.
|
virtual |
Process RTI's conformAttributeOwnershipAcquisitionCancellation service.
|
virtual |
Set yourself up so that on the next tick, you send an update for the appropriate attributes.
(Can't send them within this function since this is called from within an RTI service).
|
virtual |
Process notification of removal of the object from the network.
Call back all the remove object callbacks.
|
virtual |
Process RTI's requestAttributeOwnershipAssumption service.
|
virtual |
Process RTI's requestAttributeOwnershipRelease service.
|
protectedvirtual |
Callback for handling turnUpdatesOffForObjectInstance RTI call.
|
protected |
Callback for handling turnUpdatesOnForObjectInstance RTI call.
Non Virtual –called from CTOR
|
virtual |
Called when there is a change in the publication status of this object's object class.
|
protectedpure virtual |
Handle reflection of object (receipt of state message) from the network.
called by callReflect. Override this function rather than callReflect to change the way an HLA object reflects a stateMsg.
Implemented in DtHlaObjectWithStateRep, and DtUnknownHlaObject.
|
staticprotected |
Callback for handling state messages for the HLA object.
Casts hlaObj to DtHlaObject* and calls reflect().
|
pure virtual |
Called by callReflectLocal to handle the reflection of updates that we are sending locally.
Used when the exercise connection's reflecting flag is set.
Implemented in DtHlaObjectWithStateRep.
|
virtual |
Remove (deregister) function to be called after each reflectAttrValues.
|
virtual |
Remove (deregister) function to be called when object is about to be removed.
|
inlinevirtual |
Returns the union of all sets of attributes requested since the last call to clearRequestedAttributes.
References myRequestedAttributes.
|
virtual |
Request an update for the object for the set of attributes indicated by attrs (or all subscribed attributes if attrs is NULL).
|
virtual |
Returns the set of attributes that should be included in the next update regardless of whether their update conditions have been met.
|
inlineprotectedvirtual |
References myLastReceivedTimeStamp.
|
inlineprotectedvirtual |
Set the time an update was last received or sent.
References myLastSimTimeUpdateReceived.
|
virtual |
Ownership-Management-related functions.
Sets the current ownership handler to handler. A DtOwnershipHandler is an object that encapsulates callback function for a variety of ownership-management-related functions. Returns previous handler.
|
protectedvirtual |
Set the Region set that the last update was sent with.
| void DtHlaObject::setupClassForUpdating | ( | ) |
If the class has never been published, publish it with all attributes using DtObjClassDesc::publish.
Non Virtual – called from CTOR
|
virtual |
Remote Object specific functions.
Do the initialization required to handle reflection of object.
|
virtual |
Local Object specific functions.
Do the initialization required to begin updating attributes of this object. Calls registerObject() if the object has not yet been registered or discovered (that is, we are creating a new object).
|
virtual |
Unconditionally divest ownership of attrs.
Elements of attrs that are not currently owned are ignored. Caller needs to handle other RTI- generated exceptions.
|
static |
|
virtual |
Generate and send any necessary attribute updates through the RTI.
Called by publisher's tick function. Default implementation is to call the (logically) pure virtual generateUpdate, and then send the generated message.
Reimplemented in DtUnknownHlaObject.
|
staticprotected |
Callback for handling turnUpdatesOffForObjectInstance RTI call.
|
staticprotected |
Callback for handling turnUpdatesOnForObjectInstance RTI call.
|
protected |
Remove all callbacks from the reflect callback list.
Non-virtual since meant to be called from dtor.
|
protected |
Remove all callbacks from the remove callback list.
Non-virtual since meant to be called from dtor.
|
friend |
|
protected |
Referenced by attrHandleSet(), classDesc(), numAttributes(), and objectClassHandle().
|
protected |
Attributes that are eligible to be sent from within update() - passed to generateUpdate.
If we are reflecting local objects, then it's the union of needed attributes, locally subscribed attributes, and owned attributes. Otherwise, it's the union of owned attributes and needed attributes.
|
protected |
Referenced by exerciseConn().
|
protected |
Requested by a call to setForcedUpdate.
|
protected |
Referenced by lastReceivedTimeStamp(), and setLastReceivedTimeStamp().
|
protected |
Contains the region information of the last update that contained it.
|
protected |
Referenced by lastSimTimeUpdateReceived(), and setLastSimTimeUpdateReceived().
|
protected |
Referenced by name().
|
protected |
Set of owned attributes for which we have received a turnUpdatesOn more recently than a turnUpdatesOff.
|
protected |
|
protected |
Set of attributes owned by the local federate.
If we register the object, the owned set defaults to the published set.
Referenced by ownedAttributes().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Requested by other federates.
Referenced by requestedAttributes().
|
protected |
Union of forced and requested - not computed until needed.
|
protected |