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

Public Member Functions

 DtExampleSimulationConnection (makVrv::DtAgentManagerInterface &sceneInterface, const makVrv::DtCoordinateSystem &coordSystem, makVrv::DtSharedSettingsManager &settingsManager)
virtual ~DtExampleSimulationConnection ()
 DTOR.
virtual bool connect ()
virtual bool connected () const
virtual bool disconnect ()
virtual void tick ()
 Function to be called repeatedly by a thread.
const makVrv::DtCoordinateSystem & coordinateSystem () const
double simTime () const
void setSimTime (double simTime)
Public Member Functions inherited from makVrv::DtBaseConnection
 DtBaseConnection (DtSharedSettingsManager &settingsManager, DtAgentManagerInterface &aSceneInterface, const DtCoordinateSystem &coordSystem)
 CTOR.
 DtBaseConnection (DtSharedSettingsManager &settingsManager, DtAgentManagerInterface &aSceneInterface)
 CTOR without a coordsystem. Create a new one.
virtual ~DtBaseConnection ()
 DTOR MUST call clearInstances first.
virtual void clearInstances ()
 Clear and delete all instances rooted in the connection MUST be called before the connection is destroyed.
virtual void coordinateSystemChanged (const std::string &coordinateName, const std::string &coordinateOrigin)
 process a coordintate system change by passing the new coordinate system to the DtCoordinateSystem object
const DtCoordinateSystem & coordinateSystem () const
 get the coordinate system object for this connection
DtSharedSettingsManager & settingsManager ()
 Get the settings manager.
virtual DtAgentManagerInterface & sceneInterface ()
 Get the scene manager interface for creating drivers.
const DtSharedSettingsManager & settingsManager () const
 Get the settings manager.
DtVisualizerCreationSettings & visualizerCreationSettings ()
 Get myVisualTypeVisualizerSettings.
void reportElementCreated (DtElementID id, DtElementID parentId, unsigned int type)
 Report an element created.
void reportElementAttribute (DtElementID id, DtElementAttribute *attribute)
void reportElementDestroyed (DtElementID id)
 Report an element destroyed.
const DtElementChanges & currentElementChanges () const
 Look at the current element changes.
DtElementChanges * takeElementChanges ()
 Take the current changes and internally start a new set of changes.
DtTemporaryAgentManager & temporaryEffects ()
 Get the temporary effects manager.
DtBlinkingObjectManager & blinkManager ()
 Get the blinking manager.
DtRandomNumberGenerator & randomNumberGenerator ()
 Get the simulation's random number generator.
virtual const std::string & tag ()
 Get the tag identifying which type of connection this is.
const DtUnicode & emptyString () const
 Allocated empty string.
virtual DtVirtualBaseClass * findInstance (const std::string &instanceName)
 Find an instance with the given name. If no instance is found than a null pointer is returned.
bool destroyingInstances () const
 Check to see if the simulation is destroying instances. This function is used in the destructor of objects which access instances via reference which may throw an exception.
virtual void registerInstance (const std::string &instanceName, DtVirtualBaseClass *instance)
 Register an object as an instance of instanceName, and transfer memory ownership of the instance to the DtVrlinkBaseConnection.

Protected Attributes

DtExampleSimEngine * myExampleSimEngine
 The simulation engine.
double mySimTime
 Copy of the simulation time.
Protected Attributes inherited from makVrv::DtBaseConnection
DtSharedSettingsManager & mySettingsManagerCache
 Hold on to the shared simulation manager.
DtRandomNumberGenerator myRandomNumberGenerator
 The random number generator for the local simulation.
DtAgentManagerInterface & mySceneInterface
DtElementChanges * myWorkingElementChanges
 Internal working element changes.
DtTemporaryAgentManager * myTemporaryEffects
 Manager for temporary global effects.
DtBlinkingObjectManager * myBlinkManager
 Manager for blinking objects.
DtUnicode myEmptyString
InstanceMap myInstances
 Stores a pointer to simulation specific instances.
bool myDestroyingInstanceFlag
DtCoordinateSystem * myCoordinateSystem
 The local coordinate system the simulation will use.
DtVisualizerCreationSettings * myVisualizerCreationSettings

Additional Inherited Members

Public Attributes inherited from makVrv::DtBaseConnection
vrvSignalsLib::signal< void()> signal_coordinateSystemChanged
 Emitted when the coordinate system changed.
boost::signalslib::signal< void()> signal_preConnectionTick
 Signal sent before the tick starts.
boost::signalslib::signal< void()> signal_postConnectionTick
 Signal sent after the tick has been completed.
Protected Types inherited from makVrv::DtBaseConnection
using InstanceMap = std::unordered_map<std::string,DtVirtualBaseClass*>

Detailed Description

DtExampleSimulationConnection

We use the idea of a connection to provide some basic functionality that any object (potentially) running in a separate thread might need. A reference to the connection is typically passed to all objects that will execute in the thread, much the same way a reference to DtDe is passed to all objects executing in the main thread. It provides access to the scene interface, settings manager, element data reporting, and provides a common place to register singleton instances. This derived example connection clones the current coordinate system object on creation and makes that available as well. It also provides the link that let's us provide simulation time from the driver to the sim engine.

Constructor & Destructor Documentation

◆ DtExampleSimulationConnection()

DtExampleSimulationConnection::DtExampleSimulationConnection ( makVrv::DtAgentManagerInterface & sceneInterface,
const makVrv::DtCoordinateSystem & coordSystem,
makVrv::DtSharedSettingsManager & settingsManager )

CTOR param[in] sceneInterface is a reference to either a DtAgentManager or a DtAsynchronousManager, depending on whether or not this connection is going to be used in a separate thread param[in] coordSystem is cloned (not strictly necessary if used in the main thread, but it does it regardless param[in] settingsManager allows the objects using the connection to check for current settings that are maintained in the main thread. This includes access to a signaler that will raise signals (in whichever thread the connection is running in) when those settings change

References makVrv::DtBaseConnection::sceneInterface(), and makVrv::DtBaseConnection::settingsManager().

◆ ~DtExampleSimulationConnection()

virtual DtExampleSimulationConnection::~DtExampleSimulationConnection ( )
virtual

DTOR.

Member Function Documentation

◆ connect()

virtual bool DtExampleSimulationConnection::connect ( )
virtual

Function that creates the sim engine

Returns
true if connect succeeds; false otherwise

◆ connected()

virtual bool DtExampleSimulationConnection::connected ( ) const
virtual

Terminate the connection

Returns
true if connected; false otherwise

◆ disconnect()

virtual bool DtExampleSimulationConnection::disconnect ( )
virtual

Function that destroys the sim engine

Returns
true if disconnect succeeds; false otherwise

◆ tick()

virtual void DtExampleSimulationConnection::tick ( )
virtual

Function to be called repeatedly by a thread.

◆ coordinateSystem()

const makVrv::DtCoordinateSystem & DtExampleSimulationConnection::coordinateSystem ( ) const

Get the coordinate system. NOTE WELL: A more complete implementation would listen for the coordinate system changed signal and update this when needed

Returns
a reference to the connection's copy of the coordinate system

◆ simTime()

double DtExampleSimulationConnection::simTime ( ) const

Get the simulation time

Returns
the current simulation time

Referenced by setSimTime().

◆ setSimTime()

void DtExampleSimulationConnection::setSimTime ( double simTime)

Set the simulation time. The driver puts this function on the connection's function queue with the current simulation time param[in] simTime is the current simulation time

References simTime().

Member Data Documentation

◆ myExampleSimEngine

DtExampleSimEngine* DtExampleSimulationConnection::myExampleSimEngine
protected

The simulation engine.

◆ mySimTime

double DtExampleSimulationConnection::mySimTime
protected

Copy of the simulation time.


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