VR-Vantage
Loading...
Searching...
No Matches
DtExampleThreadedDriver Class Reference
Inheritance diagram for DtExampleThreadedDriver:

Public Member Functions

 DtExampleThreadedDriver (makVrv::DtAgentManager &am)
 CTOR.
virtual ~DtExampleThreadedDriver ()
 Virtual DTOR.
virtual const std::string & className () const
 Get this instance's class name.
virtual void queueDriverFunction (const boost::function< void()> &function)
 Put a function in the sim function queue, for threadsafe calling.
virtual void queueConnectionFunction (const boost::function< void()> &function)
 Put a function in the sim function queue, for threadsafe calling.
bool useThreadFlag () const
DtExampleSimulationConnection * simulationConnection ()
Public Member Functions inherited from makVrv::DtDriver
 DtDriver (DtAgentManager &agentManager, const std::string &instanceName)
 CTOR.
virtual ~DtDriver ()
 DTOR.
virtual void realizeConfiguration (const DtConfiguration &configuration)
 Realize the driver using the configuration.
virtual DtConfiguration createConfiguration (bool saveAllParameters=false) const
 Create a configuration for the driver.
DtAgentManager & agentManager ()
 Get the master scene for this host. Do not create drivers using this agentManager, use the sceneInterface as it may replaced the implementation of the sceneInterface.
virtual DtAgentManagerInterface & sceneInterface ()
 Get the scene manager interface for creating agents.
bool started () const
 Get this driver's active state.
virtual const std::string & instanceName () const
 Get this driver's instance name.
virtual bool autoStart () const
 Get whether this driver is set to automatically start if it is persistent.
virtual void setAutoStart (bool autoStart)
 Set whether this driver automatically starts if it is persistent.
virtual bool isWindowDependent () const
 Get whether this driver is set to automatically start when the first window is created and stop when the last window is destroyed.
virtual void setIsWindowDependent (bool dep)
 Set whether this driver is set to automatically start when the first window is created and stop when the last window is destroyed.
virtual void setIsUserControllable (bool)
 Set whether this driver can be started and stopped by the user.
virtual bool isUserControllable () const
 Get whether this driver can be started and stopped by the user.
virtual void setIsPersistent (bool per)
 Set if the driver is persistent and should be saved between runs.
virtual bool isPersistent () const
 Get if the driver is persistent and should be saved between runs.
virtual bool isOnDriverSelectionList () const
 Returns whether or not this driver is to be automatically started/stopped from the driver selection list.
virtual void setOnDriverSelectionList (bool)
 Sets whether or not this item is on the driver selection list. Will be saved to record if state is different.
bool objectFromAgentManager (const DtUniqueID &id) const
 check to see if the object was created using this driver's agent manager.

Public Attributes

makVrv::vrvSignalsLib::signal< void(DtExampleSimulationConnection *)> signal_connectionCreated
 This signal is emitted when the simulation connection is created.
makVrv::vrvSignalsLib::signal< void(DtExampleSimulationConnection *)> signal_connectionAboutToBeDestroyed
 This signal is emitted when the simulation connection is about to be destroyed.

Protected Types

typedef makVrv::DtLockedBufferedQueue< boost::function< void()> > FunctionCallQueue
typedef std::vector< boost::function< void()> > FunctionCallList

Protected Member Functions

virtual bool onStart ()
virtual bool onStop ()
virtual bool onTick ()
virtual void attachObserverToEntity (const std::string &entityName)
virtual void slot_displayEngineAdded (const makVrv::DtDeRecord &igRecord)
virtual DtExampleSimulationConnection * createSimulationConnection ()
 Abstract create simulation function called onStart.
virtual void run ()
 Function that will be called when the thread is started.
void startThread ()
 Attempt to start the thread.
void stopThread ()
 Attempt to stop the thread, blocking until the thread stops.
void setSimulationConnectionState (bool state)
 Set the connection state of the driver.
virtual void connectToDynamicSignals ()
 Connect to signals.
virtual void disconnectFromDynamicSignals ()
 Disconnect to any signals connected to in connectToDynamicSignals().
virtual void slot_togglePinnedLabel (const makVrv::DtSelectionManager::IdSet &sel, bool pinAllLabels)
 Listens for entity labels being pinned / unpinned.
virtual void runFunctionQueue (FunctionCallQueue &queue)
 Execute a function queue.
virtual void slot_coordinateSystemChanged ()
 slot for when the coordinate system changes
