Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

strmod::unievent::UnixEventRegistry Class Reference

Manages events associated with various file descriptors and/or signals. More...

#include <UniEvent/UnixEventRegistry.h>

Inheritance diagram for strmod::unievent::UnixEventRegistry:

Inheritance graph
[legend]
List of all members.

Public Types

typedef lcore::enum_set< FDConditions,
FD_Readable, FD_Invalid > 
FDCondSet
 A set of 0 or more FDConditions.

enum  FDConditions {
  FD_Readable, FD_Writeable, FD_Error, FD_Closed,
  FD_Invalid
}
 These enums are intended to be used with the enum_set, FDCondSet. More...


Public Methods

 UnixEventRegistry ()
 This is an abstract base class, so the constructor has little meaning.

virtual ~UnixEventRegistry ()
 An abstract base class with no members, has nothing to destruct.

virtual void registerFDCond (int fd, const FDCondSet &condbits, const EventPtr &ev)=0
 Register the event '*ev' to be fired on file descriptor condition true.

virtual void freeFD (int fd)=0
 Removes all entries associated with a particular file descriptor.

virtual void onSignal (int signo, const EventPtr &e)=0
 On the given signal, post the given event.

virtual void clearSignal (int signo, const EventPtr &e)=0
 Stop posting the given event for the given signal.

virtual void clearSignal (int signo)=0
 Stop posting any events for the given signal.

virtual void doPoll (bool wait=false)=0
 Actually call the UNIX poll system call, and dispatch resulting events.


Static Public Attributes

const FDCondSet all_fdconds
 The set of all FDConditions.


Static Protected Attributes

const unsigned int max_handled_by_S = 128
 Maximum number of signals the handled_by_S can keep track of.

UnixEventRegistry * handled_by_S [max_handled_by_S]
 Keeps track of which UnixEventRegistry is handling which signal.


Detailed Description

Manages events associated with various file descriptors and/or signals.

Definition at line 24 of file UnixEventRegistry.h.


Member Enumeration Documentation

enum strmod::unievent::UnixEventRegistry::FDConditions
 

These enums are intended to be used with the enum_set, FDCondSet.

In maintaining this enum, FD_Readable must be first, and FD_Invalid must be last.

Note:
fd means file descriptor.
Enumeration values:
FD_Readable  Can the fd be read from without blocking?
FD_Writeable  Can the fd be written to without blocking?
FD_Error  Is the fd in some kind of error state?
FD_Closed  Has the fd been closed by another process?
FD_Invalid  Was the fd never opened?

Definition at line 32 of file UnixEventRegistry.h.


Member Function Documentation

virtual void strmod::unievent::UnixEventRegistry::clearSignal int    signo [pure virtual]
 

Stop posting any events for the given signal.

Parameters:
signo The signal to stop posting events for.
This function should be avoided as you may interfere unkowingly with other parts of the program that are still depending on their events being posted when the signal happens.

Implemented in strmod::unievent::UnixEventPoll.

virtual void strmod::unievent::UnixEventRegistry::clearSignal int    signo,
const EventPtr   e
[pure virtual]
 

Stop posting the given event for the given signal.

Parameters:
signo The signal to stop posting the event for.
ev The event to stop posting.

Implemented in strmod::unievent::UnixEventPoll.

virtual void strmod::unievent::UnixEventRegistry::onSignal int    signo,
const EventPtr   e
[pure virtual]
 

On the given signal, post the given event.

Parameters:
signo The number of the signal to post an event for.
ev The event to post.

Implemented in strmod::unievent::UnixEventPoll.


Member Data Documentation

UnixEventRegistry * strmod::unievent::UnixEventRegistry::handled_by_S [static, protected]
 

Initial value:

 {
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}
Keeps track of which UnixEventRegistry is handling which signal.

This is so that instances of derived classes (since this is an abstract class) have a scratchpad to use to communicate with eachother about who's handling which signal. This scratchpad is used both to allow actual signal handlers to know which class to poke when a signal does arrive, and also so that different handlers don't both try to handle the same signal.

Definition at line 21 of file UnixEventRegistry.cxx.


The documentation for this class was generated from the following files:
Generated on Wed Jan 29 00:32:58 2003 for libNet by doxygen1.3-rc1