Public Types | Public Member Functions

atscppapi::AsyncTimer Class Reference

This class provides an implementation of AsyncProvider that acts as a timer. More...

#include <AsyncTimer.h>

Inherits atscppapi::AsyncProvider.

Collaboration diagram for atscppapi::AsyncTimer:
Collaboration graph
[legend]

Public Types

enum  Type { TYPE_ONE_OFF = 0, TYPE_PERIODIC }

Public Member Functions

 AsyncTimer (Type type, int period_in_ms, int initial_period_in_ms=0)
 Constructor.
virtual ~AsyncTimer ()
void run ()
 Starts the timer.
void cancel ()
 Base implementation just breaks communication channel with receiver.

Detailed Description

This class provides an implementation of AsyncProvider that acts as a timer.

It sends events at the set frequency. Calling the destructor will stop the events. A one-off timer just sends one event. Calling the destructor before this event will cancel the timer.

For either type, user must delete the timer.

See example async_timer for sample usage.

Definition at line 48 of file AsyncTimer.h.


Member Enumeration Documentation

Enumerator:
TYPE_ONE_OFF 
TYPE_PERIODIC 

Definition at line 51 of file AsyncTimer.h.


Constructor & Destructor Documentation

atscppapi::AsyncTimer::AsyncTimer ( Type  type,
int  period_in_ms,
int  initial_period_in_ms = 0 
)

Constructor.

Parameters:
type A one-off timer fires only once and a periodic timer fires periodically.
period_in_ms The receiver will receive an event every this many milliseconds.
initial_period_in_ms The first event will arrive after this many milliseconds. Subsequent events will have "regular" cadence. This is useful if the timer is set for a long period of time (1hr etc.), but an initial event is required. Value of 0 (default) indicates no initial event is desired.
virtual atscppapi::AsyncTimer::~AsyncTimer (  )  [virtual]

Member Function Documentation

void atscppapi::AsyncTimer::cancel ( void   )  [virtual]

Base implementation just breaks communication channel with receiver.

Implementations should add business logic here.

Reimplemented from atscppapi::AsyncProvider.

void atscppapi::AsyncTimer::run (  )  [virtual]

Starts the timer.

Implements atscppapi::AsyncProvider.


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