RTC Toolkit 4.0.1
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
rtctk::componentFramework::AlertSource Class Reference

Models a single alert source that can be set or cleared. More...

#include <rtctk/componentFramework/alertServiceIf.hpp>

Public Types

using TimePoint = std::chrono::system_clock::time_point
 Timestamp type.
 
using Signal = boost::signals2::signal< void(bool, TimePoint)>
 Signal type emitted on rising and falling alert status flanks.
 

Public Member Functions

 AlertSource ()
 
 ~AlertSource () noexcept
 Resets alert.
 
 AlertSource (AlertSource &&other) noexcept
 Move constructs from other to this object.
 
AlertSourceoperator= (AlertSource &&other) noexcept
 Move assigns from other to this object.
 
void Reset ()
 Clear alert.
 
void Set (bool state=true)
 Set alert status state.
 
bool IsSet () const noexcept
 Query alert status.
 
std::pair< bool, TimePointGetStatus () const noexcept
 Get current status with timestamp of the time the state was last changed.
 
boost::signals2::connection Connect (Signal::slot_type const &slot)
 Connect slot to signal.
 

Detailed Description

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

Member Typedef Documentation

◆ Signal

using rtctk::componentFramework::AlertSource::Signal = boost::signals2::signal<void(bool, TimePoint)>

Signal type emitted on rising and falling alert status flanks.

Arguments:

  • Alert state.
  • Timestamp when state was first reached.

◆ TimePoint

using rtctk::componentFramework::AlertSource::TimePoint = std::chrono::system_clock::time_point

Timestamp type.

Constructor & Destructor Documentation

◆ AlertSource() [1/2]

rtctk::componentFramework::AlertSource::AlertSource ( )

◆ ~AlertSource()

rtctk::componentFramework::AlertSource::~AlertSource ( )
noexcept

Resets alert.

◆ 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.

Member Function Documentation

◆ Connect()

boost::signals2::connection rtctk::componentFramework::AlertSource::Connect ( Signal::slot_type const &  slot)

Connect slot to signal.

Parameters
slotslot 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=()

AlertSource & rtctk::componentFramework::AlertSource::operator= ( AlertSource &&  other)
noexcept

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
statenew alert state.
Postcondition
IsSet() == state

The documentation for this class was generated from the following files: