Simple Application Framework  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Protected Types
Saf::Collection::Stack< ValType, ContainerType > Class Template Reference

Last-in first-out stack container. More...

#include <Stack.h>

List of all members.

Public Member Functions

 Stack ()
 Constructor.
 Stack (const MyType &stack)
 Copy constructor.
 Stack (const ContainerType &cont)
 Construct using the supplied container.
const ContainerType & Container () const
 Get the internal data container reference.
Size Elements () const
 Get the number of elements in the stack.
bool IsEmpty () const
 Check whether the stack is empty.
MyTypeoperator= (MyType &stack)
 Assignment operator.
MyTypePop ()
 Remove the element at the top of the stack.
MyTypePush (const ValType &val)
 Add new element at the top of the stack.
MyTypeSwap (MyType &stack)
 Swap the content of two stacks.
ValType & Top ()
 Get reference to the element on the top of the stack.
const ValType & Top () const
 Get reference to the element on the top of the stack.

Protected Types

typedef Stack< ValType,
ContainerType > 
MyType

Detailed Description

template<class ValType, class ContainerType = Deque<ValType>>
class Saf::Collection::Stack< ValType, ContainerType >

Last-in first-out stack container.

This class implements a traditional stack container where elements are inserted and extracted only from the end of the container.

Technically, an underlying container is used to store the data. The encapsulated container must provide the following methods:

Template Parameters:
ValTypeData type of values in the stack.
ContainerTypeUnderlying container storing the data.
See also:
Queue, PriorityQueue, Deqeue, List, DynArray.

Member Typedef Documentation

template<class ValType , class ContainerType = Deque<ValType>>
typedef Stack<ValType,ContainerType> Saf::Collection::Stack< ValType, ContainerType >::MyType [protected]

Constructor & Destructor Documentation

template<class ValType , class ContainerType = Deque<ValType>>
Saf::Collection::Stack< ValType, ContainerType >::Stack ( ) [inline]

Constructor.

template<class ValType , class ContainerType = Deque<ValType>>
Saf::Collection::Stack< ValType, ContainerType >::Stack ( const MyType stack) [inline]

Copy constructor.

template<class ValType , class ContainerType = Deque<ValType>>
Saf::Collection::Stack< ValType, ContainerType >::Stack ( const ContainerType &  cont) [inline, explicit]

Construct using the supplied container.


Member Function Documentation

template<class ValType , class ContainerType = Deque<ValType>>
const ContainerType& Saf::Collection::Stack< ValType, ContainerType >::Container ( ) const [inline]

Get the internal data container reference.

template<class ValType , class ContainerType = Deque<ValType>>
Size Saf::Collection::Stack< ValType, ContainerType >::Elements ( ) const [inline]

Get the number of elements in the stack.

template<class ValType , class ContainerType = Deque<ValType>>
bool Saf::Collection::Stack< ValType, ContainerType >::IsEmpty ( ) const [inline]

Check whether the stack is empty.

template<class ValType , class ContainerType = Deque<ValType>>
MyType& Saf::Collection::Stack< ValType, ContainerType >::operator= ( MyType stack) [inline]

Assignment operator.

template<class ValType , class ContainerType = Deque<ValType>>
MyType& Saf::Collection::Stack< ValType, ContainerType >::Pop ( ) [inline]

Remove the element at the top of the stack.

template<class ValType , class ContainerType = Deque<ValType>>
MyType& Saf::Collection::Stack< ValType, ContainerType >::Push ( const ValType &  val) [inline]

Add new element at the top of the stack.

template<class ValType , class ContainerType = Deque<ValType>>
MyType& Saf::Collection::Stack< ValType, ContainerType >::Swap ( MyType stack) [inline]

Swap the content of two stacks.

template<class ValType , class ContainerType = Deque<ValType>>
ValType& Saf::Collection::Stack< ValType, ContainerType >::Top ( ) [inline]

Get reference to the element on the top of the stack.

template<class ValType , class ContainerType = Deque<ValType>>
const ValType& Saf::Collection::Stack< ValType, ContainerType >::Top ( ) const [inline]

Get reference to the element on the top of the stack.


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