timer_driver Class Reference

Provides platform-independent timer support. More...

#include <timer_driver.h>

Inheritance diagram for timer_driver:

Inheritance graph
[legend]
Collaboration diagram for timer_driver:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 timer_driver ()
virtual ~timer_driver ()
 IMPLEMENT_CLASS_NAME ("timer_driver")
bool set_timer (int duration, timed_object *to_invoke)
 sets a timer to call "to_invoke" every "duration" milliseconds.
bool zap_timer (timed_object *to_drop)
 removes the timer that was established for "to_drop".
void handle_system_timer ()
 invoked by the OS timer support and must be called by main thread.

Static Public Member Functions

static timer_driverglobal_timer_driver ()
 the first time this is invoked, it creates a program-wide timer driver.

Detailed Description

Provides platform-independent timer support.

Multiple objects can be hooked to the timer to be called when their interval elapses. The driver allows new timed_objects to be added as needed.

NOTE: Only one of the timer_driver objects is allowed per program.

Definition at line 35 of file timer_driver.h.


Constructor & Destructor Documentation

timer_driver::timer_driver (  ) 

Definition at line 147 of file timer_driver.cpp.

References INITIAL_TIMER_GRANULARITY, NIL, OUR_SIGNAL, and timer_driver_private_handler().

timer_driver::~timer_driver (  )  [virtual]

Definition at line 167 of file timer_driver.cpp.

References FUNCDEF, mutex_base::lock(), LOG, NIL, OUR_SIGNAL, PAUSE_TIME, portable::sleep_ms(), mutex_base::unlock(), and WHACK().


Member Function Documentation

timer_driver::IMPLEMENT_CLASS_NAME ( "timer_driver"   ) 

bool timer_driver::set_timer ( int  duration,
timed_object to_invoke 
)

sets a timer to call "to_invoke" every "duration" milliseconds.

if the object "to_invoke" already exists, then its duration is changed.

Definition at line 244 of file timer_driver.cpp.

References FUNCDEF, LOG, and negative().

bool timer_driver::zap_timer ( timed_object to_drop  ) 

removes the timer that was established for "to_drop".

do not zap a timer from its own callback! that could cause synchronization problems.

Definition at line 218 of file timer_driver.cpp.

References FUNCDEF, LOG, and negative().

void timer_driver::handle_system_timer (  ) 

invoked by the OS timer support and must be called by main thread.

Definition at line 270 of file timer_driver.cpp.

References continuable_error, FUNCDEF, INITIAL_TIMER_GRANULARITY, array< contents >::length(), LOG, MAX_TIMER_PREDICTION, earth_time::now(), static_class_name, and istring::t().

static timer_driver& timer_driver::global_timer_driver (  )  [static]

the first time this is invoked, it creates a program-wide timer driver.


The documentation for this class was generated from the following files:
Generated on Fri Aug 29 04:30:50 2008 for HOOPLE Libraries by  doxygen 1.5.1