libassa 3.5.1
|
#include <FdSet.h>
Public Member Functions | |
FdSet () | |
Constructor. | |
bool | setFd (handler_t fd_) |
Set flag (ON) for the argument fd. | |
bool | clear (handler_t fd_) |
Clear flag (OFF) for the argument fd. | |
bool | isSet (handler_t fd_) |
Test whether fd's flag is on. | |
void | sync () |
Sync internals after used by select(3C) | |
void | reset () |
Reset every bit in the set (OFF). | |
int | maxInSet () |
Find out the highest file descriptor in the set. | |
int | numSet () |
Determine how many bits are set (ON) in the set. | |
void | dump () |
Determine highest handler in the set. | |
std::string | dump_c_str () |
Return object state dump as an ASCII string. | |
Private Types | |
typedef std::list< u_int >::iterator | ActiveFDs_Iter |
Private Attributes | |
std::list< u_int > | m_actfds |
Class FdSet.
Wrapper around struct fd_set. This class hides the differences between UNIX/POSIX and WIN32 implementations of fd_set data structure.
The main difference is that while fd_set on POSIX system is represented as bit flags, the same structure on WIN32 system is opaque and not limited by FD_SETSIZE.
In fact, it is represented as an array of SOCKETs (read u_int[FD_SETSIZE]) along with the number of FDs in the set. This allows a WIN32 socket descriptor value to fall anywhere in the range from 0 to max(u_int -1).
handler_t type hides the type difference.
|
private |
|
inline |
Clear flag (OFF) for the argument fd.
fd_ | Bit to clear |
Definition at line 38 of file FdSet.cpp.
References DL, isSet(), m_actfds, and ASSA::REACT.
Referenced by ASSA::Reactor::checkFDs(), ASSA::Reactor::removeHandler(), and ASSA::Reactor::removeIOHandler().
|
inline |
Determine highest handler in the set.
Definition at line 120 of file FdSet.h.
References DL, dump_c_str(), and ASSA::REACT.
std::string FdSet::dump_c_str | ( | ) |
Return object state dump as an ASCII string.
Definition at line 115 of file FdSet.cpp.
References m_actfds, and numSet().
Referenced by dump(), and ASSA::MaskSet::dump().
int FdSet::maxInSet | ( | ) |
Find out the highest file descriptor in the set.
Definition at line 100 of file FdSet.cpp.
References m_actfds.
Referenced by ASSA::MaskSet::max_fd().
|
inline |
Determine how many bits are set (ON) in the set.
Definition at line 125 of file FdSet.h.
References m_actfds.
Referenced by dump_c_str(), and ASSA::Reactor::isAnyReady().
void FdSet::reset | ( | ) |
Reset every bit in the set (OFF).
Definition at line 89 of file FdSet.cpp.
References m_actfds.
Referenced by FdSet(), ASSA::Acceptor< SERVICE_HANDLER, PEER_ACCEPTOR >::handle_read(), and ASSA::MaskSet::reset().
Set flag (ON) for the argument fd.
fd_ | Bit to set. |
Definition at line 19 of file FdSet.cpp.
References m_actfds.
Referenced by ASSA::Reactor::checkFDs(), ASSA::Acceptor< SERVICE_HANDLER, PEER_ACCEPTOR >::handle_read(), and ASSA::Reactor::registerIOHandler().
void FdSet::sync | ( | ) |
|
private |
Definition at line 112 of file FdSet.h.
Referenced by clear(), dump_c_str(), maxInSet(), numSet(), reset(), setFd(), and sync().