Vuo
2.4.1
runtime
VuoRuntimePersistentState.cc
Go to the documentation of this file.
1
10
#include "
VuoRuntimePersistentState.hh
"
11
12
#include "
VuoCompositionDiff.hh
"
13
#include "
VuoNodeRegistry.hh
"
14
#include "
VuoNodeSynchronization.hh
"
15
#include "
VuoRuntimeCommunicator.hh
"
16
#include "
VuoRuntimeState.hh
"
17
#include "
VuoThreadManager.hh
"
18
22
VuoRuntimePersistentState::VuoRuntimePersistentState
(
const
char
*workingDirectory)
23
{
24
this->workingDirectory = (strlen(workingDirectory) > 0 ? workingDirectory :
getCurrentWorkingDirectory
());
25
26
lastEventId = 0;
27
28
_isStopRequested =
false
;
29
30
triggerWorkersScheduled = dispatch_group_create();
31
32
compositionDiff
=
new
VuoCompositionDiff
();
33
nodeRegistry
=
new
VuoNodeRegistry
(
this
);
34
communicator
=
new
VuoRuntimeCommunicator
(
this
);
35
threadManager
=
new
VuoThreadManager
();
36
nodeSynchronization
=
new
VuoNodeSynchronization
();
37
}
38
42
VuoRuntimePersistentState::~VuoRuntimePersistentState
(
void
)
43
{
44
dispatch_release(triggerWorkersScheduled);
45
46
delete
compositionDiff
;
47
delete
nodeRegistry
;
48
delete
communicator
;
49
delete
threadManager
;
50
delete
nodeSynchronization
;
51
}
52
56
string
VuoRuntimePersistentState::getCurrentWorkingDirectory
(
void
)
57
{
58
// Keep consistent with VuoGetWorkingDirectory().
59
char
currentWorkingDirectory[PATH_MAX+1];
60
getcwd(currentWorkingDirectory, PATH_MAX+1);
61
return
currentWorkingDirectory;
62
}
63
67
char
*
VuoRuntimePersistentState::getWorkingDirectory
(
void
)
68
{
69
return
strdup(workingDirectory.c_str());
70
}
71
75
unsigned
long
VuoRuntimePersistentState::getNextEventId
(
void
)
76
{
77
return
__sync_add_and_fetch(&lastEventId, 1);
78
}
79
83
bool
VuoRuntimePersistentState::isStopRequested
(
void
)
84
{
85
return
_isStopRequested;
86
}
87
91
void
VuoRuntimePersistentState::setStopRequested
(
bool
isStopRequested)
92
{
93
_isStopRequested =
isStopRequested
;
94
}
95
100
dispatch_group_t
VuoRuntimePersistentState::getTriggerWorkersScheduled
(
void
)
101
{
102
return
triggerWorkersScheduled;
103
}
104
105
extern
"C"
106
{
107
111
unsigned
long
vuoGetNextEventId
(
VuoCompositionState
*compositionState)
112
{
113
VuoRuntimeState
*
runtimeState
= (
VuoRuntimeState
*)compositionState->
runtimeState
;
114
return
runtimeState
->
persistentState
->
getNextEventId
();
115
}
116
120
dispatch_group_t
vuoGetTriggerWorkersScheduled
(
VuoCompositionState
*compositionState)
121
{
122
VuoRuntimeState
*
runtimeState
= (
VuoRuntimeState
*)compositionState->
runtimeState
;
123
return
runtimeState
->
persistentState
->
getTriggerWorkersScheduled
();
124
}
125
126
}
Generated on Mon Feb 7 2022 18:55:36 for Vuo by
1.9.3