NAME
OTCEV_IOEvent -
Event object to notify of pending conditions on a file descriptor.
SYNOPSIS
#include <OTC/dispatch/ioevent.hh>
class OTCEV_IOEvent : public OTC_Event
{
public:
~OTCEV_IOEvent();
inline OTCEV_IOEvent(int theFd, int theEvents);
inline int events() const;
inline int fd() const;
static int agent(int theFd);
void* type() const;
inline static void* typeId();
void dump(ostream& outs) const;
static void subscribe(int theAgentId, int theFd, int theEvents);
static void unsubscribe(
int theAgentId,
int theFd,
int theEvents=~0
);
static void unsubscribeFd(int theFd);
static void unsubscribeAgent(int theAgentId);
static OTC_Job* job(int theFd, int theEvents);
static int events(int theFd);
inline static int maxFd();
protected:
void cancelSource(int theAgentId);
};
CLASS TYPE
Concrete
DESCRIPTION
OTCEV_IOEvent is a derived version of OTC_Event specifically
for notifying agents of pending conditions on a file descriptor.
CONSTRUCTION
inline OTCEV_IOEvent(int theFd, int theEvents);
Creates an event object indicating that
theEvents are pending on file descriptor
theFd.
QUERY
inline int events() const;
Returns the events pending on the file
descriptor.
inline int fd() const;
Returns the number of the file descriptor.
static int agent(int theFd);
Returns the ID of the agent subscribed to
theFd or 0 if no agent is subscribed
to that file descriptor.
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
In the following functions, theEvents is a bit mask formed from
a bitwise AND of the individual events that are of interest.
Individual events which you may subscribe to are: input, output
and priority input. These are selected using the variables:
OTCLIB_POLLIN, OTCLIB_POLLOUT and OTCLIB_POLLPRI.
static void subscribe(int theAgentId, int theFd, int theEvents);
Registers that the agent with ID number
theAgentId, is interested in being
notified, when theEvents are pending on
the file descriptor theFd. If another
agent is already subscribed to theFd,
an exception is raised. If the agent is
already subscribed to the file descriptor,
the set of events will be added to those
already subscribed to.
static void unsubscribe(int theAgentId, int theFd, int theEvents=~0);
Cancels interest by the agent with ID
number theAgentId in theEvents on the
file descriptor theFd. If theEvents
is ~0, it cancels interest in any events
on that file descriptor by that agent.
static void unsubscribeFd(int theFd);
Cancels the subscription of any agent
subscribed to theFd has.
static void unsubscribeAgent(int theAgentId);
Cancels all interest that the agent with
ID number theAgentId, has in any file
descriptors.
SCHEDULING
static OTC_Job* job(int theFd, int theEvents);
Returns a job for delivery to the agent
interested in theFd of theEvents.
Returns 0 if there is no subscription
to that file descriptor.
static int events(int theFd);
Returns the set of events on the file
descriptor theFd, in which any agents
are interested.
inline static int maxFd();
Returns the number of the highest numbered
file descriptor in which any agent is
interested. Returns -1 if there are no
agents interested in any file descriptors.
NON DELIVERY
void cancelSource(int theAgentId);
Unsubscribes the agent with ID
theAgentId to which this event was to be
delivered, from all file descriptor
events. This function will be called when
the agent to which this event was to be
delivered does not exist.
SEE ALSO
OTC_Event, OTC_EVAgent
LIBRARY
OTC
AUTHOR(S)
Graham Dumpleton
COPYRIGHT
Copyright 1993 OTC LIMITED
Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED