core-avr-ds¶
LinkedList¶
- template <class T>
-
class
LinkedList
¶ Basic doubly linked list implementation.
- Template Parameters
T
: Type parameter.
Public Functions
-
~LinkedList
()¶ Destructor.
-
void
clear
()¶ Clears all nodes.
-
int
count
()¶ The total number of elements.
- Return
- The total number of elements.
-
void
add
(T *element)¶ Adds an element to the list. Heap allocates a new node with which to store the element.
- Parameters
element
: The element to add.
-
bool
remove
(T *element)¶ Removes the element and deletes the node the element was stored within.
- Return
- True if successfully removed.
- Parameters
element
: The element to remove.
-
bool
contains
(T *element)¶ Determines if the element is contained within the list.
- Return
- True if the element is contained within the list.
- Parameters
element
: The element to query for.
Iterator¶
- template <class T>
-
class
Iterator
¶ Defines an interface for an iterator.
- Template Parameters
T
: Type parameter.
Subclassed by LinkedListIterator< T >
Public Functions
-
virtual
~Iterator
()¶ Destructor.
-
virtual T *
current
() = 0¶ Element currently pointed to.
- Return
- A pointer to the current element.
-
virtual void
reset
() = 0¶ Resets the iterator to the beginning.
-
virtual bool
moveNext
() = 0¶ Moves the iterator to the next value.
- Return
- True if there is another value, false otherwise.