Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
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  const_iterator
 
class  iterator
 
class  iterator_impl
 

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_nodenode (T &item)
 
static T & item (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 41 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 148 of file intrusive_list.h.

148  : my_size(0) {
151  }

Member Function Documentation

◆ assert_ok()

template<class List , class T >
void tbb::internal::intrusive_list_base< List, T >::assert_ok ( ) const
inlineprivate

Definition at line 110 of file intrusive_list.h.

110  {
112  (my_head.my_next_node != &my_head && my_size >0), "intrusive_list_base corrupted" );
113 #if TBB_USE_ASSERT >= 2
114  size_t i = 0;
115  for ( intrusive_list_node *n = my_head.my_next_node; n != &my_head; n = n->my_next_node )
116  ++i;
117  __TBB_ASSERT( my_size == i, "Wrong size" );
118 #endif /* TBB_USE_ASSERT >= 2 */
119  }

Referenced by tbb::internal::intrusive_list_base< intrusive_list< arena >, arena >::push_front(), and tbb::internal::intrusive_list_base< intrusive_list< arena >, arena >::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 157 of file intrusive_list.h.

157 { return iterator(my_head.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 161 of file intrusive_list.h.

161 { return const_iterator(my_head.my_next_node); }

◆ empty()

template<class List , class T >
bool tbb::internal::intrusive_list_base< List, T >::empty ( ) const
inline

Definition at line 153 of file intrusive_list.h.

153 { return my_head.my_next_node == &my_head; }

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 159 of file intrusive_list.h.

159 { return iterator(&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 163 of file intrusive_list.h.

163 { return const_iterator(&my_head); }

◆ erase()

template<class List , class T >
iterator tbb::internal::intrusive_list_base< List, T >::erase ( iterator  it)
inline

Definition at line 189 of file intrusive_list.h.

189  {
190  T& val = *it;
191  ++it;
192  remove( val );
193  return it;
194  }

◆ item()

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

Definition at line 50 of file intrusive_list.h.

50 { return List::item(node); }

Referenced by tbb::internal::intrusive_list_base< List, T >::iterator_impl< const_iterator >::item(), and tbb::internal::intrusive_list_base< intrusive_list< arena >, arena >::node().

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)
inlinestaticprivate

◆ push_front()

template<class List , class T >
void tbb::internal::intrusive_list_base< List, T >::push_front ( T &  val)
inline

Definition at line 165 of file intrusive_list.h.

165  {
166  __TBB_ASSERT( node(val).my_prev_node == &node(val) && node(val).my_next_node == &node(val),
167  "Object with intrusive list node can be part of only one intrusive list simultaneously" );
168  // An object can be part of only one intrusive list at the given moment via the given node member
169  node(val).my_prev_node = &my_head;
172  my_head.my_next_node = &node(val);
173  ++my_size;
174  assert_ok();
175  }

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

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 177 of file intrusive_list.h.

177  {
178  __TBB_ASSERT( node(val).my_prev_node != &node(val) && node(val).my_next_node != &node(val), "Element to remove is not in the list" );
179  __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" );
180  --my_size;
183 #if TBB_USE_ASSERT
184  node(val).my_prev_node = node(val).my_next_node = &node(val);
185 #endif
186  assert_ok();
187  }

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

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 155 of file intrusive_list.h.

155 { return 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

◆ my_size


The documentation for this class was generated from the following file:
tbb::internal::intrusive_list_base::my_size
size_t my_size
Number of list elements.
Definition: intrusive_list.h:46
__TBB_ASSERT
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
tbb::internal::intrusive_list_node::my_next_node
intrusive_list_node * my_next_node
Definition: intrusive_list.h:32
tbb::internal::intrusive_list_base::my_head
intrusive_list_node my_head
Pointer to the head node.
Definition: intrusive_list.h:43
tbb::internal::intrusive_list_base::remove
void remove(T &val)
Definition: intrusive_list.h:177
tbb::internal::intrusive_list_base::assert_ok
void assert_ok() const
Definition: intrusive_list.h:110
tbb::internal::intrusive_list_base::node
static intrusive_list_node & node(T &item)
Definition: intrusive_list.h:48
tbb::internal::intrusive_list_node::my_prev_node
intrusive_list_node * my_prev_node
Definition: intrusive_list.h:31
tbb::internal::intrusive_list_base::item
static T & item(intrusive_list_node *node)
Definition: intrusive_list.h:50

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.