T
with maximum
set at creation time.
#include <ace/Containers.h>
template<class T> class ACE_Bounded_Set {
public:
friend class ACE_Bounded_Set_Iterator<T>;
typedef ACE_Bounded_Set_Iterator<T> ITERATOR;
enum{ DEFAULT_SIZE = 10 };
ACE_Bounded_Set (void);
ACE_Bounded_Set (size_t size);
ACE_Bounded_Set (const ACE_Bounded_Set<T> &);
void operator= (const ACE_Bounded_Set<T> &);
~ACE_Bounded_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:
Search_Structure *search_structure_;
size_t cur_size_;
size_t max_size_;
};
ACE_Bounded_Set (void);
ACE_Bounded_Set (size_t size);
ACE_Bounded_Set (const ACE_Bounded_Set<T> &);
void operator= (const ACE_Bounded_Set<T> &);
~ACE_Bounded_Set (void);
int is_empty (void) const;
int is_full (void) const;
int insert (const T &new_item);
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);
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;
item
occurs in the set. Returns 0 if finds, else -1.
size_t size (void) const;
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;