Protected Member Functions inherited from makVrv::DtDriver
void applyChangesAndDelete (DtElementChanges *changes)
 Function for apply changes from a changes object and deleting it. This function is useful for queuing from an external thread as a means of passing changes from a secondary thread back to the main thread.
void reportElementCreated (DtElementID id, DtElementID parentId, DtElementEntry::ElementType type)
 Report an element created.
void reportElementAttribute (DtElementID id, DtElementAttribute *attribute)
 Report an element attribute changed.
void reportElementDestroyed (DtElementID id)
 Report an element destroyed.
void start ()
 Start the driver. Called by the Master Scene. Calls installAccessories().
void stop ()
 Stop the driver. Called by the Master Scene. Calls uninstallAccessories().
bool tick ()
 Tick the host driver. Called by the Master Scene.
virtual void setInstanceName (const std::string &name)
 set the Instance name.
virtual void installAccessories ()
 Installs accessories on this driver. The compatible and enabled accessories in the DtDriverManager's accessory map are installed on this driver.
virtual void uninstallAccessories ()
 Removes accessories from this driver. The compatible and enabled accessories in the DtDriverManager's accessory map are removed from this driver.

Protected Attributes

std::string myClassName
bool myUseThreadFlag
DtThreadStartSP myStart
DtThread * myThread
FunctionCallQueue myConnectionThreadFunctions
FunctionCallQueue myDriverThreadFunctions
makVrv::DtAsynchronousAgentManager * myAsynchronousInterface
DtExampleSimulationConnection * mySimulationConnection
makVrv::DtAsynchronousEventQueue * myAsynchronousEventQueue
bool mySimulationConnectionState
makVrv::DtSignalConnectionManager myDynamicSignals
Protected Attributes inherited from makVrv::DtDriver
DtAgentManager & myAgentManager
bool myStartedFlag
std::string myName
DtConfiguration myConfiguration
bool myPersistentFlag
bool myUserControllableFlag
bool myRequestStateDiffPendingFlag
DtElementChanges myChanges
DtSignalConnectionManager myConnections
 Auto-disconnects on destruction; avoids singleton lookups in the DTOR.

Additional Inherited Members

Static Protected Attributes inherited from makVrv::DtDriver
static const std::string theOnDriverSelectionList

Member Typedef Documentation

◆ FunctionCallQueue

typedef makVrv::DtLockedBufferedQueue<boost::function<void ()> > DtExampleThreadedDriver::FunctionCallQueue
protected

◆ FunctionCallList

typedef std::vector<boost::function<void ()> > DtExampleThreadedDriver::FunctionCallList
protected

Constructor & Destructor Documentation

◆ DtExampleThreadedDriver()

DtExampleThreadedDriver::DtExampleThreadedDriver ( makVrv::DtAgentManager & am)

CTOR.

◆ ~DtExampleThreadedDriver()

virtual DtExampleThreadedDriver::~DtExampleThreadedDriver ( )
virtual

Virtual DTOR.

Member Function Documentation

◆ className()

virtual const std::string & DtExampleThreadedDriver::className ( ) const
virtual

Get this instance's class name.

Implements makVrv::DtDriver.

◆ queueDriverFunction()

virtual void DtExampleThreadedDriver::queueDriverFunction ( const boost::function< void()> & function)
virtual

Put a function in the sim function queue, for threadsafe calling.

◆ queueConnectionFunction()

virtual void DtExampleThreadedDriver::queueConnectionFunction ( const boost::function< void()> & function)
virtual

Put a function in the sim function queue, for threadsafe calling.

◆ useThreadFlag()

bool DtExampleThreadedDriver::useThreadFlag ( ) const

See if this driver is running connection methods in a separate thread

Returns
true if using a separate thread, false otherwise

◆ simulationConnection()

DtExampleSimulationConnection * DtExampleThreadedDriver::simulationConnection ( )

Get the simulation connection

Returns
the simulation connection, if it exists. May return 0.

◆ onStart()

virtual bool DtExampleThreadedDriver::onStart ( )
protectedvirtual

Performs startup logic for the driver.

See also
makVrv::DtDriver::start()

Implements makVrv::DtDriver.

◆ onStop()

virtual bool DtExampleThreadedDriver::onStop ( )
protectedvirtual

Performs shutdown logic for the driver.

See also
makVrv::DtDriver::stop()

Implements makVrv::DtDriver.

◆ onTick()

virtual bool DtExampleThreadedDriver::onTick ( )
protectedvirtual

Performs update logic for the driver.

