SmartSoft Component-Developer API
Public Types | Public Member Functions | List of all members
Smart::ITimerManager Class Referenceabstract

#include <smartITimerManager.h>

Public Types

using TimerId = long int
 

Public Member Functions

virtual ~ITimerManager ()=default
 
virtual TimerId scheduleTimer (ITimerHandler *handler, const void *act, const Duration &oneshot_time, const Duration &interval=Duration::zero())=0
 Schedule a timer. More...
 
virtual int cancelTimer (const TimerId &timer_id, const void **act=nullptr)=0
 Cancel a single timer. More...
 
virtual int resetTimerInterval (const TimerId &timer_id, const Duration &interval)=0
 Resets the interval of a timer. More...
 
virtual int cancelTimersOf (ITimerHandler *handler)=0
 Cancel all timers associated with a handler. More...
 
virtual void deleteAllTimers ()=0
 Delete all currently scheduled timers. More...
 

Member Typedef Documentation

◆ TimerId

Constructor & Destructor Documentation

◆ ~ITimerManager()

virtual Smart::ITimerManager::~ITimerManager ( )
virtualdefault

Member Function Documentation

◆ cancelTimer()

virtual int Smart::ITimerManager::cancelTimer ( const TimerId timer_id,
const void **  act = nullptr 
)
pure virtual

Cancel a single timer.

Parameters
timer_idto cancel
acta pointer (to a pointer) to retrieve the act that was given on scheduleTimer(). Can be used to release resources (see Asynchronous Completion Token (ACT), POSA2). owned by act. If act == nullptr, nothing is retrieved.
Returns
0 on success
-1 on error

◆ cancelTimersOf()

virtual int Smart::ITimerManager::cancelTimersOf ( ITimerHandler handler)
pure virtual

Cancel all timers associated with a handler.

Parameters
handlercancel timers associated with this handler
Returns
number of timers canceled.

◆ deleteAllTimers()

virtual void Smart::ITimerManager::deleteAllTimers ( )
pure virtual

Delete all currently scheduled timers.

◆ resetTimerInterval()

virtual int Smart::ITimerManager::resetTimerInterval ( const TimerId timer_id,
const Duration interval 
)
pure virtual

Resets the interval of a timer.

Parameters
timer_idto change
intervalnew timer interval (relative to the current time)
Returns
0 on success
-1 on error

◆ scheduleTimer()

virtual TimerId Smart::ITimerManager::scheduleTimer ( ITimerHandler handler,
const void *  act,
const Duration oneshot_time,
const Duration interval = Duration::zero() 
)
pure virtual

Schedule a timer.

Parameters
handlerThe handler that will be called when the timer expires.
acta value that will be passed to the handler (see Asynchronous Completion Token (ACT), POSA2)
oneshot_timerelative time for the first timer expiration
intervalInterval for periodic timers. A single shot timer is scheduled by default.
Returns
timer_id: -1 on failure. Unique time id else. This id can be used to cancel a timer before it expires with cancelTimer() and to change the the interval of a timer with resetTimerInterval().

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