NAME
OTCEV_Alarm -
Event object to notify of a clock reaching a particular time.
SYNOPSIS
#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();
};
CLASS TYPE
Concrete
DESCRIPTION
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.
CONSTRUCTION
inline OTCEV_Alarm(int theAlarmId, long theTime);
Creates an event object for the alarm with
ID number theAlarmId. theTime is the
time at which the alarm was triggered,
measured as the number of seconds since
the epoch.
QUERY
inline int alarm() const;
Returns the ID number of the alarm.
inline long time() const;
Returns the time at which the alarm was
triggered, measured as the number of
seconds since the epoch.
IDENTIFICATION
void* type() const;
Returns a value that uniquely identifies
this type of event.
inline static void* typeId();
Returns a value that uniquely identifies
this type of event.
DEBUGGING
void dump(ostream& outs) const;
Dumps info about the event onto outs.
SUBSCRIPTION
static int set(int theAgentId, long theTime);
Registers that the agent identified by ID
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);
Cancels any interest in the alarm
with ID theAlarmId.
static void cancelAgent(int theAgentId);
Cancels all alarms that the agent with
ID theAgentId is interested in.
static OTC_Boolean active(int theAlarmId);
Returns OTCLIB_TRUE if the alarm with ID
theAlarmId has yet to be triggered.
SCHEDULING
static long period();
Returns the time in seconds until the
next alarm is due to expire.
static OTC_Job* pending();
Returns a job for the next pending
alarm or 0 if no alarms are pending.
NOTES
Time is measured as the number of seconds since the epoch. In most
systems the epoch is January 1, 1970.
A value of 0 will never be used as an alarm ID.
SEE ALSO
OTC_Event, OTC_EVAgent
LIBRARY
OTC
AUTHOR(S)
Graham Dumpleton
COPYRIGHT
Copyright 1993 OTC LIMITED
Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED