ubit::UTimer Class Reference

a UTimer object fires callbacks after a given delay. More...

#include <utimer.hpp>

Inheritance diagram for ubit::UTimer:

ubit::UBrick ubit::UObject List of all members.

Public Member Functions

virtual void onAction (UCall &callback)
virtual void onTimeout (UCall &callback)
 adds a callback that is fired when the time is up.
virtual void start (UTime delay, int ntimes=0, bool auto_delete=true)
 starts the timer.
virtual void stop ()
 stops the timer.
int getDelay () const
void setDelay (UTime)
bool isRunning () const
 returns true if the timer is running.
virtual void fireTimer ()

Friends

class UAppli
class UNatAppli

Detailed Description

a UTimer object fires callbacks after a given delay.

Callbacks can be fired repeatedly (each time after the delay) or only one time. Timers can also be used to postpone operations that take a long amount of time to execute by using a delay of 0 msec.

Exemple:

    uptr<UTimer> t = new UTimer();
    t->onAction( ucall(x, y, printArgs) );
    t->onAction( ucall(obj, val, &Demo::doIt) );
    t->start(1000);
 


Member Function Documentation

virtual void ubit::UTimer::onTimeout ( UCall callback  )  [virtual]

adds a callback that is fired when the time is up.

'callback' is a ucall<> expression (see UCall). It is destroyed when the timer is destroyed except if it is "referenced elsewhere" (see UBrick).

void ubit::UTimer::start ( UTime  delay,
int  ntimes = 0,
bool  auto_delete = true 
) [virtual]

starts the timer.

void ubit::UTimer::stop (  )  [virtual]

stops the timer.

the UTimer is destroyed if it was started in auto_delete mode (see start()) and if it is not referenced elsewhere (see UBrick).


The documentation for this class was generated from the following files:
Generated on Mon Jan 29 00:20:57 2007 for Ubit by  doxygen 1.4.7