Implement a simple ordered multiset of {T} of unbounded size that allows duplicates. This class template requires that < operator semantics be defined for the parameterized type {T}, but does not impose any restriction on how that ordering operator is implemented. The set is implemented as a linked list.
More...
#include <Containers_T.h>
Implement a simple ordered multiset of {T} of unbounded size that allows duplicates. This class template requires that < operator semantics be defined for the parameterized type {T}, but does not impose any restriction on how that ordering operator is implemented. The set is implemented as a linked list.
Requirements and Performance Characteristics
- Internal Structure Double linked list
- Duplicates allowed? Yes
- Random access allowed? No
- Search speed Linear
- Insert/replace speed Linear
- Iterator still valid after change to container? Yes
- Frees memory for removed elements? Yes
- Items inserted by Value
- Requirements for contained type
- Default constructor
- Copy constructor
- operator=
- operator==
- operator<
◆ ITERATOR
◆ ACE_Ordered_MultiSet() [1/2]
ACE_Ordered_MultiSet::ACE_Ordered_MultiSet |
( |
ACE_Allocator * |
the_allocator = 0 | ) |
|
Constructor. Use user specified allocation strategy if specified. Initialize the set using the allocation strategy specified. If none, use the default strategy.
◆ ACE_Ordered_MultiSet() [2/2]
Copy constructor.
Initialize the set to be a copy of the provided set.
◆ ~ACE_Ordered_MultiSet()
ACE_Ordered_MultiSet::~ACE_Ordered_MultiSet |
( |
void |
| ) |
|
Destructor.
Delete the nodes of the set.
◆ copy_nodes()
Copy nodes into this set.
◆ delete_nodes()
void ACE_Ordered_MultiSet::delete_nodes |
( |
void |
| ) |
|
|
private |
Delete all the nodes in the Set.
◆ dump()
void ACE_Ordered_MultiSet::dump |
( |
void |
| ) |
const |
Dump the state of an object.
◆ find()
int ACE_Ordered_MultiSet::find |
( |
const T & |
item, |
|
|
ITERATOR & |
iter |
|
) |
| const |
Linear find operation.
Finds first occurrence of item in the multiset, using the iterator's current position as a hint to improve performance. If find succeeds, it positions the iterator at that node and returns 0, or if it cannot locate the node, it leaves the iterator alone and just returns -1.
◆ insert() [1/2]
int ACE_Ordered_MultiSet::insert |
( |
const T & |
new_item | ) |
|
Insert new_item into the ordered multiset. Returns -1 if failures occur, else 0. Linear time, order preserving insert into the set beginning at the head.
◆ insert() [2/2]
int ACE_Ordered_MultiSet::insert |
( |
const T & |
new_item, |
|
|
ITERATOR & |
iter |
|
) |
| |
Linear time insert beginning at the point specified by the provided iterator.
Insert new_item into the ordered multiset, starting its search at the node pointed to by the iterator, and if insertion was successful, updates the iterator to point to the newly inserted node. Returns -1 if failures occur, else 0.
◆ insert_from()
int ACE_Ordered_MultiSet::insert_from |
( |
const T & |
item, |
|
|
ACE_DNode< T > * |
start_position, |
|
|
ACE_DNode< T > ** |
new_position |
|
) |
| |
|
private |
Insert item, starting its search at the position given, and if successful updates the passed pointer to point to the newly inserted item's node.
◆ is_empty()
int ACE_Ordered_MultiSet::is_empty |
( |
void |
| ) |
const |
Returns 1 if the container is empty, otherwise returns 0.
Constant time check to determine if the set is empty.
◆ locate()
int ACE_Ordered_MultiSet::locate |
( |
const T & |
item, |
|
|
ACE_DNode< T > * |
start_position, |
|
|
ACE_DNode< T > *& |
new_position |
|
) |
| const |
|
private |
Looks for first occurrence of item in the ordered set, using the passed starting position as a hint: if there is such an instance, it updates the new_position pointer to point to this node and returns 0; if there is no such node, then if there is a node before where the item would have been, it updates the new_position pointer to point to this node and returns -1; if there is no such node, then if there is a node after where the item would have been, it updates the new_position pointer to point to this node (or 0 if there is no such node) and returns 1;
◆ operator=()
Assignment operator.
Delete the nodes in lhs, and copy the nodes from the rhs.
◆ remove()
int ACE_Ordered_MultiSet::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. Linear time search operation which removes the item from the set if found .
◆ reset()
void ACE_Ordered_MultiSet::reset |
( |
void |
| ) |
|
◆ size()
size_t ACE_Ordered_MultiSet::size |
( |
void |
| ) |
const |
Size of the set.
Constant time check to determine the size of the set.
◆ ACE_Ordered_MultiSet_Iterator< T >
◆ ACE_ALLOC_HOOK_DECLARE
ACE_Ordered_MultiSet::ACE_ALLOC_HOOK_DECLARE |
Declare the dynamic allocation hooks.
◆ allocator_
Allocation strategy of the set.
◆ cur_size_
size_t ACE_Ordered_MultiSet::cur_size_ |
|
private |
◆ head_
Head of the bilinked list of Nodes.
◆ tail_
Head of the bilinked list of Nodes.
The documentation for this class was generated from the following file: