|
join 1.0
lightweight network framework library
|
base timer class. More...
#include <timer.hpp>


Public Member Functions | |
| BasicTimer () | |
| create instance. | |
| BasicTimer (const BasicTimer &other)=delete | |
| copy constructor. | |
| BasicTimer & | operator= (const BasicTimer &other)=delete |
| copy assignment operator. | |
| BasicTimer (BasicTimer &&other) noexcept | |
| move constructor. | |
| BasicTimer & | operator= (BasicTimer &&other) noexcept |
| move assignment operator. | |
| virtual | ~BasicTimer () |
| destroy instance. | |
| template<class Rep , class Period , typename Func > | |
| void | setOneShot (std::chrono::duration< Rep, Period > duration, Func &&callback) |
| arm the timer as a one-shot timer. | |
| template<class Clock , class Duration , typename Func > | |
| void | setOneShot (std::chrono::time_point< Clock, Duration > timePoint, Func &&callback) |
| arm the timer as a one-shot timer with absolute time. | |
| template<class Rep , class Period , typename Func > | |
| void | setInterval (std::chrono::duration< Rep, Period > duration, Func &&callback) |
| arm the timer as a periodic timer. | |
| void | cancel () |
| cancel the timer. | |
| bool | active () const |
| check if timer is running. | |
| std::chrono::nanoseconds | remaining () const |
| get the remaining time until expiration. | |
| std::chrono::nanoseconds | interval () const noexcept |
| get the interval of the running periodic timer. | |
| bool | oneShot () const noexcept |
| check if timer is a one-shot timer. | |
| int | type () const noexcept |
| get the timer type. | |
Protected Member Functions | |
| virtual void | onReceive () override |
| method called when data are ready to be read on handle. | |
| virtual int | handle () const noexcept override |
| get native handle. | |
Protected Member Functions inherited from join::EventHandler | |
| virtual void | onClose () |
| method called when handle is closed. | |
| virtual void | onError () |
| method called when an error occured on handle. | |
| EventHandler ()=default | |
| create instance. | |
| virtual | ~EventHandler ()=default |
| destroy instance. | |
Static Protected Member Functions | |
| static itimerspec | toTimerSpec (std::chrono::nanoseconds ns, bool periodic=false) noexcept |
| convert nsec to itimerspec. | |
base timer class.
|
inline |
create instance.
|
delete |
copy constructor.
| other | other object to copy. |
|
inlinenoexcept |
move constructor.
| other | other object to move. |
|
inlinevirtual |
destroy instance.
|
inline |
check if timer is running.
|
inline |
cancel the timer.
|
inlineoverrideprotectedvirtualnoexcept |
|
inlinenoexcept |
get the interval of the running periodic timer.
|
inlinenoexcept |
check if timer is a one-shot timer.
|
inlineoverrideprotectedvirtual |
method called when data are ready to be read on handle.
Reimplemented from join::EventHandler.
|
inlinenoexcept |
move assignment operator.
| other | other object to assign. |
|
delete |
copy assignment operator.
| other | other object to assign. |
|
inline |
get the remaining time until expiration.
|
inline |
arm the timer as a periodic timer.
| duration | interval duration between timer expirations. |
| callback | function to call on each timer expiration. |
|
inline |
arm the timer as a one-shot timer.
| duration | timeout duration before timer expires. |
| callback | function to call when timer expires. |
|
inline |
arm the timer as a one-shot timer with absolute time.
| timePoint | absolute time when timer should expire. |
| callback | function to call when timer expires. |
|
inlinestaticprotectednoexcept |
convert nsec to itimerspec.
| ns | value to convert. |
| periodic | specify if periodic. |
|
inlinenoexcept |
get the timer type.