Models a single alert source that can be set or cleared.
More...
#include <alertServiceIf.hpp>
|
using | TimePoint = std::chrono::system_clock::time_point |
| Timestamp type. More...
|
|
using | Signal = boost::signals2::signal< void(bool, TimePoint)> |
| Signal type emitted on rising and falling alert status flanks. More...
|
|
Models a single alert source that can be set or cleared.
Instances should normally be created from AlertServiceIf::MakeAlertSource.
Changes to the state are emitted as signal to connected slots/observers.
- Thread Safety
- thread-compatible
◆ Signal
Signal type emitted on rising and falling alert status flanks.
Arguments:
- Alert state.
- Timestamp when state was first reached.
◆ TimePoint
◆ AlertSource() [1/2]
rtctk::componentFramework::AlertSource::AlertSource |
( |
| ) |
|
◆ ~AlertSource()
rtctk::componentFramework::AlertSource::~AlertSource |
( |
| ) |
|
|
noexcept |
◆ AlertSource() [2/2]
rtctk::componentFramework::AlertSource::AlertSource |
( |
AlertSource && |
other | ) |
|
|
noexcept |
Move constructs from other to this object.
- Postcondition
- Other is in a moved-from state where it is only safe to destroy or move-assign it.
◆ Connect()
boost::signals2::connection rtctk::componentFramework::AlertSource::Connect |
( |
Signal::slot_type const & |
slot | ) |
|
Connect slot to signal.
- Parameters
-
slot | slot to connect which will be invoked by the thread calling Set() or Reset(). |
- Returns
- connection object used for connection management.
◆ GetStatus()
std::pair<bool, TimePoint> rtctk::componentFramework::AlertSource::GetStatus |
( |
| ) |
const |
|
inlinenoexcept |
Get current status with timestamp of the time the state was last changed.
- Returns
- Current alert status and timetamp.
◆ IsSet()
bool rtctk::componentFramework::AlertSource::IsSet |
( |
| ) |
const |
|
inlinenoexcept |
Query alert status.
- Returns
- true if alert is set.
◆ operator=()
Move assigns from other to this object.
- Postcondition
- Other is in a moved-from state where it is only safe to destroy or move-assign it.
◆ Reset()
void rtctk::componentFramework::AlertSource::Reset |
( |
| ) |
|
|
inline |
Clear alert.
If alert changes state the signal is emitted.
- Postcondition
IsSet() == false
◆ Set()
void rtctk::componentFramework::AlertSource::Set |
( |
bool |
state = true | ) |
|
Set alert status state.
If alert changes state the signal is emitted.
- Parameters
-
- Postcondition
IsSet() == state
The documentation for this class was generated from the following files: