Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

TimerPort Class Reference

Timer ports are used to provide synchronized timing events when managed under a "service thread" such as SocketService. synchronized millisecond timing for service threads. More...

#include <thread.h>

Inheritance diagram for TimerPort::

SerialPort SocketPort List of all members.

Public Methods

 TimerPort ()
 Create a timer, mark it as inactive, and set the initial "start" time to the creation time of the timer object. More...

void setTimer (timeout_t timeout=0)
 Set a new start time for the object based on when this call is made and optionally activate the timer for a specified number of milliseconds. More...

void incTimer (timeout_t timeout)
 Set a timeout based on the current time reference value either from object creation or the last setTimer(). More...

void endTimer (void)
 This is used to "disable" the service thread from expiring the timer object. More...

timeout_t getTimer (void)
 This is used by service threads to determine how much time remains before the timer expires based on a timeout specified in setTimer() or incTimer(). More...

timeout_t getElapsed (void)
 This is used to determine how much time has elapsed since a timer port setTimer benchmark time was initially set. More...


Detailed Description

Timer ports are used to provide synchronized timing events when managed under a "service thread" such as SocketService. synchronized millisecond timing for service threads.

This is made into a stand-alone base class since other derived libraries (such as the serial handlers) may also use the pooled "service thread" model and hence also require this code for managing timing.

Author:
David Sugar <dyfet@ostel.com>


Constructor & Destructor Documentation

TimerPort::TimerPort  
 

Create a timer, mark it as inactive, and set the initial "start" time to the creation time of the timer object.

This allows "incTimer" to initially refer to time delays relative to the original start time of the object.


Member Function Documentation

void TimerPort::endTimer void  
 

This is used to "disable" the service thread from expiring the timer object.

It does not effect the reference time from either creation or a setTimer().

timeout_t TimerPort::getElapsed void  
 

This is used to determine how much time has elapsed since a timer port setTimer benchmark time was initially set.

This allows one to use setTimer() to set the timer to the current time and then measure elapsed time from that point forward.

return time elapsed in milliseconds, or -1 if inactive.

timeout_t TimerPort::getTimer void  
 

This is used by service threads to determine how much time remains before the timer expires based on a timeout specified in setTimer() or incTimer().

It can also be called after setting a timeout with incTimer() to see if the current timeout has already expired and hence that the application is already delayed and should skip frame(s).

return time remaining in milliseconds, or -1 if inactive.

void TimerPort::incTimer timeout_t   timeout
 

Set a timeout based on the current time reference value either from object creation or the last setTimer().

This reference can be used to time synchronize realtime data over specified intervals and force expiration when a new frame should be released in a synchronized manner.

Parameters:
timeout   delay in milliseconds from reference.

Reimplemented in SerialPort, and SocketPort.

void TimerPort::setTimer timeout_t   timeout = 0
 

Set a new start time for the object based on when this call is made and optionally activate the timer for a specified number of milliseconds.

This can be used to set the starting time of a realtime session.

Parameters:
timeout   delay in milliseconds from "now"

Reimplemented in SerialPort, and SocketPort.


The documentation for this class was generated from the following file:
Generated at Tue Nov 20 12:34:37 2001 for CommonC++ by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001