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

ACE_Ordered_MultiSet Class Template Reference

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. More...

#include <Containers_T.h>

Collaboration diagram for ACE_Ordered_MultiSet:

Collaboration graph
[legend]
List of all members.

Public Types

typedef ACE_Ordered_MultiSet_Iterator<
T> 
ITERATOR

Public Methods

 ACE_Ordered_MultiSet (ACE_Allocator *alloc = 0)
 Constructor. Use user specified allocation strategy if specified.

 ACE_Ordered_MultiSet (const ACE_Ordered_MultiSet<T> &)
 Copy constructor.

 ~ACE_Ordered_MultiSet (void)
 Destructor.

void operator= (const ACE_Ordered_MultiSet<T> &)
 Assignment operator.

int is_empty (void) const
 Returns 1 if the container is empty, otherwise returns 0.

size_t size (void) const
 Size of the set.

int insert (const T &new_item)
 Insert <new_item> into the ordered multiset. Returns -1 if failures occur, else 0.

int insert (const T &new_item, ITERATOR &iter)
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.

int find (const T &item, ITERATOR &iter) const
void reset (void)
 Reset the to be empty.

void dump (void) const
 Dump the state of an object.


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.


Private Methods

int insert_from (const T &item, ACE_DNode<T> *start_position, ACE_DNode<T> **new_position)
int locate (const T &item, ACE_DNode<T> *start_position, ACE_DNode<T> *&new_position) const
void delete_nodes (void)
 Delete all the nodes in the Set.

void copy_nodes (const ACE_Ordered_MultiSet<T> &)
 Copy nodes into this set.


Private Attributes

ACE_DNode<T>* head_
 Head of the bilinked list of Nodes.

ACE_DNode<T>* tail_
 Head of the bilinked list of Nodes.

size_t cur_size_
 Current size of the set.

ACE_Allocatorallocator_
 Allocation strategy of the set.


Friends

class  ACE_Ordered_MultiSet_Iterator< T >

Detailed Description

template<class T> template class ACE_Ordered_MultiSet

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.


Member Typedef Documentation

template<classT>
typedef ACE_Ordered_MultiSet_Iterator<T> ACE_Ordered_MultiSet<T>::ITERATOR
 


Constructor & Destructor Documentation

template<classT>
ACE_Ordered_MultiSet<T>::ACE_Ordered_MultiSet<T> ( ACE_Allocator * alloc = 0 )
 

Constructor. Use user specified allocation strategy if specified.

template<classT>
ACE_Ordered_MultiSet<T>::ACE_Ordered_MultiSet<T> ( const ACE_Ordered_MultiSet< T >& us )
 

Copy constructor.

template<classT>
ACE_Ordered_MultiSet<T>::~ACE_Ordered_MultiSet<T> ( void )
 

Destructor.


Member Function Documentation

template<classT>
void ACE_Ordered_MultiSet<T>::copy_nodes ( const ACE_Ordered_MultiSet< T >& us ) [private]
 

Copy nodes into this set.

template<classT>
void ACE_Ordered_MultiSet<T>::delete_nodes ( void ) [private]
 

Delete all the nodes in the Set.

template<classT>
void ACE_Ordered_MultiSet<T>::dump ( void ) const
 

Dump the state of an object.

template<classT>
int ACE_Ordered_MultiSet<T>::find ( const T & item,
ITERATOR & iter ) const
 

Finds first occurrance 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.

template<classT>
int ACE_Ordered_MultiSet<T>::insert ( const T & new_item,
ITERATOR & iter )
 

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.

template<classT>
int ACE_Ordered_MultiSet<T>::insert ( const T & new_item )
 

Insert <new_item> into the ordered multiset. Returns -1 if failures occur, else 0.

template<classT>
int ACE_Ordered_MultiSet<T>::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.

template<classT>
ACE_INLINE int ACE_Ordered_MultiSet< T >::is_empty ( void ) const
 

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

template<classT>
int ACE_Ordered_MultiSet<T>::locate ( const T & item,
ACE_DNode< T >* start_position,
ACE_DNode< T >*& new_position ) const [private]
 

looks for first occurance 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;

template<classT>
void ACE_Ordered_MultiSet<T>::operator= ( const ACE_Ordered_MultiSet< T >& us )
 

Assignment operator.

template<classT>
int ACE_Ordered_MultiSet<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.

template<classT>
void ACE_Ordered_MultiSet<T>::reset ( void )
 

Reset the to be empty.

template<classT>
ACE_INLINE size_t ACE_Ordered_MultiSet< T >::size ( void ) const
 

Size of the set.


Friends And Related Function Documentation

template<classT>
class ACE_Ordered_MultiSet_Iterator [friend]
 


Member Data Documentation

template<classT>
ACE_Ordered_MultiSet<T>::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

template<classT>
ACE_Allocator * ACE_Ordered_MultiSet<T>::allocator_ [private]
 

Allocation strategy of the set.

template<classT>
size_t ACE_Ordered_MultiSet<T>::cur_size_ [private]
 

Current size of the set.

template<classT>
ACE_DNode< T >* ACE_Ordered_MultiSet<T>::head_ [private]
 

Head of the bilinked list of Nodes.

template<classT>
ACE_DNode< T >* ACE_Ordered_MultiSet<T>::tail_ [private]
 

Head of the bilinked list of Nodes.


The documentation for this class was generated from the following files:
Generated at Wed Nov 21 10:31:50 2001 for ACE by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000