ACE 8.0.1
|
Implement a simple unordered set of <T> of unbounded size. More...
#include <Unbounded_Set_Ex.h>
Public Member Functions | |
ACE_Unbounded_Set_Ex (ACE_Allocator *alloc=nullptr) | |
ACE_Unbounded_Set_Ex (const C &comparator, ACE_Allocator *alloc=nullptr) | |
ACE_Unbounded_Set_Ex (const ACE_Unbounded_Set_Ex< T, C > &) | |
Copy constructor. | |
ACE_Unbounded_Set_Ex< T, C > & | operator= (const ACE_Unbounded_Set_Ex< T, C > &) |
Assignment operator. | |
~ACE_Unbounded_Set_Ex () | |
Destructor. | |
bool | is_empty () const |
Returns true if the container is empty, otherwise returns false . | |
bool | is_full () const |
Returns false . | |
int | insert (const T &new_item) |
Linear insertion of an item. | |
int | insert_tail (const T &item) |
int | remove (const T &item) |
Linear remove operation. | |
int | find (const T &item) const |
size_t | size () const |
Size of the set. | |
void | dump () const |
Dump the state of an object. | |
void | reset () |
Reset the ACE_Unbounded_Set_Ex to be empty. | |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
Public Attributes | |
ACE_ALLOC_HOOK_DECLARE | |
Declare the dynamic allocation hooks. | |
Private Member Functions | |
void | delete_nodes () |
Delete all the nodes in the Set. | |
void | copy_nodes (const ACE_Unbounded_Set_Ex< T, C > &) |
Copy nodes into this set. | |
Private Attributes | |
NODE * | head_ |
Head of the linked list of Nodes. | |
size_t | cur_size_ |
Current size of the set. | |
ACE_Allocator * | allocator_ |
Allocation strategy of the set. | |
COMP | comp_ |
Comparator to be used. | |
Friends | |
class | ACE_Unbounded_Set_Ex_Iterator< T, C > |
class | ACE_Unbounded_Set_Ex_Const_Iterator< T, C > |
Implement a simple unordered set of <T> of unbounded size.
This implementation of an unordered set uses a circular linked list with a dummy node. This implementation does not allow duplicates, but it maintains FIFO ordering of insertions.
This implementation may also be parameterized with a comparator functor, which must implement bool operator () (const T&, const T&) const, returning true if the given items are equivalent. The default comparator is sufficient for objects reliably compared with operator==.
Requirements and Performance Characteristics
typedef ACE_Unbounded_Set_Ex_Const_Iterator<T, C> ACE_Unbounded_Set_Ex< T, C >::CONST_ITERATOR |
typedef ACE_Unbounded_Set_Ex_Const_Iterator<T, C> ACE_Unbounded_Set_Ex< T, C >::const_iterator |
typedef const_value_type* ACE_Unbounded_Set_Ex< T, C >::const_pointer |
typedef const_value_type& ACE_Unbounded_Set_Ex< T, C >::const_reference |
typedef ACE_Unbounded_Set_Ex_Iterator<T, C> ACE_Unbounded_Set_Ex< T, C >::ITERATOR |
typedef ACE_Unbounded_Set_Ex_Iterator<T, C> ACE_Unbounded_Set_Ex< T, C >::iterator |
typedef value_type* ACE_Unbounded_Set_Ex< T, C >::pointer |
typedef value_type& ACE_Unbounded_Set_Ex< T, C >::reference |
ACE_Unbounded_Set_Ex< T, C >::ACE_Unbounded_Set_Ex | ( | ACE_Allocator * | alloc = nullptr | ) |
Constructor. Use user specified allocation strategy if specified. Initialize an empty set using the allocation strategy of the user if provided.
ACE_Unbounded_Set_Ex< T, C >::ACE_Unbounded_Set_Ex | ( | const C & | comparator, |
ACE_Allocator * | alloc = nullptr ) |
Initialize an empty set using the allocation strategy of the user if provided, and a given comparator functor.
ACE_Unbounded_Set_Ex< T, C >::ACE_Unbounded_Set_Ex | ( | const ACE_Unbounded_Set_Ex< T, C > & | us | ) |
Copy constructor.
Initialize this set to be an exact copy of the set provided.
ACE_Unbounded_Set_Ex< T, C >::~ACE_Unbounded_Set_Ex | ( | ) |
Destructor.
Destroy the nodes of the set.
ACE_Unbounded_Set_Ex< T, C >::iterator ACE_Unbounded_Set_Ex< T, C >::begin | ( | ) |
ACE_Unbounded_Set_Ex< T, C >::const_iterator ACE_Unbounded_Set_Ex< T, C >::begin | ( | ) | const |
|
private |
Copy nodes into this set.
Delete all the nodes in the Set.
Dump the state of an object.
ACE_Unbounded_Set_Ex< T, C >::iterator ACE_Unbounded_Set_Ex< T, C >::end | ( | ) |
ACE_Unbounded_Set_Ex< T, C >::const_iterator ACE_Unbounded_Set_Ex< T, C >::end | ( | ) | const |
Finds if item occurs in the set. Returns 0 if find succeeds, else -1. Performs a linear find operation.
Linear insertion of an item.
Insert new_item into the set (doesn't allow duplicates). Returns -1 if failures occur, 1 if item is already present, else 0.
Insert item at the tail of the set (doesn't check for duplicates). Constant time insert at the end of the set.
Returns true
if the container is empty, otherwise returns false
.
Constant time is_empty check.
Returns false
.
Always returns false
since the set can never fill up.
ACE_Unbounded_Set_Ex< T, C > & ACE_Unbounded_Set_Ex< T, C >::operator= | ( | const ACE_Unbounded_Set_Ex< T, C > & | us | ) |
Assignment operator.
Perform a deep copy of the rhs into the lhs.
Linear remove operation.
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.
Reset the ACE_Unbounded_Set_Ex to be empty.
Delete the nodes of the set.
Size of the set.
Access the size of the set.
ACE_Unbounded_Set_Ex< T, C >::ACE_ALLOC_HOOK_DECLARE |
Declare the dynamic allocation hooks.
|
private |
Allocation strategy of the set.
Comparator to be used.
Current size of the set.
Head of the linked list of Nodes.