ASSA::FdSet Class Reference

Class FdSet. More...

#include <FdSet.h>

List of all members.

Public Member Functions

 FdSet ()
 Constructor.
 ~FdSet ()
 Destructor.
bool setFd (const unsigned int fd_)
 Set flag (ON) for the argument fd.
bool clear (const unsigned int fd_)
 Clear flag (OFF) for the argument fd.
bool isSet (const unsigned int fd_)
 Test whether fd's flag is on.
void reset (void)
 Reset every bit in set (OFF).
int numSet ()
 Determine how many bits are set (ON) in the set.
void dump (void)
 Write to debug log all bits set.


Detailed Description

Class FdSet.

Wrapper around struct fd_set

Definition at line 35 of file FdSet.h.


Constructor & Destructor Documentation

ASSA::FdSet::FdSet  )  [inline]
 

Constructor.

Definition at line 80 of file FdSet.h.

References reset().

00081 {
00082     reset (); 
00083 }

ASSA::FdSet::~FdSet  )  [inline]
 

Destructor.

Definition at line 44 of file FdSet.h.

00044 {}


Member Function Documentation

bool ASSA::FdSet::clear const unsigned int  fd_  )  [inline]
 

Clear flag (OFF) for the argument fd.

Parameters:
fd_ Bit to clear
Returns:
false if argument is out of bounds; true otherwise.

Definition at line 98 of file FdSet.h.

Referenced by ASSA::Reactor::checkFDs(), ASSA::Reactor::dispatchHandler(), and ASSA::Reactor::removeIOHandler().

00099 {
00100     if ( fd_ <= FD_SETSIZE ) {
00101         FD_CLR (fd_, this); 
00102         return true;
00103     }
00104     return false;
00105 }

void ASSA::FdSet::dump void   )  [inline]
 

Write to debug log all bits set.

Definition at line 137 of file FdSet.h.

References DL, isSet(), and ASSA::REACT.

Referenced by ASSA::MaskSet::dump().

00138 {
00139     for (int i=0; i< FD_SETSIZE; i++) {
00140         if ( isSet (i) ) {
00141             DL((REACT,"fd # %d\n",i));
00142         }
00143     }
00144 }

bool ASSA::FdSet::isSet const unsigned int  fd_  )  [inline]
 

Test whether fd's flag is on.

Parameters:
fd_ Bit to test
Returns:
true if fd_ bit is set; false otherwise

Definition at line 109 of file FdSet.h.

Referenced by ASSA::Reactor::dispatchHandler(), dump(), and numSet().

00110 { 
00111     return FD_ISSET (fd_, this); 
00112 }

int ASSA::FdSet::numSet  )  [inline]
 

Determine how many bits are set (ON) in the set.

Returns:
Number of bits set

Definition at line 123 of file FdSet.h.

References isSet().

Referenced by ASSA::Reactor::isAnyReady().

00124 {
00125     register int i, n;
00126 
00127     for (i=0, n=0; i < FD_SETSIZE; i++) {
00128         if ( isSet (i) ) {
00129             n++;
00130         }
00131     }
00132     return n;
00133 }

void ASSA::FdSet::reset void   )  [inline]
 

Reset every bit in set (OFF).

Definition at line 116 of file FdSet.h.

Referenced by FdSet(), ASSA::Acceptor< SERVICE_HANDLER, PEER_ACCEPTOR >::handle_read(), and ASSA::MaskSet::reset().

00117 { 
00118     ::memset(this, 0, sizeof (*this)); 
00119 }

bool ASSA::FdSet::setFd const unsigned int  fd_  )  [inline]
 

Set flag (ON) for the argument fd.

Parameters:
fd_ Bit to set.
Returns:
false if argument is out of bounds, true otherwise.

Definition at line 87 of file FdSet.h.

Referenced by ASSA::Reactor::checkFDs(), ASSA::Acceptor< SERVICE_HANDLER, PEER_ACCEPTOR >::handle_read(), and ASSA::Reactor::registerIOHandler().

00088 { 
00089     if ( fd_ <= FD_SETSIZE ) {
00090         FD_SET (fd_, this); 
00091         return true;
00092     }
00093     return false;
00094 }


The documentation for this class was generated from the following file:
Generated on Wed Jun 21 18:54:02 2006 for libassa by  doxygen 1.4.6