ChimeraTK-ApplicationCore 04.06.00
Loading...
Searching...
No Matches
StatusAggregator.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
2// SPDX-License-Identifier: LGPL-3.0-or-later
3#pragma once
4
5#include "ApplicationModule.h"
6#include "ModuleGroup.h"
7#include "StatusAccessor.h"
8#include "StatusWithMessage.h"
9#include "VoidAccessor.h"
10
11#include <list>
12#include <string>
13#include <vector>
14
15namespace ChimeraTK {
16
17 /********************************************************************************************************************/
18
41 enum class PriorityMode {
42 fwok,
43 fwko,
45 ofwk
46 };
47
71 StatusAggregator(ModuleGroup* owner, const std::string& outputName, const std::string& description,
72 PriorityMode mode = PriorityMode::fwok, std::unordered_set<std::string> tagsToAggregate = {},
73 const std::unordered_set<std::string>& outputTags = {},
74 std::string warnMixedMessage = "warning - StatusAggregator inputs have mixed values");
75
77 StatusAggregator() = default;
79
80 void mainLoop() override;
81
82 DataValidity getDataValidity() const override;
83
86 void setWarnMixedMessage(std::string message);
87
88 protected:
91
94 constexpr static auto tagAggregatedStatus = "_ChimeraTK_StatusAggregator_aggregatedStatus";
95
97 constexpr static auto tagInternalVars = "_ChimeraTK_StatusAggregator_internalVars";
98
101
103 std::vector<StatusWithMessageInput> _inputs;
104
107
109 std::unordered_set<std::string> _tagsToAggregate;
110
114 int getPriority(StatusOutput::Status status) const;
115
117 VoidInput _debug{this, "/Debug/statusAggregators", "Print debug info for all status aggregators once."};
118
120 std::string _warnMixedMessage;
121 };
122
123 /********************************************************************************************************************/
124
125} // namespace ChimeraTK
InvalidityTracer application module.
The StatusAggregator collects results of multiple StatusMonitor instances and aggregates them into a ...
StatusAggregator & operator=(StatusAggregator &&other)=default
VoidInput _debug
Allow runtime debugging.
void mainLoop() override
To be implemented by the user: function called in a separate thread executing the main loop of the mo...
PriorityMode
Possible status priority modes used during aggregation of unequal Status values.
@ fw_warn_mixed
fault - warning - ok or off, mixed state of ok or off results in warning
@ ofwk
off - fault - warning - ok
@ fwko
fault - warning - ok - off
@ fwok
fault - warning - off - ok
void populateStatusInput()
Recursivly search for StatusMonitors and other StatusAggregators.
void setWarnMixedMessage(std::string message)
Set a custom message for the warn mixed state.
StatusAggregator(StatusAggregator &&other)=default
std::vector< StatusWithMessageInput > _inputs
All status inputs to be aggregated.
int getPriority(StatusOutput::Status status) const
Convert Status value into a priority (high integer value = high priority), depending on chosen Priori...
PriorityMode _mode
Priority mode used in aggregation.
StatusWithMessage _output
The aggregated status output.
DataValidity getDataValidity() const override
Return the data validity flag.
std::string _warnMixedMessage
Error message for the warn_mixed condition.
static constexpr auto tagInternalVars
Reserved tag which is used to mark internal variables which should not be visible in the virtual hier...
std::unordered_set< std::string > _tagsToAggregate
List of tags to aggregate.
static constexpr auto tagAggregatedStatus
Reserved tag which is used to mark aggregated status outputs (need to stop searching further down the...
A VariableGroup for error status and message reporting.
Convenience class for input accessors.