Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
tbb::interface5::internal::split_ordered_list< T, Allocator > Class Template Reference

#include <_concurrent_unordered_impl.h>

Inheritance diagram for tbb::interface5::internal::split_ordered_list< T, Allocator >:
Collaboration diagram for tbb::interface5::internal::split_ordered_list< T, Allocator >:

Classes

struct  node
 

Public Types

typedef split_ordered_list< T, Allocator > self_type
 
typedef tbb::internal::allocator_rebind< Allocator, T >::type allocator_type
 
typedef nodenodeptr_t
 
typedef tbb::internal::allocator_traits< allocator_type >::value_type value_type
 
typedef tbb::internal::allocator_traits< allocator_type >::size_type size_type
 
typedef tbb::internal::allocator_traits< allocator_type >::difference_type difference_type
 
typedef tbb::internal::allocator_traits< allocator_type >::pointer pointer
 
typedef tbb::internal::allocator_traits< allocator_type >::const_pointer const_pointer
 
typedef value_typereference
 
typedef const value_typeconst_reference
 
typedef solist_iterator< self_type, const value_typeconst_iterator
 
typedef solist_iterator< self_type, value_typeiterator
 
typedef flist_iterator< self_type, const value_typeraw_const_iterator
 
typedef flist_iterator< self_type, value_typeraw_iterator
 

Public Member Functions

nodeptr_t create_node (sokey_t order_key)
 
template<typename Arg >
nodeptr_t create_node (sokey_t order_key, __TBB_FORWARDING_REF(Arg) t, tbb::internal::true_type=tbb::internal::true_type())
 
template<typename Arg >
nodeptr_t create_node (sokey_t, __TBB_FORWARDING_REF(Arg), tbb::internal::false_type)
 
template<typename __TBB_PARAMETER_PACK Args>
nodeptr_t create_node_v (__TBB_FORWARDING_REF(Args) __TBB_PARAMETER_PACK args)
 
 split_ordered_list (allocator_type a=allocator_type())
 
 ~split_ordered_list ()
 
allocator_type get_allocator () const
 
void clear ()
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
bool empty () const
 
size_type size () const
 
size_type max_size () const
 
void swap (self_type &other)
 
raw_iterator raw_begin ()
 
raw_const_iterator raw_begin () const
 
raw_iterator raw_end ()
 
raw_const_iterator raw_end () const
 
iterator get_iterator (raw_iterator it)
 
const_iterator get_iterator (raw_const_iterator it) const
 
raw_iterator get_iterator (raw_const_iterator it)
 
iterator first_real_iterator (raw_iterator it)
 
const_iterator first_real_iterator (raw_const_iterator it) const
 
void destroy_node (nodeptr_t pnode)
 
std::pair< iterator, bool > try_insert (raw_iterator it, raw_iterator next, nodeptr_t pnode, size_type *new_count)
 
raw_iterator insert_dummy (raw_iterator it, sokey_t order_key)
 
void erase_node (raw_iterator previous, raw_const_iterator &where)
 
iterator erase_node (raw_iterator previous, const_iterator where)
 
void move_all (self_type &source)
 

Static Public Member Functions

static sokey_t get_order_key (const raw_const_iterator &it)
 
static sokey_t get_safe_order_key (const raw_const_iterator &it)
 
static iterator get_iterator (const_iterator it)
 
static nodeptr_t try_insert_atomic (nodeptr_t previous, nodeptr_t new_node, nodeptr_t current_node)
 

Private Member Functions

void check_range (raw_iterator first, raw_iterator last)
 
void check_range ()
 

Private Attributes

tbb::internal::allocator_rebind< allocator_type, node >::type my_node_allocator
 
size_type my_element_count
 
nodeptr_t my_head
 

Friends

template<typename Traits >
class concurrent_unordered_base
 

Detailed Description

template<typename T, typename Allocator>
class tbb::interface5::internal::split_ordered_list< T, Allocator >

Definition at line 56 of file _concurrent_unordered_impl.h.

Member Typedef Documentation

◆ allocator_type

template<typename T, typename Allocator>
typedef tbb::internal::allocator_rebind<Allocator, T>::type tbb::interface5::internal::split_ordered_list< T, Allocator >::allocator_type

Definition at line 190 of file _concurrent_unordered_impl.h.

◆ const_iterator

template<typename T, typename Allocator>
typedef solist_iterator<self_type, const value_type> tbb::interface5::internal::split_ordered_list< T, Allocator >::const_iterator

