Honeycomb  0.1
Component-Model Framework
Classes | Public Types | Public Member Functions | List of all members
honey::lockfree::Stack< T > Class Template Reference

Lock-free FILO stack. Uses auto-expanding freelist allocator so memory is only reclaimed upon destruction. More...

#include <Stack.h>

Inheritance diagram for honey::lockfree::Stack< T >:
Inheritance graph
[legend]
Collaboration diagram for honey::lockfree::Stack< T >:
Collaboration graph
[legend]

Public Types

typedef T value_type
 

Public Member Functions

 Stack (szt capacity=0)
 
 ~Stack ()
 
void reserve (szt capacity)
 Ensure that enough storage is allocated for a number of elements. More...
 
szt capacity () const
 The number of elements for which storage is allocated. More...
 
template<class T_ >
void push (T_ &&val)
 Add new element constructed with val onto the top of the stack. More...
 
bool pop (optional< T & > val=optnull)
 Remove element from the top of the stack and move it into val. Returns true on success, false if there is no element to pop. More...
 
bool top (T &val)
 Get a copy of the top element. Returns true on success, false if there is no element. More...
 
void clear ()
 Remove all elements. More...
 
bool empty () const
 Check whether the stack does not contain any elements. More...
 
szt size () const
 The number of elements in the stack. More...
 

Detailed Description

template<class T>
class honey::lockfree::Stack< T >

Lock-free FILO stack. Uses auto-expanding freelist allocator so memory is only reclaimed upon destruction.

Member Typedef Documentation

template<class T >
typedef T honey::lockfree::Stack< T >::value_type

Constructor & Destructor Documentation

template<class T >
honey::lockfree::Stack< T >::Stack ( szt  capacity = 0)
inline
template<class T >
honey::lockfree::Stack< T >::~Stack ( )
inline

Member Function Documentation

template<class T >
szt honey::lockfree::Stack< T >::capacity ( ) const
inline

The number of elements for which storage is allocated.

template<class T >
void honey::lockfree::Stack< T >::clear ( )
inline

Remove all elements.

template<class T >
bool honey::lockfree::Stack< T >::empty ( ) const
inline

Check whether the stack does not contain any elements.

template<class T >
bool honey::lockfree::Stack< T >::pop ( optional< T & >  val = optnull)
inline

Remove element from the top of the stack and move it into val. Returns true on success, false if there is no element to pop.

template<class T >
template<class T_ >
void honey::lockfree::Stack< T >::push ( T_ &&  val)
inline

Add new element constructed with val onto the top of the stack.

template<class T >
void honey::lockfree::Stack< T >::reserve ( szt  capacity)
inline

Ensure that enough storage is allocated for a number of elements.

template<class T >
szt honey::lockfree::Stack< T >::size ( ) const
inline

The number of elements in the stack.

template<class T >
bool honey::lockfree::Stack< T >::top ( T &  val)
inline

Get a copy of the top element. Returns true on success, false if there is no element.


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