VR-Forces 4.3.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions
DtOrganizationManager Class Reference

This class derives from the DtOrganizationView, and adds the capability to manipulate the hierarchy. More...

Inheritance diagram for DtOrganizationManager:
Inheritance graph
[legend]

Public Types

typedef DtCallbackList< const
DtOrganizationManagerReadyCallbackInfo & > 
DtOrganizationReadyCallbackList

Public Member Functions

 DtOrganizationManager (DtVrfObjectManager *objMgr)
 Constructor.
virtual ~DtOrganizationManager ()
 Destructor.
virtual bool init ()
virtual DtOrganizationManagerNodeaddEntity (DtVrfObject *vrfObject)
 ! Functions for manipulating the hierarchy
virtual void removeEntity (DtVrfObject *vrfObject)
 Overridden to run pending operations after the remove.
virtual void updateAggregate (DtVrfObject *vrfObject)
 Overridden to run pending operations after the update.
virtual void updateEntity (DtVrfObject *vrfObject)
 Overridden to run pending operations after the update.
virtual void setSuperior (const DtEntityIdentifier &subordinateId, const DtEntityIdentifier &superiorId, int designator=0, bool localOnly=false)
 Queues operations to add a subordinate to a non-force level superior.
virtual void setSuperiorToForce (const DtEntityIdentifier &subordinateId, int designator=0, bool localOnly=false)
 Queues operations to add a subordinate to it's force level superior.
virtual void queueSetSuperior (const DtString &subordinateName, const DtString &superiorName, int designator=0, DtOrganizationManagerCallbackFcn completionCallback=0, void *usrData=0)
 Queues an operator to set superior when both the subordinate and the superior exist in the organization hierarchy.
virtual void queueSetSuperiorToForce (const DtString &subordinateName, int designator=0, DtOrganizationManagerCallbackFcn completionCallback=0, void *usrData=0)
 Queues an operator to set superior to force when both the subordinate and the superior exist in the organization hierarchy.
virtual void queueChangeSet (const DtOrganizationChangeSet &changeSet, int &changeSetRequestId, DtOrganizationManagerCallbackFcn completionCallback=0, void *usrData=0)
 Queues a set of organization change operations specified in changeSet.
virtual void removeChangeSetCallback (int changeSetRequestId, DtOrganizationManagerCallbackFcn completionCallback, void *usrData=0)
virtual void detatchFromSuperior (const DtEntityIdentifier &subordinateId, bool localOnly=false)
 Queues operations to detach a subordinate from its superior.
virtual void setSubordinateOrder (const DtEntityIdentifier &superiorId, const std::vector< DtEntityIdentifier > &orderedSubordinateList, bool localOnly=false)
 Set order of subordinates belonging to the given superior, according to the order in the given list.
virtual void processObjectAboutToBeRemoved ()
virtual bool allLocalOrgChangesComplete () const
virtual bool hasPendingOperations () const
 Returns true if there are any pending operations.
virtual void addOrganizationManagerReadyCallback (DtOrganizationManagerReadyCallbackFcn fcn, void *usrData)
 Add callback to be invoked when the organization manager readiness changes.
virtual void removeOrganizationManagerReadyCallback (DtOrganizationManagerReadyCallbackFcn fcn, void *usrData)
 Removes callback to be invoked when the organization manager readiness changes.
virtual void runPendingOperations ()
 Executes all of the pending operations.
virtual void printPendingOperations () const
virtual void deletePendingOperations ()
virtual void deletePendingOperationsFor (DtString objectName)
virtual void updateObjectIndex ()
virtual bool objectExistsInIndexByName (const DtString &name, DtString &simAddress, DtString &objectId)
 Returns true if the object with the given name exists on another sim engine.
virtual bool objectExistsInIndexByGlobalId (const DtString &globalId, DtString &simAddress)
 Returns true if the object with the given globalId exists on another sim engine.
- Public Member Functions inherited from DtOrganizationView
 DtOrganizationView (DtVrfObjectManager *objMgr)
 Constructor.