Definition at line 204 of file _concurrent_unordered_impl.h.

◆ const_pointer

Definition at line 199 of file _concurrent_unordered_impl.h.

◆ const_reference

template<typename T, typename Allocator>
typedef const value_type& tbb::interface5::internal::split_ordered_list< T, Allocator >::const_reference

Definition at line 202 of file _concurrent_unordered_impl.h.

◆ difference_type

Definition at line 197 of file _concurrent_unordered_impl.h.

◆ iterator

template<typename T, typename Allocator>
typedef solist_iterator<self_type, value_type> tbb::interface5::internal::split_ordered_list< T, Allocator >::iterator

Definition at line 205 of file _concurrent_unordered_impl.h.

◆ nodeptr_t

template<typename T, typename Allocator>
typedef node* tbb::interface5::internal::split_ordered_list< T, Allocator >::nodeptr_t

Definition at line 192 of file _concurrent_unordered_impl.h.

◆ pointer

template<typename T, typename Allocator>
typedef tbb::internal::allocator_traits<allocator_type>::pointer tbb::interface5::internal::split_ordered_list< T, Allocator >::pointer

Definition at line 198 of file _concurrent_unordered_impl.h.

◆ raw_const_iterator

template<typename T, typename Allocator>
typedef flist_iterator<self_type, const value_type> tbb::interface5::internal::split_ordered_list< T, Allocator >::raw_const_iterator

Definition at line 206 of file _concurrent_unordered_impl.h.

◆ raw_iterator

template<typename T, typename Allocator>
typedef flist_iterator<self_type, value_type> tbb::interface5::internal::split_ordered_list< T, Allocator >::raw_iterator

Definition at line 207 of file _concurrent_unordered_impl.h.

◆ reference

template<typename T, typename Allocator>
typedef value_type& tbb::interface5::internal::split_ordered_list< T, Allocator >::reference

Definition at line 201 of file _concurrent_unordered_impl.h.

◆ self_type

template<typename T, typename Allocator>
typedef split_ordered_list<T, Allocator> tbb::interface5::internal::split_ordered_list< T, Allocator >::self_type

Definition at line 188 of file _concurrent_unordered_impl.h.

◆ size_type

template<typename T, typename Allocator>
typedef tbb::internal::allocator_traits<allocator_type>::size_type tbb::interface5::internal::split_ordered_list< T, Allocator >::size_type

Definition at line 196 of file _concurrent_unordered_impl.h.

◆ value_type

template<typename T, typename Allocator>
typedef tbb::internal::allocator_traits<allocator_type>::value_type tbb::interface5::internal::split_ordered_list< T, Allocator >::value_type

Definition at line 195 of file _concurrent_unordered_impl.h.

Constructor & Destructor Documentation

◆ split_ordered_list()

template<typename T, typename Allocator>
tbb::interface5::internal::split_ordered_list< T, Allocator >::split_ordered_list ( allocator_type  a = allocator_type())
inline

Definition at line 306 of file _concurrent_unordered_impl.h.

308  {
309  // Immediately allocate a dummy node with order key of 0. This node
310  // will always be the head of the list.
312  }
tbb::internal::allocator_rebind< allocator_type, node >::type my_node_allocator

◆ ~split_ordered_list()

template<typename T, typename Allocator>
tbb::interface5::internal::split_ordered_list< T, Allocator >::~split_ordered_list ( )
inline

Definition at line 314 of file _concurrent_unordered_impl.h.

315  {
316  // Clear the list
317  clear();
318 
319  // Remove the head element which is not cleared by clear()
320  nodeptr_t pnode = my_head;
321  my_head = NULL;
322 
323  __TBB_ASSERT(pnode != NULL && pnode->my_next == NULL, "Invalid head list node");
324 
325  destroy_node(pnode);
326  }
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:169

Member Function Documentation

◆ begin() [1/2]

template<typename T, typename Allocator>
iterator tbb::interface5::internal::split_ordered_list< T, Allocator >::begin ( )
inline

◆ begin() [2/2]

template<typename T, typename Allocator>
const_iterator tbb::interface5::internal::split_ordered_list< T, Allocator >::begin ( ) const
inline

◆ cbegin()

template<typename T, typename Allocator>
const_iterator tbb::interface5::internal::split_ordered_list< T, Allocator >::cbegin ( ) const
inline

