|
Data Structures in C++
|
Stack implementation using a native C++ array as data storage. More...
#include <StaticStack.hpp>
Public Member Functions | |
| std::string | getName () |
| Provides the name of the data structure as a string representation. More... | |
| StaticStack (int size) | |
| Create a fixed-size stack. More... | |
| StaticStack (T data[]) | |
| create the structure and populate it with the data from the array More... | |
| ~StaticStack () | |
| void | push (T val) |
| Add an element to the top of the stack. More... | |
| T | pop () |
| Remove an element from the top of the stack. More... | |
| T | peek () |
| See the value from the top of the stack, without removing it. More... | |
| int | getSize () |
| Outputs the number of elements stored in the structure. More... | |
| bool | isEmpty () |
| Check whether the structure is empty. More... | |
| bool | isFull () |
| Check whether the structure is full. More... | |
Private Attributes | |
| int | top |
| int | size |
| T * | data |
Stack implementation using a native C++ array as data storage.
| T | The type of object the data structure will contain |
Definition at line 17 of file StaticStack.hpp.
|
inlineexplicit |
Create a fixed-size stack.
| size | the size of the stack |
Definition at line 27 of file StaticStack.hpp.
|
inlineexplicit |
create the structure and populate it with the data from the array
| data | an array with data with which the structure will be initialized |
Definition at line 35 of file StaticStack.hpp.
|
inline |
Definition at line 39 of file StaticStack.hpp.
|
inlinevirtual |
Provides the name of the data structure as a string representation.
Reimplemented from Stack< T >.
Definition at line 23 of file StaticStack.hpp.
|
inlinevirtual |
Outputs the number of elements stored in the structure.
Implements DataStructure.
Definition at line 59 of file StaticStack.hpp.
|
inlinevirtual |
Check whether the structure is empty.
Implements DataStructure.
Definition at line 63 of file StaticStack.hpp.
|
inlinevirtual |
Check whether the structure is full.
Implements DataStructure.
Definition at line 67 of file StaticStack.hpp.
|
inlinevirtual |
See the value from the top of the stack, without removing it.
Implements Stack< T >.
Definition at line 53 of file StaticStack.hpp.
|
inlinevirtual |
Remove an element from the top of the stack.
Implements Stack< T >.
Definition at line 47 of file StaticStack.hpp.
|
inlinevirtual |
Add an element to the top of the stack.
| val | the value to be added to the stack |
Implements Stack< T >.
Definition at line 41 of file StaticStack.hpp.
|
private |
Definition at line 20 of file StaticStack.hpp.
|
private |
Definition at line 19 of file StaticStack.hpp.
|
private |
Definition at line 19 of file StaticStack.hpp.
1.8.13