See also
makVrv::DtDriver::tick()

Implements makVrv::DtDriver.

◆ attachObserverToEntity()

virtual void DtExampleThreadedDriver::attachObserverToEntity ( const std::string & entityName)
protectedvirtual

Tells the current observer to attach to the named entity. This method uses an observer state record, and calls DtObserver::setFromRecord. When setFromRecord is used, the observer will listen for the existence of the named entity and actually do the attachment when the entity is created

◆ slot_displayEngineAdded()

virtual void DtExampleThreadedDriver::slot_displayEngineAdded ( const makVrv::DtDeRecord & igRecord)
protectedvirtual

Ensures the driver is properly restarted when a de is connected.

See also
makVrv::DtDriver::slot_displayEngineAdded( const makVrv::DtDeRecord& )

Reimplemented from makVrv::DtDriver.

◆ createSimulationConnection()

virtual DtExampleSimulationConnection * DtExampleThreadedDriver::createSimulationConnection ( )
protectedvirtual

Abstract create simulation function called onStart.

◆ run()

virtual void DtExampleThreadedDriver::run ( )
protectedvirtual

Function that will be called when the thread is started.

◆ startThread()

void DtExampleThreadedDriver::startThread ( )
protected

Attempt to start the thread.

Exceptions
DtCorruptedStateif the thread does not start.

◆ stopThread()

void DtExampleThreadedDriver::stopThread ( )
protected

Attempt to stop the thread, blocking until the thread stops.

◆ setSimulationConnectionState()

void DtExampleThreadedDriver::setSimulationConnectionState ( bool state)
protected

Set the connection state of the driver.

◆ connectToDynamicSignals()

virtual void DtExampleThreadedDriver::connectToDynamicSignals ( )
protectedvirtual

Connect to signals.

◆ disconnectFromDynamicSignals()

virtual void DtExampleThreadedDriver::disconnectFromDynamicSignals ( )
protectedvirtual

Disconnect to any signals connected to in connectToDynamicSignals().

◆ slot_togglePinnedLabel()

virtual void DtExampleThreadedDriver::slot_togglePinnedLabel ( const makVrv::DtSelectionManager::IdSet & sel,
bool pinAllLabels )
protectedvirtual

Listens for entity labels being pinned / unpinned.

◆ runFunctionQueue()

virtual void DtExampleThreadedDriver::runFunctionQueue ( FunctionCallQueue & queue)
protectedvirtual

Execute a function queue.

◆ slot_coordinateSystemChanged()

virtual void DtExampleThreadedDriver::slot_coordinateSystemChanged ( )
protectedvirtual

slot for when the coordinate system changes

Member Data Documentation

◆ signal_connectionCreated

makVrv::vrvSignalsLib::signal<void (DtExampleSimulationConnection*)> DtExampleThreadedDriver::signal_connectionCreated

This signal is emitted when the simulation connection is created.

◆ signal_connectionAboutToBeDestroyed

makVrv::vrvSignalsLib::signal<void (DtExampleSimulationConnection*)> DtExampleThreadedDriver::signal_connectionAboutToBeDestroyed

This signal is emitted when the simulation connection is about to be destroyed.

◆ myClassName

std::string DtExampleThreadedDriver::myClassName
protected

◆ myUseThreadFlag

bool DtExampleThreadedDriver::myUseThreadFlag
protected

Cross thread variables. They are used between the two threads for communication.

◆ myStart

DtThreadStartSP DtExampleThreadedDriver::myStart
protected

◆ myThread

DtThread* DtExampleThreadedDriver::myThread
protected

◆ myConnectionThreadFunctions

FunctionCallQueue DtExampleThreadedDriver::myConnectionThreadFunctions
protected

◆ myDriverThreadFunctions

FunctionCallQueue DtExampleThreadedDriver::myDriverThreadFunctions
protected

◆ myAsynchronousInterface

makVrv::DtAsynchronousAgentManager* DtExampleThreadedDriver::myAsynchronousInterface
protected

◆ mySimulationConnection

DtExampleSimulationConnection* DtExampleThreadedDriver::mySimulationConnection
protected

◆ myAsynchronousEventQueue

makVrv::DtAsynchronousEventQueue* DtExampleThreadedDriver::myAsynchronousEventQueue
protected

◆ mySimulationConnectionState

bool DtExampleThreadedDriver::mySimulationConnectionState
protected

◆ myDynamicSignals

makVrv::DtSignalConnectionManager DtExampleThreadedDriver::myDynamicSignals
protected

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