Timer  2.1
 All Classes Files Functions Variables Friends
TimerContext Class Reference

#include <TimerContext.h>

Public Member Functions

virtual ~TimerContext ()
 
void handleTick ()
 

Static Public Member Functions

static TimerContextinstance ()
 

Protected Member Functions

void attach (Timer *timer)
 
void detach (Timer *timer)
 

Private Member Functions

 TimerContext ()
 
TimerContextoperator= (const TimerContext &src)
 Root node of single linked list containing the timers to be kicked. More...
 
 TimerContext (const TimerContext &src)
 

Private Attributes

Timerm_timer
 Timer Context singleton instance variable. More...
 

Static Private Attributes

static TimerContexts_instance = (TimerContext*)0
 

Friends

class Timer
 

Detailed Description

Timer Context.

Features:

  • is like a very simple scheduler.
  • has to be kicked (by calling yield(), scheduleTimers() or TimerContext::handleTick()) as often as possible and/or on regular intervals, i.e. in the Arduino main loop() function:
    #include "Timer.h"
    
    void loop()
    {
      // Kick the timer(s)
      yield();
    
      // .. do something
    }
    
  • holds a single linked list of registered Timer objects, the Timers automatically attach themselves to this on their creation and automatically detach themselves on their destruction.
  • is a Singleton

Constructor & Destructor Documentation

TimerContext::~TimerContext ( )
virtual

Destructor.

TimerContext::TimerContext ( )
private

Constructor.

TimerContext::TimerContext ( const TimerContext src)
private

Member Function Documentation

void TimerContext::attach ( Timer timer)
protected

Add a Timer object to the single linked list.

Parameters
timerTimer object pointer.
void TimerContext::detach ( Timer timer)
protected

Remove specified Timer object from the single linked list.

Parameters
timerTimer object pointer.
void TimerContext::handleTick ( )

Kick all attached Timer objects (calls the Timer::tick() method).

TimerContext * TimerContext::instance ( )
static

Create and/or return singleton instance of Timer Context.

Returns
Pointer to singleton TimerContext object pointer.
TimerContext& TimerContext::operator= ( const TimerContext src)
private

Root node of single linked list containing the timers to be kicked.

Friends And Related Function Documentation

friend class Timer
friend

Member Data Documentation

Timer* TimerContext::m_timer
private

Timer Context singleton instance variable.

TimerContext * TimerContext::s_instance = (TimerContext*)0
staticprivate

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