VR-Link API Documentation for HLA 1516
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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
DtHlaObjectManager Class Reference

class DtHlaObjectManager: More...

+ Collaboration diagram for DtHlaObjectManager:

Public Member Functions

 DtHlaObjectManager (DtHlaObjectFactory *factory, DtExerciseConn *conn)
 Constructor.
virtual ~DtHlaObjectManager ()
 Destructor.
virtual const DtHlaObjectMapallHlaObjects () const
 Get the list of all HLA objects known to the federate.
virtual const DtHlaObjectMapregisteredObjects () const
 Get the list of all HLA objects registered by the federate.
virtual const DtHlaObjectMapdiscoveredObjects () const
 Get the list of all HLA objects discovered by the federate.
virtual DtHlaObjecthlaObject (RTI::ObjectInstanceHandle id)
 Get the HLA object based on its identifier.
virtual DtHlaObjecthlaObject (const char *name) const
 Get the HLA object based on its name.
virtual void addDiscoverObjectCallback (RTI::ObjectClassHandle handle, DtDiscoverObjectCb cb, void *usr)
 Add/remove a callback to be called when an object which meets the federate's subscription criteria is discovered.
virtual void removeDiscoverObjectCallback (RTI::ObjectClassHandle handle, DtDiscoverObjectCb cb, void *usr)
virtual void addRemoveObjectCallback (RTI::ObjectInstanceHandle id, DtRemoveObjectCb cb, void *usr)
 Add/remove a callback to be called when an object has been removed from the federation or no longer meets the interest criteria of the federate.
virtual void removeRemoveObjectCallback (RTI::ObjectInstanceHandle id, DtRemoveObjectCb cb, void *usr)
virtual const DtHlaObjectprocessDiscoverObject (RTI::ObjectInstanceHandle id, RTI::ObjectClassHandle handle, const std::wstring &name)
 Process the discovery of an object.
virtual const DtHlaObjectprocessDiscoverObject (DtHlaObject *hlaObj)
 Same as above, but takes an existing DtHlaObject.
virtual const DtHlaObjectprocessDiscoverObjectAsClass (DtHlaObject *hlaObj, RTI::ObjectClassHandle classHandle)
 Same as above, but takes an existing DtHlaObject.
virtual void processRemoveObject (RTI::ObjectInstanceHandle id)
 Process the removal of an object.
virtual void processRemoveObject (DtHlaObject *obj)
 Same as above, but takes an existing DtHlaObject.
virtual void processReflectAttributeValues (const DtStateMsg &msg)
 Process an update message.
virtual void processProvideUpdate (RTI::ObjectInstanceHandle id, const RTI::AttributeHandleSet &theAttributes)
 Process RTI's provideUpdate service.
virtual void processLocalUpdateRequest (RTI::ObjectClassHandle hand, const RTI::AttributeHandleSet &set)
 When we are reflecting local data, this function is called to let the object manager know that we have locally requested updates for a class/set of attributes.
virtual void localSubscriptionChanged (RTI::ObjectClassHandle handle)
 Called when the local subscription information changes.
virtual void publicationChanged (RTI::ObjectClassHandle handle)
 Called when the local publication information changes.
virtual void processAttributeAcquisition (RTI::ObjectInstanceHandle id, const RTI::AttributeHandleSet &attrs)
 Process RTI's attributeOwnershipAcquisitionNotification service.
virtual void processAttributeDivestiture (RTI::ObjectInstanceHandle id, const RTI::AttributeHandleSet &attrs)
 Process RTI's attributeOwnershipDivestitureNotification service.
virtual void processRequestAssumption (RTI::ObjectInstanceHandle id, const RTI::AttributeHandleSet &attrs, const RTI::VariableLengthData &tag)
 Process RTI's requestAttributeOwnershipAssumption service.
virtual void processRequestRelease (RTI::ObjectInstanceHandle id, const RTI::AttributeHandleSet &attrs, const RTI::VariableLengthData &tag)
 Process RTI's requestAttributeOwnershipRelease service.
virtual void processConfirmAcquisitionCancellation (RTI::ObjectInstanceHandle id, const RTI::AttributeHandleSet &attrs)
 Process RTI's conformAttributeOwnershipAcquisitionCancellation service.
virtual DtHlaObjectregisterHlaObject (RTI::ObjectClassHandle classHand, const char *name, const DtDDMRegionSet *regionSet=0)
 Use this function instead of the RTI's version to create a new HLA object.
virtual void registerHlaObjectWithRegion (RTI::ObjectClassHandle classHand, const char *name, const DtDDMRegionSet &regionSet, RTI::ObjectInstanceHandle &id)
virtual void deleteHlaObject (RTI::ObjectInstanceHandle objHand)
 Use this function instead of the RTI's version to delete an HLA object.
virtual bool reserveName (const std::wstring &theName, bool pushRti)
 By calling setRegionsForRegister, you are telling VR-Link that until you call setRegionsForRegister again (or call setNoRegionsForRegister), VR-Link should use the DDM version of registerObjectInstance whenever it registers an object for you.
virtual bool isNameReserved (const std::wstring &theName) const
 returns true if theName has been reserved.
virtual void removeAllObjects ()
 Called by destructor to remove and delete all DtHlaObjects.

Static Public Member Functions

static double requestNameTickMinTime ()
 Sets/Gets the time in seconds to call evoke callbacks for each try after a name reservation request.
static void setRequestNameTickMinTime (double time)
static double requestNameTickMaxTime ()
static void setRequestNameTickMaxTime (double time)
static int numberOfRequestNameTries ()
 Set/Get the number of times to tick the RTI after a name reservation request.
static void setNumberOfRequestNameTries (int tries)

Protected Member Functions

 DtHlaObjectManager (const DtHlaObjectManager &orig)
 Note: The copy constructor and assignment operator are protected because there should only be one object manager per exercise connection.
DtHlaObjectManageroperator= (const DtHlaObjectManager &orig)
 assignment operator – Not Implemented
virtual void objectProcessRemoveObject (DtHlaObject *hlaObj)
 Call DtHlaObject::processRemoveObject().
virtual void objectProcessReflect (DtHlaObject *hlaObj, const DtStateMsg &msg)
 Call DtHlaObject::callReflect().
virtual DtHlaObjectaddKnownObject (RTI::ObjectInstanceHandle id, RTI::ObjectClassHandle hand, const std::wstring &name, bool reflecting)
 Call whenever a new object has been registered or discovered.
virtual void removeKnownObject (DtHlaObject *hlaObj)
 Call whenever an object is to be deleted, either by delete, or remove.
virtual DtListdiscoverCbList (RTI::ObjectClassHandle handle)
 Returns the list of discover callbacks registered for a particular object class.
virtual void reservedNameSuceeded (const std::wstring &theName)
 Adds a new name to the reserved object Name list.
virtual void reservedNameFailed (const std::wstring &theName)
 Called when a name request Failed.

Static Protected Member Functions

static void nameReservationSuceededCb (const std::wstring &theName, void *theUserData)
 Called by the FederateAmbassador anytime a name reservation succeeds or fails.
static void nameReservationFailedCb (const std::wstring &theName, void *theUserData)

Protected Attributes

DtHashlist myDiscoverCbLists
 DtHashlist that maps object class handles (DtIntHashKeys) to pointers to DtLists of callback functions.
DtHlaObjectFactorymyFactory
DtHlaObjectMap myObjectList
 List of all known DtHlaObjects (by id).
DtHashlist myObjectListByName
 List of all known DtHlaObjects (by String).
DtHlaObjectMap myRegObjectList
 List of all DtHlaObjects that we've registered locally.
DtHlaObjectMap myDiscObjectList
 List of all DtHlaObjects that we've discovered, possibly including local objects that we are also reflecting.
DtExerciseConnmyExConn
std::set< std::wstring > myReservedObjectInstanceNameSet
 A Set of all known successfully reserved object names.
bool myPendingNameReservationPassedFlag
 booleans set to true if the pending reserved name passes, or fails respectively.
bool myPendingNameReservationFailedFlag
int myReportedNameReservationCount
std::wstring myPendingNameReservationName
std::set< std::wstring > myPendingNameReservationNameSet
int myNumAttrsForDDMRegister

Static Protected Attributes

static double theRequestNameTickMinTime
static double theRequestNameTickMaxTime
static int theNumberOfRequestNameTries

Detailed Description

class DtHlaObjectManager:

Instances of DtHlaObjectManager are used to manage the set of HLA objects known to the federate.

Constructor & Destructor Documentation

DtHlaObjectManager::DtHlaObjectManager ( DtHlaObjectFactory factory,
DtExerciseConn conn 
)

Constructor.

