Stack< Type > Class Template Reference

#include <Stack.h>

List of all members.


Detailed Description

template<typename Type>
class Stack< Type >

List class; A simple template implementation.

Public Member Functions

 Stack (int size=DEFAULT_PAGE_SIZE, int PageSize=DEFAULT_PAGE_SIZE)
 Constructor. PageSize is the chunks of memory allocated at run-time as needed.
 ~Stack ()
 Destructor.
void Push (Type newData)
 Add an element onto the top of the stack.
Type Pop ()
 Remove an element from the top of the stack.
Type Peek ()
 Returns the top-most element. If there are none, it throws an out of bounds error.
int GetSize ()
 Returns the current size.
bool IsEmpty ()
 Returns true if empty (No elements).
void Flip ()
 Flips the entire stack.

Private Attributes

List< Type > data
 Data.
int top
 The top stack index.
int pageSize
 The size of a page of memory to grow the list by.

Static Private Attributes

static const int DEFAULT_PAGE_SIZE = 16
 Define the default page size.

Constructor & Destructor Documentation

template<typename Type>
Stack< Type >::Stack ( int  size = DEFAULT_PAGE_SIZE,
int  PageSize = DEFAULT_PAGE_SIZE 
) [inline]

Constructor. PageSize is the chunks of memory allocated at run-time as needed.

template<typename Type>
Stack< Type >::~Stack (  )  [inline]

Destructor.


Member Function Documentation

template<typename Type>
void Stack< Type >::Push ( Type  newData  )  [inline]

Add an element onto the top of the stack.

template<typename Type>
Type Stack< Type >::Pop (  )  [inline]

Remove an element from the top of the stack.

template<typename Type>
Type Stack< Type >::Peek (  )  [inline]

Returns the top-most element. If there are none, it throws an out of bounds error.

template<typename Type>
int Stack< Type >::GetSize (  )  [inline]

Returns the current size.

template<typename Type>
bool Stack< Type >::IsEmpty (  )  [inline]

Returns true if empty (No elements).

template<typename Type>
void Stack< Type >::Flip (  )  [inline]

Flips the entire stack.


Member Data Documentation

template<typename Type>
const int Stack< Type >::DEFAULT_PAGE_SIZE = 16 [static, private]

Define the default page size.

template<typename Type>
List< Type > Stack< Type >::data [private]

Data.

template<typename Type>
int Stack< Type >::top [private]

The top stack index.

template<typename Type>
int Stack< Type >::pageSize [private]

The size of a page of memory to grow the list by.


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

Generated on Sun Feb 21 00:00:11 2010 for Penn State Robotics Club: Mini Grand Challenge 2010 by  doxygen 1.5.5