#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);
};
OTCEV_IOEvent
is a derived version of OTC_Event
specifically
for notifying agents of pending conditions on a file descriptor.
inline OTCEV_IOEvent(int theFd, int theEvents);
theEvents
are pending on file descriptor
theFd
.
inline int events() const;
inline int fd() const;
static int agent(int theFd);
theFd
or 0
if no agent is subscribed
to that file descriptor.
void* type() const;
inline static void* typeId();
void dump(ostream& outs) const;
outs
.
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);
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);
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);
theFd
has.
static void unsubscribeAgent(int theAgentId);
theAgentId
, has in any file
descriptors.
static OTC_Job* job(int theFd, int theEvents);
theFd
of theEvents
.
Returns 0
if there is no subscription
to that file descriptor.
static int events(int theFd);
theFd
, in which any agents
are interested.
inline static int maxFd();
-1
if there are no
agents interested in any file descriptors.
void cancelSource(int theAgentId);
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.
OTC_Event
, OTC_EVAgent