The parameterized class BoundedStack<E,INDEX> implements stacks with bounded size. More...
#include <ogdf/basic/BoundedStack.h>
Public Member Functions | |
| BoundedStack () | |
| Constructs an empty bounded stack for no elements at all. | |
| BoundedStack (INDEX n) | |
| Constructs an empty bounded stack for at most n elements. | |
| BoundedStack (const BoundedStack< E > &S) | |
| Constructs a bounded stack that is a copy of S. | |
| ~BoundedStack () | |
| INDEX | capacity () const |
| Returns the capacity of the bounded stack. | |
| void | clear () |
| Makes the stack empty. | |
| bool | empty () |
| Returns true iff the stack is empty. | |
| bool | full () |
| Returns true iff the stack is full. | |
| void | init () |
| Reinitializes the stack for no elements at all (actually frees memory). | |
| void | init (INDEX n) |
| Reinitializes the stack for n elements. | |
| BoundedStack< E > & | operator= (const BoundedStack &S) |
| Assignment operator. | |
| E | pop () |
| Removes the top-most element from the stack and returns it. | |
| void | print (ostream &os, char delim= ' ') const |
| Prints the stack to output stream os. | |
| void | push (const E &x) |
| Adds element x as top-most element to the stack. | |
| INDEX | size () const |
| Returns current size of the stack. | |
| const E & | top () const |
| Returns top element. | |
| E & | top () |
| Returns top element. | |
| bool | valid () const |
| Returns true iff the stack was initialized. | |
Private Member Functions | |
| void | copy (const BoundedStack< E > &S) |
Private Attributes | |
| E * | m_pStart |
| Pointer to first element. | |
| E * | m_pStop |
| Pointer to one past last element. | |
| E * | m_pTop |
| Pointer to top element. | |
The parameterized class BoundedStack<E,INDEX> implements stacks with bounded size.
| E | is the element type. |
| INDEX | is the index type. The default index type is int, other possible types are short and long long (on 64-bit systems). |
Definition at line 70 of file BoundedStack.h.
|
inline |
Constructs an empty bounded stack for no elements at all.
The default constructor does not allocate any space for elements; before using the stack, it is required to initialize the stack with init().
Definition at line 82 of file BoundedStack.h.
|
inlineexplicit |
Constructs an empty bounded stack for at most n elements.
Definition at line 87 of file BoundedStack.h.
|
inline |
Constructs a bounded stack that is a copy of S.
Definition at line 96 of file BoundedStack.h.
|
inline |
Definition at line 101 of file BoundedStack.h.
|
inline |
Returns the capacity of the bounded stack.
Definition at line 130 of file BoundedStack.h.
|
inline |
Makes the stack empty.
Definition at line 170 of file BoundedStack.h.
|
inlineprivate |
Definition at line 180 of file BoundedStack.h.
|
inline |
Returns true iff the stack is empty.
Definition at line 121 of file BoundedStack.h.
|
inline |
Returns true iff the stack is full.
Definition at line 124 of file BoundedStack.h.
|
inline |
Reinitializes the stack for no elements at all (actually frees memory).
Definition at line 133 of file BoundedStack.h.
|
inline |
Reinitializes the stack for n elements.
Definition at line 139 of file BoundedStack.h.
|
inline |
Assignment operator.
Definition at line 151 of file BoundedStack.h.
|
inline |
Removes the top-most element from the stack and returns it.
Definition at line 164 of file BoundedStack.h.
|
inline |
Prints the stack to output stream os.
Definition at line 173 of file BoundedStack.h.
|
inline |
Adds element x as top-most element to the stack.
Definition at line 158 of file BoundedStack.h.
|
inline |
Returns current size of the stack.
Definition at line 118 of file BoundedStack.h.
|
inline |
Returns top element.
Definition at line 106 of file BoundedStack.h.
|
inline |
Returns top element.
Definition at line 112 of file BoundedStack.h.
|
inline |
Returns true iff the stack was initialized.
Definition at line 127 of file BoundedStack.h.
|
private |
Pointer to first element.
Definition at line 73 of file BoundedStack.h.
|
private |
Pointer to one past last element.
Definition at line 74 of file BoundedStack.h.
|
private |
Pointer to top element.
Definition at line 72 of file BoundedStack.h.