fd_set
abstraction.
#include <ace/Handle_Set.h>
class ACE_Handle_Set {
public:
friend class ACE_Handle_Set_Iterator;
enum{ MAXSIZE = ACE_DEFAULT_SELECT_REACTOR_SIZE };
ACE_Handle_Set (void);
ACE_Handle_Set (const ACE_FD_SET_TYPE &mask);
~ACE_Handle_Set (void);
void reset (void);
int is_set (ACE_HANDLE handle) const;
void set_bit (ACE_HANDLE handle);
void clr_bit (ACE_HANDLE handle);
int num_set (void) const;
ACE_HANDLE max_set (void) const;
void sync (ACE_HANDLE max);
operator fd_set *();
fd_set *fdset (void);
ACE_Handle_Set & operator= (const ACE_Handle_Set &);
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;
private:
int size_;
ACE_HANDLE max_handle_;
ACE_HANDLE min_handle_;
fd_set mask_;
enum{ WORDSIZE = NFDBITS, #if !defined ( ACE_WIN32) NUM_WORDS = howmany (MAXSIZE, NFDBITS), #endif NBITS = 256 };
static int count_bits (u_long n);
static int bitpos (u_long bit);
void set_max (ACE_HANDLE max);
static const char nbits_[NBITS];
};
fd_set
. In particular, no range checking is performed, so
it's important not to set or clear bits that are outside the
ACE_DEFAULT_SELECT_REACTOR_SIZE
.
ACE_Handle_Set (void);
ACE_Handle_Set (const ACE_FD_SET_TYPE &mask);
ACE_FD_SET_TYPE
is a typedef
based on the platform's native
type used for masks passed to select
.
~ACE_Handle_Set (void);
void reset (void);
int is_set (ACE_HANDLE handle) const;
handle
is enabled. No range checking is
performed so handle
must be less than
ACE_DEFAULT_SELECT_REACTOR_SIZE
.
void set_bit (ACE_HANDLE handle);
handle
. No range checking is performed so handle
must be less than ACE_DEFAULT_SELECT_REACTOR_SIZE
.
void clr_bit (ACE_HANDLE handle);
handle
. No range checking is performed so
handle
must be less than ACE_DEFAULT_SELECT_REACTOR_SIZE
.
int num_set (void) const;
ACE_HANDLE max_set (void) const;
void sync (ACE_HANDLE max);
fd_set
up to handle max
to find the new
max_handle
(highest bit set) and size
(how many bits set) values.
This is useful for evaluating the changes after the handle set has
been manipulated in some way other than member functions; for example,
after select
modifies the fd_set
.
operator fd_set *();
fd_set
. Returns 0 if
there are no handle bits set (size_
== 0).
fd_set *fdset (void);
fd_set
. Returns 0 if
there are no handle bits set (size_
== 0).
ACE_Handle_Set & operator= (const ACE_Handle_Set &);
size_
== 0.
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;
schmidt@cs.wustl.edu