Home ⌂Doc Index ◂Up ▴
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  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_nodenode (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.

138  : my_size(0) {
141  }
intrusive_list_node my_head
Pointer to the head node.
intrusive_list_node * my_prev_node
size_t my_size
Number of list elements.
intrusive_list_node * my_next_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 123 of file intrusive_list.h.

123  {
125  (my_head.my_next_node != &my_head && my_size >0), "intrusive_list_base corrupted" );
126 #if TBB_USE_ASSERT >= 2
127  size_t i = 0;
128  for ( intrusive_list_node *n = my_head.my_next_node; n != &my_head; n = n->my_next_node )
129  ++i;
130  __TBB_ASSERT( my_size == i, "Wrong size" );
131 #endif /* TBB_USE_ASSERT >= 2 */
132  }
intrusive_list_node my_head
Pointer to the head node.
intrusive_list_node * my_prev_node
size_t my_size
Number of list elements.
intrusive_list_node * my_next_node
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165

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

147 { return iterator(my_head.my_next_node); }
intrusive_list_node my_head
Pointer to the head node.
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.

intrusive_list_node my_head
Pointer to the head node.
iterator_impl< const T > const_iterator
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.

143 { return my_head.my_next_node == &my_head; }
intrusive_list_node my_head
Pointer to the head node.
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.

149 { return iterator(&my_head); }
intrusive_list_node my_head
Pointer to the head node.

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.

153 { return const_iterator(&my_head); }
intrusive_list_node my_head
Pointer to the head node.
iterator_impl< const T > const_iterator

◆ 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.

179  {
180  T& val = *it;
181  ++it;
182  remove( val );
183  return it;
184  }

◆ item() [1/2]

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

Definition at line 51 of file intrusive_list.h.

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

Referenced by tbb::internal::intrusive_list_base< intrusive_list< arena >, arena >::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 caller graph for this function:

◆ item() [2/2]

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

Definition at line 53 of file intrusive_list.h.

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

◆ node()

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

Definition at line 49 of file intrusive_list.h.

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

Referenced by tbb::internal::intrusive_list_base< intrusive_list< arena >, arena >::item(), tbb::internal::intrusive_list_base< List, T >::iterator_impl< DereferenceType >::operator=(), 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:

◆ 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.

155  {
156  __TBB_ASSERT( node(val).my_prev_node == &node(val) && node(val).my_next_node == &node(val),
157  "Object with intrusive list node can be part of only one intrusive list simultaneously" );
158  // An object can be part of only one intrusive list at the given moment via the given node member
159  node(val).my_prev_node = &my_head;
162  my_head.my_next_node = &node(val);
163  ++my_size;
164  assert_ok();
165  }
intrusive_list_node my_head
Pointer to the head node.
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
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165

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

167  {
168  __TBB_ASSERT( node(val).my_prev_node != &node(val) && node(val).my_next_node != &node(val), "Element to remove is not in the list" );
169  __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" );
170  --my_size;
173 #if TBB_USE_ASSERT
174  node(val).my_prev_node = node(val).my_next_node = &node(val);
175 #endif
176  assert_ok();
177  }
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
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165

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

145 { 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-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.