#include <dstack.h>
Public Member Functions | |
| DStack (size_t _size=-1) | |
| The constructor. | |
| ~DStack () | |
| The destructor. | |
| void | grow () |
| Increases the array size by the number in m_stepSize. | |
| void | push (dataType _val) |
| Pushes a value onto the stack. | |
| dataType | pop () |
| Pops a value off the stack. | |
| dataType const & | peek () |
| Returns whatever value is on the top of the stack without removing it from the stack. | |
| size_t | count () const |
| Indicates the number of items on the stack. | |
| void | empty () |
| Empties the stack. | |
Private Member Functions | |
| void | setSize (size_t _size) |
| Sets the stack size to the given size. | |
Private Attributes | |
| size_t | m_stepSize |
| The step size for which to increase the stack size by. | |
| dataType * | m_bottom |
| The actual stack itself. | |
| dataType * | m_top |
| The pointer to the current position in the stack. | |
| size_t | m_size |
| The size of the stack. | |
| size_t | m_origSize |
| The original size of the stack (used on an empty() call to reset things to defaults). | |
| DStack | ( | size_t | _size = -1 |
) |
The constructor.
| _size | The step size to use. |
| size_t count | ( | ) | const |
Indicates the number of items on the stack.
| void empty | ( | ) |
Empties the stack.
If pointers are stored in the stack, they must be freed manually via a series of pop() and delete or free() calls.
| dataType const& peek | ( | ) |
Returns whatever value is on the top of the stack without removing it from the stack.
| dataType pop | ( | ) | [inline] |
Pops a value off the stack.
| void push | ( | dataType | _val | ) | [inline] |
Pushes a value onto the stack.
| _val | The value to put on the stack. |
| void setSize | ( | size_t | _size | ) | [private] |
Sets the stack size to the given size.
| _size | The size to resize to. |
1.5.8