tbb::interface9::internal::range_vector< T, MaxCapacity > Class Template Reference

Range pool stores ranges of type T in a circular buffer with MaxCapacity. More...

`#include <partitioner.h>`

Collaboration diagram for tbb::interface9::internal::range_vector< T, MaxCapacity >:

## Public Member Functions

| range_vector (const T &elem)
| initialize via first range in pool More...
| ~range_vector ()
bool | empty () const
depth_t | size () const
void | split_to_fill (depth_t max_depth)
void | pop_back ()
void | pop_front ()
T & | back ()
T & | front ()
depth_t | front_depth ()
| similarly to front(), returns depth of the first range in the pool More...
depth_t | back_depth ()
bool | is_divisible (depth_t max_depth)

## Private Attributes

depth_t | my_head
depth_t | my_tail
depth_t | my_size
depth_t | my_depth [MaxCapacity]
tbb::aligned_space< T, MaxCapacity > | my_pool

## Detailed Description

### template<typename T, depth_t MaxCapacity>
class tbb::interface9::internal::range_vector< T, MaxCapacity >

Range pool stores ranges of type T in a circular buffer with MaxCapacity.

Definition at line 154 of file partitioner.h.

## Constructor & Destructor Documentation

## range_vector()

template<typename T, depth_t MaxCapacity>

tbb::interface9::internal::range_vector< T, MaxCapacity >::range_vector | ( | const T & | elem | ) |

inline

initialize via first range in pool

Definition at line 163 of file partitioner.h.

: my_head(0), my_tail(0), my_size(1) {
my_depth[0] = 0;
new( static_cast<void *>(my_pool.begin()) ) T(elem);//TODO: std::move?
}

## ~range_vector()

template<typename T, depth_t MaxCapacity>

tbb::interface9::internal::range_vector< T, MaxCapacity >::~range_vector | ( |  | ) |

inline

Definition at line 167 of file partitioner.h.

{
while( !empty() ) pop_back();
}

## Member Function Documentation

## back()

template<typename T, depth_t MaxCapacity>

T& tbb::interface9::internal::range_vector< T, MaxCapacity >::back | ( |  | ) |

inline

Definition at line 197 of file partitioner.h.

{
__TBB_ASSERT(my_size > 0, "range_vector::back() with empty size");
return my_pool.begin()[my_head];
}

References __TBB_ASSERT.

Referenced by tbb::interface9::internal::dynamic_grainsize_mode< linear_affinity_mode< affinity_partition_type > >::work_balance().

Here is the caller graph for this function:

## back_depth()

template<typename T, depth_t MaxCapacity>

depth_t tbb::interface9::internal::range_vector< T, MaxCapacity >::back_depth | ( |  | ) |

inline

Definition at line 210 of file partitioner.h.

{
__TBB_ASSERT(my_size > 0, "range_vector::back_depth() with empty size");
return my_depth[my_head];
}

References __TBB_ASSERT.

## empty()

template<typename T, depth_t MaxCapacity>

bool tbb::interface9::internal::range_vector< T, MaxCapacity >::empty | ( |  | ) | const

inline

Definition at line 170 of file partitioner.h.

{ return my_size == 0; }

Referenced by tbb::interface9::internal::dynamic_grainsize_mode< linear_affinity_mode< affinity_partition_type > >::work_balance().

Here is the caller graph for this function:

## front()

template<typename T, depth_t MaxCapacity>

T& tbb::interface9::internal::range_vector< T, MaxCapacity >::front | ( |  | ) |

inline

Definition at line 201 of file partitioner.h.

{
__TBB_ASSERT(my_size > 0, "range_vector::front() with empty size");
return my_pool.begin()[my_tail];
}

References __TBB_ASSERT.

Referenced by tbb::interface9::internal::dynamic_grainsize_mode< linear_affinity_mode< affinity_partition_type > >::work_balance().

Here is the caller graph for this function:

## front_depth()

template<typename T, depth_t MaxCapacity>

depth_t tbb::interface9::internal::range_vector< T, MaxCapacity >::front_depth | ( |  | ) |

inline

similarly to front(), returns depth of the first range in the pool

Definition at line 206 of file partitioner.h.

{
__TBB_ASSERT(my_size > 0, "range_vector::front_depth() with empty size");
return my_depth[my_tail];
}

References __TBB_ASSERT.

Referenced by tbb::interface9::internal::dynamic_grainsize_mode< linear_affinity_mode< affinity_partition_type > >::work_balance().

Here is the caller graph for this function:

## is_divisible()

template<typename T, depth_t MaxCapacity>

bool tbb::interface9::internal::range_vector< T, MaxCapacity >::is_divisible | ( | depth_t | max_depth | ) |

inline

Definition at line 214 of file partitioner.h.

{
return back_depth() < max_depth && back().is_divisible();
}

Referenced by tbb::interface9::internal::dynamic_grainsize_mode< linear_affinity_mode< affinity_partition_type > >::work_balance().

Here is the caller graph for this function:

## pop_back()

template<typename T, depth_t MaxCapacity>

