IlsTimer
 
IlsTimer
Category 
Server class
Inheritance Path 
IlsTimer
Description 
This class manages an Rogue Wave Server timer that will call a callback function when it expires. Timers are managed by the Timer Manager, an instance of IlsTimerManager. You can use timers both on the server side and on the client side. Timers can only be used with the multithread version of the server library.
Library 
<server> and <mvcomp>
Header File 
#include <ilserver/timer.h>
Synopsis 
class IlsTime
{
public:
IlsTimer(int sec, int milli= 0,
IlsTimerCallback proc = 0,
IlsAny arg = 0);
IlsTimer(const IlsString& id,
int sec, int milli= 0,
IlsTimerCallback proc = 0,
IlsAny arg = 0);
 
const IlsString& getId() const;
virtual void start();
virtual void start(int sec, int milli = 0);
void stop();
void runOnce(IlsBoolean b);
IlsBoolean runOnce() const;
IlsBoolean isRunning() const;
void autoDelete(IlsBoolean b);
IlsBoolean autoDelete() const;
};
Constructors 
IlsTimer(int sec,
int milli= 0,
IlsTimerCallback proc = 0,
IlsAny arg = 0);
This constructor builds a new timer whose period is sec seconds and milli miliseconds. When the timer is triggered, the proc callback is invoked with arg as the argument. The timer is not started when built. You must call the virtual member function start to start it.
You should instantiate timers on the heap using new. It is your responsibility to delete the timers you create. If a timer is in autoDelete mode and is designed to be triggered only once, it will be deleted by Rogue Wave Server after it has been fired.
IlsTimer(const IlsString& id,
int sec,
int milli= 0,
IlsTimerCallback proc = 0,
IlsAny arg = 0);
This constructor builds a new timer and gives it an identifier.
Member Functions 
const IlsString& getId() const;
This member function returns the identifier of the timer if one has been specified.
[virtual] void start();
This member function starts the timer.
[virtual] void start(int sec, int milli = 0);
This member function starts the timer with a new time period.
void stop();
This member function stops a running timer.
void runOnce(IlsBoolean b);
This member function updates the timer to be fired either only once if the Boolean argument is IlsIlsTrue, or periodically if the argument is IlsIlsFalse. By default, a timer is fired only once.
IlsBoolean runOnce() const;
This member function returns IlsIlsTrue if the timer is set to be fired only once or IlsIlsFalse if it is set to be fired periodically.
IlsBoolean isRunning() const;
This member function returns IlsTrue if the timer is running.
void autoDelete(IlsBoolean b);
This member function updates the timer to mark it as “to be deleted”, after having been fired, if the argument is IlsTrue, or not to be deleted if the argument is IlsFalse.
IlsBoolean autoDelete() const;
This member function returns IlsTrue or IlsFalse depending on whether or not the timer is in autoDelete mode.
See Also 
IlsTimerManager

Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.