tbb::internal::intrusive_list_base< List, T > Class Template Reference

List of element of type T, where T is derived from intrusive_list_node. More...

`#include <intrusive_list.h>`

Inheritance diagram for tbb::internal::intrusive_list_base< List, T >:
Collaboration diagram for tbb::internal::intrusive_list_base< List, T >:

## Classes

class | iterator_impl

## Public Types

typedef iterator_impl< T > | iterator
typedef iterator_impl< const T > | const_iterator

## Public Member Functions

| intrusive_list_base ()
bool | empty () const
size_t | size () const
iterator | begin ()
iterator | end ()
const_iterator | begin () const
const_iterator | end () const
void | push_front (T &val)
void | remove (T &val)
iterator | erase (iterator it)

## Private Member Functions

void | assert_ok () const

## Static Private Member Functions

static intrusive_list_node & | node (T &item)
static T & | item (intrusive_list_node *node)
static const T & | item (const intrusive_list_node *node)

## Private Attributes

intrusive_list_node | my_head
| Pointer to the head node. More...
size_t | my_size
| Number of list elements. More...

## Detailed Description

### template<class List, class T>
class tbb::internal::intrusive_list_base< List, T >

List of element of type T, where T is derived from intrusive_list_node.

The class is not thread safe.

Definition at line 42 of file intrusive_list.h.

## Member Typedef Documentation

## const_iterator

template<class List , class T >

typedef iterator_impl<const T> tbb::internal::intrusive_list_base< List, T >::const_iterator

Definition at line 136 of file intrusive_list.h.

## iterator

template<class List , class T >

typedef iterator_impl<T> tbb::internal::intrusive_list_base< List, T >::iterator

Definition at line 135 of file intrusive_list.h.

## Constructor & Destructor Documentation

## intrusive_list_base()

template<class List , class T >

tbb::internal::intrusive_list_base< List, T >::intrusive_list_base | ( |  | ) |

inline

Definition at line 138 of file intrusive_list.h.

: my_size(0) {
my_head.my_prev_node = &my_head;
my_head.my_next_node = &my_head;
}
tbb::internal::intrusive_list_node::my_prev_node
intrusive_list_node * my_prev_node
Definition: intrusive_list.h:32
tbb::internal::intrusive_list_node::my_next_node
intrusive_list_node * my_next_node
Definition: intrusive_list.h:33
tbb::internal::intrusive_list_base::my_head
intrusive_list_node my_head
Pointer to the head node.
Definition: intrusive_list.h:44
tbb::internal::intrusive_list_base::my_size
size_t my_size
Number of list elements.
Definition: intrusive_list.h:47

References tbb::internal::intrusive_list_base< List, T >::my_head, tbb::internal::intrusive_list_node::my_next_node, and tbb::internal::intrusive_list_node::my_prev_node.

## Member Function Documentation

## assert_ok()

template<class List , class T >

void tbb::internal::intrusive_list_base< List, T >::assert_ok | ( |  | ) | const

inline private

Definition at line 123 of file intrusive_list.h.

{
__TBB_ASSERT( (my_head.my_prev_node == &my_head && !my_size) ||
(my_head.my_next_node != &my_head && my_size >0), "intrusive_list_base corrupted" );
#if TBB_USE_ASSERT >= 2
size_t i = 0;
for ( intrusive_list_node *n = my_head.my_next_node; n != &my_head; n = n->my_next_node )
++i;
__TBB_ASSERT( my_size == i, "Wrong size" );
#endif /* TBB_USE_ASSERT >= 2 */
}
__TBB_ASSERT
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165

References __TBB_ASSERT, tbb::internal::intrusive_list_base< List, T >::my_head, tbb::internal::intrusive_list_node::my_next_node, tbb::internal::intrusive_list_node::my_prev_node, and tbb::internal::intrusive_list_base< List, T >::my_size.

Referenced by tbb::internal::intrusive_list_base< List, T >::push_front(), and tbb::internal::intrusive_list_base< List, T >::remove().

Here is the caller graph for this function:

## begin() [1/2]

template<class List , class T >

iterator tbb::internal::intrusive_list_base< List, T >::begin | ( |  | ) |

inline

Definition at line 147 of file intrusive_list.h.

{ return iterator(my_head.my_next_node); }
tbb::internal::intrusive_list_base::iterator
iterator_impl< T > iterator
Definition: intrusive_list.h:135

