VR-Forces 5.0.1 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtExampleThreadedDriver.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2022 MAK Technologies, Inc.
3  * All rights reserved.
4  *****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvCore/DtDriver.h>
13 
15 
18 
19 #include <vlutil/vlRunnable.h>
20 
21 #include <boost/function.hpp>
22 #include <vrvUtil/signalslib.h>
23 #include <vlutil/vlThread.h>
24 
25 #include <string>
26 
27 namespace makVrv
28 {
29  class DtAsynchronousAgentManager;
30  class DtAsynchronousEventQueue;
31 }
32 
33 class DtThread;
34 class DtThreadStart;
36 
37 // This driver creates and owns the example driver.
40 {
41 public:
44 
46  virtual ~DtExampleThreadedDriver();
47 
49  virtual const std::string& className() const;
50 
52  virtual void queueDriverFunction(const boost::function<void ()>& function);
53 
55  virtual void queueConnectionFunction(const boost::function<void ()>& function);
56 
59  bool useThreadFlag() const;
60 
64 
66  boost::signalslib::signal<void (DtExampleSimulationConnection*)> signal_connectionCreated;
67 
69  boost::signalslib::signal<void (DtExampleSimulationConnection*)> signal_connectionAboutToBeDestroyed;
70 
71 protected:
72 
75  virtual bool onStart();
76 
79  virtual bool onStop();
80 
83  virtual bool onTick();
84 
89  virtual void attachObserverToEntity( const std::string& entityName );
90 
93  virtual void slot_displayEngineAdded( const makVrv::DtDeRecord& igRecord );
94 
97 
99  virtual void run();
100 
103  void startThread();
104 
107  void stopThread();
108 
110  void setSimulationConnectionState( bool state );
111 
113  virtual void connectToDynamicSignals();
114 
117  virtual void disconnectFromDynamicSignals();
118 
120  virtual void slot_togglePinnedLabel(
121  const makVrv::DtSelectionManager::IdSet& sel, bool pinAllLabels );
122 
124  typedef std::vector<boost::function<void ()> > FunctionCallList;
125 
127  virtual void runFunctionQueue(FunctionCallQueue& queue);
128 
130  virtual void slot_coordinateSystemChanged();
131 
132 protected:
133  //Main thread variables.
134  std::string myClassName;
135 
137  bool myUseThreadFlag;
140  DtThreadStartSP myStart;
141  DtThread* myThread;
146 
150 
152 };
boost::signalslib::signal< void(DtExampleSimulationConnection *)> signal_connectionAboutToBeDestroyed
This signal is emitted when the simulation connection is about to be destroyed.
Definition: DtExampleThreadedDriver.h:69
DtThreadStartSP myStart
Cross thread variables. They are used between the two threads for communication.
Definition: DtExampleThreadedDriver.h:140
An asynchronous interface to the scene manager.
Definition: DtAsynchronousAgentManager.h:24
virtual void attachObserverToEntity(const std::string &entityName)
Tells the current observer to attach to the named entity. This method uses an observer state record...
virtual bool onStart()
Performs startup logic for the driver.
DtExampleSimulationConnection * mySimulationConnection
Definition: DtExampleThreadedDriver.h:147
A Record of an IG instance.
Definition: DtDeRecord.h:24
void stopThread()
Attempt to stop the thread, blocking until the thread stops.
Contains makVrv:DtSelectionManager class.
DtThread * myThread
Cross thread variables. They are used between the two threads for communication.
Definition: DtExampleThreadedDriver.h:141
boost::signalslib::signal< void(DtExampleSimulationConnection *)> signal_connectionCreated
This signal is emitted when the simulation connection is created.
Definition: DtExampleThreadedDriver.h:66
virtual ~DtExampleThreadedDriver()
Virtual DTOR.
bool useThreadFlag() const
See if this driver is running connection methods in a separate thread.
Contains makVrv::DtLockedBufferedQueue class.
virtual void queueConnectionFunction(const boost::function< void()> &function)
Put a function in the sim function queue, for threadsafe calling.
virtual void queueDriverFunction(const boost::function< void()> &function)
Put a function in the sim function queue, for threadsafe calling.
void startThread()
Attempt to start the thread.
makVrv::DtAsynchronousEventQueue * myAsynchronousEventQueue
Definition: DtExampleThreadedDriver.h:148
virtual const std::string & className() const
Get this instance&#39;s class name.
Definition: DtExampleThreadedDriver.h:39
virtual void run()
Function that will be called when the thread is started.
A locked buffered queue which allows multiple writers and a single reader. Internally the queue is st...
Definition: DtLockedBufferedQueue.h:24
bool mySimulationConnectionState
Definition: DtExampleThreadedDriver.h:149
The DtDriver is an abstract class. Developers derive from this to create logic that &quot;directs&quot; things ...
Definition: DtDriver.h:31
std::vector< boost::function< void()> > FunctionCallList
Definition: DtExampleThreadedDriver.h:124
virtual bool onTick()
Performs update logic for the driver.
DtExampleThreadedDriver(makVrv::DtAgentManager &am)
CTOR.
FunctionCallQueue myDriverThreadFunctions
Cross thread variables. They are used between the two threads for communication.
Definition: DtExampleThreadedDriver.h:143
The asynchronous event queue. To create an asynchronous event queue the the makVrv::DtMainEventQueue ...
Definition: DtAsynchronousEventQueue.h:24
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
virtual void connectToDynamicSignals()
Connect to signals.
virtual void runFunctionQueue(FunctionCallQueue &queue)
Execute a function queue.
virtual void disconnectFromDynamicSignals()
Disconnect to any signals connected to in connectToDynamicSignals()
DtExampleSimulationConnection * simulationConnection()
Get the simulation connection.
The DtAgentManager manages the distributed scene object framework. This includes the objects and upda...
Definition: DtAgentManager.h:38
Contains makVrv:DtDriver class.
virtual void slot_coordinateSystemChanged()
slot for when the coordinate system changes
void setSimulationConnectionState(bool state)
Set the connection state of the driver.
std::string myClassName
Definition: DtExampleThreadedDriver.h:134
Base class to provide boost signal/slot management.
DtExampleSimulationConnection.
Definition: DtExampleSimulationConnection.h:35
virtual DtExampleSimulationConnection * createSimulationConnection()
Abstract create simulation function called onStart.
makVrv::DtSignalConnectionManager myDynamicSignals
Definition: DtExampleThreadedDriver.h:151
FunctionCallQueue myConnectionThreadFunctions
Cross thread variables. They are used between the two threads for communication.
Definition: DtExampleThreadedDriver.h:142
makVrv::DtLockedBufferedQueue< boost::function< void()> > FunctionCallQueue
Definition: DtExampleThreadedDriver.h:123
makVrv::DtAsynchronousAgentManager * myAsynchronousInterface
Cross thread variables. They are used between the two threads for communication.
Definition: DtExampleThreadedDriver.h:144
bool myUseThreadFlag
Cross thread variables. They are used between the two threads for communication.
Definition: DtExampleThreadedDriver.h:139
std::set< DtUniqueID > IdSet
Definition: DtSelectionManager.h:32
virtual void slot_displayEngineAdded(const makVrv::DtDeRecord &igRecord)
Ensures the driver is properly restarted when a de is connected.
virtual bool onStop()
Performs shutdown logic for the driver.
virtual void slot_togglePinnedLabel(const makVrv::DtSelectionManager::IdSet &sel, bool pinAllLabels)
Listens for entity labels being pinned / unpinned.

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)