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

This class handles all requests as they pertain to viewing or modifying the ORBAT.

Classes

class  LockedOrbatManagerNode
 
struct  OrbatInformation
 

Public Types

typedef boost::unordered_map
< DtUUID, DtOrbatManagerNode * > 
UUIDMap
 
typedef boost::unordered_map
< DtUUID, OrbatInformation
OrbatMap
 

Public Member Functions

 DtOrbatManager (DtSimulationServices *objMgr, DtLocalObjectManager *)
 
virtual ~DtOrbatManager ()
 
virtual bool init ()
 
virtual void closingScenario ()
 
virtual void setOrbatEnabled (bool)
 
virtual bool orbatEnabled () const
 
virtual DtOrbatDataList addOrUpdateObjectsInOrbat (const DtOrbatDataList &, int flags=DtIfOrbatOperation::IterateChildrenOnAdd)
 
virtual DtOrbatDataList removeObjectsFromOrbat (const DtOrbatDataList &)
 
virtual DtOrbatDataList removeObjectFromOrbat (const DtRwOrbatData &, bool onlyPublished=false)
 
virtual void sendOrbatList (int requestId=0)
 
virtual void clearOrbat (bool send=false)
 
virtual void mergeFrom (const DtOrbatManager &fromOm, bool sendNewList=false)
 
virtual bool loadOrbat (const DtFilename &, bool send=false, bool clearOnLoad=true)
 
virtual bool loadOrbatFromZipFile (const DtFilename &scenarioZipFile, const std::string &, bool send=false, bool clearOnLoad=true)
 
virtual bool loadOrbat (const std::string &str, bool send=false, bool clearOnLoad=true)
 
virtual bool writeOrbat (const DtFilename &)
 
virtual bool writeOrbat (std::string &)
 
virtual LockedOrbatManagerNode addNode (const DtRwOrbatData &)
 
virtual bool hasNode (const DtUUID &) const
 
virtual LockedOrbatManagerNode lookupNodeByUUID (const DtUUID &id) const
 
virtual LockedOrbatManagerNode lookupNodeByMarkingText (const DtString &) const
 
const OrbatMapnodes () const
 
virtual DtOrbatDataList modifyOrbatObjects (const DtOrbatDataList &)
 
virtual DtOrbatDataList modifyOrbatObject (const DtRwOrbatData &)
 
virtual const DtLocalObjectcreateOrReturnSuperiorOf (const DtUUID &, const DtVector &locationOfSuperior=DtVector::zero(), bool forceCreate=false)
 
virtual void createSubordinatesOfObject (const DtUUID &)
 
virtual void tick ()
 
virtual void makeAllSimulationObjectsPartOfOrbat ()
 

Protected Types

typedef std::vector
< DtOrbatManagerNode * > 
OrbatNodeList
 
typedef std::map< DtUUID,
OrbatNodeList
UnparentedOrbatNodes
 
typedef std::map< int,
DtOrbatManagerNode * > 
RootNodesByForce
 

Protected Member Functions

virtual DtString trimNameForLength (int maxLength, const DtString &) const
 
virtual DtOrbatManagerNodecreateOrbatManagerNode () const
 
virtual void processOrbatOperation (DtSimMessage *msg)
 
virtual void processOrbatResponse (DtSimMessage *msg)
 
virtual DtOrbatDataList createOrbatNodes (const DtRwOrbatData &, int flags=DtIfOrbatOperation::IterateChildrenOnAdd)
 
virtual bool loadOrbat (DtlInputStream *, bool send)
 
virtual DtString generateMarkingText (const DtEntityType &)
 
virtual void processSimObjectAdded (DtSimObjectReference ref, int flags=0)
 
virtual void processSimObjectRemoved (DtSimObjectReference ref)
 
virtual bool objectShouldBeSavedToSimulationObjectGroup (const DtSimObject *obj) const
 
virtual void processSuperiorChanged (const DtSimObject *, const DtUUID &oldSuperior, const DtUUID &newSuperior)
 
virtual void processAddSuperior (const DtSimObject *, const DtUUID &superior)
 
virtual void processRemoveSuperior (const DtSimObject *, const DtUUID &superior)
 
virtual void reorderOrbatNodesExcluding (LockedOrbatManagerNode)
 
virtual void setOrbatNodeOrder (LockedOrbatManagerNode, int order, bool inserting=false)
 
virtual void insertOrbatNodeInOrder (LockedOrbatManagerNode, int order)
 