Definition at line 371 of file _concurrent_unordered_impl.h.

371  {
372  return (((const self_type *)this)->begin());
373  }

◆ cend()

template<typename T, typename Allocator>
const_iterator tbb::interface5::internal::split_ordered_list< T, Allocator >::cend ( ) const
inline

Definition at line 375 of file _concurrent_unordered_impl.h.

375  {
376  return (((const self_type *)this)->end());
377  }

◆ check_range() [1/2]

template<typename T, typename Allocator>
void tbb::interface5::internal::split_ordered_list< T, Allocator >::check_range ( raw_iterator  first,
raw_iterator  last 
)
inlineprivate

Definition at line 625 of file _concurrent_unordered_impl.h.

626  {
627 #if TBB_USE_ASSERT
628  for (raw_iterator it = first; it != last; ++it)
629  {
630  raw_iterator next = it;
631  ++next;
632 
633  __TBB_ASSERT(next == raw_end() || get_order_key(next) >= get_order_key(it), "!!! List order inconsistency !!!");
634  }
635 #else
637 #endif
638  }
static sokey_t get_order_key(const raw_const_iterator &it)
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:169
auto first(Container &c) -> decltype(begin(c))
void suppress_unused_warning(const T1 &)
Utility template function to prevent "unused" warnings by various compilers.
Definition: tbb_stddef.h:381
auto last(Container &c) -> decltype(begin(c))
flist_iterator< self_type, value_type > raw_iterator

◆ check_range() [2/2]

template<typename T, typename Allocator>
void tbb::interface5::internal::split_ordered_list< T, Allocator >::check_range ( )
inlineprivate

◆ clear()

template<typename T, typename Allocator>
void tbb::interface5::internal::split_ordered_list< T, Allocator >::clear ( )
inline

Definition at line 334 of file _concurrent_unordered_impl.h.

334  {
335  nodeptr_t pnext;
336  nodeptr_t pnode = my_head;
337 
338  __TBB_ASSERT(my_head != NULL, "Invalid head list node");
339  pnext = pnode->my_next;
340  pnode->my_next = NULL;
341  pnode = pnext;
342 
343  while (pnode != NULL)
344  {
345  pnext = pnode->my_next;
346  destroy_node(pnode);
347  pnode = pnext;
348  }
349 
350  my_element_count = 0;
351  }
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:169

◆ create_node() [1/3]

template<typename T, typename Allocator>
nodeptr_t tbb::interface5::internal::split_ordered_list< T, Allocator >::create_node ( sokey_t  order_key)
inline

Definition at line 258 of file _concurrent_unordered_impl.h.

258  {
259  nodeptr_t pnode = my_node_allocator.allocate(1);
260  pnode->init(order_key);
261  return (pnode);
262  }
tbb::internal::allocator_rebind< allocator_type, node >::type my_node_allocator

◆ create_node() [2/3]

template<typename T, typename Allocator>
template<typename Arg >
nodeptr_t tbb::interface5::internal::split_ordered_list< T, Allocator >::create_node ( sokey_t  order_key,
__TBB_FORWARDING_REF(Arg)  t,
tbb::internal::true_type  = tbb::internal::true_type() 
)
inline

Definition at line 266 of file _concurrent_unordered_impl.h.

267  {
268  nodeptr_t pnode = my_node_allocator.allocate(1);
269 
270  //TODO: use RAII scoped guard instead of explicit catch
271  __TBB_TRY {
272  new(static_cast<void*>(&pnode->my_element)) T(tbb::internal::forward<Arg>(t));
273  pnode->init(order_key);
274  } __TBB_CATCH(...) {
275  my_node_allocator.deallocate(pnode, 1);
276  __TBB_RETHROW();
277  }
278 
279  return (pnode);
280  }
#define __TBB_TRY
Definition: tbb_stddef.h:287
#define __TBB_CATCH(e)
Definition: tbb_stddef.h:288
tbb::internal::allocator_rebind< allocator_type, node >::type my_node_allocator
#define __TBB_RETHROW()
Definition: tbb_stddef.h:290

◆ create_node() [3/3]

template<typename T, typename Allocator>
template<typename Arg >
nodeptr_t tbb::interface5::internal::split_ordered_list< T, Allocator >::create_node ( sokey_t  ,
__TBB_FORWARDING_REF(Arg)  ,
tbb::internal::false_type   
)
inline

