ChimeraTK-ApplicationCore 04.06.00
Loading...
Searching...
No Matches
EventMessageAggregator.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK
2// SPDX-License-Identifier: LGPL-3.0-or-later
3#pragma once
4
5#include "ConfigReader.h"
6#include "PeriodicTrigger.h"
7#include "StatusWithMessage.h"
8#include "VoidAccessor.h"
9
10#include <ChimeraTK/ScalarRegisterAccessor.h>
11
12namespace ChimeraTK {
13
14 /********************************************************************************************************************/
15
23 class AggregatableMessage : public ScalarOutput<std::string> {
24 public:
25 AggregatableMessage(Module* owner, const std::string& name, std::string unit, const std::string& description,
26 const std::unordered_set<std::string>& tags = {});
27
29 using ScalarOutput::operator=;
30
31 static constexpr std::string_view aggregatableMessageTag{"_ChimeraTK_AggregatableMessage"};
32 };
33
34 /********************************************************************************************************************/
35
52 public:
54
56
57 private:
58 class Impl : public ApplicationModule {
59 public:
60 Impl(ModuleGroup* owner, const std::string& name, const std::string& description,
61 const std::unordered_set<std::string>& tags = {});
62
64
65 void mainLoop() override;
66
67 protected:
68 std::vector<ScalarPushInput<std::string>> _inputs;
69
70 StatusWithMessage _output{this, "event", ""};
71
72 VoidInput _clear{this, "clear", ""};
73 ScalarPushInput<uint64_t> _autoClearTimer{this, "AutoClearTimer/tick", "", ""};
74
75 uint32_t _autoClearSeconds{appConfig().get<uint32_t>("Configuration/autoClearEventMessage", 300)};
76 };
77
78 Impl _impl{this, ".", ""};
79
80 PeriodicTrigger _autoClearTimer{this, "AutoClearTimer", "1 Hz trigger for the auto clear timer"};
81 };
82
83 /********************************************************************************************************************/
84
85} // namespace ChimeraTK
Specialised ScalarOutput for sending event messages which can be aggregated by the EventMessageAggreg...
static constexpr std::string_view aggregatableMessageTag
ApplicationModule()=default
Default constructor: Allows late initialisation of modules (e.g.
friend class ChimeraTK::Model::Impl
const T & get(std::string variableName) const
Get value for given configuration variable.
Module to aggregate messages from AggregatableMessage outputs.
ModuleGroup()=default
Default constructor to allow late initialisation of module groups.
Base class for ApplicationModule and DeviceModule, to have a common interface for these module types.
Definition Module.h:21
static ConfigReader & appConfig()
Obtain the ConfigReader instance of the application.
Definition Module.cc:251
InvalidityTracer application module.
Convenience class for output scalar accessors (always UpdateMode::push)
void mainLoop() override