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

The DtCommunicationManager class is a convenience class that will create both the DtNetworkInterfaceManager and the DtEventManager as well as provide methods to access them and pass information to them. You can still use the individual classes (and should for registering callbacks), however, where at all possible, use this higher level interface to access broader functionality.

Related Examples
Inheritance diagram for DtCommunicationManager:
Inheritance graph
[legend]

Public Types

typedef boost::function
< double(double &dt)> 
SimTimeProvideFcn
 

Public Member Functions

 DtCommunicationManager (const DtSimulationAddress &, makVrf::DtStateDataManager *sm=0, int threadPoolSize=-1)
 
virtual ~DtCommunicationManager ()
 
virtual void setNetworkInterfaceManager (DtNetworkInterfaceManager *)
 
DtNetworkInterfaceManagernetworkInterfaceManager ()
 
virtual void setSimulationAddress (const DtSimulationAddress &)
 
const DtSimulationAddress & simulationAddress () const
 
const DtSimulationAddress & applicationId () const
 
virtual void setEventManager (makVrfEvents::DtEventManager *)
 
makVrfEvents::DtEventManagereventManager ()
 
virtual void setParameterDatabase (DtVrfParameterDb *)
 
DtVrfParameterDbparameterDatabase () const
 
virtual void setNumCallbackThreads (unsigned)
 
virtual bool typeIsPublishable (const DtEntityType &) const
 
virtual void setCoordinateSystem (const Coordinate_System *)
 
virtual double beginFrame (double &dt, DtCommunicationManagerPerformanceTimerInformation *performanceTimerInformation=nullptr)
 
virtual bool advanceFrame (DtCommunicationManagerPerformanceTimerInformation *performanceTimerInformation=nullptr)
 
virtual bool waitingToAddObjects () const
 
virtual bool supportsOwnershipTransfer () const
 
virtual bool insertManagerAtBeginning (DtNetworkManagerInterface *)
 
virtual bool addManager (DtNetworkManagerInterface *)
 
virtual DtNetworkManagerInterfacenetworkManagerInterface (const char *) const
 
virtual void removeManager (const char *)
 
virtual void addEvent (const makVrfEvents::DtEvent &)
 
virtual void postEvent (const makVrfEvents::DtEvent &)
 
virtual void sendEvent (const makVrfEvents::DtEvent &)
 
virtual void setUsePerfCounter (bool)
 
virtual DtString nextEventId (const DtString &=DtString::nullString())
 
virtual void setSessionId (int)
 
int sessionId () const
 
virtual double elapsedRealTime () const
 
virtual void run ()
 
virtual void pause ()
 
virtual void rewindScenario ()
 
virtual void resetSimulation ()
 
virtual void setSimTime (double)
 
virtual void setFrameRateMode (const DtString &mode, double deltaTime, bool manageTime=false)
 
virtual void setTimeMultiplier (double)
 
virtual void setExerciseStartTime (double)
 
virtual bool isPaused () const
 
virtual double approximateElapsedRealTime () const
 
virtual double absRealTime () const
 
virtual double timeMultiplier () const
 
virtual double exerciseStartTime () const
 
virtual bool isRunToCompleteFrameMode () const
 
virtual void setSimTimeProviderFunction (SimTimeProvideFcn f)
 
virtual double simTime () const
 
DtExerciseClockclock () const
 
bool skippedLastFrame () const
 
bool inFame () const
 
virtual bool isConnectionless () const
 
virtual void removeAndDeleteAll (const std::set< DtUUID > &except=std::set< DtUUID >())
 
virtual void reserve (unsigned int)
 
virtual bool validateScenario (const DtScenario &s, DtString &error) const
 
virtual bool selfReflecting () const
 
virtual void setSelfReflecting (bool)
 
virtual void beginBulkCreate ()
 
virtual void endBulkCreate ()
 
makVrf::DtStateDataManagerstateDataManager () const
 
virtual bool rediscoverObjects ()
 

Static Public Member Functions

static void setCommunicationManagerCreatorFcn (DtCommunicationManagerCreatorFcn fcn)
 
static DtCommunicationManagercreateCommunicationManager (const DtSimulationAddress &, makVrf::DtStateDataManager *sm=0, int threadPoolSize=-1)
 

Public Attributes

boost::signals2::signal< void(bool
&continueAdvance)> 
signal_aboutToAdvanceFrame
 
