Rudiments
Public Member Functions
intervaltimer Class Reference

List of all members.

Public Member Functions

 intervaltimer (int32_t which)
 ~intervaltimer ()
void initialize ()
void setInitialInterval (long seconds, long microseconds)
void setPeriodicInterval (long seconds, long microseconds)
void setIntervals (long seconds, long microseconds)
void getInitialInterval (long *seconds, long *microseconds) const
void getPeriodicInterval (long *seconds, long *microseconds) const
bool start () const
bool start (long *seconds, long *microseconds) const
bool getTimeRemaining (long *seconds, long *microseconds) const
bool stop ()

Detailed Description

The intervaltimer class provides methods for interfacing with timers.

A timer has an initial interval and periodic intervals. The timer will raise a signal after the initial interval and then again after each periodic interval.


Constructor & Destructor Documentation

intervaltimer::intervaltimer ( int32_t  which)

Creates an instance of the intervaltimer class.

    "which" must be one of:
    ITIMER_REAL - decrements in real time, raises SIGALRM
    ITIMER_VIRTUAL - decrements when the process is
                        executing but not during system
                        calls, raises SIGVTALRM
    ITIMER_PROF - decrements when the process is 
                        executing or and during system
                        calls, raises SIGPROF  
intervaltimer::~intervaltimer ( )

Deletes this instance of the intervaltimer class.


Member Function Documentation

void intervaltimer::getInitialInterval ( long *  seconds,
long *  microseconds 
) const

Sets "seconds" and "microseconds" to the timer's initial interval values.

void intervaltimer::getPeriodicInterval ( long *  seconds,
long *  microseconds 
) const

Sets "seconds" and "microseconds" to the timer's periodic interval values.

bool intervaltimer::getTimeRemaining ( long *  seconds,
long *  microseconds 
) const

Sets "seconds" and "microseconds" to the time remaining before the timer will raise the signal.

void intervaltimer::initialize ( )

Sets (or resets) the initial and periodic intervals to 0 seconds and 0 microseconds.

void intervaltimer::setInitialInterval ( long  seconds,
long  microseconds 
)

Sets the timer's initial interval to "seconds" seconds and "microseconds" microseconds.

void intervaltimer::setIntervals ( long  seconds,
long  microseconds 
)

Sets the timer's initial and periodic intervals both to "seconds" seconds and "microseconds" microseconds.

void intervaltimer::setPeriodicInterval ( long  seconds,
long  microseconds 
)

Sets the timer's periodic interval to "seconds" seconds and "microseconds" microseconds.

bool intervaltimer::start ( ) const

Starts (or restarts) the timer. It will first run for the initial interval, then raise a signal, then run over and over for the periodic interval, raising the signal at the end of each interval.

bool intervaltimer::start ( long *  seconds,
long *  microseconds 
) const

Starts (or restarts) the timer. It will first run for the initial interval, then raise a signal, then run over and over for the periodic interval, raising the signal at the end of each interval. "seconds" and "microseconds" will be set to the interval that the timer was using prior to calling start().

bool intervaltimer::stop ( )

Stops the currently running timer, but preserves it's initial and perodic intervals.