#include <Stack.h>
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. | |
| 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.
| void Stack< Type >::Push | ( | Type | newData | ) | [inline] |
Add an element onto the top of the stack.
| Type Stack< Type >::Pop | ( | ) | [inline] |
Remove an element from the top of the stack.
| Type Stack< Type >::Peek | ( | ) | [inline] |
Returns the top-most element. If there are none, it throws an out of bounds error.
| int Stack< Type >::GetSize | ( | ) | [inline] |
Returns the current size.
| bool Stack< Type >::IsEmpty | ( | ) | [inline] |
Returns true if empty (No elements).
| void Stack< Type >::Flip | ( | ) | [inline] |
Flips the entire stack.
const int Stack< Type >::DEFAULT_PAGE_SIZE = 16 [static, private] |
Define the default page size.
The size of a page of memory to grow the list by.
1.5.5