Newer
Older
Martin Killenberg
committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <ChimeraTK/ApplicationCore/ApplicationCore.h>
#include <ChimeraTK/ApplicationCore/TestFacility.h>
using namespace ChimeraTK;
struct TestApp : public Application {
TestApp() : Application("test") {}
~TestApp() override { shutdown(); }
ControlSystemModule cs;
// hides itself, and then produces A and B as sub-grops. Works.
struct A : public ApplicationModule {
using ApplicationModule::ApplicationModule;
struct : public VariableGroup {
using VariableGroup::VariableGroup;
ScalarPushInput<int> in{this, "input", "", ""};
} self{this, "A", ""};
// the output of A is the input of B
struct : public VariableGroup {
using VariableGroup::VariableGroup;
ScalarOutput<int> in{this, "input", "", ""};
} b{this, "B", ""};
void mainLoop() override {
b.in = int(self.in);
b.in.write();
}
} a{this, "A", "", HierarchyModifier::hideThis};
// tries to hide itself like A, but fails. We get B/B/input and B/output
struct B : public ApplicationModule {
using ApplicationModule::ApplicationModule;
struct : public VariableGroup {
using VariableGroup::VariableGroup;
ScalarPushInput<int> in{this, "input", "", ""};
} self{this, "B", ""};
// the output of B is one level up (global output)
ScalarOutput<int> out{this, "output", "", ""};
void mainLoop() override {
out = int(self.in);
out.write();
}
} b{this, "B", "", HierarchyModifier::hideThis}; // name it "HiddenB" here and it works
void defineConnections() override { findTag(".*").connectTo(cs); }
};
int main() {
TestApp t;
ChimeraTK::TestFacility testFacility;
testFacility.runApplication();
t.dumpConnections();
t.dump();
}