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

# ACE_Double_Linked_List Class Template Reference

A double-linked list implementation. More...

`#include <Containers_T.h>`

Inheritance diagram for ACE_Double_Linked_List

[legend]
Collaboration diagram for ACE_Double_Linked_List:

[legend]
List of all members.

## Public Types
typedef ACE_Double_Linked_List_Iterator< T> | ITERATOR
typedef ACE_Double_Linked_List_Reverse_Iterator< T> | REVERSE_ITERATOR
## Public Methods
| ACE_Double_Linked_List (ACE_Allocator *alloc = 0)
| construction. Use user specified allocation strategy if specified.
| ACE_Double_Linked_List (const ACE_Double_Linked_List<T> &)
| Copy constructor.
void | operator= (const ACE_Double_Linked_List<T> &)
| Assignment operator.
| ~ACE_Double_Linked_List (void)
| Destructor.
int | is_empty (void) const
| Returns 1 if the container is empty, otherwise returns 0.
int | is_full (void) const
| Returns 1 if the container is full, otherwise returns 0.
T* | insert_tail (T *new_item)
| Adds <new_item> to the tail of the list. Returns the new item that was inserted.
T* | insert_head (T *new_item)
| Adds <new_item> to the head of the list.Returns the new item that was inserted.
T* | delete_head (void)
T* | delete_tail (void)
void | reset (void)
int | get (T *&item, size_t slot = 0)
| Get the <slot>th element in the set. Returns -1 if the element isn't in the range {0..<size> - 1}, else 0.
size_t | size (void) const
| The number of items in the queue.
void | dump (void) const
| Dump the state of an object.
int | remove (T *n)
| Use DNode address directly.
## Public Attributes
| ACE_ALLOC_HOOK_DECLARE
| Declare the dynamic allocation hooks.
## Protected Methods
void | delete_nodes (void)
| Delete all the nodes in the list.
void | copy_nodes (const ACE_Double_Linked_List<T> &rhs)
| Copy nodes from <rhs> into this list.
void | init_head (void)
| Setup header pointer. Called after we create the head node in ctor.
int | insert_element (T *new_item, int before = 0, T *old_item = 0)
int | remove_element (T *item)
## Protected Attributes
T* | head_
| Head of the circular double-linked list.
size_t | size_
| Size of this list.
ACE_Allocator* | allocator_
| Allocation Strategy of the queue.
## Friends
class | ACE_Double_Linked_List_Iterator_Base< T >
class | ACE_Double_Linked_List_Iterator< T >
class | ACE_Double_Linked_List_Reverse_Iterator< T >

## Detailed Description

### template<class T> template class ACE_Double_Linked_List

A double-linked list implementation.

This implementation of an unbounded double-linked list uses a circular linked list with a dummy node. It is pretty much like the except that it allows removing of a specific element from a specific location. Notice that this class is an implementation of a very simply data structure.is *NOT* a container class. You can use the class to implement other contains classes but it is *NOT* a general purpose container class. The parameter class *MUST* has members T* prev and T* next and users of this class are responsible to follow the general rules of using double-linked lists to maintaining the list integrities. If you need a double linked container class, check out the DLList class in this file.

## Member Typedef Documentation

template<classT>
typedef ACE_Double_Linked_List_Iterator<T> ACE_Double_Linked_List<T>::ITERATOR

template<classT>
typedef ACE_Double_Linked_List_Reverse_Iterator<T> ACE_Double_Linked_List<T>::REVERSE_ITERATOR

## Constructor & Destructor Documentation

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

| construction. Use user specified allocation strategy if specified.

template<classT>
ACE_Double_Linked_List<T>::ACE_Double_Linked_List<T> ( | const ACE_Double_Linked_List< T >& cx )

| Copy constructor.

template<classT>
ACE_Double_Linked_List<T>::~ACE_Double_Linked_List<T> ( | void )

| Destructor.

## Member Function Documentation

template<classT>
void ACE_Double_Linked_List<T>::copy_nodes ( | const ACE_Double_Linked_List< T >& rhs )`[protected]`

