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

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.

Inheritance diagram for DtExampleSimulationConnection:
Inheritance graph
[legend]

Public Member Functions

 DtExampleSimulationConnection (makVrv::DtAgentManagerInterface &sceneInterface, const makVrv::DtCoordinateSystem &coordSystem, makVrv::DtSharedSettingsManager &settingsManager)
 
virtual ~DtExampleSimulationConnection ()
 
virtual bool connect ()
 
virtual bool connected () const
 
virtual bool disconnect ()
 
virtual void tick ()
 
const makVrv::DtCoordinateSystemcoordinateSystem () const
 
double simTime () const
 
void setSimTime (double simTime)
 
- Public Member Functions inherited from makVrv::DtBaseConnection
 DtBaseConnection (DtSharedSettingsManager &settingsManager, DtAgentManagerInterface &aSceneInterface, const DtCoordinateSystem &coordSystem)
 
 DtBaseConnection (DtSharedSettingsManager &settingsManager, DtAgentManagerInterface &aSceneInterface)
 
virtual ~DtBaseConnection ()
 
virtual void clearInstances ()
 
virtual void coordinateSystemChanged (const std::string &coordinateName, const std::string &coordinateOrigin)
 
const DtCoordinateSystemcoordinateSystem () const
 
DtSharedSettingsManagersettingsManager ()
 
virtual DtAgentManagerInterfacesceneInterface ()
 
const DtSharedSettingsManagersettingsManager () const
 
DtVisualizerCreationSettingsvisualizerCreationSettings ()
 
void reportElementCreated (DtElementID id, DtElementID parentId, unsigned int type)
 
void reportElementAttribute (DtElementID id, DtElementAttribute *attribute)
 
void reportElementDestroyed (DtElementID id)
 
const DtElementChangescurrentElementChanges () const
 
DtElementChangestakeElementChanges ()
 
DtTemporaryAgentManagertemporaryEffects ()
 
DtBlinkingObjectManagerblinkManager ()
 
DtRandomNumberGeneratorrandomNumberGenerator ()
 
virtual const std::string & tag ()
 
const DtUnicodeemptyString () const
 
virtual DtVirtualBaseClassfindInstance (const std::string &instanceName)
 
bool destroyingInstances () const
 
virtual void registerInstance (const std::string &instanceName, DtVirtualBaseClass *instance)
 

Protected Attributes

DtExampleSimEnginemyExampleSimEngine
 
makVrv::DtCoordinateSystemmyCoordinateSystem
 
double mySimTime
 
- Protected Attributes inherited from makVrv::DtBaseConnection
DtSharedSettingsManagermySettingsManagerCache
 
DtRandomNumberGenerator myRandomNumberGenerator
 
DtAgentManagerInterfacemySceneInterface
 
DtElementChangesmyWorkingElementChanges
 
DtTemporaryAgentManagermyTemporaryEffects
 
DtBlinkingObjectManagermyBlinkManager
 
DtUnicode myEmptyString
 
InstanceMap myInstances
 
bool myDestroyingInstanceFlag
 
DtCoordinateSystemmyCoordinateSystem
 
DtVisualizerCreationSettingsmyVisualizerCreationSettings
 

Additional Inherited Members

- Public Attributes inherited from makVrv::DtBaseConnection
boost::signalslib::signal< void()> signal_coordinateSystemChanged
 
- Protected Types inherited from makVrv::DtBaseConnection
typedef boost::unordered_map
< std::string,
DtVirtualBaseClass * > 
InstanceMap
 

Constructor & Destructor Documentation

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.

virtual DtExampleSimulationConnection::~DtExampleSimulationConnection ( )
virtual

DTOR.

Member Function Documentation

virtual bool DtExampleSimulationConnection::connect ( )
virtual

Function that creates the sim engine.

Returns
true if connect succeeds; false otherwise
virtual bool DtExampleSimulationConnection::connected ( ) const
virtual

Terminate the connection.

Returns
true if connected; false otherwise
virtual bool DtExampleSimulationConnection::disconnect ( )
virtual

Function that destroys the sim engine.

Returns
true if disconnect succeeds; false otherwise
virtual void DtExampleSimulationConnection::tick ( )
virtual

Function to be called repeatedly by a thread.

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
double DtExampleSimulationConnection::simTime ( ) const

Get the simulation time.

Returns
the current simulation time
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.

Member Data Documentation

DtExampleSimEngine* DtExampleSimulationConnection::myExampleSimEngine
protected

The simulation engine.

makVrv::DtCoordinateSystem* DtExampleSimulationConnection::myCoordinateSystem
protected
double DtExampleSimulationConnection::mySimTime
protected

Copy of the simulation time.


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

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)