11#ifndef RTCTK_COMPONENTFRAMEWORK_ALERTSERVICE_HPP
12#define RTCTK_COMPONENTFRAMEWORK_ALERTSERVICE_HPP
21#include <taiclock/taiClock.hpp>
71 void Publish(
const AlertInfo& reduced,
const std::vector<AlertInfo>& alerts)
noexcept override;
76 log4cplus::Logger m_logger;
88 void Publish(
const AlertInfo& reduced,
const std::vector<AlertInfo>& alerts)
noexcept override;
91 log4cplus::Logger m_logger;
109 void Publish(
const AlertInfo& reduced,
const std::vector<AlertInfo>& alerts)
noexcept override;
114 std::unique_ptr<EventPublisherIf> m_publisher;
115 log4cplus::Logger m_logger;
133 void Publish(
const AlertInfo& reduced,
const std::vector<AlertInfo>& alerts)
noexcept override;
138 log4cplus::Logger m_logger;
146 void AddObserver(std::unique_ptr<AlertObserverIf> o);
148 void AddAlert(
const std::string&
id,
const std::string& text);
150 void SetAlert(
const std::string&
id,
bool state =
true);
157 std::recursive_mutex m_mtx;
159 std::vector<AlertInfo> m_alerts;
160 size_t m_last_size = 0;
161 std::vector<std::unique_ptr<AlertObserverIf>> m_observers;
167 m_status.AddObserver(std::move(o));
171 return {m_status, id, text};
175 return m_status.GetInfo(
"").state;
179 m_status.ClearAlerts();
AlertEventPublisher(const std::string &name, EventServiceIf &ev)
Constructor.
Definition alertService.cpp:287
void Publish(const AlertInfo &reduced, const std::vector< AlertInfo > &alerts) noexcept override
Definition alertService.cpp:294
void Publish(const AlertInfo &reduced, const std::vector< AlertInfo > &alerts) noexcept override
Definition alertService.cpp:264
AlertLogger()
Definition alertService.cpp:261
void Publish(const AlertInfo &reduced, const std::vector< AlertInfo > &alerts) noexcept override
Definition alertService.cpp:227
AlertOldbPublisher(const std::string &name, OldbIf &oldb)
Constructor.
Definition alertService.cpp:202
Alert Service interface.
Definition alertServiceIf.hpp:138
Definition alertService.hpp:164
bool GetStatus() override
Returns the overall alert status.
Definition alertService.hpp:174
void ClearAll() override
Clears all active alerts.
Definition alertService.hpp:178
AlertSource MakeAlertSource(const std::string &id, const std::string &text) override
Creates a new alert source for a specified alert condition.
Definition alertService.hpp:170
void AddObserver(std::unique_ptr< AlertObserverIf > o)
Definition alertService.hpp:166
Models a single alert source that can be set or cleared.
Definition alertServiceIf.hpp:47
Definition alertService.hpp:141
void AddAlert(const std::string &id, const std::string &text)
Definition alertService.cpp:68
~AlertStatus()
Definition alertService.cpp:59
void ClearAlerts()
Definition alertService.cpp:122
void AddObserver(std::unique_ptr< AlertObserverIf > o)
Definition alertService.cpp:63
AlertInfo GetInfo(const std::string &id)
Definition alertService.cpp:153
AlertStatus()
Definition alertService.cpp:56
void SetAlert(const std::string &id, bool state=true)
Definition alertService.cpp:85
AlertTelegrafPublisher(const std::string &name, TelegrafAdapter &telegraf_adapter)
Constructor.
Definition alertService.cpp:328
void Publish(const AlertInfo &reduced, const std::vector< AlertInfo > &alerts) noexcept override
Definition alertService.cpp:341
AlertUnknownException(const std::string &id)
Definition alertService.cpp:45
Interface class for providing pub/sub facilities for JSON events.
Definition eventServiceIf.hpp:28
Base interface for all OLDB adapters.
Definition oldbIf.hpp:24
RtctkException() noexcept
Definition exceptions.cpp:112
Implementation of the Telegraf Adapter.
Definition telegrafAdapter.hpp:93
Framework-provided event definitions.
Low-level interface of the event service.
Logging Support Library based on log4cplus.
Definition commandReplier.cpp:21
Header file for OldbIf, which defines the API for OldbAdapters.
Definition alertService.hpp:39
taiclock::TaiClock::time_point TimePoint
Definition alertService.hpp:40
std::string text
Definition alertService.hpp:47
std::string id
Definition alertService.hpp:46
AlertInfo(bool state, TimePoint since, const std::string &id, const std::string &text)
Definition alertService.cpp:49
bool state
Definition alertService.hpp:44
TimePoint since
Definition alertService.hpp:45
Definition alertService.hpp:50
virtual ~AlertObserverIf()=default
virtual void Publish(const AlertInfo &reduced, const std::vector< AlertInfo > &alerts) noexcept=0
Header file needed to instantiate an TelegrafAdapter.