12#ifndef RTCTK_COMPONENTFRAMEWORK_ALERTSERVICE_HPP
13#define RTCTK_COMPONENTFRAMEWORK_ALERTSERVICE_HPP
22#include <taiclock/taiClock.hpp>
61 void Publish(
const AlertInfo& reduced,
const std::vector<AlertInfo>& alerts)
noexcept override;
66 log4cplus::Logger m_logger;
78 void Publish(
const AlertInfo& reduced,
const std::vector<AlertInfo>& alerts)
noexcept override;
81 log4cplus::Logger m_logger;
99 void Publish(
const AlertInfo& reduced,
const std::vector<AlertInfo>& alerts)
noexcept override;
104 std::unique_ptr<EventPublisherIf> m_publisher;
105 log4cplus::Logger m_logger;
123 void Publish(
const AlertInfo& reduced,
const std::vector<AlertInfo>& alerts)
noexcept override;
128 log4cplus::Logger m_logger;
136 void AddObserver(std::unique_ptr<AlertObserverIf> o);
138 void AddAlert(
const std::string&
id,
const std::string& text);
140 void SetAlert(
const std::string&
id,
bool state =
true);
147 std::recursive_mutex m_mtx;
149 std::vector<AlertInfo> m_alerts;
150 size_t m_last_size = 0;
151 std::vector<std::unique_ptr<AlertObserverIf>> m_observers;
157 m_status.AddObserver(std::move(o));
161 return {m_status, id, text};
165 return m_status.GetInfo(
"").state;
169 m_status.ClearAlerts();
AlertEventPublisher(const std::string &name, EventServiceIf &ev)
Constructor.
Definition alertService.cpp:297
void Publish(const AlertInfo &reduced, const std::vector< AlertInfo > &alerts) noexcept override
Definition alertService.cpp:304
void Publish(const AlertInfo &reduced, const std::vector< AlertInfo > &alerts) noexcept override
Definition alertService.cpp:274
AlertLogger()
Definition alertService.cpp:271
void Publish(const AlertInfo &reduced, const std::vector< AlertInfo > &alerts) noexcept override
Definition alertService.cpp:237
AlertOldbPublisher(const std::string &name, OldbIf &oldb)
Constructor.
Definition alertService.cpp:212
Alert Service interface.
Definition alertServiceIf.hpp:138
Definition alertService.hpp:154
bool GetStatus() override
Returns the overall alert status.
Definition alertService.hpp:164
void ClearAll() override
Clears all active alerts.
Definition alertService.hpp:168
AlertSource MakeAlertSource(const std::string &id, const std::string &text) override
Creates a new alert source for a specified alert condition.
Definition alertService.hpp:160
void AddObserver(std::unique_ptr< AlertObserverIf > o)
Definition alertService.hpp:156
Models a single alert source that can be set or cleared.
Definition alertServiceIf.hpp:47
Definition alertService.hpp:131
void AddAlert(const std::string &id, const std::string &text)
Definition alertService.cpp:79
~AlertStatus()
Definition alertService.cpp:70
void ClearAlerts()
Definition alertService.cpp:133
void AddObserver(std::unique_ptr< AlertObserverIf > o)
Definition alertService.cpp:74
AlertInfo GetInfo(const std::string &id)
Definition alertService.cpp:164
AlertStatus()
Definition alertService.cpp:67
void SetAlert(const std::string &id, bool state=true)
Definition alertService.cpp:96
AlertTelegrafPublisher(const std::string &name, TelegrafAdapter &telegraf_adapter)
Constructor.
Definition alertService.cpp:337
void Publish(const AlertInfo &reduced, const std::vector< AlertInfo > &alerts) noexcept override
Definition alertService.cpp:350
Interface class for providing pub/sub facilities for JSON events.
Definition eventServiceIf.hpp:29
Base interface for all OLDB adapters.
Definition oldbIf.hpp:25
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:22
Header file for OldbIf, which defines the API for OldbAdapters.
Definition alertService.hpp:29
taiclock::TaiClock::time_point TimePoint
Definition alertService.hpp:30
std::string text
Definition alertService.hpp:37
std::string id
Definition alertService.hpp:36
AlertInfo(bool state, TimePoint since, const std::string &id, const std::string &text)
Definition alertService.cpp:60
bool state
Definition alertService.hpp:34
TimePoint since
Definition alertService.hpp:35
Definition alertService.hpp:40
virtual ~AlertObserverIf()=default
virtual void Publish(const AlertInfo &reduced, const std::vector< AlertInfo > &alerts) noexcept=0
Header file needed to instantiate an TelegrafAdapter.