VR-Forces Development_Version Class Documentation
Home
Modules
Namespaces
Classes
Files
Examples
Behavior Models
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
examples
exampleThreadedDriver
DtExampleThreadedDriver.h
Go to the documentation of this file.
1
/*****************************************************************************
2
* Copyright (c) 2014 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
#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;
35
class
DtExampleSimulationConnection
;
36
37
// This driver creates and owns the example driver.
39
class
DtExampleThreadedDriver
:
public
makVrv::DtDriver
,
protected
DtRunnable
40
{
41
public
:
43
DtExampleThreadedDriver
(
makVrv::DtAgentManager
& am );
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
63
DtExampleSimulationConnection
*
simulationConnection
();
64
66
boost::signal<void (DtExampleSimulationConnection*)>
signal_simulationCreated
;
67
69
boost::signal<void (DtExampleSimulationConnection*)>
signal_simulationAboutToBeDestroyed
;
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
96
virtual
DtExampleSimulationConnection
*
createSimulationConnection
();
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 );
122
123
typedef
makVrv::DtLockedBufferedQueue<boost::function<void ()>
>
FunctionCallQueue
;
124
typedef
std::vector<boost::function<void ()> >
FunctionCallList
;
125
127
virtual
void
runFunctionQueue
(
FunctionCallQueue
& queue);
128
129
protected
:
130
//Main thread variables.
131
std::string
myClassName
;
132
134
135
136
bool
myUseThreadFlag
;
137
DtThreadStartSP
myStart
;
138
DtThread*
myThread
;
139
FunctionCallQueue
myConnectionThreadFunctions
;
140
FunctionCallQueue
myDriverThreadFunctions
;
141
makVrv::DtAsynchronousAgentManager
*
myAsynchronousInterface
;
143
144
DtExampleSimulationConnection
*
mySimulationConnection
;
145
makVrv::DtAsynchronousEventQueue
*
myAsynchronousEventQueue
;
146
bool
mySimulationConnectionState
;
147
148
makVrv::DtSignalConnectionManager
myDynamicSignals
;
149
};
Document ID: Generated on Tue Mar 8 22:13:38 EST 2016 from SVN revision 162938
Copyright © 2005-2015 VT MÄK. All Rights Reserved (
www.mak.com
)