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.

Iterator<T> *it()

Retrieves an iterator.

Return
The iterator with which to iterate.

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.

Tuple

template <class T1, class T2>
class Tuple

Wraps two pointers.

Template Parameters
  • T1: Type of first.
  • T2: Type of second.

Public Functions

Tuple()

Constructor.

Tuple(T1 *first, T2 *second)

Constructor.

Parameters
  • first: The first object.
  • second: The second object.

Public Members

T1 *first

Allows access to first parameter.

T2 *second

Allows access to second parameter.