boost::signals2::signal< void(makVrf::DtStateDataManager *)> signal_stateDataManagerChanged
 
boost::signals2::signal< void()> signal_frameAdvanced
 
boost::signals2::signal< void()> signal_preEventManagerTick
 
boost::signals2::signal< void(double
simTime, double dT)> 
signal_beginFrame
 
boost::signals2::signal< void(DtNetworkManagerInterface *)> signal_interfaceAdded
 
boost::signals2::signal< void(DtNetworkManagerInterface *)> signal_interfaceRemoved
 

Protected Member Functions

virtual void slot_interfaceAdded (DtNetworkManagerInterface *)
 
virtual void slot_interfaceRemoved (DtNetworkManagerInterface *)
 
void initialize ()
 

Protected Attributes

DtNetworkInterfaceManagermyNetworkInterfaceManager
 
makVrf::DtStateDataManagermyStateDataManager
 
makVrfEvents::DtEventManagermyEventManager
 
DtSimulationAddress mySimulationAddress
 
DtExerciseClockmyExerciseClock
 
bool myOwnsStateDataManager
 
int mySessionId
 
double mySimTime
 
double myLastDt
 
SimTimeProvideFcn mySimTimeProviderFunction
 
int myInFrame
 
DtVrfParameterDbmyParameterDatabase
 
std::atomic< intmyNextEventNumber
 

Static Protected Attributes

static
DtCommunicationManagerCreatorFcn 
theCommunicationManagerCreatorFcn
 

Member Typedef Documentation

Constructor & Destructor Documentation

DtCommunicationManager::DtCommunicationManager ( const DtSimulationAddress &  ,
makVrf::DtStateDataManager sm = 0,
int  threadPoolSize = -1 
)

Creates the network manager, state data manager (if not supplied) and event manager from their creator functions. The simulation address is the unique identifier of the communication address of this instance. If threadPoolSize is not -1 and this class creates the state data manager, use the number of threads for the legion thread pool update.

virtual DtCommunicationManager::~DtCommunicationManager ( )
virtual

Member Function Documentation

static void DtCommunicationManager::setCommunicationManagerCreatorFcn ( DtCommunicationManagerCreatorFcn  fcn)
static

Factory method for creating this class. If no factory method defined the default DtCommunicationManager is created.

static DtCommunicationManager* DtCommunicationManager::createCommunicationManager ( const DtSimulationAddress &  ,
makVrf::DtStateDataManager sm = 0,
int  threadPoolSize = -1 
)
static

Factory method for creating this class. If no factory method defined the default DtCommunicationManager is created.

virtual void DtCommunicationManager::setNetworkInterfaceManager ( DtNetworkInterfaceManager )
virtual

When set, this class will take ownership of the supplied manager.

DtNetworkInterfaceManager* DtCommunicationManager::networkInterfaceManager ( )
inline
virtual void DtCommunicationManager::setSimulationAddress ( const DtSimulationAddress &  )
virtual
const DtSimulationAddress& DtCommunicationManager::simulationAddress ( ) const
const DtSimulationAddress& DtCommunicationManager::applicationId ( ) const
inline
virtual void DtCommunicationManager::setEventManager ( makVrfEvents::DtEventManager )
virtual

When set this class will take ownership of the supplied manager.

makVrfEvents::DtEventManager* DtCommunicationManager::eventManager ( )
inline
virtual void DtCommunicationManager::setParameterDatabase ( DtVrfParameterDb )
virtual
DtVrfParameterDb* DtCommunicationManager::parameterDatabase ( ) const
inline
virtual void DtCommunicationManager::setNumCallbackThreads ( unsigned  )
virtual

If the network thread supports it, the number of threads to use the network.

virtual bool DtCommunicationManager::typeIsPublishable ( const DtEntityType &  ) const
virtual

Returns true if the entity type is publishable by this connection.

virtual void DtCommunicationManager::setCoordinateSystem ( const Coordinate_System )
virtual

Sets the coordinate system to use with this scenario.

virtual double DtCommunicationManager::beginFrame ( double dt,
DtCommunicationManagerPerformanceTimerInformation performanceTimerInformation = nullptr 
)
virtual

Starts the beginning of the frame. The return value of this is the new simulation time as determined by the network interface.

virtual bool DtCommunicationManager::advanceFrame ( DtCommunicationManagerPerformanceTimerInformation performanceTimerInformation = nullptr)
virtual

