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

FileDescriptorManager Class Reference

Manages a collection of FileDescriptors, using fd_sets and select(). More...

#include <FileDescriptor.h>

Inheritance diagram for FileDescriptorManager:

Inheritance graph
[legend]
Collaboration diagram for FileDescriptorManager:

Collaboration graph
[legend]
List of all members.

[NOHEADER]

void update (ref< FileDescriptor > const &fd, bool forRead, bool forWrite)
void remove (int fdnum)
class  FileDescriptor

Public Methods

 FileDescriptorManager ()
void closeAll ()
int getMaxFd () const
void fillFdSet (fd_set *rfds, fd_set *wfds) const
void processFdSet (fd_set *rfds, fd_set *wfds)
bool poll (struct timeval const *timeout)
void mainloop ()
int getCountRegistered () const

Private Types

typedef vector< ref<FileDescriptor> > descVec_t

Private Attributes

descVec_t allFds
int countRegistered
int maxFd
fd_set readFds
fd_set writeFds

Detailed Description

Manages a collection of FileDescriptors, using fd_sets and select().

Definition at line 186 of file FileDescriptor.h.


Member Typedef Documentation

typedef vector< ref< FileDescriptor > > FileDescriptorManager::descVec_t< ref<FileDescriptor> > [private]
 

Allow lookup of object from fd number.

Definition at line 188 of file FileDescriptor.h.


Constructor & Destructor Documentation

FileDescriptorManager::FileDescriptorManager ( )
 


Member Function Documentation

void FileDescriptorManager::closeAll ( )
 

Force close all FileDescriptors managed by this.

void FileDescriptorManager::fillFdSet ( fd_set * rfds,
fd_set * wfds ) const
 

Fills in all entries for managed fds.

int FileDescriptorManager::getCountRegistered ( ) const [inline]
 

Statistics.

Definition at line 229 of file FileDescriptor.h.

int FileDescriptorManager::getMaxFd ( ) const [inline]
 

Returns the maximum FD managed.

Definition at line 210 of file FileDescriptor.h.

void FileDescriptorManager::mainloop ( )
 

Repeatedly calls poll(NULL).

bool FileDescriptorManager::poll ( struct timeval const * timeout )
 

Wait for incoming work for up to the given timeout, or forever if timeout is NULL.

Returns:
true for "work processed"; false for "timed out"

void FileDescriptorManager::processFdSet ( fd_set * rfds,
fd_set * wfds )
 

Runs work from a post-select() fdset.

void FileDescriptorManager::remove ( int fdnum ) [private]
 

Removes the entry for a given FileDescriptor completely.

void FileDescriptorManager::update ( ref< FileDescriptor > const & fd,
bool forRead,
bool forWrite ) [private]
 

Adds, updates or disables the entry for a given FileDescriptor.


Friends And Related Function Documentation

class FileDescriptor [friend]
 

Definition at line 197 of file FileDescriptor.h.


Member Data Documentation

descVec_t FileDescriptorManager::allFds [private]
 

All FileDescriptor objects registered with this fdMgr.

Definition at line 190 of file FileDescriptor.h.

int FileDescriptorManager::countRegistered [private]
 

Count of registered FileDescriptor objects.

Definition at line 191 of file FileDescriptor.h.

int FileDescriptorManager::maxFd [private]
 

Maximum fd number of all registered FileDescriptors.

Definition at line 192 of file FileDescriptor.h.

fd_set FileDescriptorManager::readFds [private]
 

Set of fds interested in read-available events.

Definition at line 193 of file FileDescriptor.h.

fd_set FileDescriptorManager::writeFds [private]
 

Set of fds interested in write-available events.

Definition at line 194 of file FileDescriptor.h.


The documentation for this class was generated from the following file:
Generated at Wed Aug 15 01:05:28 2001 for mps-cpp by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001