## NAME

ACE_Handle_Set - C++ wrapper 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) const;
        void set_bit (ACE_HANDLE);
        void clr_bit (ACE_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];
    };

## 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) const;

Checks whether handle is enabled.

    void set_bit (ACE_HANDLE);

Enables the handle.

    void clr_bit (ACE_HANDLE);

Disables the handle.

    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

Doug Schmidt

## LIBRARY

ace