VR-Forces 4.2 Class Documentation
DtExampleThreadedDriver.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2013 MAK Technologies, Inc.
3  * All rights reserved.
4  *****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvCore/DtDriver.h>
13 
14 #include <vrvCore/DtSelectionManager.h>
15 
16 #include <vrvUtil/DtLockedBufferedQueue.h>
17 #include <vrvUtil/DtSignalConnectionManager.h>
18 
19 #include <vlutil/vlRunnable.h>
20 
21 #include <boost/function.hpp>
22 #include <boost/signal.hpp>
23 
24 #include <string>
25 
26 namespace makVrv
27 {
28  class DtAsynchronousAgentManager;
29  class DtAsynchronousEventQueue;
30 }
31 
32 class DtThread;
33 class DtThreadStart;
35 
36 // This driver creates and owns the example driver.
38 class DtExampleThreadedDriver : public makVrv::DtDriver, protected DtRunnable
39 {
40 public:
42  DtExampleThreadedDriver( makVrv::DtAgentManager& am );
43 
45  virtual ~DtExampleThreadedDriver();
46 
48  virtual const std::string& className() const;
49 
51  virtual void queueDriverFunction(const boost::function<void ()>& function);
52 
54  virtual void queueConnectionFunction(const boost::function<void ()>& function);
55 
58  bool useThreadFlag() const;
59 
63 
65  boost::signal<void (DtExampleSimulationConnection*)> signal_simulationCreated;
66 
68  boost::signal<void (DtExampleSimulationConnection*)> signal_simulationAboutToBeDestroyed;
69 
70 protected:
71 
74  virtual bool onStart();
75 
78  virtual bool onStop();
79 
82  virtual bool onTick();
83 
88  virtual void attachObserverToEntity( const std::string& entityName );
89 
92  virtual void slot_displayEngineAdded( const makVrv::DtDeRecord& igRecord );
93 
96 
98  virtual void run();
99 
102  void startThread();
103 
106  void stopThread();
107 
109  void setSimulationConnectionState( bool state );
110 
112  virtual void connectToDynamicSignals();
113 
116  virtual void disconnectFromDynamicSignals();
117 
119  virtual void slot_togglePinnedLabel(
120  const makVrv::DtSelectionManager::IdSet& sel );
121 
122  typedef makVrv::DtLockedBufferedQueue<boost::function<void ()> > FunctionCallQueue;
123  typedef std::vector<boost::function<void ()> > FunctionCallList;
124 
126  virtual void runFunctionQueue(FunctionCallQueue& queue);
127 
128 protected:
129  //Main thread variables.
130  std::string myClassName;
131 
133 
134 
136  DtThreadStart* myStart;
137  DtThread* myThread;
140  makVrv::DtAsynchronousAgentManager* myAsynchronousInterface;
142 
144  makVrv::DtAsynchronousEventQueue* myAsynchronousEventQueue;
146 
147  makVrv::DtSignalConnectionManager myDynamicSignals;
148 };

Document ID: Generated on Sun Nov 24 19:49:21 EST 2013 from SVN revision 133924
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)