---
name: "ACE_Handle_Set"
section: "3"
platform: "linux"
package: "libace-doc"
version: "5.0.7-4"
release: "Debian 2.2 (Potato)"
platforms: ["linux"]
url: "https://new.carta.tech/ACE_Handle_Set"
---

# ACE\_Handle\_Set(3)

C++ wrapper facade for the socket fd\_set abstraction.

## 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 schmidt@cs.wustl.edu

## LIBRARY

ace
