|
| Timer (const std::shared_ptr< Service > &service) |
| Initialize timer with a given Asio service.
|
|
| Timer (const std::shared_ptr< Service > &service, const CppCommon::UtcTime &time) |
| Initialize timer with a given Asio service and absolute expiry time.
|
|
| Timer (const std::shared_ptr< Service > &service, const CppCommon::Timespan ×pan) |
| Initialize timer with a given Asio service and expiry time relative to now.
|
|
| Timer (const std::shared_ptr< Service > &service, const std::function< void(bool)> &action) |
| Initialize timer with a given Asio service and action function.
|
|
| Timer (const std::shared_ptr< Service > &service, const std::function< void(bool)> &action, const CppCommon::UtcTime &time) |
| Initialize timer with a given Asio service, action function and absolute expiry time.
|
|
| Timer (const std::shared_ptr< Service > &service, const std::function< void(bool)> &action, const CppCommon::Timespan ×pan) |
| Initialize timer with a given Asio service, action function and expiry time relative to now.
|
|
| Timer (const Timer &)=delete |
|
| Timer (Timer &&)=delete |
|
virtual | ~Timer ()=default |
|
Timer & | operator= (const Timer &)=delete |
|
Timer & | operator= (Timer &&)=delete |
|
std::shared_ptr< Service > & | service () noexcept |
| Get the Asio service.
|
|
std::shared_ptr< asio::io_service > & | io_service () noexcept |
| Get the Asio IO service.
|
|
asio::io_service::strand & | strand () noexcept |
| Get the Asio service strand for serialized handler execution.
|
|
CppCommon::UtcTime | expire_time () const |
| Get the timer's expiry time as an absolute time.
|
|
CppCommon::Timespan | expire_timespan () const |
| Get the timer's expiry time relative to now.
|
|
virtual bool | Setup (const CppCommon::UtcTime &time) |
| Setup the timer with absolute expiry time.
|
|
virtual bool | Setup (const CppCommon::Timespan ×pan) |
| Setup the timer with expiry time relative to now.
|
|
virtual bool | Setup (const std::function< void(bool)> &action) |
| Setup the timer with an action function.
|
|
virtual bool | Setup (const std::function< void(bool)> &action, const CppCommon::UtcTime &time) |
| Setup the timer with an action function and absolute expiry time.
|
|
virtual bool | Setup (const std::function< void(bool)> &action, const CppCommon::Timespan ×pan) |
| Setup the timer with an action function and expiry time relative to now.
|
|
virtual bool | WaitAsync () |
| Wait for the timer (asynchronous)
|
|
virtual bool | WaitSync () |
| Wait for the timer (synchronous)
|
|
virtual bool | Cancel () |
| Cancel any wait operation on the timer.
|
|
Timer.
Timer is used to plan and perform delayed operation.
Thread-safe.
- Examples
- asio_timer.cpp.
Definition at line 29 of file timer.h.