cds  1.4.0
Data Structures | Public Types | Public Member Functions | Protected Types
cds::container::TreiberStack< GC, T, Options > Class Template Reference

Treiber's stack algorithm. More...

#include <cds/container/treiber_stack.h>

Inheritance diagram for cds::container::TreiberStack< GC, T, Options >:
cds::intrusive::TreiberStack< GC, cds::intrusive::single_link::node< T >, Options... >

Data Structures

struct  rebind
 Rebind template arguments. More...
 

Public Types

typedef T value_type
 Value type stored in the stack.
 
typedef base_class::gc gc
 Garbage collector used.
 
typedef base_class::back_off back_off
 Back-off strategy used.
 
typedef options::allocator_type allocator_type
 Allocator type used for allocate/deallocate the nodes.
 
typedef options::memory_model memory_model
 Memory ordering. See cds::opt::memory_order option.
 
typedef base_class::stat stat
 Internal statistics policy used.
 
- Public Types inherited from cds::intrusive::TreiberStack< GC, cds::intrusive::single_link::node< T >, Options... >
typedef
cds::intrusive::single_link::node
< T > 
value_type
 type of value stored in the stack
 
typedef options::hook hook
 hook type
 
typedef hook::node_type node_type
 node type
 
typedef options::disposer disposer
 disposer used
 
typedef get_node_traits
< value_type, node_type, hook >
::type 
node_traits
 node traits
 
typedef
single_link::get_link_checker
< node_type,
options::link_checker >::type 
link_checker
 link checker
 
typedef options::memory_model memory_model
 Memory ordering. See cds::opt::memory_model option.
 
typedef options::item_counter item_counter
 Item counting policy used.
 
typedef options::stat stat
 Internal statistics policy used.
 
typedef GC gc
 Garbage collector.
 
typedef options::back_off back_off
 back-off strategy
 

Public Member Functions

 TreiberStack ()
 Constructs empty stack.
 
 ~TreiberStack ()
 Clears the stack on destruction.
 
bool push (const value_type &val)
 Push the item val on the stack.
 
template<typename... Args>
bool emplace (Args &&...args)
 Pushes data of type value_type constructed with std::forward<Args>(args)... More...
 
bool pop (value_type &val)
 Pop an item from the stack. More...
 
bool empty () const
 Check if stack is empty.
 
void clear ()
 Clear the stack.
 
size_t size () const
 Returns stack's item count. More...
 
stat const & statistics () const
 Returns reference to internal statistics.
 
- Public Member Functions inherited from cds::intrusive::TreiberStack< GC, cds::intrusive::single_link::node< T >, Options... >
 TreiberStack ()
 Constructs empty stack.
 
 ~TreiberStack ()
 Destructor calls clear member function.
 
bool push (value_type &val)
 Push the item val on the stack. More...
 
value_typepop ()
 Pop an item from the stack. More...
 
bool empty () const
 Check if stack is empty.
 
void clear ()
 Clear the stack. More...
 
size_t size () const
 Returns stack's item count. More...
 
stat const & statistics () const
 Returns reference to internal statistics.
 

Protected Types

typedef options::node_type node_type
 stack node type (derived from intrusive::single_link::node)
 

Additional Inherited Members

- Protected Attributes inherited from cds::intrusive::TreiberStack< GC, cds::intrusive::single_link::node< T >, Options... >
node_type::atomic_node_ptr m_Top
 Top of the stack.
 
item_counter m_ItemCounter
 Item counter.
 
stat m_stat
 Internal statistics.
 

Detailed Description

template<typename GC, typename T, typename... Options>
class cds::container::TreiberStack< GC, T, Options >

Treiber's stack algorithm.

It is non-intrusive version of Treiber's stack algorithm based on intrusive implementation intrusive::TreiberStack.

Template arguments:

Available Options:

Member Function Documentation

template<typename GC , typename T , typename... Options>
template<typename... Args>
bool cds::container::TreiberStack< GC, T, Options >::emplace ( Args &&...  args)
inline

Pushes data of type value_type constructed with std::forward<Args>(args)...

This function is available only for compiler that supports variadic template and move semantics

template<typename GC , typename T , typename... Options>
bool cds::container::TreiberStack< GC, T, Options >::pop ( value_type val)
inline

Pop an item from the stack.

The value of popped item is stored in val. On success functions returns true, val contains value popped from the stack. If stack is empty the function returns false, val is unchanged.

template<typename GC , typename T , typename... Options>
size_t cds::container::TreiberStack< GC, T, Options >::size ( ) const
inline

Returns stack's item count.

The value returned depends on opt::item_counter option. For atomicity::empty_item_counter, this function always returns 0.

Warning: even if you use real item counter and it returns 0, this fact is not mean that the stack is empty. To check emptyness use empty() method.


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

cds 1.4.0 Developed by Maxim Khiszinsky aka khizmax 2007 - 2012
Autogenerated Mon May 20 2013 00:37:58 by Doxygen 1.8.3.1