References tbb::internal::intrusive_list_base< List, T >::my_head, and tbb::internal::intrusive_list_node::my_next_node.

Referenced by tbb::internal::market::arena_in_need(), tbb::internal::market::insert_arena_into_list(), tbb::internal::market::is_arena_in_list(), tbb::internal::market::remove_arena_from_list(), tbb::internal::market::try_destroy_arena(), and tbb::internal::market::update_allotment().

Here is the caller graph for this function:

## begin() [2/2]

template<class List , class T >

const_iterator tbb::internal::intrusive_list_base< List, T >::begin | ( |  | ) | const

inline

Definition at line 151 of file intrusive_list.h.

{ return const_iterator(my_head.my_next_node); }
tbb::internal::intrusive_list_base::const_iterator
iterator_impl< const T > const_iterator
Definition: intrusive_list.h:136

References tbb::internal::intrusive_list_base< List, T >::my_head, and tbb::internal::intrusive_list_node::my_next_node.

## empty()

template<class List , class T >

bool tbb::internal::intrusive_list_base< List, T >::empty | ( |  | ) | const

inline

Definition at line 143 of file intrusive_list.h.

{ return my_head.my_next_node == &my_head; }

References tbb::internal::intrusive_list_base< List, T >::my_head, and tbb::internal::intrusive_list_node::my_next_node.

Referenced by tbb::internal::market::arena_in_need().

Here is the caller graph for this function:

## end() [1/2]

template<class List , class T >

iterator tbb::internal::intrusive_list_base< List, T >::end | ( |  | ) |

inline

Definition at line 149 of file intrusive_list.h.

{ return iterator(&my_head); }

References tbb::internal::intrusive_list_base< List, T >::my_head.

Referenced by tbb::internal::market::arena_in_need(), tbb::internal::market::is_arena_in_list(), tbb::internal::market::remove_arena_from_list(), tbb::internal::market::try_destroy_arena(), and tbb::internal::market::update_allotment().

Here is the caller graph for this function:

## end() [2/2]

template<class List , class T >

const_iterator tbb::internal::intrusive_list_base< List, T >::end | ( |  | ) | const

inline

Definition at line 153 of file intrusive_list.h.

{ return const_iterator(&my_head); }

References tbb::internal::intrusive_list_base< List, T >::my_head.

## erase()

template<class List , class T >

iterator tbb::internal::intrusive_list_base< List, T >::erase | ( | iterator | it | ) |

inline

Definition at line 179 of file intrusive_list.h.

{
T& val = *it;
++it;
remove( val );
return it;
}
tbb::internal::intrusive_list_base::remove
void remove(T &val)
Definition: intrusive_list.h:167

References tbb::internal::intrusive_list_base< List, T >::remove().

Here is the call graph for this function:

## item() [1/2]

template<class List , class T >

static const T& tbb::internal::intrusive_list_base< List, T >::item | ( | const intrusive_list_node * | node | ) |

inline static private

Definition at line 53 of file intrusive_list.h.

{ return List::item(node); }
tbb::internal::intrusive_list_base::node
static intrusive_list_node & node(T &item)
Definition: intrusive_list.h:49

References tbb::internal::intrusive_list_base< List, T >::node().

Here is the call graph for this function:

## item() [2/2]

template<class List , class T >

static T& tbb::internal::intrusive_list_base< List, T >::item | ( | intrusive_list_node * | node | ) |

inline static private

Definition at line 51 of file intrusive_list.h.

{ return List::item(node); }

References tbb::internal::intrusive_list_base< List, T >::node().

Referenced by tbb::internal::intrusive_list_base< List, T >::node(), tbb::internal::intrusive_list_base< List, T >::iterator_impl< DereferenceType >::operator*(), and tbb::internal::intrusive_list_base< List, T >::iterator_impl< DereferenceType >::operator->().

Here is the call graph for this function:
Here is the caller graph for this function:

## node()

template<class List , class T >

static intrusive_list_node& tbb::internal::intrusive_list_base< List, T >::node | ( | T & | item | ) |

inline static private

Definition at line 49 of file intrusive_list.h.

{ return List::node(item); }
tbb::internal::intrusive_list_base::item
static T & item(intrusive_list_node *node)
Definition: intrusive_list.h:51

References tbb::internal::intrusive_list_base< List, T >::item().

Referenced by tbb::internal::intrusive_list_base< List, T >::item(), tbb::internal::intrusive_list_base< List, T >::iterator_impl< DereferenceType >::operator=(), tbb::internal::intrusive_list_base< List, T >::push_front(), and tbb::internal::intrusive_list_base< List, T >::remove().

