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

# ACE_Bounded_Set Class Template Reference

Implement a simple unordered set of <T> with maximum set at creation time. More...

`#include <Containers_T.h>`

List of all members.

## Public Types
typedef ACE_Bounded_Set_Iterator< T > | ITERATOR
enum | { DEFAULT_SIZE = 10 }
## Public Methods
| ACE_Bounded_Set (void)
| The default constructor initializes the Bounded_Set to a maximum size specified by the DEFAULT_SIZE. More...
| ACE_Bounded_Set (size_t size)
| Initialize the Bounded_Set to have a maximum size equal to the size parameter specified. More...
| ACE_Bounded_Set (const ACE_Bounded_Set< T > &)
| Initialize the Bounded_Set to be a copy of the Bounded_Set parameter. More...
void | operator= (const ACE_Bounded_Set< T > &)
| The assignment will make a deep copy of the Bounded_Set provided. More...
| ~ACE_Bounded_Set (void)
| Clean up the underlying dynamically allocated memory that is used by the Bounded_Set. More...
int | is_empty (void) const
| A constant time check is performed to determine if the Bounded_Set is empty. More...
int | is_full (void) const
| Performs a constant time check to determine if the Bounded_Set is at capacity. More...
int | insert (const T &new_item)
| Insert <new_item> into the set (doesn't allow duplicates) in linear time. More...
int | remove (const T &item)
| Remove first occurrence of <item> from the set. More...
int | find (const T &item) const
| find preforms a linear search for <item> and returns 0 on successful find and -1 otherwise. More...
size_t | size (void) const
| Returns a size_t representing the current size of the set. 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 Attributes
Search_Structure * | search_structure_
| Holds the contents of the set. More...
size_t | cur_size_
| Current size of the set. More...
size_t | max_size_
| Maximum size of the set. More...
## Friends
class | ACE_Bounded_Set_Iterator< T >

## Detailed Description

### template<class T>
class ACE_Bounded_Set< T >

Implement a simple unordered set of <T> with maximum set at creation time.

This implementation of an unordered set uses a Bounded array. This implementation does not allow duplicates. It provides linear insert/remove/find operations. Insertion/removal does not invalidate iterators, but caution should be taken to ensure expected behavior. Once initialized, the object has a maximum size which can only be increased by the assignment of another larger Bounded_Set.

Requirements and Performance Characteristics

- Internal Structure Bounded array which can grow via assignment
- Duplicates allowed? No
- Random access allowed? No
- Search speed Linear
- Insert/replace speed Linear
- Iterator still valid after change to container? Yes
- Frees memory for removed elements? No
- Items inserted by Value
- Requirements for contained type
  1. Default constructor
  2. Copy constructor
  3. operator=
  4. operator==

## Member Typedef Documentation

template<class T>
typedef ACE_Bounded_Set_Iterator<T> ACE_Bounded_Set::ITERATOR

## Member Enumeration Documentation

template<class T>
anonymous enum

  | Enumeration values:
  DEFAULT_SIZE |

## Constructor & Destructor Documentation

template<class T>
ACE_Bounded_Set< T >::ACE_Bounded_Set | ( | void |  | ) |

| The default constructor initializes the Bounded_Set to a maximum size specified by the DEFAULT_SIZE.

template<class T>
ACE_Bounded_Set< T >::ACE_Bounded_Set | ( | size_t | size | ) |

| Initialize the Bounded_Set to have a maximum size equal to the size parameter specified.

template<class T>
ACE_Bounded_Set< T >::ACE_Bounded_Set | ( | const ACE_Bounded_Set< T > & | bs | ) |

| Initialize the Bounded_Set to be a copy of the Bounded_Set parameter.

template<class T>
ACE_Bounded_Set< T >::~ACE_Bounded_Set | ( | void |  | ) |

| Clean up the underlying dynamically allocated memory that is used by the Bounded_Set.

## Member Function Documentation

template<class T>
void ACE_Bounded_Set< T >::dump | ( | void |  | ) | const

| Dump the state of an object.

template<class T>
int ACE_Bounded_Set< T >::find | ( | const T & | item | ) | const

| find preforms a linear search for <item> and returns 0 on successful find and -1 otherwise.

template<class T>
int ACE_Bounded_Set< T >::insert | ( | const T & | item | ) |

| Insert <new_item> into the set (doesn't allow duplicates) in linear time. Returns -1 if failures occur, 1 if item is already present, else 0.

template<class T>
ACE_INLINE int ACE_Bounded_Set< T >::is_empty | ( | void |  | ) | const

| A constant time check is performed to determine if the Bounded_Set is empty.

template<class T>
ACE_INLINE int ACE_Bounded_Set< T >::is_full | ( | void |  | ) | const

| Performs a constant time check to determine if the Bounded_Set is at capacity.

template<class T>
void ACE_Bounded_Set< T >::operator= | ( | const ACE_Bounded_Set< T > & | bs | ) |

| The assignment will make a deep copy of the Bounded_Set provided. If the rhs has more elements than the capacity of the lhs, then the lhs will be deleted and reallocated to accomadate the larger number of elements.

template<class T>
int ACE_Bounded_Set< T >::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. The linear remove operation does not reclaim the memory associated with the removed item.

template<class T>
size_t ACE_Bounded_Set< T >::size | ( | void |  | ) | const

| Returns a size_t representing the current size of the set.

## Friends And Related Function Documentation

template<class T>
friend class ACE_Bounded_Set_Iterator< T >`[friend]`

## Member Data Documentation

template<class T>
ACE_Bounded_Set::ACE_ALLOC_HOOK_DECLARE

| Declare the dynamic allocation hooks.

template<class T>
size_t ACE_Bounded_Set::cur_size_`[private]`

| Current size of the set.

template<class T>
size_t ACE_Bounded_Set::max_size_`[private]`

| Maximum size of the set.

template<class T>
Search_Structure* ACE_Bounded_Set::search_structure_`[private]`

| Holds the contents of the set.

The documentation for this class was generated from the following files:

- Containers_T.h
- Containers_T.cpp
- Containers_T.i