virtual LockedOrbatManagerNode rootNodeForForce (int)
 
virtual void processObjectDataChanged (const DtLocalObject *, int flag)
 
virtual DtOrbatDataList setForceToSubordinatesOf (int force, const LockedOrbatManagerNode &) const
 
virtual void processOrbatNodeRemoved (const DtOrgNodeCallbackInfo &)
 

Static Protected Member Functions

static void orbatOperationCallback (DtSimMessage *msg, void *usr)
 
static void orbatResponseCallback (DtSimMessage *msg, void *usr)
 
static void vrfObjectAdded (const DtLocalObject *, void *usr)
 
static void orbatNodeRemovedCallback (const DtOrgNodeCallbackInfo &, void *)
 

Protected Attributes

bool myIsOrbatEnabled
 
tbb::recursive_mutex myOrbatNodesMutex
 
UnparentedOrbatNodes myUnparentedOrbatNodes
 
OrbatMap myOrbatNodes
 
DtSimulationServicesmySimulationServices
 
DtLocalObjectManagermyObjectManager
 
std::map< std::string, intmyEntityTypeCounts
 
UUIDMap myModifiedNodes
 
tbb::spin_rw_mutex myRootNodeByForceMutex
 
RootNodesByForce myRootNodesByForce
 
DtIsOrbatEnabledCommand * myIsOrbatEnabledCommand
 
DtSetIsOrbatEnabledCommand * mySetIsOrbatEnabledCommand
 
boost::signals2::scoped_connection mySimObjectAddedConnection
 
boost::signals2::scoped_connection mySimObjectDeletedConnection
 
tbb::spin_mutex myModifiedNodesMutex
 
std::set< DtUUIDmyAddToOrbatOnNextAdd
 

Private Member Functions

 DtOrbatManager ()
 
 DtOrbatManager (const DtOrbatManager &orig)
 
DtOrbatManageroperator= (const DtOrbatManager &orig)
 

Member Typedef Documentation

typedef boost::unordered_map<DtUUID, DtOrbatManagerNode*> DtOrbatManager::UUIDMap
typedef boost::unordered_map<DtUUID, OrbatInformation> DtOrbatManager::OrbatMap
typedef std::vector<DtOrbatManagerNode*> DtOrbatManager::OrbatNodeList
protected

Constructor & Destructor Documentation

DtOrbatManager::DtOrbatManager ( )
private

Default constructor not implemented.

DtOrbatManager::DtOrbatManager ( const DtOrbatManager orig)
private

Copy constructor not implemented.

DtOrbatManager::DtOrbatManager ( DtSimulationServices objMgr,
DtLocalObjectManager  
)

Constructor.

virtual DtOrbatManager::~DtOrbatManager ( )
virtual

Destructor.

Member Function Documentation

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

Assignment operator not implemented.

virtual bool DtOrbatManager::init ( )
virtual
virtual void DtOrbatManager::closingScenario ( )
virtual

Called when scenario is closing. Can perform some cleanup.

virtual void DtOrbatManager::setOrbatEnabled ( bool  )
virtual

Sets whether or not this is enabled to process orbat messages. Default is false.

virtual bool DtOrbatManager::orbatEnabled ( ) const
virtual
virtual DtOrbatDataList DtOrbatManager::addOrUpdateObjectsInOrbat ( const DtOrbatDataList ,
int  flags = DtIfOrbatOperation::IterateChildrenOnAdd 
)
virtual

Adds the specified orbat items to the orbat manager, creating new nodes as necessary. What will be returned is the orbat data created in response to this operation.

virtual DtOrbatDataList DtOrbatManager::removeObjectsFromOrbat ( const DtOrbatDataList )
virtual

Removes all the specified objects from the orbat. If any of the objects are a superior, all subordinates in the orbat are removed. Returns objects removed.

virtual DtOrbatDataList DtOrbatManager::removeObjectFromOrbat ( const DtRwOrbatData ,
bool  onlyPublished = false 
)
virtual

Removes the specified object from the orbat. If any of the objects are a superior, all subordinates in the orbat are removed. Returns objects removed.

virtual void DtOrbatManager::sendOrbatList ( int  requestId = 0)
virtual

Sends off a flat list of all the orbat items that are marked as part of the orbat. Up to receiver to reconstitute into a tree, if need be.

virtual void DtOrbatManager::clearOrbat ( bool  send = false)
virtual

Clears out any objects are are in the orbat only. If is orbat enabled and send flag is true will send an empty orbat list out.