Definition at line 284 of file _concurrent_unordered_impl.h.

285  {
286  __TBB_ASSERT(false, "This compile-time helper should never get called");
287  return nodeptr_t();
288  }
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:169

◆ create_node_v()

template<typename T, typename Allocator>
template<typename __TBB_PARAMETER_PACK Args>
nodeptr_t tbb::interface5::internal::split_ordered_list< T, Allocator >::create_node_v ( __TBB_FORWARDING_REF(Args) __TBB_PARAMETER_PACK  args)
inline

Definition at line 292 of file _concurrent_unordered_impl.h.

292  {
293  nodeptr_t pnode = my_node_allocator.allocate(1);
294 
295  //TODO: use RAII scoped guard instead of explicit catch
296  __TBB_TRY {
297  new(static_cast<void*>(&pnode->my_element)) T(__TBB_PACK_EXPANSION(tbb::internal::forward<Args>(args)));
298  } __TBB_CATCH(...) {
299  my_node_allocator.deallocate(pnode, 1);
300  __TBB_RETHROW();
301  }
302 
303  return (pnode);
304  }
#define __TBB_TRY
Definition: tbb_stddef.h:287
#define __TBB_CATCH(e)
Definition: tbb_stddef.h:288
#define __TBB_PACK_EXPANSION(A)
Definition: tbb_stddef.h:508
tbb::internal::allocator_rebind< allocator_type, node >::type my_node_allocator
#define __TBB_RETHROW()
Definition: tbb_stddef.h:290

◆ destroy_node()

template<typename T, typename Allocator>
void tbb::interface5::internal::split_ordered_list< T, Allocator >::destroy_node ( nodeptr_t  pnode)
inline

Definition at line 483 of file _concurrent_unordered_impl.h.

483  {
484  if (!pnode->is_dummy()) my_node_allocator.destroy(pnode);
485  my_node_allocator.deallocate(pnode, 1);
486  }
tbb::internal::allocator_rebind< allocator_type, node >::type my_node_allocator

◆ empty()

template<typename T, typename Allocator>
bool tbb::interface5::internal::split_ordered_list< T, Allocator >::empty ( ) const
inline

Definition at line 380 of file _concurrent_unordered_impl.h.

380  {
381  return (my_element_count == 0);
382  }

◆ end() [1/2]

template<typename T, typename Allocator>
iterator tbb::interface5::internal::split_ordered_list< T, Allocator >::end ( )
inline

Definition at line 363 of file _concurrent_unordered_impl.h.

363  {
364  return (iterator(0, this));
365  }
solist_iterator< self_type, value_type > iterator

◆ end() [2/2]

template<typename T, typename Allocator>
const_iterator tbb::interface5::internal::split_ordered_list< T, Allocator >::end ( ) const
inline

Definition at line 367 of file _concurrent_unordered_impl.h.

367  {
368  return (const_iterator(0, this));
369  }
solist_iterator< self_type, const value_type > const_iterator

◆ erase_node() [1/2]

template<typename T, typename Allocator>
void tbb::interface5::internal::split_ordered_list< T, Allocator >::erase_node ( raw_iterator  previous,
raw_const_iterator where 
)
inline

Definition at line 572 of file _concurrent_unordered_impl.h.

Referenced by tbb::interface5::internal::split_ordered_list< value_type, typename Traits::allocator_type >::move_all().

573  {
574  nodeptr_t pnode = (where++).get_node_ptr();
575  nodeptr_t prevnode = previous.get_node_ptr();
576  __TBB_ASSERT(prevnode->my_next == pnode, "Erase must take consecutive iterators");
577  prevnode->my_next = pnode->my_next;
578 
579  destroy_node(pnode);
580  }
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:169
Here is the caller graph for this function:

◆ erase_node() [2/2]

template<typename T, typename Allocator>
iterator tbb::interface5::internal::split_ordered_list< T, Allocator >::erase_node ( raw_iterator  previous,
const_iterator  where 
)
inline

Definition at line 583 of file _concurrent_unordered_impl.h.

584  {
585  raw_const_iterator it = where;
586  erase_node(previous, it);
588 
589  return get_iterator(first_real_iterator(it));
590  }
flist_iterator< self_type, const value_type > raw_const_iterator
void erase_node(raw_iterator previous, raw_const_iterator &where)

◆ first_real_iterator() [1/2]

