Simple Application Framework
1
|
Last-in first-out stack container. More...
#include <Stack.h>
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. | |
MyType & | operator= (MyType &stack) |
Assignment operator. | |
MyType & | Pop () |
Remove the element at the top of the stack. | |
MyType & | Push (const ValType &val) |
Add new element at the top of the stack. | |
MyType & | Swap (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 |
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:
PushBack()
PopBack()
Back()
IsEmpty()
Therefore, the following classes are examples of containers that can be used to implement the stack: Deque, List, DynArray.ValType | Data type of values in the stack. |
ContainerType | Underlying container storing the data. |
typedef Stack<ValType,ContainerType> Saf::Collection::Stack< ValType, ContainerType >::MyType [protected] |
Saf::Collection::Stack< ValType, ContainerType >::Stack | ( | ) | [inline] |
Constructor.
Saf::Collection::Stack< ValType, ContainerType >::Stack | ( | const MyType & | stack | ) | [inline] |
Copy constructor.
Saf::Collection::Stack< ValType, ContainerType >::Stack | ( | const ContainerType & | cont | ) | [inline, explicit] |
Construct using the supplied container.
const ContainerType& Saf::Collection::Stack< ValType, ContainerType >::Container | ( | ) | const [inline] |
Get the internal data container reference.
Size Saf::Collection::Stack< ValType, ContainerType >::Elements | ( | ) | const [inline] |
Get the number of elements in the stack.
bool Saf::Collection::Stack< ValType, ContainerType >::IsEmpty | ( | ) | const [inline] |
Check whether the stack is empty.
MyType& Saf::Collection::Stack< ValType, ContainerType >::operator= | ( | MyType & | stack | ) | [inline] |
Assignment operator.
MyType& Saf::Collection::Stack< ValType, ContainerType >::Pop | ( | ) | [inline] |
Remove the element at the top of the stack.
MyType& Saf::Collection::Stack< ValType, ContainerType >::Push | ( | const ValType & | val | ) | [inline] |
Add new element at the top of the stack.
MyType& Saf::Collection::Stack< ValType, ContainerType >::Swap | ( | MyType & | stack | ) | [inline] |
Swap the content of two stacks.
ValType& Saf::Collection::Stack< ValType, ContainerType >::Top | ( | ) | [inline] |
Get reference to the element on the top of the stack.
const ValType& Saf::Collection::Stack< ValType, ContainerType >::Top | ( | ) | const [inline] |
Get reference to the element on the top of the stack.