Nebula
Loading...
Searching...
No Matches
Util::Stack< TYPE > Class Template Reference

#include <stack.h>

Detailed Description

template<class TYPE>
class Util::Stack< TYPE >

Nebula's stack class (a FILO container).

Public Member Functions

 Stack ()
 constructor
 
 Stack (const Stack< TYPE > &rhs)
 copy constructor
 
void operator= (const Stack< TYPE > &rhs)
 assignment operator
 
TYPE & operator[] (IndexT index) const
 access element by index, 0 is the topmost element
 
bool operator== (const Stack< TYPE > &rhs) const
 equality operator
 
bool operator!= (const Stack< TYPE > &rhs) const
 inequality operator
 
SizeT Size () const
 returns number of elements on stack
 
bool IsEmpty () const
 returns true if stack is empty
 
void Clear ()
 remove all elements from the stack
 
bool Contains (const TYPE &e) const
 return true if stack contains element
 
void EraseIndex (const IndexT i)
 erase element at index
 
void Push (const TYPE &e)
 push an element on the stack
 
TYPE & Peek () const
 get reference of topmost element of stack, without removing it
 
TYPE Pop ()
 get topmost element of stack, remove element
 

Private Attributes

Array< TYPE > stackArray
 

Constructor & Destructor Documentation

◆ Stack() [1/2]

template<class TYPE >
Util::Stack< TYPE >::Stack ( )

constructor

◆ Stack() [2/2]

template<class TYPE >
Util::Stack< TYPE >::Stack ( const Stack< TYPE > & rhs)

copy constructor

Member Function Documentation

◆ Clear()

template<class TYPE >
void Util::Stack< TYPE >::Clear ( )

remove all elements from the stack

◆ Contains()

template<class TYPE >
bool Util::Stack< TYPE >::Contains ( const TYPE & e) const

return true if stack contains element

◆ EraseIndex()

template<class TYPE >
void Util::Stack< TYPE >::EraseIndex ( const IndexT i)

erase element at index

◆ IsEmpty()

template<class TYPE >
bool Util::Stack< TYPE >::IsEmpty ( ) const

returns true if stack is empty

◆ operator!=()

template<class TYPE >
bool Util::Stack< TYPE >::operator!= ( const Stack< TYPE > & rhs) const

inequality operator

◆ operator=()

template<class TYPE >
void Util::Stack< TYPE >::operator= ( const Stack< TYPE > & rhs)

assignment operator

◆ operator==()

template<class TYPE >
bool Util::Stack< TYPE >::operator== ( const Stack< TYPE > & rhs) const

equality operator

◆ operator[]()

template<class TYPE >
TYPE & Util::Stack< TYPE >::operator[] ( IndexT index) const

access element by index, 0 is the topmost element

◆ Peek()

template<class TYPE >
TYPE & Util::Stack< TYPE >::Peek ( ) const

get reference of topmost element of stack, without removing it

◆ Pop()

template<class TYPE >
TYPE Util::Stack< TYPE >::Pop ( )

get topmost element of stack, remove element

◆ Push()

template<class TYPE >
void Util::Stack< TYPE >::Push ( const TYPE & e)

push an element on the stack

◆ Size()

template<class TYPE >
SizeT Util::Stack< TYPE >::Size ( ) const

returns number of elements on stack

Member Data Documentation

◆ stackArray

template<class TYPE >
Array<TYPE> Util::Stack< TYPE >::stackArray
private

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