Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

MNSelector Class Reference

#include <MNSelector.h>

Inheritance diagram for MNSelector:

Inheritance graph
[legend]
Collaboration diagram for MNSelector:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MNSelector (bool notifiable)
virtual ~MNSelector ()
void select ()
void insert (MNSocketBase *socketptr, bool threaded, const char *caller, u_int32_t set=MNSelector::READSET)
void remove_fd (int fd, u_int32_t set=MNSelector::BOTHSETS)
void remove_fd (MNSocketBase *socketptr)
bool insert_abs_timer (void *data, TimerCallBase *timerptr, const struct timeval &timeout, const char *owner)
bool insert_rel_timer (void *data, TimerCallBase *timerptr, const struct timeval &timeout, const char *owner)
bool insert_periodic_timer (void *data, TimerCallBase *timerptr, const struct timeval &timeout, const char *owner)
bool cancel_timer (TimerCallBase *timerptr)
void cancel_all_timers ()
void wakeup ()
bool notifiable () const

Static Public Attributes

const bool DontWakeup = false
 only to increase readability of caller of insert()
const bool Wakeup = true
 only to increase readability of caller of insert()
const u_int32_t READSET = 0
 Constants.
const u_int32_t WRITESET = 1
const u_int32_t BOTHSETS = 2

Constructor & Destructor Documentation

MNSelector::MNSelector bool  notifiable  ) 
 

Each selector may implement an internal pipe that allows it to be waken up for an arbitrary reason. Such reasons may be the insertion of a new socket, a clean deletion of a class that has a socket registered at this selector, or somesuch. The external notifier classes make sense in specialized cases, but if the selector is shared by many sockets, it is cheaper to integrated the pipe.

Parameters:
notifiable Pass true if the selector should have a notifier pipe. The pipe can only be created at instantiation time.

virtual MNSelector::~MNSelector  )  [virtual]
 


Member Function Documentation

void MNSelector::cancel_all_timers  ) 
 

bool MNSelector::cancel_timer TimerCallBase timerptr  ) 
 

void MNSelector::insert MNSocketBase socketptr,
bool  threaded,
const char *  caller,
u_int32_t  set = MNSelector::READSET
 

Use this function to insert a new file descriptor struct into the selector for observation. Some of the socket classes include this call in their constructor, for others it must be called manually. Look there.

Parameters:
socketptr A pointer to the class that encapsulated the new file descriptor or socket to observe.
threaded Nothing if false. If true, the wakeup member function is called, which signals on the internal notification pipe and to end the select system call. This works only if the selector is notifiable, and results in an MN_FATAL if it is not.
caller A string that identifies the entity that inserts this socket into the selector. This is meant for debugging only.

bool MNSelector::insert_abs_timer void *  data,
TimerCallBase timerptr,
const struct timeval &  timeout,
const char *  owner
 

bool MNSelector::insert_periodic_timer void *  data,
TimerCallBase timerptr,
const struct timeval &  timeout,
const char *  owner
 

bool MNSelector::insert_rel_timer void *  data,
TimerCallBase timerptr,
const struct timeval &  timeout,
const char *  owner
 

bool MNSelector::notifiable  )  const
 

void MNSelector::remove_fd MNSocketBase socketptr  ) 
 

void MNSelector::remove_fd int  fd,
u_int32_t  set = MNSelector::BOTHSETS
 

void MNSelector::select  ) 
 

void MNSelector::wakeup  ) 
 

Send a byte to the notification pipe and wake the selector up for some arbitrary processing. If the selector has been created with this capability, this results in an assertion.


Member Data Documentation

const u_int32_t MNSelector::BOTHSETS = 2 [static]
 

const bool MNSelector::DontWakeup = false [static]
 

only to increase readability of caller of insert()

const u_int32_t MNSelector::READSET = 0 [static]
 

Constants.

const bool MNSelector::Wakeup = true [static]
 

only to increase readability of caller of insert()

const u_int32_t MNSelector::WRITESET = 1 [static]
 


The documentation for this class was generated from the following file:
Generated on Sun Mar 6 13:36:02 2005 for Komssys by doxygen 1.3.8