virtual ~DtOrganizationView ()
 Destructor.
virtual
DtOrgViewManagedObjectListConstPtr 
getList (const DtEntityIdentifier &aggregateId, const DtVrfObjectPredicate &predicate=DtVrfObjectPredicate::nullPredicate(), bool reevaluateFlag=false, DtTime evaluationPeriod=0.) const
 Request a filtered list of subordinates for a given aggregate, based on user-supplied criteria.
virtual DtOrganizationManagerNodelookupNode (const DtEntityIdentifier &id) const
 Methods for inspecting the hierarchy.
virtual bool isSubordinateOfTopLevel (const DtEntityIdentifier &id) const
virtual const DtEntityIdentifier & superior (const DtEntityIdentifier &id) const
virtual DtVrfObjectsuperiorVrfObject (const DtEntityIdentifier &id) const
virtual bool isSubordinateOf (const DtEntityIdentifier &subordinateId, const DtEntityIdentifier &superiorId) const
virtual void addNodeAddedCallback (DtEntityIdentifierCallbackFunction fcn, void *userData)
 Callback for notification when a child is added to the list of child nodes.
virtual void removeNodeAddedCallback (DtEntityIdentifierCallbackFunction fcn, void *userData)
 Callback for notification when a child is added to the list of child nodes.
virtual void addNodeRemovedCallback (DtEntityIdentifierCallbackFunction fcn, void *userData)
 Callback for notification when a child is about to be removed from the list of child nodes.
virtual void removeNodeRemovedCallback (DtEntityIdentifierCallbackFunction fcn, void *userData)
 Callback for notification when a child is about to be removed from the list of child nodes.
virtual DtOrganizationManagerNodelocateSuperiorNodeForGlobalId (const DtGlobalObjectDesignator &globalId) const
 Methods mainly used internally.
virtual bool isLocal (DtOrganizationManagerNode *node) const
virtual void printHierarchy () const
 Prints a text representation of the current hierarchy for debugging.
virtual DtVrfObjectManagerobjectManager ()
 Methods mainly used internally.
virtual DtVrfObjecttopLevelObjectForForce (const DtForceType &force)
virtual DtOrganizationManagerNodetopLevelNodeForForce (DtForceType force)
virtual const DtHashList & nodes () const

Static Public Member Functions

static void addToOrganizationCallback (DtSimMessage *msg, void *usr)
static void removeFromOrganizationCallback (DtSimMessage *msg, void *usr)
static void objectAboutToBeRemovedCallback (DtVrfObject *vrfObject, void *usr)
 Registered with the objectManager's objectAboutToBeRemoved callback list.
- Static Public Member Functions inherited from DtOrganizationView
static void vrfObjectAddedCallback (DtVrfObject *vrfObject, void *usr)
static void vrfObjectAboutToBeRemovedCallback (DtVrfObject *vrfObject, void *usr)
static bool isTopLevelEntity (const DtEntityType &objectType)
 Methods mainly used internally.
static bool isOrganizedAggregate (DtVrfObject *vrfObject)
static bool isOrganizedEntity (DtVrfObject *vrfObject)

Protected Types

typedef std::pair
< DtOrganizationManager
*, unsigned int
DtPendingOperationCompletionCallbackData
 Structure used in the userData field of the pending operation callbacks.
- Protected Types inherited from DtOrganizationView
typedef std::list
< DtEntityIdentifierCallbackInfo
DtEntityIdentifierCallbackInfoList

Protected Member Functions

virtual void invokeOrganizationManagerReadyCallbacks ()
 Called when organization manager ready state has changed.
virtual void processAddToOrganization (DtSimMessage *msg)
virtual void processRemoveFromOrganization (DtSimMessage *msg)
virtual bool setSuperiorIsLocal (const DtEntityIdentifier &subordinateId, const DtEntityIdentifier &superiorId)
 Returns true if the entire equivalent setSuperior call can be completed locally.
