libcommonc++  0.7
IntervalTimer Class Referenceabstract

A high-precision interval timer that does not require blocking or polling from a dedicated thread. More...

#include <IntervalTimer.h++>

Public Member Functions

virtual ~IntervalTimer ()
 Destructor. More...
 
void start ()
 Start the timer. More...
 
void stop ()
 Stop the timer. More...
 
uint_t getInitialDelay () const
 Get the initial delay, in milliseconds. More...
 
void setInitialDelay (uint_t initialDelay)
 Set the initial delay, in milliseconds. More...
 
uint_t getInterval () const
 Get the interval, in milliseconds. More...
 
void setInterval (uint_t interval)
 Set the interval, in milliseconds. More...
 
bool isRunning () const
 Determine if the timer is currently running. More...
 

Protected Member Functions

 IntervalTimer (uint_t initialDelay, uint_t interval=0)
 Construct a new IntervalTimer with the given initial delay and interval. More...
 
virtual void fired ()=0
 Callback. More...
 

Detailed Description

A high-precision interval timer that does not require blocking or polling from a dedicated thread.

This is an abstract class which should be subclassed to provide an implementation of the fired() method, which is invoked each time the timer fires.

NOTE: This class is currently not implemented on Mac OS X.

Author
Mark Lindner

Constructor & Destructor Documentation

◆ ~IntervalTimer()

~IntervalTimer ( )
virtual

Destructor.

◆ IntervalTimer()

IntervalTimer ( uint_t  initialDelay,
uint_t  interval = 0 
)
protected

Construct a new IntervalTimer with the given initial delay and interval.

Parameters
initialDelayThe delay, in milliseconds, between the time that the timer is started and the first time it fires.
intervalThe interval, in milliseconds, between subsequent firings. If 0, the timer is a "one-shot" timer.

Member Function Documentation

◆ fired()

virtual void fired ( )
protectedpure virtual

Callback.

This method is invoked each time the timer fires.

◆ getInitialDelay()

uint_t getInitialDelay ( ) const
inline

Get the initial delay, in milliseconds.

◆ getInterval()

uint_t getInterval ( ) const
inline

Get the interval, in milliseconds.

◆ isRunning()

bool isRunning ( ) const
inline

Determine if the timer is currently running.

◆ setInitialDelay()

void setInitialDelay ( uint_t  initialDelay)
inline

Set the initial delay, in milliseconds.

The new value will take effect the next time the timer is started.

◆ setInterval()

void setInterval ( uint_t  interval)
inline

Set the interval, in milliseconds.

The new value will take effect the next time the timer is started.

◆ start()

void start ( )

Start the timer.

Exceptions
SystemExceptionIf an error occurs while creating the timer.

◆ stop()

void stop ( )

Stop the timer.


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