STXXL
1.4.0
|
Efficient implementation that uses prefetching and overlapping using internal buffers.
Use it if your access pattern consists of many repeated push'es and pop's For semantics of the methods see documentation of the STL std::stack
.
Public Types | |
enum | { blocks_per_page = cfg::blocks_per_page, block_size = cfg::block_size } |
typedef cfg::alloc_strategy | alloc_strategy_type |
typedef BID< block_size > | bid_type |
typedef typed_block < block_size, value_type > | block_type |
type of block used in disk-memory transfers More... | |
typedef StackConfig | cfg |
typedef cfg::size_type | size_type |
type for sizes (64-bit) More... | |
typedef cfg::value_type | value_type |
type of the elements stored in the stack More... | |
Public Member Functions | |
Constructors/Destructor | |
grow_shrink_stack () | |
Default constructor: creates empty stack. More... | |
Accessor Functions | |
void | swap (grow_shrink_stack &obj) |
value_type & | top () |
Return mutable reference to the element at the top of the stack. Precondition: stack is not empty(). More... | |
const value_type & | top () const |
Return constant reference to the element at the top of the stack. Precondition: stack is not empty(). More... | |
void | push (const value_type &val) |
Inserts an element at the top of the stack. Postconditions: size() is incremented by 1, and top() is the inserted element. More... | |
void | pop () |
Removes the element at the top of the stack. Precondition: stack is not empty(). Postcondition: size() is decremented. More... | |
Constructors/Destructors | |
template<class stack_type > | |
grow_shrink_stack (const stack_type &stack_) | |
Copy-construction from a another stack of any type. More... | |
virtual | ~grow_shrink_stack () |
Capacity | |
size_type | size () const |
Returns the number of elements contained in the stack. More... | |
bool | empty () const |
Returns true if the stack is empty. More... | |
Private Attributes | |
alloc_strategy_type | alloc_strategy |
std::vector< bid_type > | bids |
simple_vector< block_type > | cache |
simple_vector< block_type > ::iterator | cache_buffers |
unsigned_type | cache_offset |
value_type * | current_element |
size_type | m_size |
simple_vector< block_type > ::iterator | overlap_buffers |
simple_vector< request_ptr > | requests |
Additional Inherited Members | |
Private Member Functions inherited from stxxl::noncopyable | |
noncopyable () | |
typedef cfg::alloc_strategy stxxl::grow_shrink_stack< StackConfig >::alloc_strategy_type |
typedef BID<block_size> stxxl::grow_shrink_stack< StackConfig >::bid_type |
typedef typed_block<block_size, value_type> stxxl::grow_shrink_stack< StackConfig >::block_type |
typedef StackConfig stxxl::grow_shrink_stack< StackConfig >::cfg |
typedef cfg::size_type stxxl::grow_shrink_stack< StackConfig >::size_type |
typedef cfg::value_type stxxl::grow_shrink_stack< StackConfig >::value_type |
anonymous enum |
|
inline |
|
inline |
|
inlinevirtual |
Definition at line 408 of file stack.h.
References STXXL_PRETTY_FUNCTION_NAME, STXXL_VERBOSE, and stxxl::wait_all().
|
inline |
|
inline |
Removes the element at the top of the stack. Precondition: stack is not empty(). Postcondition: size() is decremented.
Definition at line 502 of file stack.h.
References STXXL_VERBOSE2, UNLIKELY, and stxxl::wait_all().
|
inline |
|
inline |
|
inline |
Definition at line 360 of file stack.h.
References stxxl::grow_shrink_stack< StackConfig >::alloc_strategy, stxxl::grow_shrink_stack< StackConfig >::bids, stxxl::grow_shrink_stack< StackConfig >::cache, stxxl::grow_shrink_stack< StackConfig >::cache_buffers, stxxl::grow_shrink_stack< StackConfig >::cache_offset, stxxl::grow_shrink_stack< StackConfig >::current_element, stxxl::grow_shrink_stack< StackConfig >::m_size, stxxl::grow_shrink_stack< StackConfig >::overlap_buffers, and stxxl::grow_shrink_stack< StackConfig >::requests.
|
inline |
|
inline |
|
private |
Definition at line 335 of file stack.h.
Referenced by stxxl::grow_shrink_stack< StackConfig >::swap().
|
private |
Definition at line 334 of file stack.h.
Referenced by stxxl::grow_shrink_stack< StackConfig >::swap().
|
private |
Definition at line 330 of file stack.h.
Referenced by stxxl::grow_shrink_stack< StackConfig >::swap().
|
private |
Definition at line 331 of file stack.h.
Referenced by stxxl::grow_shrink_stack< StackConfig >::swap().
|
private |
Definition at line 328 of file stack.h.
Referenced by stxxl::grow_shrink_stack< StackConfig >::swap().
|
private |
Definition at line 329 of file stack.h.
Referenced by stxxl::grow_shrink_stack< StackConfig >::swap().
|
private |
Definition at line 327 of file stack.h.
Referenced by stxxl::grow_shrink_stack< StackConfig >::swap().
|
private |
Definition at line 332 of file stack.h.
Referenced by stxxl::grow_shrink_stack< StackConfig >::swap().
|
private |
Definition at line 333 of file stack.h.
Referenced by stxxl::grow_shrink_stack< StackConfig >::swap().