linkedlist< valuetype > Class Template Reference

## Public Member Functions

| linkedlist ()
virtual | ~linkedlist ()
void | append (valuetype value)
void | append (linkedlistnode< valuetype > *node)
bool | insert (uint64_t index, valuetype value)
bool | insert (uint64_t index, linkedlistnode< valuetype > *node)
bool | removeByIndex (uint64_t index)
bool | removeByValue (valuetype value)
bool | removeAllByValue (valuetype value)
bool | removeNode (linkedlistnode< valuetype > *node)
bool | setValueByIndex (uint64_t index, valuetype value)
bool | getValueByIndex (uint64_t index, valuetype *value)
uint64_t | getLength () const
linkedlistnode< valuetype > * | getFirstNode ()
linkedlistnode< valuetype > * | getLastNode ()
linkedlistnode< valuetype > * | getNodeByIndex (uint64_t index)
linkedlistnode< valuetype > * | getNodeByValue (valuetype value)
linkedlistnode< valuetype > * | getNodeByValue (linkedlistnode< valuetype > *startnode, valuetype value)
void | clear ()
void | print () const

## Detailed Description

### template<class valuetype>
class linkedlist< valuetype >

The linkedlist class allows you to store an arbitrary number of values in a doubly-linked list. Since the linkedlist class is template-based, you can store arbitrary value types as well.

Each linkedlist is composed of a series of linkedlistnode's. Each linkedlistnode contains the value.

## Constructor & Destructor Documentation

template<class valuetype>

linkedlist< valuetype >::linkedlist | ( |  | ) |

Creates an empty instance of the linkedlist class.

template<class valuetype>

virtual linkedlist< valuetype >::~linkedlist | ( |  | ) |

virtual

Deletes this instance of the linkedlist class and all of its linkedlistnodes. Note however, that the daata stored in each linkedlistnode is not deleted by this call.

## Member Function Documentation

template<class valuetype>

void linkedlist< valuetype >::append | ( | valuetype | value | ) |

Creates a new linkedlistnode containing "value" and appends it to the linkedlist.

template<class valuetype>

void linkedlist< valuetype >::append | ( | linkedlistnode< valuetype > * | node | ) |

Appends already created linkedlistnode "node" to the linkedlist.

template<class valuetype>

void linkedlist< valuetype >::clear | ( |  | ) |

Deletes all linkedlistnodes currently in the linkedlist. Note however, that the daata stored in each linkedlistnode is not deleted by this call.

template<class valuetype>

linkedlistnode<valuetype>* linkedlist< valuetype >::getFirstNode | ( |  | ) |

Returns the first node in the linkedlist.

template<class valuetype>

linkedlistnode<valuetype>* linkedlist< valuetype >::getLastNode | ( |  | ) |

Returns the last node in the linkedlist.

template<class valuetype>

uint64_t linkedlist< valuetype >::getLength | ( |  | ) | const

Returns the number of nodes in the linkedlist.

template<class valuetype>

linkedlistnode<valuetype>* linkedlist< valuetype >::getNodeByIndex | ( | uint64_t | index | ) |

Returns a pointer to the linkedlistnode at "index".

template<class valuetype>

linkedlistnode<valuetype>* linkedlist< valuetype >::getNodeByValue | ( | valuetype | value | ) |

Returns a pointer to the first linkedlistnode containing "value".

template<class valuetype>

linkedlistnode<valuetype>* linkedlist< valuetype >::getNodeByValue | ( | linkedlistnode< valuetype > * | startnode,
|  | valuetype | value
| ) |  |

Returns a pointer to the firs linkedlistnode after "startnode" containing "value".

template<class valuetype>

bool linkedlist< valuetype >::getValueByIndex | ( | uint64_t | index,
|  | valuetype * | value
| ) |  |

Returns the value contained in the linkedlistnode at "index".

Returns true on success and false on failure.

template<class valuetype>

bool linkedlist< valuetype >::insert | ( | uint64_t | index,
|  | valuetype | value
| ) |  |

Creates a new linkedlistnode containing "value" and inserts it into the linkedlist at "index".

Returns true on success and false on failure.

template<class valuetype>

bool linkedlist< valuetype >::insert | ( | uint64_t | index,
|  | linkedlistnode< valuetype > * | node
| ) |  |

Inserts already created linkedlistnode "node" into the linkedlist at "index".

Returns true on success and false on failure.

template<class valuetype>

void linkedlist< valuetype >::print | ( |  | ) | const

Prints out a representation of the linkedlist.

template<class valuetype>

bool linkedlist< valuetype >::removeAllByValue | ( | valuetype | value | ) |

Deletes all linkedlistnodes containing "value".

Returns true on success and false on failure.

template<class valuetype>

bool linkedlist< valuetype >::removeByIndex | ( | uint64_t | index | ) |

Deletes the linkedlistnode at "index".

Returns true on success and false on failure.

template<class valuetype>

bool linkedlist< valuetype >::removeByValue | ( | valuetype | value | ) |

Deletes the first linkedlistnode containing "value".

Returns true on success and false on failure.

template<class valuetype>

bool linkedlist< valuetype >::removeNode | ( | linkedlistnode< valuetype > * | node | ) |

Removed linkedlistnode "node" from the linkedlist.

Returns true on success and false on failure.

template<class valuetype>

bool linkedlist< valuetype >::setValueByIndex | ( | uint64_t | index,
|  | valuetype | value
| ) |  |

Sets the value contained in the linkedlistnode at "index" to "value".

Returns true on success and false on failure.