template<typename T, typename Allocator>
iterator tbb::interface5::internal::split_ordered_list< T, Allocator >::first_real_iterator ( raw_iterator  it)
inline

Definition at line 462 of file _concurrent_unordered_impl.h.

Referenced by tbb::interface5::internal::concurrent_unordered_base< Traits >::const_range_type::set_midpoint().

463  {
464  // Skip all dummy, internal only iterators
465  while (it != raw_end() && it.get_node_ptr()->is_dummy())
466  ++it;
467 
468  return iterator(it.get_node_ptr(), this);
469  }
solist_iterator< self_type, value_type > iterator
Here is the caller graph for this function:

◆ first_real_iterator() [2/2]

template<typename T, typename Allocator>
const_iterator tbb::interface5::internal::split_ordered_list< T, Allocator >::first_real_iterator ( raw_const_iterator  it) const
inline

Definition at line 473 of file _concurrent_unordered_impl.h.

474  {
475  // Skip all dummy, internal only iterators
476  while (it != raw_end() && it.get_node_ptr()->is_dummy())
477  ++it;
478 
479  return const_iterator(it.get_node_ptr(), this);
480  }
solist_iterator< self_type, const value_type > const_iterator

◆ get_allocator()

template<typename T, typename Allocator>
allocator_type tbb::interface5::internal::split_ordered_list< T, Allocator >::get_allocator ( ) const
inline

Definition at line 330 of file _concurrent_unordered_impl.h.

330  {
331  return (my_node_allocator);
332  }
tbb::internal::allocator_rebind< allocator_type, node >::type my_node_allocator

◆ get_iterator() [1/4]

template<typename T, typename Allocator>
iterator tbb::interface5::internal::split_ordered_list< T, Allocator >::get_iterator ( raw_iterator  it)
inline

Definition at line 438 of file _concurrent_unordered_impl.h.

Referenced by tbb::interface5::internal::concurrent_unordered_base< Traits >::const_range_type::begin(), and tbb::interface5::internal::concurrent_unordered_base< Traits >::const_range_type::end().

438  {
439  __TBB_ASSERT(it.get_node_ptr() == NULL || !it.get_node_ptr()->is_dummy(), "Invalid user node (dummy)");
440  return iterator(it.get_node_ptr(), this);
441  }
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:169
solist_iterator< self_type, value_type > iterator
Here is the caller graph for this function:

◆ get_iterator() [2/4]

template<typename T, typename Allocator>
const_iterator tbb::interface5::internal::split_ordered_list< T, Allocator >::get_iterator ( raw_const_iterator  it) const
inline

Definition at line 445 of file _concurrent_unordered_impl.h.

445  {
446  __TBB_ASSERT(it.get_node_ptr() == NULL || !it.get_node_ptr()->is_dummy(), "Invalid user node (dummy)");
447  return const_iterator(it.get_node_ptr(), this);
448  }
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:169
solist_iterator< self_type, const value_type > const_iterator

◆ get_iterator() [3/4]

template<typename T, typename Allocator>
raw_iterator tbb::interface5::internal::split_ordered_list< T, Allocator >::get_iterator ( raw_const_iterator  it)
inline

Definition at line 451 of file _concurrent_unordered_impl.h.

451  {
452  return raw_iterator(it.get_node_ptr());
453  }
flist_iterator< self_type, value_type > raw_iterator

◆ get_iterator() [4/4]

template<typename T, typename Allocator>
static iterator tbb::interface5::internal::split_ordered_list< T, Allocator >::get_iterator ( const_iterator  it)
inlinestatic

Definition at line 456 of file _concurrent_unordered_impl.h.

456  {
457  return iterator(it.my_node_ptr, it.my_list_ptr);
458  }
solist_iterator< self_type, value_type > iterator

◆ get_order_key()

template<typename T, typename Allocator>
static sokey_t tbb::interface5::internal::split_ordered_list< T, Allocator >::get_order_key ( const raw_const_iterator it)
inlinestatic

Definition at line 427 of file _concurrent_unordered_impl.h.

427  {
428  return it.get_node_ptr()->get_order_key();
429  }

◆ get_safe_order_key()

template<typename T, typename Allocator>
static sokey_t tbb::interface5::internal::split_ordered_list< T, Allocator >::get_safe_order_key ( const raw_const_iterator it)
inlinestatic

Definition at line 431 of file _concurrent_unordered_impl.h.

