Stack with up to size objects of class T. More...
#include <SgStack.h>
Public Member Functions | |
SgStack () | |
~SgStack () | |
void | Clear () |
Empty the stack. | |
void | CopyFrom (const SgStack< T, SIZE > &other) |
Make this stack a copy of other. | |
bool | IsEmpty () const |
bool | NonEmpty () const |
T | Pop () |
remove and return top element. | |
void | Push (T data) |
void | PushAll (const SgStack< T, SIZE > &other) |
Push all elements from other stack onto this stack. | |
int | Size () const |
Number of elements on stack. | |
void | SwapWith (SgStack< T, SIZE > &other) |
Exchange contents of this and other stack. | |
const T & | Top () const |
const T & | operator[] (int index) const |
Private Member Functions | |
SgStack (const SgStack &) | |
not implemented | |
SgStack & | operator= (const SgStack &) |
not implemented | |
Private Attributes | |
int | m_sp |
T | m_stack [SIZE] |
Stack with up to size objects of class T.
Stack does not assume ownership. Memory management of objects on stack is the user's responsibility.
Definition at line 16 of file SgStack.h.
not implemented
void SgStack< T, SIZE >::Clear | ( | ) |
Empty the stack.
Definition at line 68 of file SgStack.h.
References SgStack< T, SIZE >::m_sp.
Referenced by SgSearch::SearchEngine().
void SgStack< T, SIZE >::CopyFrom | ( | const SgStack< T, SIZE > & | other | ) |
Make this stack a copy of other.
Definition at line 74 of file SgStack.h.
References SgStack< T, SIZE >::m_sp, SgStack< T, SIZE >::m_stack, and SgStack< T, SIZE >::Size().
Referenced by SgSearch::TryMove().
bool SgStack< T, SIZE >::IsEmpty | ( | ) | const |
Definition at line 82 of file SgStack.h.
References SgStack< T, SIZE >::m_sp.
Referenced by SgSearch::SearchEngine().
bool SgStack< T, SIZE >::NonEmpty | ( | ) | const |
Definition at line 88 of file SgStack.h.
References SgStack< T, SIZE >::m_sp.
Referenced by SgSearch::SearchEngine().
SgStack& SgStack< T, SIZE >::operator= | ( | const SgStack< T, SIZE > & | ) | [private] |
not implemented
const T & SgStack< T, SIZE >::operator[] | ( | int | index | ) | const |
Definition at line 143 of file SgStack.h.
References SgStack< T, SIZE >::m_sp, SgStack< T, SIZE >::m_stack, and SG_ASSERT.
T SgStack< T, SIZE >::Pop | ( | ) |
remove and return top element.
Must be NonEmpty.
Definition at line 94 of file SgStack.h.
References SgStack< T, SIZE >::m_sp, SgStack< T, SIZE >::m_stack, and SG_ASSERT.
void SgStack< T, SIZE >::Push | ( | T | data | ) |
Definition at line 101 of file SgStack.h.
References SgStack< T, SIZE >::m_sp, SgStack< T, SIZE >::m_stack, and SG_ASSERT.
Referenced by SgStack< T, SIZE >::PushAll(), SgSearch::SearchEngine(), and SgSearch::TryMove().
void SgStack< T, SIZE >::PushAll | ( | const SgStack< T, SIZE > & | other | ) |
Push all elements from other stack onto this stack.
Definition at line 108 of file SgStack.h.
References SgStack< T, SIZE >::m_stack, SgStack< T, SIZE >::Push(), and SgStack< T, SIZE >::Size().
Referenced by SgProbCut::ProbCut().
int SgStack< T, SIZE >::Size | ( | ) | const |
Number of elements on stack.
Definition at line 115 of file SgStack.h.
References SgStack< T, SIZE >::m_sp.
Referenced by SgStack< T, SIZE >::CopyFrom(), SgStack< T, SIZE >::PushAll(), and SgStack< T, SIZE >::SwapWith().
Exchange contents of this and other stack.
Definition at line 121 of file SgStack.h.
References SgStack< T, SIZE >::m_sp, SgStack< T, SIZE >::m_stack, and SgStack< T, SIZE >::Size().
Referenced by SgProbCut::ProbCut().
const T & SgStack< T, SIZE >::Top | ( | ) | const |
Definition at line 136 of file SgStack.h.
References SgStack< T, SIZE >::m_sp, SgStack< T, SIZE >::m_stack, and SG_ASSERT.
Referenced by SgSearch::SearchEngine().
Definition at line 54 of file SgStack.h.
Referenced by SgStack< T, SIZE >::Clear(), SgStack< T, SIZE >::CopyFrom(), SgStack< T, SIZE >::IsEmpty(), SgStack< T, SIZE >::NonEmpty(), SgStack< T, SIZE >::operator[](), SgStack< T, SIZE >::Pop(), SgStack< T, SIZE >::Push(), SgStack< T, SIZE >::Size(), SgStack< T, SIZE >::SwapWith(), and SgStack< T, SIZE >::Top().
Definition at line 56 of file SgStack.h.
Referenced by SgStack< T, SIZE >::CopyFrom(), SgStack< T, SIZE >::operator[](), SgStack< T, SIZE >::Pop(), SgStack< T, SIZE >::Push(), SgStack< T, SIZE >::PushAll(), SgStack< T, SIZE >::SwapWith(), and SgStack< T, SIZE >::Top().