ACE
6.3.3
|
Implement an intrusive double linked list. More...
#include <Intrusive_List.h>
Public Member Functions | |
ACE_Intrusive_List (void) | |
~ACE_Intrusive_List (void) | |
Destructor. More... | |
bool | is_empty (void) const |
Returns true if the container is empty, otherwise returns false. More... | |
void | push_front (T *node) |
Insert an element at the beginning of the list. More... | |
void | push_back (T *node) |
Insert an element at the end of the list. More... | |
T * | pop_front (void) |
Remove the element at the beginning of the list. More... | |
T * | pop_back (void) |
Remove the element at the end of the list. More... | |
T * | head (void) const |
Get the element at the head of the queue. More... | |
T * | tail (void) const |
Get the element at the tail of the queue. More... | |
void | remove (T *node) |
Remove a element from the list. More... | |
void | swap (ACE_Intrusive_List< T > &rhs) |
Swap two lists. More... | |
void | unsafe_remove (T *node) |
Remove a element from the list without checking. More... | |
Private Member Functions | |
Disallow copying | |
ACE_Intrusive_List (const ACE_Intrusive_List< T > &) | |
ACE_Intrusive_List< T > & | operator= (const ACE_Intrusive_List< T > &) |
Private Attributes | |
T * | head_ |
Head of the list. More... | |
T * | tail_ |
Tail of the list. More... | |
Implement an intrusive double linked list.
Intrusive lists assume that the elements they contain the pointers required to build the list. They are useful as light-weight containers and free-lists.
The template argument T must implement the following methods:
A simple way to satisfy the Intrusive_List requirements would be to implement a helper class:
class My_Object : public ACE_Intrusive_List_Node<My_Object> {
....
};
typedef ACE_Intrusive_List<My_Object> My_Object_List;
However, ACE is supported on platforms that would surely get confused using such templates.
ACE_Intrusive_List< T >::ACE_Intrusive_List | ( | void | ) |
Constructor. Use user specified allocation strategy if specified.
ACE_Intrusive_List< T >::~ACE_Intrusive_List | ( | void | ) |
Destructor.
|
private |
|
inline |
Get the element at the head of the queue.
|
inline |
Returns true if the container is empty, otherwise returns false.
|
private |
T * ACE_Intrusive_List< T >::pop_back | ( | void | ) |
Remove the element at the end of the list.
T * ACE_Intrusive_List< T >::pop_front | ( | void | ) |
Remove the element at the beginning of the list.
void ACE_Intrusive_List< T >::push_back | ( | T * | node | ) |
Insert an element at the end of the list.
void ACE_Intrusive_List< T >::push_front | ( | T * | node | ) |
Insert an element at the beginning of the list.
void ACE_Intrusive_List< T >::remove | ( | T * | node | ) |
Remove a element from the list.
Verify that the element is still in the list before removing it.
|
inline |
Swap two lists.
|
inline |
Get the element at the tail of the queue.
void ACE_Intrusive_List< T >::unsafe_remove | ( | T * | node | ) |
Remove a element from the list without checking.
No attempts are performed to check if T* really belongs to the list. The effects of removing an invalid element are unspecified
|
private |
Head of the list.
|
private |
Tail of the list.