431  {
432  if( !it.get_node_ptr() ) return ~sokey_t(0);
433  return it.get_node_ptr()->get_order_key();
434  }

◆ insert_dummy()

template<typename T, typename Allocator>
raw_iterator tbb::interface5::internal::split_ordered_list< T, Allocator >::insert_dummy ( raw_iterator  it,
sokey_t  order_key 
)
inline

Definition at line 514 of file _concurrent_unordered_impl.h.

515  {
517  raw_iterator where = it;
518 
519  __TBB_ASSERT(where != last, "Invalid head node");
520 
521  ++where;
522 
523  // Create a dummy element up front, even though it may be discarded (due to concurrent insertion)
524  nodeptr_t dummy_node = create_node(order_key);
525 
526  for (;;)
527  {
528  __TBB_ASSERT(it != last, "Invalid head list node");
529 
530  // If the head iterator is at the end of the list, or past the point where this dummy
531  // node needs to be inserted, then try to insert it.
532  if (where == last || get_order_key(where) > order_key)
533  {
534  __TBB_ASSERT(get_order_key(it) < order_key, "Invalid node order in the list");
535 
536  // Try to insert it in the right place
537  nodeptr_t inserted_node = try_insert_atomic(it.get_node_ptr(), dummy_node, where.get_node_ptr());
538 
539  if (inserted_node == dummy_node)
540  {
541  // Insertion succeeded, check the list for order violations
542  check_range(it, where);
543  return raw_iterator(dummy_node);
544  }
545  else
546  {
547  // Insertion failed: either dummy node was inserted by another thread, or
548  // a real element was inserted at exactly the same place as dummy node.
549  // Proceed with the search from the previous location where order key was
550  // known to be larger (note: this is legal only because there is no safe
551  // concurrent erase operation supported).
552  where = it;
553  ++where;
554  continue;
555  }
556  }
557  else if (get_order_key(where) == order_key)
558  {
559  // Another dummy node with the same value found, discard the new one.
560  destroy_node(dummy_node);
561  return where;
562  }
563 
564  // Move the iterator forward
565  it = where;
566  ++where;
567  }
568 
569  }
static sokey_t get_order_key(const raw_const_iterator &it)
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:169
auto last(Container &c) -> decltype(begin(c))
static nodeptr_t try_insert_atomic(nodeptr_t previous, nodeptr_t new_node, nodeptr_t current_node)
flist_iterator< self_type, value_type > raw_iterator

◆ max_size()

template<typename T, typename Allocator>
size_type tbb::interface5::internal::split_ordered_list< T, Allocator >::max_size ( ) const
inline

Definition at line 390 of file _concurrent_unordered_impl.h.

390  {
391  return my_node_allocator.max_size();
392  }
tbb::internal::allocator_rebind< allocator_type, node >::type my_node_allocator

◆ move_all()

template<typename T, typename Allocator>
void tbb::interface5::internal::split_ordered_list< T, Allocator >::move_all ( self_type source)
inline

Definition at line 593 of file _concurrent_unordered_impl.h.

594  {
595  raw_const_iterator first = source.raw_begin();
596  raw_const_iterator last = source.raw_end();
597 
598  if (first == last)
599  return;
600 
601  nodeptr_t previous_node = my_head;
602  raw_const_iterator begin_iterator = first++;
603 
604  // Move all elements one by one, including dummy ones
605  for (raw_const_iterator it = first; it != last;)
606  {
607  nodeptr_t pnode = it.get_node_ptr();
608 
609  nodeptr_t dummy_node = pnode->is_dummy() ? create_node(pnode->get_order_key()) : create_node(pnode->get_order_key(), pnode->my_element);
610  previous_node = try_insert_atomic(previous_node, dummy_node, NULL);
611  __TBB_ASSERT(previous_node != NULL, "Insertion must succeed");
612  raw_const_iterator where = it++;
613  source.erase_node(get_iterator(begin_iterator), where);
614  }
615  check_range();
616  }
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:169
auto first(Container &c) -> decltype(begin(c))
auto last(Container &c) -> decltype(begin(c))
flist_iterator< self_type, const value_type > raw_const_iterator
static nodeptr_t try_insert_atomic(nodeptr_t previous, nodeptr_t new_node, nodeptr_t current_node)

◆ raw_begin() [1/2]

template<typename T, typename Allocator>
raw_iterator tbb::interface5::internal::split_ordered_list< T, Allocator >::raw_begin ( )
inline