void tbb::interface9::internal::range_vector< T, MaxCapacity >::pop_back | ( |  | ) |

inline

Definition at line 185 of file partitioner.h.

{
__TBB_ASSERT(my_size > 0, "range_vector::pop_back() with empty size");
my_pool.begin()[my_head].~T();
my_size--;
my_head = (my_head + MaxCapacity - 1) % MaxCapacity;
}

References __TBB_ASSERT.

Referenced by tbb::interface9::internal::dynamic_grainsize_mode< linear_affinity_mode< affinity_partition_type > >::work_balance().

Here is the caller graph for this function:

## pop_front()

template<typename T, depth_t MaxCapacity>

void tbb::interface9::internal::range_vector< T, MaxCapacity >::pop_front | ( |  | ) |

inline

Definition at line 191 of file partitioner.h.

{
__TBB_ASSERT(my_size > 0, "range_vector::pop_front() with empty size");
my_pool.begin()[my_tail].~T();
my_size--;
my_tail = (my_tail + 1) % MaxCapacity;
}

References __TBB_ASSERT.

Referenced by tbb::interface9::internal::dynamic_grainsize_mode< linear_affinity_mode< affinity_partition_type > >::work_balance().

Here is the caller graph for this function:

## size()

template<typename T, depth_t MaxCapacity>

depth_t tbb::interface9::internal::range_vector< T, MaxCapacity >::size | ( |  | ) | const

inline

Definition at line 171 of file partitioner.h.

{ return my_size; }

Referenced by tbb::interface9::internal::dynamic_grainsize_mode< linear_affinity_mode< affinity_partition_type > >::work_balance().

Here is the caller graph for this function:

## split_to_fill()

template<typename T, depth_t MaxCapacity>

void tbb::interface9::internal::range_vector< T, MaxCapacity >::split_to_fill | ( | depth_t | max_depth | ) |

inline

Populates range pool via ranges up to max depth or while divisible max_depth starts from 0, e.g. value 2 makes 3 ranges in the pool up to two 1/4 pieces

Definition at line 174 of file partitioner.h.

{
while( my_size < MaxCapacity && is_divisible(max_depth) ) {
depth_t prev = my_head;
my_head = (my_head + 1) % MaxCapacity;
new(my_pool.begin()+my_head) T(my_pool.begin()[prev]); // copy TODO: std::move?
my_pool.begin()[prev].~T(); // instead of assignment
new(my_pool.begin()+prev) T(my_pool.begin()[my_head], split()); // do 'inverse' split
my_depth[my_head] = ++my_depth[prev];
my_size++;
}
}

Referenced by tbb::interface9::internal::dynamic_grainsize_mode< linear_affinity_mode< affinity_partition_type > >::work_balance().

Here is the caller graph for this function:

## Member Data Documentation

## my_depth

template<typename T, depth_t MaxCapacity>

depth_t tbb::interface9::internal::range_vector< T, MaxCapacity >::my_depth[MaxCapacity]

private

Definition at line 158 of file partitioner.h.

## my_head

template<typename T, depth_t MaxCapacity>

depth_t tbb::interface9::internal::range_vector< T, MaxCapacity >::my_head

private

Definition at line 155 of file partitioner.h.

## my_pool

template<typename T, depth_t MaxCapacity>

tbb::aligned_space<T, MaxCapacity> tbb::interface9::internal::range_vector< T, MaxCapacity >::my_pool

private

Definition at line 159 of file partitioner.h.

## my_size

template<typename T, depth_t MaxCapacity>

depth_t tbb::interface9::internal::range_vector< T, MaxCapacity >::my_size

private

Definition at line 157 of file partitioner.h.

## my_tail

template<typename T, depth_t MaxCapacity>

depth_t tbb::interface9::internal::range_vector< T, MaxCapacity >::my_tail

private

Definition at line 156 of file partitioner.h.

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

- partitioner.h

tbb::interface9::internal::range_vector::back
T & back()
Definition: partitioner.h:197
__TBB_ASSERT
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
tbb::interface9::internal::range_vector::back_depth
depth_t back_depth()
Definition: partitioner.h:210
tbb::interface9::internal::range_vector::is_divisible
bool is_divisible(depth_t max_depth)
Definition: partitioner.h:214
tbb::interface9::internal::range_vector::my_head
depth_t my_head
Definition: partitioner.h:155
tbb::interface9::internal::range_vector::my_pool
tbb::aligned_space< T, MaxCapacity > my_pool
Definition: partitioner.h:159
tbb::interface9::internal::depth_t
unsigned char depth_t
Definition: partitioner.h:150
tbb::interface9::internal::range_vector::pop_back
void pop_back()
Definition: partitioner.h:185
tbb::interface9::internal::range_vector::my_depth
depth_t my_depth[MaxCapacity]
Definition: partitioner.h:158
tbb::interface9::internal::range_vector::my_size
depth_t my_size
Definition: partitioner.h:157
tbb::interface9::internal::range_vector::empty
bool empty() const
Definition: partitioner.h:170
tbb::interface9::internal::range_vector::my_tail
depth_t my_tail
Definition: partitioner.h:156

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.