virtual DtHlaObjectManager::~DtHlaObjectManager ( )
virtual

Destructor.

DtHlaObjectManager::DtHlaObjectManager ( const DtHlaObjectManager orig)
protected

Note: The copy constructor and assignment operator are protected because there should only be one object manager per exercise connection.

These should not be called. copy constructor – Not Implemented

Member Function Documentation

virtual void DtHlaObjectManager::addDiscoverObjectCallback ( RTI::ObjectClassHandle  handle,
DtDiscoverObjectCb  cb,
void *  usr 
)
virtual

Add/remove a callback to be called when an object which meets the federate's subscription criteria is discovered.

virtual DtHlaObject* DtHlaObjectManager::addKnownObject ( RTI::ObjectInstanceHandle  id,
RTI::ObjectClassHandle  hand,
const std::wstring &  name,
bool  reflecting 
)
protectedvirtual

Call whenever a new object has been registered or discovered.

It creates a DtHlaObject, adds it to the set of managed objects, and returns it.

virtual void DtHlaObjectManager::addRemoveObjectCallback ( RTI::ObjectInstanceHandle  id,
DtRemoveObjectCb  cb,
void *  usr 
)
virtual

Add/remove a callback to be called when an object has been removed from the federation or no longer meets the interest criteria of the federate.

const DtHlaObjectMap & DtHlaObjectManager::allHlaObjects ( ) const
inlinevirtual

Get the list of all HLA objects known to the federate.

References myObjectList.

virtual void DtHlaObjectManager::deleteHlaObject ( RTI::ObjectInstanceHandle  objHand)
virtual

Use this function instead of the RTI's version to delete an HLA object.

This function calls RTI's deleteObjectInstance. You should have ownership of the priviledgeToDelete for this object before calling.

virtual DtList* DtHlaObjectManager::discoverCbList ( RTI::ObjectClassHandle  handle)
protectedvirtual

Returns the list of discover callbacks registered for a particular object class.

const std::map< DtObjectId, DtHlaObject * > & DtHlaObjectManager::discoveredObjects ( ) const
inlinevirtual

Get the list of all HLA objects discovered by the federate.

References myDiscObjectList.

virtual DtHlaObject* DtHlaObjectManager::hlaObject ( RTI::ObjectInstanceHandle  id)
virtual

Get the HLA object based on its identifier.

virtual DtHlaObject* DtHlaObjectManager::hlaObject ( const char *  name) const
virtual

Get the HLA object based on its name.

virtual bool DtHlaObjectManager::isNameReserved ( const std::wstring &  theName) const
virtual

returns true if theName has been reserved.

There is no promise that the name is not already used.

virtual void DtHlaObjectManager::localSubscriptionChanged ( RTI::ObjectClassHandle  handle)
virtual

Called when the local subscription information changes.

As a result, we call localSubscriptionChanged for all DtHlaObjects that may be affected.

static void DtHlaObjectManager::nameReservationFailedCb ( const std::wstring &  theName,
void *  theUserData 
)
staticprotected
static void DtHlaObjectManager::nameReservationSuceededCb ( const std::wstring &  theName,
void *  theUserData 
)
staticprotected

Called by the FederateAmbassador anytime a name reservation succeeds or fails.

static int DtHlaObjectManager::numberOfRequestNameTries ( )
static

Set/Get the number of times to tick the RTI after a name reservation request.

virtual void DtHlaObjectManager::objectProcessReflect ( DtHlaObject hlaObj,
const DtStateMsg msg 
)
protectedvirtual

Call DtHlaObject::callReflect().

Provides friendship towards DtHlaObject to derived classes.

virtual void DtHlaObjectManager::objectProcessRemoveObject ( DtHlaObject hlaObj)
protectedvirtual

Call DtHlaObject::processRemoveObject().

Provides friendship towards DtHlaObject to derived classes.

DtHlaObjectManager& DtHlaObjectManager::operator= ( const DtHlaObjectManager orig)
protected

assignment operator – Not Implemented

virtual void DtHlaObjectManager::processAttributeAcquisition ( RTI::ObjectInstanceHandle  id,
const RTI::AttributeHandleSet &  attrs 
)
virtual

Process RTI's attributeOwnershipAcquisitionNotification service.

virtual void DtHlaObjectManager::processAttributeDivestiture ( RTI::ObjectInstanceHandle  id,
const RTI::AttributeHandleSet &  attrs 
)
virtual