virtual bool setSuperiorToForceIsLocal (const DtEntityIdentifier &subordinateId)
 Returns true if the entire equivalent setSuperiorToForce can be completed locally.
virtual bool detatchFromSuperiorIsLocal (const DtEntityIdentifier &subordinateId)
 Returns true if the entire equivalent detach call can be completed locally.
virtual bool setSubordinateOrderIsLocal (const DtEntityIdentifier &superiorId) const
 Returns true if setSubordinateOrder call can be completed locally.
virtual void addOperationToQueue (DtOrgManagerOperation *operation)
 Adds the specified operation to the queue.
virtual unsigned int newPendingOperationId ()
 Inserts the next pending operation ID onto the pending list, and returns that same ID.
virtual void clearPendingOperationId (unsigned int id)
- Protected Member Functions inherited from DtOrganizationView
 DtOrganizationView (const DtOrganizationView &orig)
 Copy constructor not implemented.
DtOrganizationViewoperator= (const DtOrganizationView &orig)
 Assignment operator not implemented.
virtual void processVrfObjectAdded (DtVrfObject *vrfObject)
virtual void processVrfObjectAboutToBeRemoved (DtVrfObject *vrfObject)
 Looks up vrfObject's superior.
virtual bool shouldBeAdded (DtVrfObject *vrfObject) const
virtual void findAndConnectNodeParent (DtOrganizationManagerNode *node)
 Searches the existing hierarchy for an aggregate which claims this node, and connects it as a child.
virtual void disconnectNodeParent (DtOrganizationManagerNode *node)
 Removes the specified node from the child list of it's current parent, and sets it parent to NULL.
virtual void findAndConnectNodeChildren (DtOrganizationManagerNode *node)
 Looks up this vrfObject, and searches the existing hierarchy for any nodes specified in the subordinate manger of this object and connects them to this node as children.
virtual void disconnectNodeChildren (DtOrganizationManagerNode *node)
 Disconnects all the children from this node.
virtual void connectNodeToTopLevel (DtOrganizationManagerNode *node, bool allowCreation=true)
 Makes this node a child of the top level node corresponding to its force type.
virtual void printNode (DtOrganizationManagerNode *node, int indentLevel=0) const
 Prints a node and all it's children recursively.
virtual bool networkStateIsDifferentFromLocalState (const DtOrganizationManagerNode &node) const
virtual void invokeNodeAddedCallbacks (const DtEntityIdentifier &entId) const
 Invokes all callbacks registered for notification that a node has been added.
virtual void invokeNodeRemovedCallbacks (const DtEntityIdentifier &entId) const
 Invokes all callbacks registered for notification that a node is about to be removed.

Static Protected Member Functions

static void pendingOperationCompleteCallback (void *usr)
static int nextId ()

Protected Attributes

DtList myPendingOperationList
 List of DtOrgManagerOperations which have not been successfully executed yet.
bool myOperationsRunning
 Flag to prevent reentrance of runPendingOperations.
std::list< unsigned intmyPendingOperationIdList
unsigned int myNextPendingOperationId
DtOrganizationReadyCallbackList myOrganizationManagerReadyCallbackList
std::map< DtString,
DtNameToObjectIdMap
myReflectedObjectNames
 Maps sim address as a DtString to a map of object names to their respective global Ids.
std::map< DtString, DtStringSetmyReflectedObjectGlobalIds
 Maps sim address as a DtString to a set of global ids as strings.
