Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_Handle_Set Class Reference

C++ wrapper facade for the socket <fd_set> abstraction. More...

#include <Handle_Set.h>

List of all members.

Public Types

enum  { MAXSIZE = ACE_DEFAULT_SELECT_REACTOR_SIZE }

Public Methods

 ACE_Handle_Set (void)
 Constructor, initializes the bitmask to all 0s. More...

 ACE_Handle_Set (const ACE_FD_SET_TYPE &mask)
 Constructor, initializes the handle set from a given mask. More...

void reset (void)
 Initialize the bitmask to all 0s and reset the associated fields. More...

int is_set (ACE_HANDLE handle) const
 Checks whether <handle> is enabled. More...

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>. More...

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>. More...

int num_set (void) const
 Returns a count of the number of enabled bits. More...

ACE_HANDLE max_set (void) const
 Returns the number of the large bit. More...

void sync (ACE_HANDLE max)
 Rescan the underlying <fd_set> up to handle <max> to find the new <max_handle> (highest bit set) and <size> (how many bits set) values. More...

 operator fd_set * ()
 Returns a pointer to the underlying <fd_set>. Returns 0 if there are no handle bits set (<size_> == 0). More...

fd_set * fdset (void)
 Returns a pointer to the underlying <fd_set>. Returns 0 if there are no handle bits set (<size_> == 0). More...

void dump (void) const
 Dump the state of an object. More...


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...


Private Types

enum  { WORDSIZE = NFDBITS, NBITS = 256 }

Private Methods

void set_max (ACE_HANDLE max)
 Resets the <max_handle_> after a clear of the original <max_handle_>. More...


Static Private Methods

int count_bits (u_long n)
 Counts the number of bits enabled in N. Uses a table lookup to speed up the count. More...


Private Attributes

int size_
 Size of the set, i.e., a count of the number of enabled bits. More...

ACE_HANDLE max_handle_
 Current max handle. More...

fd_set mask_
 Bitmask. More...


Static Private Attributes

const char nbits_ [NBITS]
 Table that maps bytes to counts of the enabled bits in each value from 0 to 255. More...


Friends

class ACE_Handle_Set_Iterator


Detailed Description

C++ wrapper facade for the socket <fd_set> abstraction.

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>.


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
MAXSIZE 

anonymous enum [private]
 

Enumeration values:
WORDSIZE 
NBITS 


Constructor & Destructor Documentation

ACE_Handle_Set::ACE_Handle_Set void   
 

Constructor, initializes the bitmask to all 0s.

ACE_Handle_Set::ACE_Handle_Set const ACE_FD_SET_TYPE   fd_mask
 

Constructor, initializes the handle set from a given mask.

<ACE_FD_SET_TYPE> is a <typedef> based on the platform's native type used for masks passed to <select>.


Member Function Documentation

ACE_INLINE void ACE_Handle_Set::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 ACE_Handle_Set::count_bits u_long    n [static, private]
 

Counts the number of bits enabled in N. Uses a table lookup to speed up the count.

void ACE_Handle_Set::dump void    const
 

Dump the state of an object.

ACE_INLINE fd_set * ACE_Handle_Set::fdset void   
 

Returns a pointer to the underlying <fd_set>. Returns 0 if there are no handle bits set (<size_> == 0).

ACE_INLINE int ACE_Handle_Set::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>.

ACE_INLINE ACE_HANDLE ACE_Handle_Set::max_set void    const
 

Returns the number of the large bit.

ACE_INLINE int ACE_Handle_Set::num_set void    const
 

Returns a count of the number of enabled bits.

ACE_INLINE ACE_Handle_Set::operator fd_set *  
 

Returns a pointer to the underlying <fd_set>. Returns 0 if there are no handle bits set (<size_> == 0).

ACE_INLINE void ACE_Handle_Set::reset void   
 

Initialize the bitmask to all 0s and reset the associated fields.

ACE_INLINE void ACE_Handle_Set::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 ACE_Handle_Set::set_max ACE_HANDLE    current_max [private]
 

Resets the <max_handle_> after a clear of the original <max_handle_>.

void ACE_Handle_Set::sync ACE_HANDLE    max
 

Rescan the underlying <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>.


Friends And Related Function Documentation

friend class ACE_Handle_Set_Iterator [friend]
 


Member Data Documentation

ACE_Handle_Set::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

fd_set ACE_Handle_Set::mask_ [private]
 

Bitmask.

ACE_HANDLE ACE_Handle_Set::max_handle_ [private]
 

Current max handle.

const char ACE_Handle_Set::nbits_ [static, private]
 

Initial value:

{
  0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
  1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
  1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
  2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
  1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
  2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
  2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
  3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
  1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
  2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
  2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
  3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
  2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
  3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
  3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
  4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8}
Table that maps bytes to counts of the enabled bits in each value from 0 to 255.

int ACE_Handle_Set::size_ [private]
 

Size of the set, i.e., a count of the number of enabled bits.


The documentation for this class was generated from the following files:
Generated on Thu Oct 10 17:07:12 2002 for ACE by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001