Process RTI's attributeOwnershipDivestitureNotification service.

virtual void DtHlaObjectManager::processConfirmAcquisitionCancellation ( RTI::ObjectInstanceHandle  id,
const RTI::AttributeHandleSet &  attrs 
)
virtual

Process RTI's conformAttributeOwnershipAcquisitionCancellation service.

virtual const DtHlaObject* DtHlaObjectManager::processDiscoverObject ( RTI::ObjectInstanceHandle  id,
RTI::ObjectClassHandle  handle,
const std::wstring &  name 
)
virtual

Process the discovery of an object.

Creates the object, sets it up for reflecting, and calls discover callbacks. Called on real discovers. Returns the added instance.

virtual const DtHlaObject* DtHlaObjectManager::processDiscoverObject ( DtHlaObject hlaObj)
virtual

Same as above, but takes an existing DtHlaObject.

Called on real discovers and when discovering objects that we register locally, if reflecting is on. returns the instance.

virtual const DtHlaObject* DtHlaObjectManager::processDiscoverObjectAsClass ( DtHlaObject hlaObj,
RTI::ObjectClassHandle  classHandle 
)
virtual

Same as above, but takes an existing DtHlaObject.

Called on real discovers and when discovering objects that we register locally, if reflecting is on. returns the instance.

virtual void DtHlaObjectManager::processLocalUpdateRequest ( RTI::ObjectClassHandle  hand,
const RTI::AttributeHandleSet &  set 
)
virtual

When we are reflecting local data, this function is called to let the object manager know that we have locally requested updates for a class/set of attributes.

As a result, we will call processProvideUpdate for all relevant objects.

virtual void DtHlaObjectManager::processProvideUpdate ( RTI::ObjectInstanceHandle  id,
const RTI::AttributeHandleSet &  theAttributes 
)
virtual

Process RTI's provideUpdate service.

virtual void DtHlaObjectManager::processReflectAttributeValues ( const DtStateMsg msg)
virtual

Process an update message.

virtual void DtHlaObjectManager::processRemoveObject ( RTI::ObjectInstanceHandle  id)
virtual

Process the removal of an object.

Cleans up the object from reflecting. Called on real removals.

virtual void DtHlaObjectManager::processRemoveObject ( DtHlaObject obj)
virtual

Same as above, but takes an existing DtHlaObject.

Called on real removals, and on removals from the discovered list of objects that we are deleting locally, if reflecting is on.

virtual void DtHlaObjectManager::processRequestAssumption ( RTI::ObjectInstanceHandle  id,
const RTI::AttributeHandleSet &  attrs,
const RTI::VariableLengthData &  tag 
)
virtual

Process RTI's requestAttributeOwnershipAssumption service.

virtual void DtHlaObjectManager::processRequestRelease ( RTI::ObjectInstanceHandle  id,
const RTI::AttributeHandleSet &  attrs,
const RTI::VariableLengthData &  tag 
)
virtual

Process RTI's requestAttributeOwnershipRelease service.

virtual void DtHlaObjectManager::publicationChanged ( RTI::ObjectClassHandle  handle)
virtual

Called when the local publication information changes.

As a result, we call publicationChanged for all DtHlaObjects that may be affected.

const DtHlaObjectMap & DtHlaObjectManager::registeredObjects ( ) const
inlinevirtual

Get the list of all HLA objects registered by the federate.

References myRegObjectList.

virtual DtHlaObject* DtHlaObjectManager::registerHlaObject ( RTI::ObjectClassHandle  classHand,
const char *  name,
const DtDDMRegionSet regionSet = 0 
)
virtual

Use this function instead of the RTI's version to create a new HLA object.

This function calls RTI's registerObjectInstance.

virtual void DtHlaObjectManager::registerHlaObjectWithRegion ( RTI::ObjectClassHandle  classHand,
const char *  name,
const DtDDMRegionSet regionSet,
RTI::ObjectInstanceHandle &  id 
)
virtual
virtual void DtHlaObjectManager::removeAllObjects ( )
virtual

Called by destructor to remove and delete all DtHlaObjects.

virtual void DtHlaObjectManager::removeDiscoverObjectCallback ( RTI::ObjectClassHandle  handle,
DtDiscoverObjectCb  cb,
void *  usr 
)
virtual
virtual void DtHlaObjectManager::removeKnownObject ( DtHlaObject hlaObj)
protectedvirtual