Here is the call graph for this function:
Here is the caller graph for this function:

## push_front()

template<class List , class T >

void tbb::internal::intrusive_list_base< List, T >::push_front | ( | T & | val | ) |

inline

Definition at line 155 of file intrusive_list.h.

{
__TBB_ASSERT( node(val).my_prev_node == &node(val) && node(val).my_next_node == &node(val),
"Object with intrusive list node can be part of only one intrusive list simultaneously" );
// An object can be part of only one intrusive list at the given moment via the given node member
node(val).my_prev_node = &my_head;
node(val).my_next_node = my_head.my_next_node;
my_head.my_next_node->my_prev_node = &node(val);
my_head.my_next_node = &node(val);
++my_size;
assert_ok();
}
tbb::internal::intrusive_list_base::assert_ok
void assert_ok() const
Definition: intrusive_list.h:123

References __TBB_ASSERT, tbb::internal::intrusive_list_base< List, T >::assert_ok(), tbb::internal::intrusive_list_base< List, T >::my_head, tbb::internal::intrusive_list_node::my_next_node, tbb::internal::intrusive_list_node::my_prev_node, tbb::internal::intrusive_list_base< List, T >::my_size, and tbb::internal::intrusive_list_base< List, T >::node().

Referenced by tbb::internal::market::insert_arena_into_list().

Here is the call graph for this function:
Here is the caller graph for this function:

## remove()

template<class List , class T >

void tbb::internal::intrusive_list_base< List, T >::remove | ( | T & | val | ) |

inline

Definition at line 167 of file intrusive_list.h.

{
__TBB_ASSERT( node(val).my_prev_node != &node(val) && node(val).my_next_node != &node(val), "Element to remove is not in the list" );
__TBB_ASSERT( node(val).my_prev_node->my_next_node == &node(val) && node(val).my_next_node->my_prev_node == &node(val), "Element to remove is not in the list" );
--my_size;
node(val).my_next_node->my_prev_node = node(val).my_prev_node;
node(val).my_prev_node->my_next_node = node(val).my_next_node;
#if TBB_USE_ASSERT
node(val).my_prev_node = node(val).my_next_node = &node(val);
#endif
assert_ok();
}

References __TBB_ASSERT, tbb::internal::intrusive_list_base< List, T >::assert_ok(), tbb::internal::intrusive_list_node::my_next_node, tbb::internal::intrusive_list_node::my_prev_node, tbb::internal::intrusive_list_base< List, T >::my_size, and tbb::internal::intrusive_list_base< List, T >::node().

Referenced by tbb::internal::intrusive_list_base< List, T >::erase(), and tbb::internal::market::remove_arena_from_list().

Here is the call graph for this function:
Here is the caller graph for this function:

## size()

template<class List , class T >

size_t tbb::internal::intrusive_list_base< List, T >::size | ( |  | ) | const

inline

Definition at line 145 of file intrusive_list.h.

{ return my_size; }

References tbb::internal::intrusive_list_base< List, T >::my_size.

Referenced by tbb::internal::market::insert_arena_into_list(), and tbb::internal::market::remove_arena_from_list().

Here is the caller graph for this function:

## Member Data Documentation

## my_head

template<class List , class T >

intrusive_list_node tbb::internal::intrusive_list_base< List, T >::my_head

private

Pointer to the head node.

Definition at line 44 of file intrusive_list.h.

Referenced by tbb::internal::intrusive_list_base< List, T >::assert_ok(), tbb::internal::intrusive_list_base< List, T >::begin(), tbb::internal::intrusive_list_base< List, T >::empty(), tbb::internal::intrusive_list_base< List, T >::end(), tbb::internal::intrusive_list_base< List, T >::intrusive_list_base(), and tbb::internal::intrusive_list_base< List, T >::push_front().

## my_size

template<class List , class T >

size_t tbb::internal::intrusive_list_base< List, T >::my_size

private

Number of list elements.

Definition at line 47 of file intrusive_list.h.

Referenced by tbb::internal::intrusive_list_base< List, T >::assert_ok(), tbb::internal::intrusive_list_base< List, T >::push_front(), tbb::internal::intrusive_list_base< List, T >::remove(), and tbb::internal::intrusive_list_base< List, T >::size().

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

- intrusive_list.h

Copyright © 2005-2020 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.