Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

SgStack< T, SIZE > Class Template Reference

#include <SgStack.h>

List of all members.


Detailed Description

template<class T, int SIZE>
class SgStack< T, 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 18 of file 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
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
SgStackoperator= (const SgStack &)
 not implemented

Private Attributes

int m_sp
m_stack [SIZE]


Constructor & Destructor Documentation

template<class T, int SIZE>
SgStack< T, SIZE >::SgStack (  ) 

Definition at line 21 of file SgStack.h.

template<class T, int SIZE>
SgStack< T, SIZE >::~SgStack (  ) 

Definition at line 25 of file SgStack.h.

template<class T, int SIZE>
SgStack< T, SIZE >::SgStack ( const SgStack< T, SIZE > &   )  [private]

not implemented


Member Function Documentation

template<typename T, int SIZE>
void SgStack< T, SIZE >::Clear (  ) 

Empty the stack.

Definition at line 70 of file SgStack.h.

References SgStack< T, SIZE >::m_sp.

template<typename T, int SIZE>
void SgStack< T, SIZE >::CopyFrom ( const SgStack< T, SIZE > &  other  ) 

Make this stack a copy of other.

Definition at line 76 of file SgStack.h.

References SgStack< T, SIZE >::m_sp, SgStack< T, SIZE >::m_stack, and SgStack< T, SIZE >::Size().

Referenced by SgSearch::TryMove().

template<typename T, int SIZE>
bool SgStack< T, SIZE >::IsEmpty (  )  const

Definition at line 84 of file SgStack.h.

References SgStack< T, SIZE >::m_sp.

template<typename T, int SIZE>
bool SgStack< T, SIZE >::NonEmpty (  )  const

Definition at line 90 of file SgStack.h.

References SgStack< T, SIZE >::m_sp.

template<class T, int SIZE>
SgStack& SgStack< T, SIZE >::operator= ( const SgStack< T, SIZE > &   )  [private]

not implemented

template<typename T, int SIZE>
const T & SgStack< T, SIZE >::operator[] ( int  index  )  const

Definition at line 145 of file SgStack.h.

References SgStack< T, SIZE >::m_sp, SgStack< T, SIZE >::m_stack, and SG_ASSERT.

template<typename T, int SIZE>
T SgStack< T, SIZE >::Pop (  ) 

remove and return top element.

Must be NonEmpty.

Definition at line 96 of file SgStack.h.

References SgStack< T, SIZE >::m_sp, SgStack< T, SIZE >::m_stack, and SG_ASSERT.

template<typename T, int SIZE>
void SgStack< T, SIZE >::Push ( data  ) 

Definition at line 103 of file SgStack.h.

References SgStack< T, SIZE >::m_sp, SgStack< T, SIZE >::m_stack, and SG_ASSERT.

Referenced by SgStack< T, SIZE >::PushAll(), and SgSearch::TryMove().

template<typename T, int SIZE>
void SgStack< T, SIZE >::PushAll ( const SgStack< T, SIZE > &  other  ) 

Push all elements from other stack onto this stack.

Definition at line 110 of file SgStack.h.

References SgStack< T, SIZE >::m_stack, SgStack< T, SIZE >::Push(), and SgStack< T, SIZE >::Size().

Referenced by SgProbCut::ProbCut().

template<typename T, int SIZE>
int SgStack< T, SIZE >::Size (  )  const

Number of elements on stack.

Definition at line 117 of file SgStack.h.

References SgStack< T, SIZE >::m_sp.

Referenced by SgStack< T, SIZE >::CopyFrom(), SgStack< T, SIZE >::PushAll(), and ReverseCopyStack().

template<class T, int SIZE>
void SgStack< T, SIZE >::SwapWith ( SgStack< T, SIZE > &  other  ) 

Exchange contents of this and other stack.

Referenced by SgProbCut::ProbCut().

template<typename T, int SIZE>
const T & SgStack< T, SIZE >::Top (  )  const

Definition at line 138 of file SgStack.h.

References SgStack< T, SIZE >::m_sp, SgStack< T, SIZE >::m_stack, and SG_ASSERT.


Member Data Documentation

template<class T, int SIZE>
int SgStack< T, SIZE >::m_sp [private]

Definition at line 56 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(), and SgStack< T, SIZE >::Top().

template<class T, int SIZE>
T SgStack< T, SIZE >::m_stack[SIZE] [private]

Definition at line 58 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(), and SgStack< T, SIZE >::Top().


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


17 Jun 2010 Doxygen 1.4.7