Tells all network interfaces the frame wants to be advanced. Returns true if the frame was advanced (myInFrame counter is 0) If supply preAdvanceFrameTime, returns the time spent in the preAdvanceFrame call.

virtual bool DtCommunicationManager::waitingToAddObjects ( ) const
virtual

Returns true if the network manager is waiting to add objects.

virtual bool DtCommunicationManager::supportsOwnershipTransfer ( ) const
virtual

Returns true if this communication manager supports ownership transfer. Will query the network interface manager.

virtual bool DtCommunicationManager::insertManagerAtBeginning ( DtNetworkManagerInterface )
virtual

Since the network interfaces will be walked in order to see if one wants to put it on the network to prevent other interfaces from also publishing on the network, insert this at the beginning to give it priority. This class will take ownership of the manager. If the manager type already exists, existing type is deleted.

virtual bool DtCommunicationManager::addManager ( DtNetworkManagerInterface )
virtual

This class will take ownership of the manager. If the manager type already exists, existing type is deleted.

virtual DtNetworkManagerInterface* DtCommunicationManager::networkManagerInterface ( const char ) const
virtual

Returns the network manager by type.

virtual void DtCommunicationManager::removeManager ( const char )
virtual

Removes and deletes the manager.

virtual void DtCommunicationManager::addEvent ( const makVrfEvents::DtEvent )
virtual

Adds an event to the event manager. If the event manager has an associated network manager will also send via the network manager.

virtual void DtCommunicationManager::postEvent ( const makVrfEvents::DtEvent )
virtual

Posts an event to the event manager only. Will not send over the network.

virtual void DtCommunicationManager::sendEvent ( const makVrfEvents::DtEvent )
virtual

Sends the event over the network only. Does not post to the event manager.

virtual void DtCommunicationManager::setUsePerfCounter ( bool  )
virtual

Whether or not created clock should use performance counter (default is true for windows)

virtual DtString DtCommunicationManager::nextEventId ( const DtString = DtString::nullString())
virtual

Fire/detonate (and other) PDUs/interactions can be tied with an event id. This routine will return the event id in a protocol dependent way based on the communication interface. Pass in the optional entity id of the entity causing the event.

virtual void DtCommunicationManager::setSessionId ( int  )
virtual

Sets the id of this session. Used to filter data network traffic.

int DtCommunicationManager::sessionId ( ) const
inline
virtual double DtCommunicationManager::elapsedRealTime ( ) const
virtual