| Copy nodes from <rhs> into this list.

template<classT>
T * ACE_Double_Linked_List<T>::delete_head ( | void )

| Removes and returns the first <item> in the list. Returns internal node's address on success, 0 if the queue was empty. This method will *not* free the internal node. Reimplemented in ACE_DLList.

template<classT>
void ACE_Double_Linked_List<T>::delete_nodes ( | void )`[protected]`

| Delete all the nodes in the list.

template<classT>
T * ACE_Double_Linked_List<T>::delete_tail ( | void )

| Removes and returns the last <item> in the list. Returns internal nodes's address on success, 0 if the queue was empty. This method will *not* free the internal node. Reimplemented in ACE_DLList.

template<classT>
void ACE_Double_Linked_List<T>::dump ( | void ) const

| Dump the state of an object. Reimplemented in ACE_DLList.

template<classT>
int ACE_Double_Linked_List<T>::get ( | T *& item,
| size_t index = 0 )

| Get the <slot>th element in the set. Returns -1 if the element isn't in the range {0..<size> - 1}, else 0. Reimplemented in ACE_DLList.

template<classT>
void ACE_Double_Linked_List<T>::init_head ( | void )`[protected]`

| Setup header pointer. Called after we create the head node in ctor.

template<classT>
int ACE_Double_Linked_List<T>::insert_element ( | T * new_item,
| int before = 0,
| T * old_item = 0 )`[protected]`

| Insert a <new_element> into the list. It will be added before or after <old_item>. Default is to insert the new item *after* <head_>. Return 0 if succeed, -1 if error occured.

template<classT>
T * ACE_Double_Linked_List<T>::insert_head ( | T * new_item )

| Adds <new_item> to the head of the list.Returns the new item that was inserted. Reimplemented in ACE_DLList.

template<classT>
T * ACE_Double_Linked_List<T>::insert_tail ( | T * new_item )

| Adds <new_item> to the tail of the list. Returns the new item that was inserted. Reimplemented in ACE_DLList.

template<classT>
int ACE_Double_Linked_List<T>::is_empty ( | void ) const

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

template<classT>
int ACE_Double_Linked_List<T>::is_full ( | void ) const

| Returns 1 if the container is full, otherwise returns 0.

template<classT>
void ACE_Double_Linked_List<T>::operator= ( | const ACE_Double_Linked_List< T >& cx )

| Assignment operator.

template<classT>
int ACE_Double_Linked_List<T>::remove ( | T * n )

| Use DNode address directly.

template<classT>
int ACE_Double_Linked_List<T>::remove_element ( | T * item )`[protected]`

| Remove an <item> from the list. Return 0 if succeed, -1 otherwise. Notice that this function checks if item is <head_> and either its <next_> or <prev_> is NULL. The function resets item's <next_> and <prev_> to 0 to prevent clobbering the double-linked list if a user tries to remove the same node again.

template<classT>
void ACE_Double_Linked_List<T>::reset ( | void )

| Reset the to be empty. Notice that since no one is interested in the items within, This operation will delete all items.

template<classT>
size_t ACE_Double_Linked_List<T>::size ( | void ) const

| The number of items in the queue.

## Friends And Related Function Documentation

template<classT>
class ACE_Double_Linked_List_Iterator`[friend]`

| Reimplemented in ACE_DLList.

template<classT>
class ACE_Double_Linked_List_Iterator_Base`[friend]`

template<classT>
class ACE_Double_Linked_List_Reverse_Iterator`[friend]`

## Member Data Documentation

template<classT>
ACE_Double_Linked_List<T>::ACE_ALLOC_HOOK_DECLARE

| Declare the dynamic allocation hooks.

template<classT>
ACE_Allocator * ACE_Double_Linked_List<T>::allocator_`[protected]`

| Allocation Strategy of the queue.

template<classT>
T * ACE_Double_Linked_List<T>::head_`[protected]`

| Head of the circular double-linked list.

template<classT>
size_t ACE_Double_Linked_List<T>::size_`[protected]`

| Size of this list.

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

- Containers_T.h
- Containers_T.cpp