virtual void DtOrbatManager::mergeFrom ( const DtOrbatManager fromOm,
bool  sendNewList = false 
)
virtual

Merges orbat items from the given orbat into this orbat.

virtual bool DtOrbatManager::loadOrbat ( const DtFilename &  ,
bool  send = false,
bool  clearOnLoad = true 
)
virtual

Loads the scenario scripts from the specified file. If send is true sends out all scripts onto the network.

virtual bool DtOrbatManager::loadOrbatFromZipFile ( const DtFilename &  scenarioZipFile,
const std::string &  ,
bool  send = false,
bool  clearOnLoad = true 
)
virtual
virtual bool DtOrbatManager::loadOrbat ( const std::string &  str,
bool  send = false,
bool  clearOnLoad = true 
)
virtual

Loads the scenario scripts from the given string.

virtual bool DtOrbatManager::writeOrbat ( const DtFilename &  )
virtual

Writes the local scenario scripts to the specified file.

virtual bool DtOrbatManager::writeOrbat ( std::string &  )
virtual

Writes the local scenario scripts to the specified string.

virtual LockedOrbatManagerNode DtOrbatManager::addNode ( const DtRwOrbatData )
virtual

Adds a node without expansion or hooking to child/parent.

virtual bool DtOrbatManager::hasNode ( const DtUUID ) const
virtual
virtual LockedOrbatManagerNode DtOrbatManager::lookupNodeByUUID ( const DtUUID id) const
virtual
virtual LockedOrbatManagerNode DtOrbatManager::lookupNodeByMarkingText ( const DtString ) const
virtual

Looks up and returns node by marking text. If there are multiple items with the same marking text will return the first it finds.

const OrbatMap& DtOrbatManager::nodes ( ) const
inline
virtual DtOrbatDataList DtOrbatManager::modifyOrbatObjects ( const DtOrbatDataList )
virtual

Modify orbat hierarchy given the nodes to modify. Will return a list of changed nodes.

virtual DtOrbatDataList DtOrbatManager::modifyOrbatObject ( const DtRwOrbatData )
virtual

Modify orbat hierarchy given the nodes to modify. If attached to a parent and that parent is not in the orbat view, will create a new parent for that, and walk the chain as long as the parent nodes are not created.

virtual const DtLocalObject* DtOrbatManager::createOrReturnSuperiorOf ( const DtUUID ,
const DtVector locationOfSuperior = DtVector::zero(),
bool  forceCreate = false 
)
virtual

If this is part of the orbat, and there is a parent for this object, return that parent. If there should be a parent and there is no parent created create it locall via a DtIfCreateVrfObject message. Pass in a location if you want to use that as a seed location. The location is geocentric.

If force create is true, then this assumes this is a local creation and not waiting for the superior to potentially show up on the network

virtual void DtOrbatManager::createSubordinatesOfObject ( const DtUUID )
virtual

If this object is in the orbat and has uncreated subordinates, create them and parent them to their superior.

virtual void DtOrbatManager::tick ( )
virtual

Perform any pending operations.

virtual void DtOrbatManager::makeAllSimulationObjectsPartOfOrbat ( )
virtual

For any simulation object that is not currently part of the ORBAT, call processVrfObjectAdded on it to make it part of the ORBAT. If the DtDoNotAddToOrbat flag is set for vrf objects it will be removed so they will be added to the ORBAT.

virtual DtString DtOrbatManager::trimNameForLength ( int  maxLength,
const DtString  
) const
protectedvirtual

If the marking text is >= max length, trims end.

virtual DtOrbatManagerNode* DtOrbatManager::createOrbatManagerNode ( ) const
protectedvirtual

Creates a new node to put into the hierarchy.

virtual void DtOrbatManager::processOrbatOperation ( DtSimMessage msg)
protectedvirtual

Process an orbat operation.

static void DtOrbatManager::orbatOperationCallback ( DtSimMessage msg,
void *  usr 
)
staticprotected
virtual void DtOrbatManager::processOrbatResponse ( DtSimMessage msg)
protectedvirtual

Process an orbat response such that if this back-end is not the sender, update orbat.

static void DtOrbatManager::orbatResponseCallback ( DtSimMessage msg,
void *  usr 
)
staticprotected
virtual DtOrbatDataList DtOrbatManager::createOrbatNodes ( const DtRwOrbatData ,
int  flags = DtIfOrbatOperation::IterateChildrenOnAdd 
)
protectedvirtual

