An implementation of an external-memory stack. More...
#include <tpie/stack.h>
Public Member Functions | |
stack (double blockFactor=1.0) | |
Initialize anonymous stack. More... | |
stack (const std::string &path, double blockFactor=1.0) | |
Initialize named, nontemporary stack. More... | |
stack (temp_file &tempFile, double blockFactor=1.0) | |
Initialize temporary stack. More... | |
~stack () | |
Closes the underlying stream and truncates it to the logical end of the stack. More... | |
void | push (const T &t) throw (stream_exception) |
Pushes one item onto the stack. More... | |
const T & | pop () throw (stream_exception) |
Pops one item from the stack. More... | |
const T & | top () throw (stream_exception) |
Peeks at the topmost item on the stack. More... | |
stream_size_type | size () const |
Returns the number of items currently on the stack. More... | |
bool | empty () const |
Returns whether the stack is empty or not. More... | |
Static Public Member Functions | |
static memory_size_type | memory_usage (float blockFactor=1.0) |
Compute the memory used by a stack. More... | |
Protected Attributes | |
file_stream< T > | m_stream |
The stream used to store the items. More... | |
An implementation of an external-memory stack.
|
inline |
Initialize anonymous stack.
Definition at line 46 of file stack.h.
|
inline |
Initialize named, nontemporary stack.
path | The path to a file used for storing the items. |
blockFactor | The block factor to use |
Definition at line 61 of file stack.h.
|
inline |
Initialize temporary stack.
tempFile | The temporary file containing the stack |
blockFactor | The block factor to use |
Definition at line 78 of file stack.h.
|
inline |
Closes the underlying stream and truncates it to the logical end of the stack.
Definition at line 94 of file stack.h.
|
inline |
Returns whether the stack is empty or not.
m_file_stream.can_read_back();
Definition at line 139 of file stack.h.
Referenced by tpie::pipelining::bits::reverser_pull_output_t< T >::can_pull(), and tpie::pipelining::bits::reverser_output_t< dest_t >::go().
|
inlinestatic |
Compute the memory used by a stack.
Definition at line 146 of file stack.h.
Referenced by tpie::ami::stack< T >::main_memory_usage().
|
inline |
Pops one item from the stack.
Definition at line 113 of file stack.h.
Referenced by tpie::pipelining::bits::reverser_output_t< dest_t >::go(), and tpie::pipelining::bits::reverser_pull_output_t< T >::pull().
|
inline |
|
inline |
Returns the number of items currently on the stack.
Definition at line 132 of file stack.h.
Referenced by tpie::stack< item_type >::empty().
|
inline |
Peeks at the topmost item on the stack.
Definition at line 122 of file stack.h.
|
protected |
The stream used to store the items.
Definition at line 155 of file stack.h.
Referenced by tpie::stack< item_type >::pop(), tpie::stack< item_type >::size(), tpie::stack< item_type >::stack(), tpie::stack< item_type >::top(), and tpie::stack< item_type >::~stack().