◆ raw_begin() [2/2]

template<typename T, typename Allocator>
raw_const_iterator tbb::interface5::internal::split_ordered_list< T, Allocator >::raw_begin ( ) const
inline

Definition at line 415 of file _concurrent_unordered_impl.h.

415  {
416  return raw_const_iterator(my_head);
417  }
flist_iterator< self_type, const value_type > raw_const_iterator

◆ raw_end() [1/2]

template<typename T, typename Allocator>
raw_iterator tbb::interface5::internal::split_ordered_list< T, Allocator >::raw_end ( )
inline

Definition at line 419 of file _concurrent_unordered_impl.h.

Referenced by tbb::interface5::internal::split_ordered_list< value_type, typename Traits::allocator_type >::move_all().

419  {
420  return raw_iterator(0);
421  }
flist_iterator< self_type, value_type > raw_iterator
Here is the caller graph for this function:

◆ raw_end() [2/2]

template<typename T, typename Allocator>
raw_const_iterator tbb::interface5::internal::split_ordered_list< T, Allocator >::raw_end ( ) const
inline

Definition at line 423 of file _concurrent_unordered_impl.h.

423  {
424  return raw_const_iterator(0);
425  }
flist_iterator< self_type, const value_type > raw_const_iterator

◆ size()

template<typename T, typename Allocator>
size_type tbb::interface5::internal::split_ordered_list< T, Allocator >::size ( ) const
inline

Definition at line 385 of file _concurrent_unordered_impl.h.

◆ swap()

template<typename T, typename Allocator>
void tbb::interface5::internal::split_ordered_list< T, Allocator >::swap ( self_type other)
inline

Definition at line 395 of file _concurrent_unordered_impl.h.

396  {
397  if (this == &other)
398  {
399  // Nothing to do
400  return;
401  }
402 
403  std::swap(my_element_count, other.my_element_count);
404  std::swap(my_head, other.my_head);
405  }
void swap(atomic< T > &lhs, atomic< T > &rhs)
Definition: atomic.h:539

◆ try_insert()

template<typename T, typename Allocator>
std::pair<iterator, bool> tbb::interface5::internal::split_ordered_list< T, Allocator >::try_insert ( raw_iterator  it,
raw_iterator  next,
nodeptr_t  pnode,
size_type new_count 
)
inline

Definition at line 496 of file _concurrent_unordered_impl.h.

497  {
498  nodeptr_t inserted_node = try_insert_atomic(it.get_node_ptr(), pnode, next.get_node_ptr());
499 
500  if (inserted_node == pnode)
501  {
502  // If the insert succeeded, check that the order is correct and increment the element count
503  check_range(it, next);
504  *new_count = tbb::internal::as_atomic(my_element_count).fetch_and_increment();
505  return std::pair<iterator, bool>(iterator(pnode, this), true);
506  }
507  else
508  {
509  return std::pair<iterator, bool>(end(), false);
510  }
511  }
solist_iterator< self_type, value_type > iterator
static nodeptr_t try_insert_atomic(nodeptr_t previous, nodeptr_t new_node, nodeptr_t current_node)
atomic< T > & as_atomic(T &t)
Definition: atomic.h:547

◆ try_insert_atomic()

template<typename T, typename Allocator>
static nodeptr_t tbb::interface5::internal::split_ordered_list< T, Allocator >::try_insert_atomic ( nodeptr_t  previous,
nodeptr_t  new_node,
nodeptr_t  current_node 
)
inlinestatic

Definition at line 490 of file _concurrent_unordered_impl.h.

490  {
491  new_node->my_next = current_node;
492  return previous->atomic_set_next(new_node, current_node);
493  }

Friends And Related Function Documentation

◆ concurrent_unordered_base

template<typename T, typename Allocator>
template<typename Traits >
friend class concurrent_unordered_base
friend

Definition at line 622 of file _concurrent_unordered_impl.h.

Member Data Documentation

◆ my_element_count

template<typename T, typename Allocator>
size_type tbb::interface5::internal::split_ordered_list< T, Allocator >::my_element_count
private

◆ my_head

◆ my_node_allocator

template<typename T, typename Allocator>
tbb::internal::allocator_rebind<allocator_type, node>::type tbb::interface5::internal::split_ordered_list< T, Allocator >::my_node_allocator
private

Definition at line 646 of file _concurrent_unordered_impl.h.


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.