double myLastObjectIndexSentTime
double myObjectIndexHeartbeatThreshold
bool myForceObjectIndexUpdate
DtPrintPendingOpsCommand * myPrintPendingOpsCommand
DtDeletePendingOpsCommand * myDeletePendingOpsCommand
- Protected Attributes inherited from DtOrganizationView
DtVrfObjectManagermyObjectManager
DtHashList myTopLevelNodes
 Hash list of top level nodes hashed by force type. (.
DtHashList myIdHashList
 Hash list associating entity identifiers with nodes.
DtEntityIdentifierCallbackInfoList myNodeAddedCallbackList
DtEntityIdentifierCallbackInfoList myNodeRemovedCallbackList
DtOrgViewManagedObjectListManagermyManagedObjectListManager

Static Protected Attributes

static int theNextId

Private Member Functions

 DtOrganizationManager ()
 Default constructor not implemented.
 DtOrganizationManager (const DtOrganizationManager &orig)
 Copy constructor not implemented.
DtOrganizationManageroperator= (const DtOrganizationManager &orig)
 Assignment operator not implemented.
virtual void processObjectIndexMessage (DtSimInterfaceMessage *msg)
 Update local cached object index based on new message.
static void objectIndexMessageCallback (DtSimMessage *msg, void *usr)
 Update local cached object index based on new message.

Detailed Description

This class derives from the DtOrganizationView, and adds the capability to manipulate the hierarchy.

Remember that the organization view is solely based off of what is heard over the network, and the manipulation that occurs on the org manager level changes the subordinate lists of local entites (and remotes by sending messages to the org manager on the backend simulating them). Because of this, changes made to the organization hierarchy through these calls will not be seen immediately in the organization view.

Examples

Member Typedef Documentation

Structure used in the userData field of the pending operation callbacks.

Constructor & Destructor Documentation

DtOrganizationManager::DtOrganizationManager ( )
private

Default constructor not implemented.

DtOrganizationManager::DtOrganizationManager ( const DtOrganizationManager orig)
private

Copy constructor not implemented.

DtOrganizationManager::DtOrganizationManager ( DtVrfObjectManager objMgr)

Constructor.

virtual DtOrganizationManager::~DtOrganizationManager ( )
virtual

Destructor.

Member Function Documentation

DtOrganizationManager& DtOrganizationManager::operator= ( const DtOrganizationManager orig)
private

Assignment operator not implemented.

virtual bool DtOrganizationManager::init ( )
virtual

Reimplemented from DtOrganizationView.

virtual DtOrganizationManagerNode* DtOrganizationManager::addEntity ( DtVrfObject vrfObject)
virtual

! Functions for manipulating the hierarchy

Overridden to run pending operations after the add.

Reimplemented from DtOrganizationView.

virtual void DtOrganizationManager::removeEntity ( DtVrfObject vrfObject)
virtual

Overridden to run pending operations after the remove.

Reimplemented from DtOrganizationView.

virtual void DtOrganizationManager::updateAggregate ( DtVrfObject vrfObject)
virtual

Overridden to run pending operations after the update.

Reimplemented from DtOrganizationView.

virtual void DtOrganizationManager::updateEntity ( DtVrfObject vrfObject)
virtual

Overridden to run pending operations after the update.

Reimplemented from DtOrganizationView.

virtual void DtOrganizationManager::setSuperior ( const DtEntityIdentifier &  subordinateId,
const DtEntityIdentifier &  superiorId,
int  designator = 0,
bool  localOnly = false 
)
virtual

Queues operations to add a subordinate to a non-force level superior.

An implicit detach is included in this call. if localOnly is false, a message will be sent to all backends if the operation cannot be complete locally.

virtual void DtOrganizationManager::setSuperiorToForce ( const DtEntityIdentifier &  subordinateId,
int  designator = 0,
bool  localOnly = false 
)
virtual

Queues operations to add a subordinate to it's force level superior.

An implicit detach is included in this call. If localOnly is false, a message will be sent to all backends if the operation cannot be completed locally.

virtual void DtOrganizationManager::queueSetSuperior ( const DtString subordinateName,
const DtString superiorName,
int  designator = 0,
DtOrganizationManagerCallbackFcn  completionCallback = 0,
void *  usrData = 0 
)
virtual

Queues an operator to set superior when both the subordinate and the superior exist in the organization hierarchy.

If necessary, messages will be sent to other backends to complete the operation once the objects exist. Optionally takes a completion callback function pointer and user data as an argument. This callback will be invoked onces the setSuperior operation has successfully completed.

virtual void DtOrganizationManager::queueSetSuperiorToForce ( const DtString subordinateName,
int  designator = 0,
DtOrganizationManagerCallbackFcn  completionCallback = 0,
void *  usrData = 0 
)
virtual

Queues an operator to set superior to force when both the subordinate and the superior exist in the organization hierarchy.

If necessary, messages will be sent to other backends to complete the operation once the objects exist. Optionally takes a completion callback function pointer and user data as an argument. This callback will be invoked onces the setSuperior operation has successfully completed.

virtual void DtOrganizationManager::queueChangeSet ( const DtOrganizationChangeSet changeSet,
int changeSetRequestId,
DtOrganizationManagerCallbackFcn  completionCallback = 0,
void *  usrData = 0 
)
virtual

Queues a set of organization change operations specified in changeSet.

Optionally takes a completion callback function pointer and user data as an argument. This callback will be invoked onces the entire change set has successfully completed.

virtual void DtOrganizationManager::removeChangeSetCallback ( int  changeSetRequestId,
DtOrganizationManagerCallbackFcn  completionCallback,
void *  usrData = 0 
)
virtual
virtual void DtOrganizationManager::detatchFromSuperior ( const DtEntityIdentifier &  subordinateId,
bool  localOnly = false 
)
virtual

Queues operations to detach a subordinate from its superior.

if localOnly is false, a message will be sent to other backends if the operation cannot be completed locally.

virtual void DtOrganizationManager::setSubordinateOrder ( const DtEntityIdentifier &  superiorId,
const std::vector< DtEntityIdentifier > &  orderedSubordinateList,
bool  localOnly = false 
)
virtual

Set order of subordinates belonging to the given superior, according to the order in the given list.

static void DtOrganizationManager::addToOrganizationCallback ( DtSimMessage msg,
void *  usr 
)
static
static void DtOrganizationManager::removeFromOrganizationCallback ( DtSimMessage msg,
void *  usr 
)
static
static void DtOrganizationManager::objectAboutToBeRemovedCallback ( DtVrfObject vrfObject,
void *  usr 
)
static

Registered with the objectManager's objectAboutToBeRemoved callback list.

Forces the object index to update the next time updateObjectIndex is called.

virtual void DtOrganizationManager::processObjectAboutToBeRemoved ( )
virtual
virtual bool DtOrganizationManager::allLocalOrgChangesComplete ( ) const
virtual
Returns
True if all locally initiated organization changes have been carried out. This applies to any operations initiated with queueSetSuperior() or queueSetSuperiorToForce().
virtual bool DtOrganizationManager::hasPendingOperations ( ) const
virtual

Returns true if there are any pending operations.

virtual void DtOrganizationManager::addOrganizationManagerReadyCallback ( DtOrganizationManagerReadyCallbackFcn  fcn,
void *  usrData 
)
virtual

Add callback to be invoked when the organization manager readiness changes.

virtual void DtOrganizationManager::removeOrganizationManagerReadyCallback ( DtOrganizationManagerReadyCallbackFcn  fcn,
void *  usrData 
)
virtual

Removes callback to be invoked when the organization manager readiness changes.

virtual void DtOrganizationManager::runPendingOperations ( )
virtual

Executes all of the pending operations.

virtual void DtOrganizationManager::printPendingOperations ( ) const
virtual
virtual void DtOrganizationManager::deletePendingOperations ( )
virtual
virtual void DtOrganizationManager::deletePendingOperationsFor ( DtString  objectName)
virtual
virtual void DtOrganizationManager::updateObjectIndex ( )
virtual
virtual bool DtOrganizationManager::objectExistsInIndexByName ( const DtString name,
DtString simAddress,
DtString objectId 
)
virtual

Returns true if the object with the given name exists on another sim engine.

simAddress is set to the sim address of the object, and objectId is set to the objectId of the object.

virtual bool DtOrganizationManager::objectExistsInIndexByGlobalId ( const DtString globalId,
DtString simAddress 
)
virtual

Returns true if the object with the given globalId exists on another sim engine.

simAddress is set to the sim address of the object.

static void DtOrganizationManager::objectIndexMessageCallback ( DtSimMessage msg,
void *  usr 
)
static

Update local cached object index based on new message.

Ignores messages sent from ourselves.

virtual void DtOrganizationManager::processObjectIndexMessage ( DtSimInterfaceMessage msg)
virtual

Update local cached object index based on new message.

Ignores messages sent from ourselves.

virtual void DtOrganizationManager::invokeOrganizationManagerReadyCallbacks ( )
protectedvirtual

Called when organization manager ready state has changed.

virtual void DtOrganizationManager::processAddToOrganization ( DtSimMessage msg)
protectedvirtual
virtual void DtOrganizationManager::processRemoveFromOrganization ( DtSimMessage msg)
protectedvirtual
virtual bool DtOrganizationManager::setSuperiorIsLocal ( const DtEntityIdentifier &  subordinateId,
const DtEntityIdentifier &  superiorId 
)
protectedvirtual

Returns true if the entire equivalent setSuperior call can be completed locally.

virtual bool DtOrganizationManager::setSuperiorToForceIsLocal ( const DtEntityIdentifier &  subordinateId)
protectedvirtual

Returns true if the entire equivalent setSuperiorToForce can be completed locally.

virtual bool DtOrganizationManager::detatchFromSuperiorIsLocal ( const DtEntityIdentifier &  subordinateId)
protectedvirtual

Returns true if the entire equivalent detach call can be completed locally.

virtual bool DtOrganizationManager::setSubordinateOrderIsLocal ( const DtEntityIdentifier &  superiorId) const
protectedvirtual

Returns true if setSubordinateOrder call can be completed locally.

virtual void DtOrganizationManager::addOperationToQueue ( DtOrgManagerOperation operation)
protectedvirtual

Adds the specified operation to the queue.

The queue will delete this object when it is done with it. Please don't keep a pointer to it.

virtual unsigned int DtOrganizationManager::newPendingOperationId ( )
protectedvirtual

Inserts the next pending operation ID onto the pending list, and returns that same ID.

virtual void DtOrganizationManager::clearPendingOperationId ( unsigned int  id)
protectedvirtual
static void DtOrganizationManager::pendingOperationCompleteCallback ( void *  usr)
staticprotected
static int DtOrganizationManager::nextId ( )
staticprotected

Member Data Documentation

DtList DtOrganizationManager::myPendingOperationList
protected

List of DtOrgManagerOperations which have not been successfully executed yet.

bool DtOrganizationManager::myOperationsRunning
protected

Flag to prevent reentrance of runPendingOperations.

std::list<unsigned int> DtOrganizationManager::myPendingOperationIdList
protected
unsigned int DtOrganizationManager::myNextPendingOperationId
protected
DtOrganizationReadyCallbackList DtOrganizationManager::myOrganizationManagerReadyCallbackList
protected
std::map<DtString, DtNameToObjectIdMap> DtOrganizationManager::myReflectedObjectNames
protected

Maps sim address as a DtString to a map of object names to their respective global Ids.

std::map<DtString, DtStringSet> DtOrganizationManager::myReflectedObjectGlobalIds
protected

Maps sim address as a DtString to a set of global ids as strings.

double DtOrganizationManager::myLastObjectIndexSentTime
protected
double DtOrganizationManager::myObjectIndexHeartbeatThreshold
protected
bool DtOrganizationManager::myForceObjectIndexUpdate
protected
DtPrintPendingOpsCommand* DtOrganizationManager::myPrintPendingOpsCommand
protected
DtDeletePendingOpsCommand* DtOrganizationManager::myDeletePendingOpsCommand
protected
int DtOrganizationManager::theNextId
staticprotected

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

Document ID: Generated on Wed Jul 29 00:55:00 EDT 2015 from SVN revision 155257
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)