Flat-combining intrusive stack.
More...
#include <cds/intrusive/fcstack.h>
|
typedef T | value_type |
| Value type.
|
|
typedef Container | container_type |
| Sequential container type.
|
|
typedef Traits | traits |
| Stack traits.
|
|
typedef traits::disposer | disposer |
| The disposer functor. The disposer is used only in clear() function.
|
|
typedef traits::stat | stat |
| Internal statistics type.
|
|
|
| FCStack () |
| Initializes empty stack object.
|
|
| FCStack (unsigned int nCompactFactor, unsigned int nCombinePassCount) |
| Initializes empty stack object and gives flat combining parameters. More...
|
|
bool | push (value_type &val) |
| Inserts a new element at the top of stack. More...
|
|
value_type * | pop () |
| Removes the element on top of the stack.
|
|
void | clear (bool bDispose=false) |
| Clears the stack. More...
|
|
template<typename Func > |
void | apply (Func f) |
| Exclusive access to underlying stack object. More...
|
|
template<typename Func > |
void | apply (Func f) const |
| Exclusive access to underlying stack object. More...
|
|
size_t | size () const |
| Returns the number of elements in the stack. More...
|
|
bool | empty () const |
| Checks if the stack is empty. More...
|
|
stat const & | statistics () const |
| Internal statistics.
|
|
|
static constexpr const bool | c_bEliminationEnabled = traits::enable_elimination |
| true if elimination is enabled
|
|
template<typename T, class Container = boost::intrusive::slist<T>, typename Traits = fcstack::traits>
class cds::intrusive::FCStack< T, Container, Traits >
Flat-combining intrusive stack.
Flat combining sequential intrusive stack.
Template parameters:
T
- a value type stored in the stack
Container
- sequential intrusive container with push_front
and pop_front
functions. Possible containers are boost::intrusive::slist
(the default), boost::inrtrusive::list
Traits
- type traits of flat combining, default is fcstack::traits
. fcstack::make_traits
metafunction can be used to construct specialized traits
◆ FCStack()
template<typename T , class Container = boost::intrusive::slist<T>, typename Traits = fcstack::traits>
Initializes empty stack object and gives flat combining parameters.
- Parameters
-
nCompactFactor | Flat combining: publication list compacting factor |
nCombinePassCount | Flat combining: number of combining passes for combiner thread |
◆ apply() [1/2]
template<typename T , class Container = boost::intrusive::slist<T>, typename Traits = fcstack::traits>
template<typename Func >
Exclusive access to underlying stack object.
The functor f
can do any operation with underlying container_type
in exclusive mode. For example, you can iterate over the stack. Func
signature is:
◆ apply() [2/2]
template<typename T , class Container = boost::intrusive::slist<T>, typename Traits = fcstack::traits>
template<typename Func >
Exclusive access to underlying stack object.
The functor f
can do any operation with underlying container_type
in exclusive mode. For example, you can iterate over the stack. Func
signature is:
◆ clear()
template<typename T , class Container = boost::intrusive::slist<T>, typename Traits = fcstack::traits>
Clears the stack.
If bDispose
is true
, the disposer provided in Traits
class' template parameter will be called for each removed element.
◆ empty()
template<typename T , class Container = boost::intrusive::slist<T>, typename Traits = fcstack::traits>
Checks if the stack is empty.
If the combining is in process the function waits while it is done.
◆ push()
template<typename T , class Container = boost::intrusive::slist<T>, typename Traits = fcstack::traits>
Inserts a new element at the top of stack.
The content of the new element initialized to a copy of val
.
◆ size()
template<typename T , class Container = boost::intrusive::slist<T>, typename Traits = fcstack::traits>
Returns the number of elements in the stack.
Note that size() == 0
is not mean that the stack is empty because combining record can be in process. To check emptiness use empty function.
The documentation for this class was generated from the following file: