Skip to content
Snippets Groups Projects
Commit 83df8c81 authored by Martin Killenberg's avatar Martin Killenberg
Browse files

introduced oneUpAndHide in the StatusMonitor

parent 49390fac
No related branches found
No related tags found
No related merge requests found
......@@ -42,7 +42,7 @@ namespace ChimeraTK {
StatusMonitor(EntityOwner* owner, const std::string& name, const std::string& description,
HierarchyModifier modifier, const std::string& input, const std::string& output,
const std::unordered_set<std::string>& tags)
: ApplicationModule(owner, name, description, modifier), _parameterTags(tags), watch(this, input, "", "", tags),
: ApplicationModule(owner, name, description, modifier), _parameterTags(tags), oneUp(this, input, tags),
status(this, output, "", "", tags) {}
StatusMonitor(EntityOwner* owner, const std::string& name, const std::string& description,
......@@ -50,18 +50,18 @@ namespace ChimeraTK {
const std::string& output, const std::unordered_set<std::string>& outputTags,
const std::unordered_set<std::string>& parameterTags)
: ApplicationModule(owner, name, description, modifier), _parameterTags(parameterTags),
watch(this, input, "", "", inputTags), status(this, output, "", "", outputTags) {}
oneUp(this, input, inputTags), status(this, output, "", "", outputTags) {}
StatusMonitor(EntityOwner* owner, const std::string& name, const std::string& description,
HierarchyModifier modifier, const std::string& input, const std::unordered_set<std::string>& inputTags,
const std::string& output, const std::unordered_set<std::string>& parameterTags)
: ApplicationModule(owner, name, description, modifier), _parameterTags(parameterTags),
watch(this, input, "", "", inputTags), status(this, output, "", "", {}) {}
oneUp(this, input, inputTags), status(this, output, "", "", {}) {}
StatusMonitor(EntityOwner* owner, const std::string& name, const std::string& description,
HierarchyModifier modifier, const std::string& input, const std::string& output,
const std::unordered_set<std::string>& inputTags, const std::unordered_set<std::string>& outputTags)
: ApplicationModule(owner, name, description, modifier), _parameterTags({}), watch(this, input, "", "", inputTags),
: ApplicationModule(owner, name, description, modifier), _parameterTags({}), oneUp(this, input, inputTags),
status(this, output, "", "", outputTags) {}
~StatusMonitor() override {}
......@@ -69,8 +69,16 @@ namespace ChimeraTK {
/**Tags for parameters. This makes it easier to connect them to e.g, to control system*/
std::unordered_set<std::string> _parameterTags;
/**Input value that should be monitored*/
ScalarPushInput<T> watch;
/**Input value that should be monitored. It is moved one level up, so it's parallel to this monitor object.*/
struct OneUp : public VariableGroup {
OneUp(EntityOwner* owner, const std::string& watchName, const std::unordered_set<std::string>& tags)
: VariableGroup(owner, "hidden", "", HierarchyModifier::oneUpAndHide), watch(this, watchName, "", "", tags) {}
ScalarPushInput<T> watch;
} oneUp;
// Conveniance reference to avoid the "oneUp" in the code
ScalarPushInput<T>& watch = oneUp.watch;
/**One of four possible states to be reported*/
ScalarOutput<uint16_t> status;
};
......
......@@ -46,7 +46,7 @@ BOOST_AUTO_TEST_CASE(testMaxMonitor) {
error.write();
test.stepApplication();
auto watch = test.getScalar<double_t>(std::string("/monitor/watch"));
auto watch = test.getScalar<double_t>(std::string("/watch"));
watch = 40.1;
watch.write();
test.stepApplication();
......@@ -134,7 +134,7 @@ BOOST_AUTO_TEST_CASE(testMinMonitor) {
error.write();
test.stepApplication();
auto watch = test.getScalar<uint>(std::string("/monitor/watch"));
auto watch = test.getScalar<uint>(std::string("/watch"));
watch = 55;
watch.write();
test.stepApplication();
......@@ -232,7 +232,7 @@ BOOST_AUTO_TEST_CASE(testRangeMonitor) {
errorLowerLimit.write();
test.stepApplication();
auto watch = test.getScalar<int>(std::string("/monitor/watch"));
auto watch = test.getScalar<int>(std::string("/watch"));
watch = 40;
watch.write();
test.stepApplication();
......@@ -338,7 +338,7 @@ BOOST_AUTO_TEST_CASE(testExactMonitor) {
requiredValue.write();
test.stepApplication();
auto watch = test.getScalar<float>(std::string("/monitor/watch"));
auto watch = test.getScalar<float>(std::string("/watch"));
watch = 40.9;
watch.write();
test.stepApplication();
......@@ -396,7 +396,7 @@ BOOST_AUTO_TEST_CASE(testStateMonitor) {
stateValue.write();
test.stepApplication();
auto watch = test.getScalar<uint8_t>(std::string("/monitor/watch"));
auto watch = test.getScalar<uint8_t>(std::string("/watch"));
watch = 1;
watch.write();
test.stepApplication();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment