Stefan Scholz / ETL
Embed: (wiki syntax)

« Back to documentation index

intrusive_stack< TValue, TLink > Class Template Reference

intrusive_stack< TValue, TLink > Class Template Reference
[stack]

An intrusive stack. More...

#include <intrusive_stack.h>

Inherits etl::intrusive_stack_base< TLink >.

Public Member Functions

 intrusive_stack ()
 Constructor.
reference top ()
 Gets a reference to the value at the top of the stack.
const_reference top () const
 Gets a const reference to the value at the top of the stack.
void push (link_type &value)
 Adds a value to the stack.
void pop ()
 Removes the oldest item from the top of the stack.
template<typename TContainer >
void pop_into (TContainer &destination)
 Removes the oldest item from the queue and pushes it to the destination.
void reverse ()
 Reverses the stack order.
void clear ()
 Clears the stack to the empty state.
bool empty () const
 Checks if the stack is in the empty state.
size_t size () const
 Returns the number of elements.

Protected Attributes

link_type * p_top
 The current top of the stack.
size_t current_size
 Counts the number of elements in the list.

Detailed Description

template<typename TValue, typename TLink>
class etl::intrusive_stack< TValue, TLink >

An intrusive stack.

Stores elements derived from any type that supports an 'etl_next' pointer member.

Warning:
This stack cannot be used for concurrent access from multiple threads.
Template Parameters:
TValueThe type of value that the stack holds.
TLinkThe link type that the value is derived from.

Definition at line 204 of file intrusive_stack.h.


Constructor & Destructor Documentation

Constructor.

Definition at line 222 of file intrusive_stack.h.


Member Function Documentation

void clear (  ) [inherited]

Clears the stack to the empty state.

Definition at line 154 of file intrusive_stack.h.

bool empty (  ) const [inherited]

Checks if the stack is in the empty state.

Definition at line 167 of file intrusive_stack.h.

void pop (  ) [inherited]

Removes the oldest item from the top of the stack.

Undefined behaviour if the stack is already empty.

Definition at line 108 of file intrusive_stack.h.

void pop_into ( TContainer &  destination ) [inherited]

Removes the oldest item from the queue and pushes it to the destination.

Undefined behaviour if the queue is already empty. NOTE: The destination must be an intrusize container that supports a push(TLink) member function.

Definition at line 124 of file intrusive_stack.h.

void push ( link_type &  value ) [inherited]

Adds a value to the stack.

Parameters:
valueThe value to push to the stack.

Definition at line 90 of file intrusive_stack.h.

void reverse (  ) [inherited]

Reverses the stack order.

Definition at line 134 of file intrusive_stack.h.

size_t size (  ) const [inherited]

Returns the number of elements.

Definition at line 175 of file intrusive_stack.h.

const_reference top (  ) const

Gets a const reference to the value at the top of the stack.


Returns:
A const reference to the value at the top of the stack.

Definition at line 241 of file intrusive_stack.h.

reference top (  )

Gets a reference to the value at the top of the stack.

Undefined behaviour if the stack is empty.

Returns:
A reference to the value at the top of the stack.

Definition at line 232 of file intrusive_stack.h.


Field Documentation

size_t current_size [protected, inherited]

Counts the number of elements in the list.

Definition at line 193 of file intrusive_stack.h.

link_type* p_top [protected, inherited]

The current top of the stack.

Definition at line 191 of file intrusive_stack.h.