@ { Time routines

virtual void DtCommunicationManager::run ( )
virtual

Puts the simulation into run mode by letting the network connections know.

virtual void DtCommunicationManager::pause ( )
virtual

Puts the simulation into pause mode by letting the network connections know.

virtual void DtCommunicationManager::rewindScenario ( )
virtual

Scenario is about to rewind.

virtual void DtCommunicationManager::resetSimulation ( )
virtual

Resets the simulation.

virtual void DtCommunicationManager::setSimTime ( double  )
virtual

Sets the current simulation time.

virtual void DtCommunicationManager::setFrameRateMode ( const DtString mode,
double  deltaTime,
bool  manageTime = false 
)
virtual

Sets the mode for the exercise clock.

virtual void DtCommunicationManager::setTimeMultiplier ( double  )
virtual

Sets the current time multiplier.

virtual void DtCommunicationManager::setExerciseStartTime ( double  )
virtual

Start day/date time of the exercise.

virtual bool DtCommunicationManager::isPaused ( ) const
virtual
virtual double DtCommunicationManager::approximateElapsedRealTime ( ) const
virtual
virtual double DtCommunicationManager::absRealTime ( ) const
virtual
virtual double DtCommunicationManager::timeMultiplier ( ) const
virtual
virtual double DtCommunicationManager::exerciseStartTime ( ) const
virtual
virtual bool DtCommunicationManager::isRunToCompleteFrameMode ( ) const
virtual
virtual void DtCommunicationManager::setSimTimeProviderFunction ( SimTimeProvideFcn  f)
virtual
virtual double DtCommunicationManager::simTime ( ) const
inlinevirtual
DtExerciseClock* DtCommunicationManager::clock ( ) const
inline
bool DtCommunicationManager::skippedLastFrame ( ) const
bool DtCommunicationManager::inFame ( ) const
inline
virtual bool DtCommunicationManager::isConnectionless ( ) const
virtual

Returns true if there are no registered connections.

virtual void DtCommunicationManager::removeAndDeleteAll ( const std::set< DtUUID > &  except = std::set< DtUUID >())
virtual

Called when all objects are being deleted, will indicate that all remotes will eventually need to be rediscovered, except for the ones specified.

virtual void DtCommunicationManager::reserve ( unsigned  int)
virtual

Calls down to the state data manager to reserve a number of entities. This reservation will be cumulative, so, if a previous reserve reserved 1000 entitie, and this reserves 1000, the total will be 2000.

virtual bool DtCommunicationManager::validateScenario ( const DtScenario s,
DtString error 
) const
virtual

If any connection returns false do not run.

virtual bool DtCommunicationManager::selfReflecting ( ) const
virtual

Returns true if any of the connections are self reflecting.

virtual void DtCommunicationManager::setSelfReflecting ( bool  )
virtual

Sets all connections (if supported) to self reflecting. This will only apply to current handlers, not ones that are added after this is called.

virtual void DtCommunicationManager::beginBulkCreate ( )
virtual
virtual void DtCommunicationManager::endBulkCreate ( )
virtual
makVrf::DtStateDataManager* DtCommunicationManager::stateDataManager ( ) const
inline
virtual bool DtCommunicationManager::rediscoverObjects ( )
virtual

This is a destructive call in that it will remove all the state data and then tell the network connections to recreate the state data from the remote entities. This call assumes that this would not be made unless the simulation model set has been changed after remote entities have been discovered This operation could take a significant amount of time depending on the amount of objects that are in the system. Returns true if there are remote objects to rediscover.

virtual void DtCommunicationManager::slot_interfaceAdded ( DtNetworkManagerInterface )
protectedvirtual
virtual void DtCommunicationManager::slot_interfaceRemoved ( DtNetworkManagerInterface )
protectedvirtual
void DtCommunicationManager::initialize ( )
protected

Called from constructor. Creates event and network managers.

Member Data Documentation

boost::signals2::signal<void (bool& continueAdvance)> DtCommunicationManager::signal_aboutToAdvanceFrame

Sent before the state data manager advances its frame. Set continueAdvance to false to prevent the advancing of the frame. This is called after preAdvance.

boost::signals2::signal<void (makVrf::DtStateDataManager*)> DtCommunicationManager::signal_stateDataManagerChanged

Sent if a network manager is assigned with a different state data manager in it.

boost::signals2::signal<void ()> DtCommunicationManager::signal_frameAdvanced

Can be called by outside holders of this class if the frame cannot be advanced, however, other classes connect to this to be signaled for a post communication advance event. Will also be called from advanceFrame.

boost::signals2::signal<void ()> DtCommunicationManager::signal_preEventManagerTick

Signal sent before the signal_beginFrame and before the event manager tick, but after state data manager and network manager tick.

boost::signals2::signal<void (double simTime, double dT)> DtCommunicationManager::signal_beginFrame

Signal sent right before beginFrame is returned.

boost::signals2::signal<void (DtNetworkManagerInterface*)> DtCommunicationManager::signal_interfaceAdded

Signal sent when an interface is added.

boost::signals2::signal<void (DtNetworkManagerInterface*)> DtCommunicationManager::signal_interfaceRemoved

Signal sent when an interface is removed.

DtNetworkInterfaceManager* DtCommunicationManager::myNetworkInterfaceManager
protected
makVrf::DtStateDataManager* DtCommunicationManager::myStateDataManager
protected
makVrfEvents::DtEventManager* DtCommunicationManager::myEventManager
protected
DtCommunicationManagerCreatorFcn DtCommunicationManager::theCommunicationManagerCreatorFcn
staticprotected
DtSimulationAddress DtCommunicationManager::mySimulationAddress
protected
DtExerciseClock* DtCommunicationManager::myExerciseClock
protected

Backup for simulation time (absRealTime) if no network manager.

bool DtCommunicationManager::myOwnsStateDataManager
protected
int DtCommunicationManager::mySessionId
protected
double DtCommunicationManager::mySimTime
protected
double DtCommunicationManager::myLastDt
protected
SimTimeProvideFcn DtCommunicationManager::mySimTimeProviderFunction
protected
int DtCommunicationManager::myInFrame
protected
DtVrfParameterDb* DtCommunicationManager::myParameterDatabase
protected
std::atomic<int> DtCommunicationManager::myNextEventNumber
protected

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

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)