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. | |
| int | get (T *&item, size_t slot=0) |
| void | dump (void) const |
| Delegates to ACE_Double_Linked_List. | |
| int | remove (ACE_DLList_Node *n) |
| Delegates to ACE_Double_Linked_List. | |
| ACE_DLList (ACE_Allocator *the_allocator=0) | |
| ACE_DLList (const ACE_DLList< T > &l) | |
| Delegates to ACE_Double_Linked_List. | |
| ~ACE_DLList (void) | |
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) |
Friends | |
| class | ACE_DLList_Node |
| class | ACE_Double_Linked_List_Iterator< T > |
| class | ACE_DLList_Iterator< T > |
| class | ACE_DLList_Reverse_Iterator< 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.
Definition at line 1031 of file Containers_T.h.
| ACE_DLList< T >::ACE_DLList | ( | ACE_Allocator * | the_allocator = 0 |
) | [inline] |
Constructor.
| the_allocator | Allocator to use for allocating ACE_DLList_Node objects that wrap T objects for inclusion in the list. If 0, ACE_Allocator::instance() is used. |
Definition at line 353 of file Containers_T.inl.
: ACE_DLList_Base (alloc) { }
| ACE_DLList< T >::ACE_DLList | ( | const ACE_DLList< T > & | l | ) | [inline] |
Delegates to ACE_Double_Linked_List.
Definition at line 359 of file Containers_T.inl.
: ACE_DLList_Base ((ACE_DLList<T> &) l) { }
| 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:
ACE_DLList<Item> list; ... // insert dynamically allocated Items... Item *p; while ((p = list.delete_head()) != 0) delete *p;
Definition at line 365 of file Containers_T.inl.
{
while (this->delete_head ()) ;
}
| T * ACE_DLList< T >::delete_head | ( | void | ) |
Removes the item at the head of the list and returns its pointer.
Reimplemented from ACE_Double_Linked_List< ACE_DLList_Node >.
Definition at line 1886 of file Containers_T.cpp.
{
ACE_DLList_Node *temp1 = ACE_DLList_Base::delete_head ();
T *temp2 = (T *) (temp1 ? temp1->item_ : 0);
ACE_DES_FREE (temp1,
this->allocator_->free,
ACE_DLList_Node);
return temp2;
}
| T * ACE_DLList< T >::delete_tail | ( | void | ) |
Removes the item at the tail of the list and returns its pointer.
Reimplemented from ACE_Double_Linked_List< ACE_DLList_Node >.
Definition at line 1898 of file Containers_T.cpp.
{
ACE_DLList_Node *temp1 = ACE_DLList_Base::delete_tail ();
T *temp2 = (T *) (temp1 ? temp1->item_ : 0);
ACE_DES_FREE (temp1,
this->allocator_->free,
ACE_DLList_Node);
return temp2;
}
| void ACE_DLList< T >::dump | ( | void | ) | const [inline] |
Delegates to ACE_Double_Linked_List.
Reimplemented from ACE_Double_Linked_List< ACE_DLList_Node >.
Definition at line 335 of file Containers_T.inl.
{
#if defined (ACE_HAS_DUMP)
ACE_DLList_Base::dump ();
#endif /* ACE_HAS_DUMP */
}
| int ACE_DLList< T >::get | ( | T *& | item, | |
| size_t | slot = 0 | |||
| ) | [inline] |
Provide random access to any item in the list.
| item | Receives a pointer to the T object pointer held at the specified position in the list. | |
| slot | Position in the list to access. The first position is 0. |
| 0 | Success; T pointer returned in item. | |
| -1 | Error, most likely slot is outside the range of the list. |
Definition at line 325 of file Containers_T.inl.
{
ACE_DLList_Node *node;
int result = ACE_DLList_Base::get (node, index);
if (result != -1)
item = (T *) node->item_;
return result;
}
| T * ACE_DLList< T >::insert_head | ( | T * | new_item | ) |
Insert pointer for a new item at the head of the list.
Definition at line 1875 of file Containers_T.cpp.
{
ACE_DLList_Node *temp1 = 0;
ACE_NEW_MALLOC_RETURN (temp1,
(ACE_DLList_Node *) this->allocator_->malloc (sizeof (ACE_DLList_Node)),
ACE_DLList_Node (new_item), 0);
ACE_DLList_Node *temp2 = ACE_DLList_Base::insert_head (temp1);
return (T *) (temp2 ? temp2->item_ : 0);
}
| T * ACE_DLList< T >::insert_tail | ( | T * | new_item | ) |
Insert pointer for a new item at the tail of the list.
Definition at line 1863 of file Containers_T.cpp.
{
ACE_DLList_Node *temp1 = 0;
ACE_NEW_MALLOC_RETURN (temp1,
static_cast<ACE_DLList_Node *> (this->allocator_->malloc (sizeof (ACE_DLList_Node))),
ACE_DLList_Node (new_item),
0);
ACE_DLList_Node *temp2 = ACE_DLList_Base::insert_tail (temp1);
return (T *) (temp2 ? temp2->item_ : 0);
}
| void ACE_DLList< T >::operator= | ( | const ACE_DLList< T > & | l | ) | [inline] |
Delegates to ACE_Double_Linked_List.
Definition at line 319 of file Containers_T.inl.
{
*(ACE_DLList_Base *) this = l;
}
| int ACE_DLList< T >::remove | ( | ACE_DLList_Node * | n | ) | [inline] |
Delegates to ACE_Double_Linked_List.
Reimplemented from ACE_Double_Linked_List< ACE_DLList_Node >.
Definition at line 343 of file Containers_T.inl.
{
int result = ACE_DLList_Base::remove (n);
ACE_DES_FREE (n,
this->allocator_->free,
ACE_DLList_Node);
return result;
}
friend class ACE_DLList_Iterator< T > [friend] |
Definition at line 1035 of file Containers_T.h.
friend class ACE_DLList_Node [friend] |
Definition at line 1033 of file Containers_T.h.
friend class ACE_DLList_Reverse_Iterator< T > [friend] |
Definition at line 1036 of file Containers_T.h.
friend class ACE_Double_Linked_List_Iterator< T > [friend] |
Reimplemented from ACE_Double_Linked_List< ACE_DLList_Node >.
Definition at line 1034 of file Containers_T.h.
1.7.0