#include <OTC/dispatch/alarm.hh> class OTCEV_Alarm : public OTC_Event {
public:
~OTCEV_Alarm();
inline OTCEV_Alarm(int theAlarmId, long theTime);
inline int alarm() const;
inline long time() const;
void* type() const;
inline static void* typeId();
void dump(ostream& outs) const;
static int set(int theAgentId, long theTime);
static void cancel(int theAlarmId);
static void cancelAgent(int theAgentId);
static OTC_Boolean active(int theAlarmId);
static long period();
static OTC_Job* pending();
};
OTCEV_Alarm
is a derived version of OTC_Event
specifically for
notifying agents that a clock has reached a particular time. The
class also provides the interface for registration of interest in
alarms by agents.
inline OTCEV_Alarm(int theAlarmId, long theTime);
theAlarmId
. theTime
is the
time at which the alarm was triggered,
measured as the number of seconds since
the epoch.
inline int alarm() const;
inline long time() const;
void* type() const;
inline static void* typeId();
void dump(ostream& outs) const;
outs
.
static int set(int theAgentId, long theTime);
theAgentId
is interested in being
notified when time reaches theTime
seconds since the epoch. An ID is returned
which can be used to cancel the alarm.
If an alarm is already registered to expire
at theTime
, the new alarm will be expired
after the existing alarm.
static void cancel(int theAlarmId);
theAlarmId
.
static void cancelAgent(int theAgentId);
theAgentId
is interested in.
static OTC_Boolean active(int theAlarmId);
OTCLIB_TRUE
if the alarm with ID
theAlarmId
has yet to be triggered.
static long period();
static OTC_Job* pending();
0
if no alarms are pending.
0
will never be used as an alarm ID.
OTC_Event
, OTC_EVAgent