ACE 8.0.1
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ACE_Intrusive_List< T > Class Template Reference

Implement an intrusive double linked list. More...

#include <Intrusive_List.h>

Public Member Functions

 ACE_Intrusive_List ()=default
 
 ~ACE_Intrusive_List ()=default
 Destructor.
 
bool is_empty () const
 Returns true if the container is empty, otherwise returns false.
 
void push_front (T *node)
 Insert an element at the beginning of the list.
 
void push_back (T *node)
 Insert an element at the end of the list.
 
T * pop_front ()
 Remove the element at the beginning of the list.
 
T * pop_back ()
 Remove the element at the end of the list.
 
T * head () const
 Get the element at the head of the queue.
 
T * tail () const
 Get the element at the tail of the queue.
 
void remove (T *node)
 Remove a element from the list.
 
void swap (ACE_Intrusive_List< T > &rhs)
 Swap two lists.
 
void unsafe_remove (T *node)
 Remove a element from the list without checking.
 

Disallow copying

T * head_ {}
 Head of the list.
 
T * tail_ {}
 Tail of the list.
 
 ACE_Intrusive_List (const ACE_Intrusive_List< T > &)
 Head of the list.
 
ACE_Intrusive_List< T > & operator= (const ACE_Intrusive_List< T > &)
 Head of the list.
 

Detailed Description

template<class T>
class ACE_Intrusive_List< T >

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.

Todo
The ACE_Message_Queue is an example of an intrusive list (or queue) but it is not implemented in terms of this class.

Constructor & Destructor Documentation

◆ ACE_Intrusive_List() [1/2]

template<class T >
ACE_Intrusive_List< T >::ACE_Intrusive_List ( )
default

Constructor. Use user specified allocation strategy if specified.

◆ ~ACE_Intrusive_List()

template<class T >
ACE_Intrusive_List< T >::~ACE_Intrusive_List ( )
default

Destructor.

◆ ACE_Intrusive_List() [2/2]

template<class T >
ACE_Intrusive_List< T >::ACE_Intrusive_List ( const ACE_Intrusive_List< T > & )
private

Head of the list.

Member Function Documentation

◆ head()

template<class T >
T * ACE_Intrusive_List< T >::head ( ) const
inline

Get the element at the head of the queue.

◆ is_empty()

template<class T >
bool ACE_Intrusive_List< T >::is_empty ( ) const
inline

Returns true if the container is empty, otherwise returns false.

◆ operator=()

template<class T >
ACE_Intrusive_List< T > & ACE_Intrusive_List< T >::operator= ( const ACE_Intrusive_List< T > & )
private

Head of the list.

◆ pop_back()

template<class T >
T * ACE_Intrusive_List< T >::pop_back ( )

Remove the element at the end of the list.

◆ pop_front()

template<class T >
T * ACE_Intrusive_List< T >::pop_front ( )

Remove the element at the beginning of the list.

◆ push_back()

template<class T >
void ACE_Intrusive_List< T >::push_back ( T * node)

Insert an element at the end of the list.

◆ push_front()

template<class T >
void ACE_Intrusive_List< T >::push_front ( T * node)

Insert an element at the beginning of the list.

◆ remove()

template<class T >
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.

◆ swap()

template<class T >
void ACE_Intrusive_List< T >::swap ( ACE_Intrusive_List< T > & rhs)
inline

Swap two lists.

◆ tail()

template<class T >
T * ACE_Intrusive_List< T >::tail ( ) const
inline

Get the element at the tail of the queue.

◆ unsafe_remove()

template<class T >
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

Member Data Documentation

◆ head_

template<class T >
T* ACE_Intrusive_List< T >::head_ {}
private

Head of the list.

◆ tail_

template<class T >
T* ACE_Intrusive_List< T >::tail_ {}
private

Tail of the list.


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