Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
bitpit::LIFOStack< T > Class Template Reference

class for Last In First Out stack More...

Public Member Functions

 LIFOStack (int)
 
 LIFOStack (std::vector< T > &)
 
 LIFOStack (void)
 
 ~LIFOStack (void)
 
void clear (void)
 
void decreaseSTACK (void)
 
void display (std::ostream &)
 
void increaseSTACK (void)
 
pop (void)
 
void push (const std::vector< T > &)
 
void push (const T &)
 

Public Attributes

int MAXSTK
 
std::vector< T > STACK
 
int TOPSTK
 

Detailed Description

template<class T>
class bitpit::LIFOStack< T >

class for Last In First Out stack

Manage insertion and extraction from/to a list of object using the L.I.F.O. pragma.

Class template parameter, T, can be of any copy-constructible type.

Definition at line 322 of file SortAlgorithms.hpp.

Constructor & Destructor Documentation

◆ LIFOStack() [1/3]

template<class T >
bitpit::LIFOStack< T >::LIFOStack ( void )

Default constructor for class LIFOStack. Initalize an empty stack

Definition at line 62 of file LIFOStack.tpp.

◆ LIFOStack() [2/3]

template<class T >
bitpit::LIFOStack< T >::LIFOStack ( int maxstack)

Constructor #1 for class LIFOStack. Initialize an empty stack, and set the memory reserve to maxstack. Once the max capacity is reached, insertion of another elements will cause the memory to be further increased by maxstack.

Parameters
[in]maxstackmemory reserved for stack.

Definition at line 101 of file LIFOStack.tpp.

◆ LIFOStack() [3/3]

template<class T >
bitpit::LIFOStack< T >::LIFOStack ( std::vector< T > & items)

Constructor #2 for LIFOStack. Initialize a LIFO stack from a vector of elements. The memory reserve is set to the size of the input vector and elements are inserted in order from items.begin() to items.end()

Parameters
[in]itemslist of objects to be inserted into the stack

Definition at line 140 of file LIFOStack.tpp.

◆ ~LIFOStack()

template<class T >
bitpit::LIFOStack< T >::~LIFOStack ( void )

Default destructor for class LIFOStack.

Clear stack content and release memory.

Definition at line 181 of file LIFOStack.tpp.

Member Function Documentation

◆ clear()

template<class T >
void bitpit::LIFOStack< T >::clear ( void )

Clear stack content without freeing memory.

Definition at line 217 of file LIFOStack.tpp.

◆ decreaseSTACK()

template<class T >
void bitpit::LIFOStack< T >::decreaseSTACK ( void )

Decrease memory reserved for stack by maxstack. The parameter maxstack is assigned at class declaration.

Definition at line 272 of file LIFOStack.tpp.

◆ display()

template<class T >
void bitpit::LIFOStack< T >::display ( std::ostream & out)

Display stack info to output stream (e.g. number of elements currently stored into stack, memory currently reserved for stack, etc.)

Parameters
[in,out]outoutput stream

Definition at line 409 of file LIFOStack.tpp.

◆ increaseSTACK()

template<class T >
void bitpit::LIFOStack< T >::increaseSTACK ( void )

Increase memory reserved for stack by maxstack. The parameter maxstack is assigned at class declaration.

Definition at line 245 of file LIFOStack.tpp.

◆ pop()

template<class T >
T bitpit::LIFOStack< T >::pop ( void )

Pop the first item (i.e. the last added item) from stack, reducing its size by one element.

Returns
returns the first item in the stack

Definition at line 301 of file LIFOStack.tpp.

◆ push() [1/2]

template<class T >
void bitpit::LIFOStack< T >::push ( const std::vector< T > & items)

Push a list of items into stack. Items are inserted in the same order they appear in the input vector, i.e. from items.begin() to items.end().

Parameters
[in]itemsvector storing the list of items to be pushed into the stack

Definition at line 377 of file LIFOStack.tpp.

◆ push() [2/2]

template<class T >
void bitpit::LIFOStack< T >::push ( const T & item)

Push item into stack. This item will be the first to be returned if pop() is called.

Parameters
[in]itemitem to be pushed into the list.

Definition at line 338 of file LIFOStack.tpp.

Member Data Documentation

◆ MAXSTK

template<class T >
int bitpit::LIFOStack< T >::MAXSTK

Maximal stack size between resize

Definition at line 326 of file SortAlgorithms.hpp.

◆ STACK

template<class T >
std::vector<T> bitpit::LIFOStack< T >::STACK

LIFO stack

Definition at line 328 of file SortAlgorithms.hpp.

◆ TOPSTK

template<class T >
int bitpit::LIFOStack< T >::TOPSTK

Current stack size

Definition at line 327 of file SortAlgorithms.hpp.


The documentation for this class was generated from the following files:
--- layout: doxygen_footer ---