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

152  : my_size(0) {
155  }
intrusive_list_node * my_prev_node
intrusive_list_node * my_next_node
size_t my_size
Number of list elements.
intrusive_list_node my_head
Pointer to the head node.

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

114  {
116  (my_head.my_next_node != &my_head && my_size >0), "intrusive_list_base corrupted" );
117 #if TBB_USE_ASSERT >= 2
118  size_t i = 0;
119  for ( intrusive_list_node *n = my_head.my_next_node; n != &my_head; n = n->my_next_node )
120  ++i;
121  __TBB_ASSERT( my_size == i, "Wrong size" );
122 #endif /* TBB_USE_ASSERT >= 2 */
123  }
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:169
intrusive_list_node * my_prev_node
intrusive_list_node * my_next_node
size_t my_size
Number of list elements.
intrusive_list_node my_head
Pointer to the head node.

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]

◆ begin() [2/2]

template<class List, class T>
const_iterator tbb::internal::intrusive_list_base< List, T >::begin ( ) const
inline

Definition at line 165 of file intrusive_list.h.

165 { return const_iterator(my_head.my_next_node); }
intrusive_list_node * my_next_node
intrusive_list_node my_head
Pointer to the head node.

◆ empty()

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

Definition at line 157 of file intrusive_list.h.

157 { return my_head.my_next_node == &my_head; }
intrusive_list_node * my_next_node
intrusive_list_node my_head
Pointer to the head node.

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

Here is the caller graph for this function:

◆ end() [1/2]

◆ end() [2/2]

template<class List, class T>
const_iterator tbb::internal::intrusive_list_base< List, T >::end ( ) const
inline

Definition at line 167 of file intrusive_list.h.

167 { return const_iterator(&my_head); }
intrusive_list_node my_head
Pointer to the head node.

◆ erase()

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

Definition at line 193 of file intrusive_list.h.

193  {
194  T& val = *it;
195  ++it;
196  remove( val );
197  return it;
198  }

◆ item()

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

Definition at line 54 of file intrusive_list.h.

54 { return List::item(node); }
static intrusive_list_node & node(T &item)

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

◆ push_front()

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

Definition at line 169 of file intrusive_list.h.

169  {
170  __TBB_ASSERT( node(val).my_prev_node == &node(val) && node(val).my_next_node == &node(val),
171  "Object with intrusive list node can be part of only one intrusive list simultaneously" );
172  // An object can be part of only one intrusive list at the given moment via the given node member
173  node(val).my_prev_node = &my_head;
176  my_head.my_next_node = &node(val);
177  ++my_size;
178  assert_ok();
179  }
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:169
intrusive_list_node * my_prev_node
static intrusive_list_node & node(T &item)
size_t my_size
Number of list elements.
intrusive_list_node * my_next_node
intrusive_list_node my_head
Pointer to the head node.

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

181  {
182  __TBB_ASSERT( node(val).my_prev_node != &node(val) && node(val).my_next_node != &node(val), "Element to remove is not in the list" );
183  __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" );
184  --my_size;
187 #if TBB_USE_ASSERT
188  node(val).my_prev_node = node(val).my_next_node = &node(val);
189 #endif
190  assert_ok();
191  }
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:169
intrusive_list_node * my_prev_node
static intrusive_list_node & node(T &item)
size_t my_size
Number of list elements.
intrusive_list_node * my_next_node

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

159 { return my_size; }
size_t my_size
Number of list elements.

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:

Copyright © 2005-2019 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.