Creates orbat nodes based on the orbat data. It will look up the parameter data for the given entity type, and, if that entity type is an aggregate will recursively create nodes for all subordinates in that aggregate and add them to the orbat with pre-generated unique ids.

virtual bool DtOrbatManager::loadOrbat ( DtlInputStream *  ,
bool  send 
)
protectedvirtual
virtual DtString DtOrbatManager::generateMarkingText ( const DtEntityType &  )
protectedvirtual

Given an entity type generate unique marking text.

static void DtOrbatManager::vrfObjectAdded ( const DtLocalObject ,
void *  usr 
)
staticprotected
virtual void DtOrbatManager::processSimObjectAdded ( DtSimObjectReference  ref,
int  flags = 0 
)
protectedvirtual
virtual void DtOrbatManager::processSimObjectRemoved ( DtSimObjectReference  ref)
protectedvirtual
virtual bool DtOrbatManager::objectShouldBeSavedToSimulationObjectGroup ( const DtSimObject obj) const
protectedvirtual
virtual void DtOrbatManager::processSuperiorChanged ( const DtSimObject ,
const DtUUID oldSuperior,
const DtUUID newSuperior 
)
protectedvirtual
virtual void DtOrbatManager::processAddSuperior ( const DtSimObject ,
const DtUUID superior 
)
protectedvirtual
virtual void DtOrbatManager::processRemoveSuperior ( const DtSimObject ,
const DtUUID superior 
)
protectedvirtual
virtual void DtOrbatManager::reorderOrbatNodesExcluding ( LockedOrbatManagerNode  )
protectedvirtual

Reorders the orbat order of any node that are after the orbat order of the specified node that share the same parent by the amount specified.

virtual void DtOrbatManager::setOrbatNodeOrder ( LockedOrbatManagerNode  ,
int  order,
bool  inserting = false 
)
protectedvirtual

Sets the order of the orbat node, reording others as needed.

virtual void DtOrbatManager::insertOrbatNodeInOrder ( LockedOrbatManagerNode  ,
int  order 
)
protectedvirtual
virtual LockedOrbatManagerNode DtOrbatManager::rootNodeForForce ( int  )
protectedvirtual
virtual void DtOrbatManager::processObjectDataChanged ( const DtLocalObject ,
int  flag 
)
protectedvirtual
virtual DtOrbatDataList DtOrbatManager::setForceToSubordinatesOf ( int  force,
const LockedOrbatManagerNode  
) const
protectedvirtual

Sets the force of all the subordinates (recursive) of the orbat node to the given force and returns a list of all nodes affected.

static void DtOrbatManager::orbatNodeRemovedCallback ( const DtOrgNodeCallbackInfo ,
void *   
)
staticprotected
virtual void DtOrbatManager::processOrbatNodeRemoved ( const DtOrgNodeCallbackInfo )
protectedvirtual

Member Data Documentation

bool DtOrbatManager::myIsOrbatEnabled
protected
tbb::recursive_mutex DtOrbatManager::myOrbatNodesMutex
mutableprotected
UnparentedOrbatNodes DtOrbatManager::myUnparentedOrbatNodes
protected
OrbatMap DtOrbatManager::myOrbatNodes
protected
DtSimulationServices* DtOrbatManager::mySimulationServices
protected
DtLocalObjectManager* DtOrbatManager::myObjectManager
protected
std::map<std::string, int> DtOrbatManager::myEntityTypeCounts
protected

Number of items used by entity type so unique name can be generated when adding nodes to the orbat.

UUIDMap DtOrbatManager::myModifiedNodes
protected

Map of modified nodes to be sent off during a tick.

tbb::spin_rw_mutex DtOrbatManager::myRootNodeByForceMutex
protected
RootNodesByForce DtOrbatManager::myRootNodesByForce
protected
DtIsOrbatEnabledCommand* DtOrbatManager::myIsOrbatEnabledCommand
protected
DtSetIsOrbatEnabledCommand* DtOrbatManager::mySetIsOrbatEnabledCommand
protected
boost::signals2::scoped_connection DtOrbatManager::mySimObjectAddedConnection
protected
boost::signals2::scoped_connection DtOrbatManager::mySimObjectDeletedConnection
protected
tbb::spin_mutex DtOrbatManager::myModifiedNodesMutex
protected
std::set<DtUUID> DtOrbatManager::myAddToOrbatOnNextAdd
protected

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

Document ID: Generated on Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)