SObjectizer  5.8
Loading...
Searching...
No Matches
so_5::timer_id_t Class Reference

An indentificator for the timer. More...

#include <timers.hpp>

Public Member Functions

 timer_id_t () noexcept=default
 Default constructor.
 
 timer_id_t (so_5::intrusive_ptr_t< timer_t > &&timer) noexcept
 Initializing constructor.
 
bool is_active () const noexcept
 
void release () noexcept
 Release the timer event.
 

Private Attributes

so_5::intrusive_ptr_t< timer_tm_timer
 Actual timer.
 

Friends

void swap (timer_id_t &a, timer_id_t &b) noexcept
 Swapping.
 

Detailed Description

An indentificator for the timer.

This type is Copyable and Moveable.

Instances of this type work like smart pointers: a reference counter for a timer event is used. When a timer_id is copied this counter is incremented. When a timer_id dies this counter is decremented. When the last timer_id dies then the timer event if cancelled (released).

The timer event can be cancelled explicitly by calling release() method.

The method is_active() allows to check if timer event is not cancelled yet.

Since
v.5.5.0
Examples
so_5/agent_name/main.cpp, so_5/bind_transformer/main.cpp, so_5/child_soenv/main.cpp, so_5/chstate/main.cpp, so_5/chstate_msg_tracing/main.cpp, so_5/hello_periodic/main.cpp, so_5/intercom_statechart/main.cpp, so_5/machine_control/main.cpp, so_5/mchain_empty_notificator_2/main.cpp, so_5/mchain_handler_formats/main.cpp, and so_5/stop_guard/main.cpp.

Definition at line 81 of file timers.hpp.

Constructor & Destructor Documentation

◆ timer_id_t() [1/2]

so_5::timer_id_t::timer_id_t ( )
defaultnoexcept

Default constructor.

◆ timer_id_t() [2/2]

so_5::timer_id_t::timer_id_t ( so_5::intrusive_ptr_t< timer_t > && timer)
inlinenoexcept

Initializing constructor.

Definition at line 87 of file timers.hpp.

Member Function Documentation

◆ is_active()

bool so_5::timer_id_t::is_active ( ) const
inlinenoexcept

Is this timer event is active?

Return values
trueif timer event wasn't cancelled yet.
falseif timer event was cancelled by release() call.
Note
This method can return true even if timer event is already fired. The false will be returned only if release() was called explicitly.

Definition at line 108 of file timers.hpp.

◆ release()

void so_5::timer_id_t::release ( )
inlinenoexcept

Release the timer event.

Examples
so_5/intercom_statechart/main.cpp, and so_5/mchain_empty_notificator_2/main.cpp.

Definition at line 115 of file timers.hpp.

Friends And Related Symbol Documentation

◆ swap

void swap ( timer_id_t & a,
timer_id_t & b )
friend

Swapping.

Definition at line 94 of file timers.hpp.

Member Data Documentation

◆ m_timer

so_5::intrusive_ptr_t< timer_t > so_5::timer_id_t::m_timer
private

Actual timer.

Definition at line 123 of file timers.hpp.


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