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_node & | node (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.

: my_size(0) {
my_head.my_prev_node = &my_head;
my_head.my_next_node = &my_head;
}

## 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 110 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 */
}

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.

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

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

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

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

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

{
T& val = *it;
++it;
remove( val );
return it;
}

## item()

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

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

inline static private

Definition at line 48 of file intrusive_list.h.

{ return List::node(item); }

Referenced by tbb::internal::intrusive_list_base< intrusive_list< arena >, arena >::item(), tbb::internal::intrusive_list_base< List, T >::iterator_impl< const_iterator >::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 165 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();
}

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.

{
__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();
}

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.

{ 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

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

Referenced by tbb::internal::intrusive_list_base< intrusive_list< arena >, arena >::assert_ok(), tbb::internal::intrusive_list_base< intrusive_list< arena >, arena >::begin(), tbb::internal::intrusive_list_base< intrusive_list< arena >, arena >::empty(), tbb::internal::intrusive_list_base< intrusive_list< arena >, arena >::end(), tbb::internal::intrusive_list_base< intrusive_list< arena >, arena >::intrusive_list_base(), and tbb::internal::intrusive_list_base< intrusive_list< arena >, arena >::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 46 of file intrusive_list.h.

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

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

- intrusive_list.h

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::item
static T & item(intrusive_list_node *node)
Definition: intrusive_list.h:50
__TBB_ASSERT
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
tbb::internal::intrusive_list_base::my_size
size_t my_size
Number of list elements.
Definition: intrusive_list.h:46
tbb::internal::intrusive_list_base::assert_ok
void assert_ok() const
Definition: intrusive_list.h:110
tbb::internal::intrusive_list_base::remove
void remove(T &val)
Definition: intrusive_list.h:177
tbb::internal::intrusive_list_base::node
static intrusive_list_node & node(T &item)
Definition: intrusive_list.h:48
tbb::internal::intrusive_list_node::my_next_node
intrusive_list_node * my_next_node
Definition: intrusive_list.h:31
tbb::internal::intrusive_list_node::my_prev_node
intrusive_list_node * my_prev_node
Definition: intrusive_list.h:31

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.