STXXL  1.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
stxxl::migrating_stack< CritSize, ExternalStack, InternalStack > Class Template Reference

Detailed Description

template<unsigned_type CritSize, class ExternalStack, class InternalStack>
class stxxl::migrating_stack< CritSize, ExternalStack, InternalStack >

A stack that migrates from internal memory to external when its size exceeds a certain threshold.

For semantics of the methods see documentation of the STL std::stack.

Definition at line 815 of file stack.h.

+ Inheritance diagram for stxxl::migrating_stack< CritSize, ExternalStack, InternalStack >:
+ Collaboration diagram for stxxl::migrating_stack< CritSize, ExternalStack, InternalStack >:

Public Types

enum  { blocks_per_page = cfg::blocks_per_page, block_size = cfg::block_size }
 
typedef ExternalStack::cfg cfg
 
typedef ExternalStack ext_stack_type
 
typedef InternalStack int_stack_type
 
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/Destructors
 migrating_stack ()
 Default constructor: creates empty stack. More...
 
virtual ~migrating_stack ()
 
Accessor Functions
void swap (migrating_stack &obj)
 
value_typetop ()
 Return mutable reference to the element at the top of the stack. Precondition: stack is not empty(). More...
 
const value_typetop () 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...
 
Miscellaneous
bool internal () const
 Returns true if current implementation is internal, otherwise false. More...
 
bool external () const
 Returns true if current implementation is external, otherwise false. More...
 
Capacity
bool empty () const
 Returns true if the stack is empty. More...
 
size_type size () const
 Returns the number of elements contained in the stack. More...
 

Private Types

enum  { critical_size = CritSize }
 

Private Member Functions

template<class StackType >
 migrating_stack (const StackType &stack_)
 Copy-construction from a another stack of any type. More...
 
- Private Member Functions inherited from stxxl::noncopyable
 noncopyable ()
 

Private Attributes

ext_stack_typeext_impl
 
int_stack_typeint_impl
 

Member Typedef Documentation

template<unsigned_type CritSize, class ExternalStack, class InternalStack>
typedef ExternalStack::cfg stxxl::migrating_stack< CritSize, ExternalStack, InternalStack >::cfg

Definition at line 818 of file stack.h.

template<unsigned_type CritSize, class ExternalStack, class InternalStack>
typedef ExternalStack stxxl::migrating_stack< CritSize, ExternalStack, InternalStack >::ext_stack_type

Definition at line 829 of file stack.h.

template<unsigned_type CritSize, class ExternalStack, class InternalStack>
typedef InternalStack stxxl::migrating_stack< CritSize, ExternalStack, InternalStack >::int_stack_type

Definition at line 828 of file stack.h.

template<unsigned_type CritSize, class ExternalStack, class InternalStack>
typedef cfg::size_type stxxl::migrating_stack< CritSize, ExternalStack, InternalStack >::size_type

type for sizes (64-bit)

Definition at line 822 of file stack.h.

template<unsigned_type CritSize, class ExternalStack, class InternalStack>
typedef cfg::value_type stxxl::migrating_stack< CritSize, ExternalStack, InternalStack >::value_type

type of the elements stored in the stack

Definition at line 820 of file stack.h.

Member Enumeration Documentation

template<unsigned_type CritSize, class ExternalStack, class InternalStack>
anonymous enum
Enumerator
blocks_per_page 
block_size 

Definition at line 823 of file stack.h.

template<unsigned_type CritSize, class ExternalStack, class InternalStack>
anonymous enum
private
Enumerator
critical_size 

Definition at line 832 of file stack.h.

Constructor & Destructor Documentation

template<unsigned_type CritSize, class ExternalStack, class InternalStack>
template<class StackType >
stxxl::migrating_stack< CritSize, ExternalStack, InternalStack >::migrating_stack ( const StackType &  stack_)
private

Copy-construction from a another stack of any type.

Warning
not implemented yet!
template<unsigned_type CritSize, class ExternalStack, class InternalStack>
stxxl::migrating_stack< CritSize, ExternalStack, InternalStack >::migrating_stack ( )
inline

Default constructor: creates empty stack.

Definition at line 847 of file stack.h.

template<unsigned_type CritSize, class ExternalStack, class InternalStack>
virtual stxxl::migrating_stack< CritSize, ExternalStack, InternalStack >::~migrating_stack ( )
inlinevirtual

Definition at line 851 of file stack.h.

Member Function Documentation

template<unsigned_type CritSize, class ExternalStack, class InternalStack>
bool stxxl::migrating_stack< CritSize, ExternalStack, InternalStack >::empty ( ) const
inline

Returns true if the stack is empty.

Definition at line 892 of file stack.h.

template<unsigned_type CritSize, class ExternalStack, class InternalStack>
bool stxxl::migrating_stack< CritSize, ExternalStack, InternalStack >::external ( ) const
inline

Returns true if current implementation is external, otherwise false.

Definition at line 880 of file stack.h.

template<unsigned_type CritSize, class ExternalStack, class InternalStack>
bool stxxl::migrating_stack< CritSize, ExternalStack, InternalStack >::internal ( ) const
inline

Returns true if current implementation is internal, otherwise false.

Definition at line 874 of file stack.h.

template<unsigned_type CritSize, class ExternalStack, class InternalStack>
void stxxl::migrating_stack< CritSize, ExternalStack, InternalStack >::pop ( )
inline

Removes the element at the top of the stack. Precondition: stack is not empty(). Postcondition: size() is decremented.

Definition at line 948 of file stack.h.

template<unsigned_type CritSize, class ExternalStack, class InternalStack>
void stxxl::migrating_stack< CritSize, ExternalStack, InternalStack >::push ( const value_type val)
inline

Inserts an element at the top of the stack. Postconditions: size() is incremented by 1, and top() is the inserted element.

Definition at line 927 of file stack.h.

References UNLIKELY.

template<unsigned_type CritSize, class ExternalStack, class InternalStack>
size_type stxxl::migrating_stack< CritSize, ExternalStack, InternalStack >::size ( ) const
inline

Returns the number of elements contained in the stack.

Definition at line 898 of file stack.h.

template<unsigned_type CritSize, class ExternalStack, class InternalStack>
void stxxl::migrating_stack< CritSize, ExternalStack, InternalStack >::swap ( migrating_stack< CritSize, ExternalStack, InternalStack > &  obj)
inline
template<unsigned_type CritSize, class ExternalStack, class InternalStack>
value_type& stxxl::migrating_stack< CritSize, ExternalStack, InternalStack >::top ( )
inline

Return mutable reference to the element at the top of the stack. Precondition: stack is not empty().

Definition at line 911 of file stack.h.

template<unsigned_type CritSize, class ExternalStack, class InternalStack>
const value_type& stxxl::migrating_stack< CritSize, ExternalStack, InternalStack >::top ( ) const
inline

Return constant reference to the element at the top of the stack. Precondition: stack is not empty().

Definition at line 919 of file stack.h.

Member Data Documentation

template<unsigned_type CritSize, class ExternalStack, class InternalStack>
ext_stack_type* stxxl::migrating_stack< CritSize, ExternalStack, InternalStack >::ext_impl
private
template<unsigned_type CritSize, class ExternalStack, class InternalStack>
int_stack_type* stxxl::migrating_stack< CritSize, ExternalStack, InternalStack >::int_impl
private

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