Call whenever an object is to be deleted, either by delete, or remove.

It removes hlaObj from the set of managed objects, and deletes it.

virtual void DtHlaObjectManager::removeRemoveObjectCallback ( RTI::ObjectInstanceHandle  id,
DtRemoveObjectCb  cb,
void *  usr 
)
virtual
static double DtHlaObjectManager::requestNameTickMaxTime ( )
static
static double DtHlaObjectManager::requestNameTickMinTime ( )
static

Sets/Gets the time in seconds to call evoke callbacks for each try after a name reservation request.

virtual void DtHlaObjectManager::reservedNameFailed ( const std::wstring &  theName)
protectedvirtual

Called when a name request Failed.

virtual void DtHlaObjectManager::reservedNameSuceeded ( const std::wstring &  theName)
protectedvirtual

Adds a new name to the reserved object Name list.

This method is called by the RTI to indicate a name request succeeded.

virtual bool DtHlaObjectManager::reserveName ( const std::wstring &  theName,
bool  pushRti 
)
virtual

By calling setRegionsForRegister, you are telling VR-Link that until you call setRegionsForRegister again (or call setNoRegionsForRegister), VR-Link should use the DDM version of registerObjectInstance whenever it registers an object for you.

The specified arguments will be passed to the RTI. (VR-Link typically registers an object from within a DtObjectPublisher constructor). In order to restore VR-Link back to the default state, when registers are done with the non-DDM version of registerObjectInstance, call setNoRegionsForRegister. attrs is an array of numAttrs attribute handles, regions is an array of numAttrs pointers to RTI::regions. The lifetime of the arrays must extend through the time that the register occurs. Deletion of the arrays is the caller's responsibility. Request a name be reserved by the RTI. If pushRti is true, evokeCallbacks will be called to drain any waiting RTI Events. The goal is to try to make the name reservation right away. Catches RTI exceptions: RTIinternalError and IllegalName Returns status of name reservation: True if call is successful (or name already reserved); False if RTI throws exception or callback reports fail when using push (and name not already reserved)

static void DtHlaObjectManager::setNumberOfRequestNameTries ( int  tries)
static
static void DtHlaObjectManager::setRequestNameTickMaxTime ( double  time)
static
static void DtHlaObjectManager::setRequestNameTickMinTime ( double  time)
static

Member Data Documentation

DtHlaObjectMap DtHlaObjectManager::myDiscObjectList
protected

List of all DtHlaObjects that we've discovered, possibly including local objects that we are also reflecting.

Referenced by discoveredObjects().

DtHashlist DtHlaObjectManager::myDiscoverCbLists
protected

DtHashlist that maps object class handles (DtIntHashKeys) to pointers to DtLists of callback functions.

DtExerciseConn* DtHlaObjectManager::myExConn
protected
DtHlaObjectFactory* DtHlaObjectManager::myFactory
protected
int DtHlaObjectManager::myNumAttrsForDDMRegister
protected
DtHlaObjectMap DtHlaObjectManager::myObjectList
protected

List of all known DtHlaObjects (by id).

Referenced by allHlaObjects().

DtHashlist DtHlaObjectManager::myObjectListByName
protected

List of all known DtHlaObjects (by String).

bool DtHlaObjectManager::myPendingNameReservationFailedFlag
protected
std::wstring DtHlaObjectManager::myPendingNameReservationName
protected
std::set<std::wstring> DtHlaObjectManager::myPendingNameReservationNameSet
protected
bool DtHlaObjectManager::myPendingNameReservationPassedFlag
protected

booleans set to true if the pending reserved name passes, or fails respectively.

DtHlaObjectMap DtHlaObjectManager::myRegObjectList
protected

List of all DtHlaObjects that we've registered locally.

Referenced by registeredObjects().

int DtHlaObjectManager::myReportedNameReservationCount
protected
std::set<std::wstring> DtHlaObjectManager::myReservedObjectInstanceNameSet
protected

A Set of all known successfully reserved object names.

int DtHlaObjectManager::theNumberOfRequestNameTries
staticprotected
double DtHlaObjectManager::theRequestNameTickMaxTime
staticprotected
double DtHlaObjectManager::theRequestNameTickMinTime
staticprotected

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

Document ID: Generated on Thu Feb 22 04:26:36 EST 2018 from SVN revision 186468
Copyright © 2005-2016 VT MÄK. All Rights Reserved (www.mak.com)