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 block_factor=1.0) | |
| Initialize named, nontemporary stack. More... | |
| stack (temp_file &tempFile, double block_factor=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_file_stream |
| The file_stream used to store the items. More... | |
An implementation of an external-memory stack.
|
inline |
Initialize anonymous stack.
Definition at line 45 of file stack.h.
|
inline |
Initialize named, nontemporary stack.
| path | The path to a file used for storing the items. |
| block_factor | The block factor to use |
Definition at line 59 of file stack.h.
|
inline |
Initialize temporary stack.
| tempFile | The temporary file containing the stack |
| block_factor | The block factor to use |
Definition at line 75 of file stack.h.
|
inline |
Closes the underlying stream and truncates it to the logical end of the stack.
Definition at line 91 of file stack.h.
|
inline |
Returns whether the stack is empty or not.
m_file_stream.can_read_back();
Definition at line 136 of file stack.h.
Referenced by tpie::pipelining::bits::reverser_output_t< dest_t >::go().
|
inlinestatic |
Compute the memory used by a stack.
Definition at line 143 of file stack.h.
Referenced by tpie::ami::stack< T >::main_memory_usage().
|
inline | |||||||||||||
Pops one item from the stack.
Definition at line 110 of file stack.h.
Referenced by tpie::pipelining::bits::reverser_output_t< dest_t >::go().
|
inline | ||||||||||||||
|
inline |
Returns the number of items currently on the stack.
Definition at line 129 of file stack.h.
Referenced by tpie::stack< item_type >::empty(), tpie::pipelining::bits::reverser_output_t< dest_t >::propagate(), and tpie::stack< item_type >::~stack().
|
inline | |||||||||||||
Peeks at the topmost item on the stack.
Definition at line 119 of file stack.h.
|
protected |
The file_stream used to store the items.
Definition at line 152 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().