VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtVreCommunicationManager Class Reference

Detailed Description

DtVreCommunicationManager provides functionality for managing simulation model sets, parameter databases, and frame updates. It serves as a bridge between the player station and the underlying VR-Link connection, handling pre and post thread ticks for frame advancement.

#include <vreCommunicationManager.h>

Inheritance diagram for makVre::DtVreCommunicationManager:
[legend]

Public Member Functions

 DtVreCommunicationManager (const DtSimulationAddress &addr, makVrf::DtStateDataManager *sm=0, int threadPoolSize=-1)
 
virtual ~DtVreCommunicationManager () override
 
virtual void connectForUpdate (makVrv::DtBaseConnection &vrlConn)
 
virtual void disconnectForUpdate ()
 
virtual bool setSimulationModelSets (const std::vector< DtFilename > &smss)
 
virtual bool setSimulationModelSets (const std::vector< std::string > &smss)
 
virtual bool setSimulationModelSets (const std::set< std::string > &smss)
 
virtual bool setSimulationModelSets (const std::vector< DtString > &smss)
 
virtual void addSimulationModelSet (const std::string &sms)
 
virtual void clearSimModelSets ()
 
virtual const std::vector< DtFilename > & simulationModelSets ()
 
virtual void setParameterDatabase (DtVrfParameterDb *parameterDb) override
 

Static Public Member Functions

static DtVreCommunicationManagerinstance (makVrv::DtBaseConnection &conn)
 
static void registerInstance (makVrv::DtBaseConnection &sim, DtVreCommunicationManager *instance)
 
static DtCommunicationManager * creator (const DtSimulationAddress &addr, makVrf::DtStateDataManager *sm=0, int threadPoolSize=-1)
 

Protected Member Functions

virtual void slot_preThreadTick ()
 
virtual void slot_postThreadTick ()
 
virtual bool setupParameterDatabase ()
 
virtual void parseOPDFiles (const DtFilename &smsToLoad, std::vector< DtFilename > &opdFiles, std::vector< DtFilename > &searchPaths)
 

Protected Attributes

boost::signals2::scoped_connection myPreTickConnection
 
boost::signals2::scoped_connection myPostTickConnection
 
DtMtlParameterDb * myParamDB
 
std::vector< DtFilename > myLastSearchPaths
 
std::vector< DtFilename > mySimulationModelSets
 
bool mySmsChanged
 
double myParamDBTimerStart
 

Constructor & Destructor Documentation

◆ DtVreCommunicationManager()

makVre::DtVreCommunicationManager::DtVreCommunicationManager ( const DtSimulationAddress & addr,
makVrf::DtStateDataManager * sm = 0,
int threadPoolSize = -1 )

Constructor for the communication manager.

Parameters
addrThe simulation address to be used
smPointer to the state data manager (optional)
threadPoolSizeSize of the thread pool; -1 uses default size

Referenced by instance(), and registerInstance().

◆ ~DtVreCommunicationManager()

virtual makVre::DtVreCommunicationManager::~DtVreCommunicationManager ( )
overridevirtual

Virtual destructor.

Member Function Documentation

◆ instance()

static DtVreCommunicationManager & makVre::DtVreCommunicationManager::instance ( makVrv::DtBaseConnection & conn)
static

Gets or creates a singleton instance of DtVreCommunicationManager for the given connection.

Parameters
connReference to the VR-Link connection to associate with the instance
Returns
Reference to the singleton instance

If an instance doesn't exist, one will be created and registered with the connection

References DtVreCommunicationManager().

Referenced by registerInstance().

◆ registerInstance()

static void makVre::DtVreCommunicationManager::registerInstance ( makVrv::DtBaseConnection & sim,
DtVreCommunicationManager * instance )
static

Registers an instance with the connection and connects it for updates.

Parameters
simReference to the VR-Link connection
instancePointer to the instance to register

References DtVreCommunicationManager(), and instance().

◆ creator()

static DtCommunicationManager * makVre::DtVreCommunicationManager::creator ( const DtSimulationAddress & addr,
makVrf::DtStateDataManager * sm = 0,
int threadPoolSize = -1 )
static

Factory method to create a new communication manager.

Parameters
addrThe simulation address to use
smPointer to the state data manager (optional)
threadPoolSizeSize of the thread pool; -1 uses default size
Returns
Pointer to a newly created DtCommunicationManager

◆ connectForUpdate()

virtual void makVre::DtVreCommunicationManager::connectForUpdate ( makVrv::DtBaseConnection & vrlConn)
virtual

Connects for pre/post tick to be able to advance frame.

Parameters
vrlConnReference to the VR-Link connection to connect to

This function connects the manager to the pre and post tick signals of the VR-Link connection, allowing automatic frame advancement. Call disconnectForUpdate to disable this and handle the updates yourself.

◆ disconnectForUpdate()

virtual void makVre::DtVreCommunicationManager::disconnectForUpdate ( )
virtual

Disconnects from pre/post tick signals.

Disconnects the manager from the pre and post tick signals, disabling automatic frame advancement.

◆ setSimulationModelSets() [1/4]

virtual bool makVre::DtVreCommunicationManager::setSimulationModelSets ( const std::vector< DtFilename > & smss)
virtual

Sets the simulation model sets from a vector of DtFilename objects.

Parameters
smssVector of DtFilename objects representing simulation model sets
Returns
True if the model sets were changed, false otherwise

◆ setSimulationModelSets() [2/4]

virtual bool makVre::DtVreCommunicationManager::setSimulationModelSets ( const std::vector< std::string > & smss)
virtual

Sets the simulation model sets from a vector of strings.

Parameters
smssVector of strings representing simulation model sets
Returns
True if the model sets were changed, false otherwise

◆ setSimulationModelSets() [3/4]

virtual bool makVre::DtVreCommunicationManager::setSimulationModelSets ( const std::set< std::string > & smss)
virtual

Sets the simulation model sets from a set of strings.

Parameters
smssSet of strings representing simulation model sets
Returns
True if the model sets were changed, false otherwise

◆ setSimulationModelSets() [4/4]

virtual bool makVre::DtVreCommunicationManager::setSimulationModelSets ( const std::vector< DtString > & smss)
virtual

Sets the simulation model sets from a vector of DtString objects.

Parameters
smssVector of DtString objects representing simulation model sets
Returns
True if the model sets were changed, false otherwise

◆ addSimulationModelSet()

virtual void makVre::DtVreCommunicationManager::addSimulationModelSet ( const std::string & sms)
virtual

Adds a single simulation model set.

Parameters
smsString representing the simulation model set to add

◆ clearSimModelSets()

virtual void makVre::DtVreCommunicationManager::clearSimModelSets ( )
virtual

Clears all simulation model sets.

◆ simulationModelSets()

virtual const std::vector< DtFilename > & makVre::DtVreCommunicationManager::simulationModelSets ( )
inlinevirtual

Gets the current simulation model sets.

Returns
Constant reference to the vector of simulation model sets

References mySimulationModelSets.

◆ setParameterDatabase()

virtual void makVre::DtVreCommunicationManager::setParameterDatabase ( DtVrfParameterDb * parameterDb)
overridevirtual

Sets the parameter database for the communication manager.

Parameters
parameterDbPointer to the parameter database to use
Note
The parameter database is cast to DtMtlParameterDb internally

◆ slot_preThreadTick()

virtual void makVre::DtVreCommunicationManager::slot_preThreadTick ( )
protectedvirtual

Slot called before each thread tick.

Calls beginFrame to prepare for the next simulation frame

◆ slot_postThreadTick()

virtual void makVre::DtVreCommunicationManager::slot_postThreadTick ( )
protectedvirtual

Slot called after each thread tick.

Calls advanceFrame to complete the current simulation frame and handles parameter database updates if simulation model sets have changed

◆ setupParameterDatabase()

virtual bool makVre::DtVreCommunicationManager::setupParameterDatabase ( )
protectedvirtual

Sets up the parameter database with the current simulation model sets.

Returns
True if the parameter database was set up successfully, false otherwise

Creates a new parameter database if one doesn't exist, then loads all OPD files from the simulation model sets into the database

◆ parseOPDFiles()

virtual void makVre::DtVreCommunicationManager::parseOPDFiles ( const DtFilename & smsToLoad,
std::vector< DtFilename > & opdFiles,
std::vector< DtFilename > & searchPaths )
protectedvirtual

Parses OPD files from a simulation model set.

Parameters
smsToLoadThe simulation model set to load
opdFilesVector to store the found OPD files
searchPathsVector to store the search paths

Recursively processes included simulation model sets and collects all OPD files and search paths

Member Data Documentation

◆ myPreTickConnection

boost::signals2::scoped_connection makVre::DtVreCommunicationManager::myPreTickConnection
protected

Connection to the pre-tick signal.

◆ myPostTickConnection

boost::signals2::scoped_connection makVre::DtVreCommunicationManager::myPostTickConnection
protected

Connection to the post-tick signal.

◆ myParamDB

DtMtlParameterDb* makVre::DtVreCommunicationManager::myParamDB
protected

Pointer to the parameter database.

◆ myLastSearchPaths

std::vector<DtFilename> makVre::DtVreCommunicationManager::myLastSearchPaths
protected

Last used search paths for the parameter database.

◆ mySimulationModelSets

std::vector<DtFilename> makVre::DtVreCommunicationManager::mySimulationModelSets
protected

Current simulation model sets.

Referenced by simulationModelSets().

◆ mySmsChanged

bool makVre::DtVreCommunicationManager::mySmsChanged
protected

Flag indicating whether simulation model sets have changed.

◆ myParamDBTimerStart

double makVre::DtVreCommunicationManager::myParamDBTimerStart
protected

Timer for parameter database updates.


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