## NAME

ACE_Fixed_Set - Implement a simple unordered set of `T` with maximum `ACE_SIZE`.

## SYNOPSIS

    #include <ace/Containers.h>

    template<class T, size_t ACE_SIZE>
    class ACE_Fixed_Set
    {
      public:
        friend class ACE_Fixed_Set_Iterator<T, ACE_SIZE>;
        typedef ACE_Fixed_Set_Iterator<T, ACE_SIZE> ITERATOR;
        ACE_Fixed_Set (void);
        ACE_Fixed_Set (const ACE_Fixed_Set<T, ACE_SIZE> &);
        void operator= (const ACE_Fixed_Set<T, ACE_SIZE> &);
        ~ACE_Fixed_Set (void);
        int is_empty (void) const;
        int is_full (void) const;
        int insert (const T &new_item);
        int remove (const T &item);
        int find (const T &item) const;
        size_t size (void) const;
        void dump (void) const;
        ACE_ALLOC_HOOK_DECLARE;
      private:
        struct { T item_; int is_free_; } search_structure_[ACE_SIZE]; size_t cur_size_; size_t max_size_; }; template <class T> class ACE_Bounded_Set; template <class T> class ACE_Bounded_Set_Iterator { public: ACE_Bounded_Set_Iterator (
            ACE_Bounded_Set<T> &s
            );
        int next (T *&next_item);
        int advance (void);
        int first (void);
        int done (void) const;
        void dump (void) const;
        ACE_ALLOC_HOOK_DECLARE;
        ACE_Bounded_Set<T> &s_;
        ssize_t next_;
    };

## DESCRIPTION

This implementation of an unordered set uses a fixed array. This implementation does not allow duplicates...

## Initialization and termination methods.

    ACE_Fixed_Set (void);

Constructor.

    ACE_Fixed_Set (const ACE_Fixed_Set<T, ACE_SIZE> &);

Copy constructor.

    void operator= (const ACE_Fixed_Set<T, ACE_SIZE> &);

Assignment operator.

    ~ACE_Fixed_Set (void);

Destructor.

## Check boundary conditions.

    int is_empty (void) const;

Returns 1 if the container is empty, otherwise returns 0.

    int is_full (void) const;

Returns 1 if the container is full, otherwise returns 0.

## Classic unordered set operations.

    int insert (const T &new_item);

Insert `new_item` into the set (doesn't allow duplicates). Returns -1 if failures occur, 1 if item is already present, else 0.

    int remove (const T &item);

Remove first occurrence of `item` from the set. Returns 0 if it removes the item, -1 if it can't find the item, and -1 if a failure occurs.

    int find (const T &item) const;

Finds if `item` occurs in the set. Returns 0 if finds, else -1.

    size_t size (void) const;

Size of the set.

    void dump (void) const;

Dump the state of an object.

    ACE_ALLOC_HOOK_DECLARE;

Declare the dynamic allocation hooks.

## Iteration methods.

    int next (T *&next_item);

Pass back the `next_item` that hasn't been seen in the Set. Returns 0 when all items have been seen, else 1.

    int advance (void);

Move forward by one element in the set. Returns 0 when all the items in the set have been seen, else 1.

    int first (void);

Move to the first element in the set. Returns 0 if the set is empty, else 1.

    int done (void) const;

Returns 1 when all items have been seen, else 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