ChimeraTK-ApplicationCore 04.06.00
Loading...
Searching...
No Matches
StatusWithMessage.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 "ScalarAccessor.h"
6#include "StatusAccessor.h"
7#include "Utilities.h"
8#include "VariableGroup.h"
9
10#include <ChimeraTK/ControlSystemAdapter/StatusWithMessageReader.h>
11#include <ChimeraTK/DataConsistencyGroup.h>
12#include <ChimeraTK/ForwardDeclarations.h>
13#include <ChimeraTK/RegisterPath.h>
14
15#include <utility>
16
17namespace ChimeraTK {
18
19 /********************************************************************************************************************/
20
27 StatusWithMessage(VariableGroup* owner, const std::string& qualifiedStatusVariableName,
28 const std::string& description = "", const std::unordered_set<std::string>& tags = {});
29
30 StatusWithMessage() = default;
31
36 void write(StatusOutput::Status status, std::string message);
37 void writeIfDifferent(StatusOutput::Status status, std::string message);
38
42 void writeOk();
43 void writeOkIfDifferent();
44
49 void set(StatusOutput::Status status, std::string message);
50
54 void setOk();
55
57 constexpr static auto tagStatusHasMessage = "_ChimeraTK_StatusOutput_hasMessage";
58
59 // FIXME: This needs additional modification in ControlSystemAdapter if changed
60 // https://redmine.msktools.desy.de/issues/12241
61 // NOLINTNEXTLINE(readability-identifier-naming)
63 // NOLINTNEXTLINE(readability-identifier-naming)
65 };
66
67 /********************************************************************************************************************/
68
74 struct StatusWithMessageInput : StatusWithMessageReaderBase<StatusWithMessageInput>, public VariableGroup {
76 StatusWithMessageInput(VariableGroup* owner, const std::string& qualifiedName, const std::string& description,
77 const std::unordered_set<std::string>& tags = {});
78
81 void setMessageSource(std::string msgInputName = "");
82
83 // TODO: This needs additional modification in ControlSystemAdapter if changed
84 // https://redmine.msktools.desy.de/issues/12241
85 // NOLINTNEXTLINE(readability-identifier-naming)
87 // NOLINTNEXTLINE(readability-identifier-naming)
88 ScalarPushInput<std::string> _message; // left uninitialized, if no message source provided
89 };
90
91 /********************************************************************************************************************/
92
93} /* namespace ChimeraTK */
Convenience class for input scalar accessors with UpdateMode::push.
InvalidityTracer application module.
Convenience class for output scalar accessors (always UpdateMode::push)
Special ScalarOutput which represents a status which can be aggregated by the StatusAggregator.
Special StatusPushInput which reads from a StatusOutput and also handles the type conversion.
A VariableGroup for error status and message reporting.
void writeOk()
Set status to OK, clear the message and write the outputs.
static constexpr auto tagStatusHasMessage
Reserved tag which is used to mark presense of the message output.
void setOk()
Set status to OK and clear the message, but to not write.
void set(StatusOutput::Status status, std::string message)
Set status and message but to not write.
void writeIfDifferent(StatusOutput::Status status, std::string message)
ScalarOutput< std::string > _message
void write(StatusOutput::Status status, std::string message)
Set the status and the message and write the outputs.
This is for consistent readout of StatusWithMessage - ApplicationCore version.
void setMessageSource(std::string msgInputName="")
read associated status message from given (fully qualified) msgInputName.
ScalarPushInput< std::string > _message