NAME
ACE_Handle_Set - C++ wrapper facade for the socket fd_set abstraction.
SYNOPSIS
#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 *();
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];
};
DESCRIPTION
This abstraction is a very efficient wrapper facade over 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.
Initialization and termination.
Initialization methods.
ACE_Handle_Set (void);
Constructor, initializes the bitmask to all 0s.
ACE_Handle_Set (const ACE_FD_SET_TYPE &mask);
~ACE_Handle_Set (void);
Default dtor.
Methods for manipulating bitsets.
void reset (void);
Initialize the bitmask to all 0s and reset the associated fields.
int is_set (ACE_HANDLE handle) const;
Checks whether 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);
Enables the handle. No range checking is performed so handle must be less than ACE_DEFAULT_SELECT_REACTOR_SIZE.
void clr_bit (ACE_HANDLE handle);
Disables the handle. No range checking is performed so handle must be less than ACE_DEFAULT_SELECT_REACTOR_SIZE.
int num_set (void) const;
Returns a count of the number of enabled bits.
ACE_HANDLE max_set (void) const;
Returns the number of the large bit.
void sync (ACE_HANDLE max);
Synchronize the underlying fd_set with the max_handle and the size.
operator fd_set *();
Returns a pointer to the underlying fd_set. Returns 0 if size_ == 0.
ACE_Handle_Set & operator= (const ACE_Handle_Set &);
Assignment operator optimizes for cases where size_ == 0.
void dump (void) const;
Dump the state of an object.
ACE_ALLOC_HOOK_DECLARE;
Declare the dynamic allocation hooks.
AUTHOR
Douglas C. Schmidt [email protected]
LIBRARY
ace