#include <Timeout.h>
Public Member Functions | |
Timeout (const std::string &label, unsigned long milli) | |
standard constructor for new timeouts | |
Timeout (const std::string &label, void *inst, unsigned long milli) | |
constructor for new timeouts which are owned by an instance of a class | |
Timeout & | operator= (const Timeout &t) |
assignment operator | |
void | extend (unsigned long msec) |
extend the timeout termination by the specified time. | |
void | reset (unsigned long msec) |
reset the timeout to the specified time, and reset the 'expired' flag. | |
void | cancel () |
cancel the Timeout immediately | |
unsigned long | poll (const Time::Stamp &t) |
bool | isExpired () const |
test whether or not the timeout has fired or not | |
Static Public Member Functions | |
const Timeout * | findByName (const std::string &lbl, void *inst=0) |
Access an existing timeout by name. | |
unsigned long | pollAll () |
poll all running timeouts. | |
void | extendByName (const std::string &lbl, unsigned long msec) |
helper function to lookup a timeout and call extend(). | |
void | extendByName (const std::string &lbl, void *inst, unsigned long msec) |
void | cancelByName (const std::string &lbl, void *inst=0) |
helper function to lookup a timeout and call cancel(). | |
Public Attributes | |
SigC::Signal0< void > | Expired |
The timeout signal. | |
Protected Types | |
typedef std::map< Label, Timeout * > | TimeoutMap |
Protected Attributes | |
const Label | _label |
the unique label of the timeout | |
Time::Stamp | _due |
interval at which the timeout is due | |
bool | _fired |
flag if the timeout has expired | |
Static Protected Attributes | |
TimeoutMap | _allTimeouts |
|
standard constructor for new timeouts
|
|
constructor for new timeouts which are owned by an instance of a class
|
|
helper function to lookup a timeout and call cancel(). As above, a missing timeout will cause an InvalidOperation to be thrown. |
|
extend the timeout termination by the specified time. This has no effect if the timeout has already fired
|
|
helper function to lookup a timeout and call extend(). If the timeout is not found, InvalidOperation will be thrown |
|
Access an existing timeout by name. This will throw an exception if no such timeout exists. Also note that it returns a reference, so don't mis-treat the poor thing |
|
poll all running timeouts. This calls poll() on each timeout, and hence triggers expiry signals and so on. Timeout accuracy is directly related to how frequently polling is done (but timeouts aren't supposed to be accurate, so once per main loop iteration should be fine) |
|
reset the timeout to the specified time, and reset the 'expired' flag. This means invoking reset() is equivalent to destroying the Timeout object and creating a new one with the same name. |