|
MADARA
3.1.8
|
Defines a generic "last-in/first-out" (LIFO) Abstract Data Type (ADT) using a stack that's implemented as a linked list. More...
#include <LStack.h>
Classes | |
| class | Overflow |
| Exception thrown by methods in this class when an overflow condition occurs. More... | |
| class | Underflow |
| Exception thrown by methods in this class when an underflow condition occurs. More... | |
Public Types | |
| typedef LStackConstIterator< T > | const_iterator |
| typedef LStackIterator< T > | iterator |
| typedef T | value_type |
Public Member Functions | |
| LStack (size_t size_hint=0) | |
| Constructor. More... | |
| LStack (const LStack< T > &rhs) | |
| Copy constructor. More... | |
| ~LStack (void) | |
| Perform actions needed when stack goes out of scope. More... | |
| iterator | begin (void) |
| Get an iterator that points to the beginning of the stack. More... | |
| const_iterator | begin (void) const |
| Get a const iterator that points to the beginning of the stack. More... | |
| iterator | end (void) |
| Get an iterator that points to the end of the stack. More... | |
| const_iterator | end (void) const |
| Get a const iterator that points to the end of the stack. More... | |
| void | erase (void) |
| Delete all the nodes in the LStack. More... | |
| bool | is_empty (void) const |
| Returns 1 if the stack is empty, otherwise returns 0. More... | |
| bool | is_full (void) const |
| Returns 1 if the stack is full, otherwise returns 0. More... | |
| bool | operator!= (const LStack< T > &s) const |
| LStack< T > & | operator= (const LStack< T > &rhs) |
| Assignment operator. More... | |
| bool | operator== (const LStack< T > &rhs) const |
| Compare this stack with rhs for equality. More... | |
| T | pop (void) |
| Remove and return the front item on the stack. More... | |
| void | push (const T &new_item) |
| Place a new_item at the tail of the stack. More... | |
| size_t | size (void) const |
| Returns the current number of elements in the stack. More... | |
| T | top (void) const |
| Returns the front stack item without removing it. More... | |
Protected Member Functions | |
| void | copy_list (const LStack< T > &rhs) |
| Copy a linked list of nodes. More... | |
| void | delete_list (void) |
| Delete a linked list of nodes. More... | |
| void | pop_i (void) |
| Remove the front item on the stack. does not throw exceptions. More... | |
Private Attributes | |
| size_t | count_ |
| Number of items that are currently in the stack. More... | |
| LStackNode< T > * | head_ |
| We only need to keep a single pointer for the circular linked list. More... | |
Friends | |
| class | LStackConstIterator< T > |
| class | LStackIterator< T > |
Defines a generic "last-in/first-out" (LIFO) Abstract Data Type (ADT) using a stack that's implemented as a linked list.
| typedef LStackConstIterator<T> madara::utility::LStack< T >::const_iterator |
| typedef LStackIterator<T> madara::utility::LStack< T >::iterator |
| typedef T madara::utility::LStack< T >::value_type |
| madara::utility::LStack< T >::LStack | ( | size_t | size_hint = 0 | ) |
Constructor.
Definition at line 190 of file LStack.cpp.
| madara::utility::LStack< T >::LStack | ( | const LStack< T > & | rhs | ) |
Copy constructor.
Definition at line 202 of file LStack.cpp.
| madara::utility::LStack< T >::~LStack | ( | void | ) |
Perform actions needed when stack goes out of scope.
Definition at line 308 of file LStack.cpp.
| madara::utility::LStack< T >::iterator madara::utility::LStack< T >::begin | ( | void | ) |
Get an iterator that points to the beginning of the stack.
Definition at line 434 of file LStack.cpp.
| madara::utility::LStack< T >::const_iterator madara::utility::LStack< T >::begin | ( | void | ) | const |
Get a const iterator that points to the beginning of the stack.
Definition at line 450 of file LStack.cpp.
|
protected |
Copy a linked list of nodes.
This can throw a bad_alloc exception.
Definition at line 224 of file LStack.cpp.
|
protected |
Delete a linked list of nodes.
Definition at line 271 of file LStack.cpp.
| madara::utility::LStack< T >::iterator madara::utility::LStack< T >::end | ( | void | ) |
Get an iterator that points to the end of the stack.
Definition at line 442 of file LStack.cpp.
| madara::utility::LStack< T >::const_iterator madara::utility::LStack< T >::end | ( | void | ) | const |
Get a const iterator that points to the end of the stack.
Definition at line 458 of file LStack.cpp.
| void madara::utility::LStack< T >::erase | ( | void | ) |
Delete all the nodes in the LStack.
Definition at line 283 of file LStack.cpp.
| bool madara::utility::LStack< T >::is_empty | ( | void | ) | const |
Returns 1 if the stack is empty, otherwise returns 0.
Definition at line 418 of file LStack.cpp.
| bool madara::utility::LStack< T >::is_full | ( | void | ) | const |
Returns 1 if the stack is full, otherwise returns 0.
Definition at line 426 of file LStack.cpp.
| bool madara::utility::LStack< T >::operator!= | ( | const LStack< T > & | s | ) | const |
Definition at line 330 of file LStack.cpp.
| madara::utility::LStack< T > & madara::utility::LStack< T >::operator= | ( | const LStack< T > & | rhs | ) |
Assignment operator.
Definition at line 290 of file LStack.cpp.
| bool madara::utility::LStack< T >::operator== | ( | const LStack< T > & | rhs | ) | const |
Compare this stack with rhs for equality.
Returns true if the size's of the two stacks are equal and all the elements from 0 .. size() are equal, else false.
Definition at line 318 of file LStack.cpp.
| T madara::utility::LStack< T >::pop | ( | void | ) |
Remove and return the front item on the stack.
Throws the Underflow exception if the stack is empty.
Definition at line 366 of file LStack.cpp.
|
protected |
Remove the front item on the stack. does not throw exceptions.
Definition at line 386 of file LStack.cpp.
| void madara::utility::LStack< T >::push | ( | const T & | new_item | ) |
Place a new_item at the tail of the stack.
Throws the Overflow exception if the stack is full, e.g., if memory is exhausted.
Definition at line 340 of file LStack.cpp.
| size_t madara::utility::LStack< T >::size | ( | void | ) | const |
Returns the current number of elements in the stack.
Definition at line 182 of file LStack.cpp.
| T madara::utility::LStack< T >::top | ( | void | ) | const |
Returns the front stack item without removing it.
Throws the Underflow exception if the stack is empty.
Definition at line 405 of file LStack.cpp.
|
friend |
|
friend |
|
private |
|
private |