ACE  6.5.12
Public Member Functions | Friends | List of all members
ACE_DLList< T > Class Template Reference

A double-linked list container class. More...

#include <Containers_T.h>

Public Member Functions

void operator= (const ACE_DLList< T > &l)
 Delegates to ACE_Double_Linked_List. More...
 
Queue-like insert and delete methods
T * insert_tail (T *new_item)
 
T * insert_head (T *new_item)
 
T * delete_head (void)
 
T * delete_tail (void)
 
int get (T *&item, size_t slot=0)
 
void dump (void) const
 Delegates to ACE_Double_Linked_List. More...
 
int remove (ACE_DLList_Node *n)
 Delegates to ACE_Double_Linked_List. More...
 
 ACE_DLList (ACE_Allocator *the_allocator=0)
 
 ACE_DLList (const ACE_DLList< T > &l)
 Delegates to ACE_Double_Linked_List. More...
 
 ~ACE_DLList (void)
 

Friends

class ACE_DLList_Node
 
class ACE_Double_Linked_List_Iterator< T >
 
class ACE_DLList_Iterator< T >
 
class ACE_DLList_Reverse_Iterator< T >
 

Detailed Description

template<class T>
class ACE_DLList< T >

A double-linked list container class.

ACE_DLList is a simple, unbounded container implemented using a double-linked list. It is critical to remember that ACE_DLList inherits from ACE_Double_Linked_List, wrapping each T pointer in a ACE_DLList_Node object which satisfies the next/prev pointer requirements imposed by ACE_Double_Linked_List.

Each item inserted to an ACE_DLList is a pointer to a T object. The caller is responsible for lifetime of the T object. ACE_DLList takes no action on the T object; it is not copied on insertion and it is not deleted on removal from the ACE_DLList.

Constructor & Destructor Documentation

◆ ACE_DLList() [1/2]

template<class T >
ACE_DLList< T >::ACE_DLList ( ACE_Allocator the_allocator = 0)
inline

Constructor.

Parameters
the_allocatorAllocator to use for allocating ACE_DLList_Node objects that wrap T objects for inclusion in the list. If 0, ACE_Allocator::instance() is used.

◆ ACE_DLList() [2/2]

template<class T >
ACE_DLList< T >::ACE_DLList ( const ACE_DLList< T > &  l)
inline

Delegates to ACE_Double_Linked_List.

◆ ~ACE_DLList()

template<class T >
ACE_DLList< T >::~ACE_DLList ( void  )
inline

Deletes all ACE_DLList_Node objects in the list starting from the head. No T objects referred to by the deleted ACE_DLList_Node objects are modified or freed. If you desire all of the T objects in the list to be deleted as well, code such as this should be used prior to destroying the ACE_DLList:

... // insert dynamically allocated Items...
Item *p;
while ((p = list.delete_head()) != 0)
delete *p;

Member Function Documentation

◆ delete_head()

template<class T >
T * ACE_DLList< T >::delete_head ( void  )

Removes the item at the head of the list and returns its pointer.

Returns
Pointer to previously inserted item; 0 if the list is empty, an error occurred, or the original pointer inserted was 0.

◆ delete_tail()

template<class T >
T * ACE_DLList< T >::delete_tail ( void  )

Removes the item at the tail of the list and returns its pointer.

Returns
Pointer to previously inserted item; 0 if the list is empty, an error occurred, or the original pointer inserted was 0.

◆ dump()

template<class T >
void ACE_DLList< T >::dump ( void  ) const
inline

Delegates to ACE_Double_Linked_List.

◆ get()

template<class T >
int ACE_DLList< T >::get ( T *&  item,
size_t  slot = 0 
)
inline

Provide random access to any item in the list.

Parameters
itemReceives a pointer to the T object pointer held at the specified position in the list.
slotPosition in the list to access. The first position is 0.
Return values
0Success; T pointer returned in item.
-1Error, most likely slot is outside the range of the list.

◆ insert_head()

template<class T >
T * ACE_DLList< T >::insert_head ( T *  new_item)

Insert pointer for a new item at the head of the list.

Returns
Pointer to item inserted; 0 on error.

◆ insert_tail()

template<class T >
T * ACE_DLList< T >::insert_tail ( T *  new_item)

Insert pointer for a new item at the tail of the list.

Returns
Pointer to item inserted; 0 on error.

◆ operator=()

template<class T >
void ACE_DLList< T >::operator= ( const ACE_DLList< T > &  l)
inline

Delegates to ACE_Double_Linked_List.

◆ remove()

template<class T >
int ACE_DLList< T >::remove ( ACE_DLList_Node n)
inline

Delegates to ACE_Double_Linked_List.

Friends And Related Function Documentation

◆ ACE_DLList_Iterator< T >

template<class T >
friend class ACE_DLList_Iterator< T >
friend

◆ ACE_DLList_Node

template<class T >
friend class ACE_DLList_Node
friend

◆ ACE_DLList_Reverse_Iterator< T >

template<class T >
friend class ACE_DLList_Reverse_Iterator< T >
friend

◆ ACE_Double_Linked_List_Iterator< T >

template<class T >
friend class ACE_Double_Linked_List_Iterator< T >
friend

The documentation for this class was generated from the following files:
ACE_DLList::delete_head
T * delete_head(void)
Definition: Containers_T.cpp:1852
ACE_DLList
A double-linked list container class.
Definition: Containers_T.h:1020