rili::service::TimeBase Class Referenceabstract
Inheritance diagram for rili::service::TimeBase:
[legend]

Public Types

typedef std::chrono::steady_clock Clock
 

Public Member Functions

template<class Rep , class Period >
CancelablePromise< void > promiseFor (std::chrono::duration< Rep, Period > const &duration) noexcept
 
virtual CancelablePromise< void > promiseUntil (Clock::time_point const &timePoint) noexcept=0
 

Detailed Description

It can be used for example as timeouts implementation. Derivering form this class could be usefull if you wnat provide own implementation related to timer management or to create mocks or stubs for testing purposes.

Remarks
is abstract class
use steady clock
See also
rili::service::Time
rili::Promise

Member Typedef Documentation

typedef std::chrono::steady_clock rili::service::TimeBase::Clock

define type of clock used by Time related services.

Member Function Documentation

template<class Rep , class Period >
CancelablePromise<void> rili::service::TimeBase::promiseFor ( std::chrono::duration< Rep, Period > const &  duration)
inlinenoexcept

This function return rili::CancelablePromise<void> which will be resolved when time(from duration) elapse.

If promise will be canceled resources related to timer will be released. Implementation of this method depends on implementation of promiseUntil.

Remarks
if promise will be canceled resources related to timer will be released.
is thread safe.
See also
rili::CancalablePromise<void>
promiseUntil
Parameters
durationpoints how much time should elapse until returned promise will be resolved
Returns
rili::CancelablePromise<void> which will be resolved after given in duration time
virtual CancelablePromise<void> rili::service::TimeBase::promiseUntil ( Clock::time_point const &  timePoint)
pure virtualnoexcept

promiseUntil is pure virtual method intended to be interface for Time related services.

Derived class should provide implementation, which will resolved returned promise exactly at given time point ar as soon as possible after it.

Note
It is expected that implementation of this method in derived should be thread safe.
Parameters
timePointdefines moment after which returned promise should be resolved.
Returns
rili::CancelablePromise<void> which will be resolved in given timePoint.
See also
promiseFor

Implemented in rili::service::Time.


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