Rudiments
|
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 |
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.
linkedlist< valuetype >::linkedlist | ( | ) |
Creates an empty instance of the linkedlist class.
|
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.
void linkedlist< valuetype >::append | ( | valuetype | value | ) |
Creates a new linkedlistnode containing "value" and appends it to the linkedlist.
void linkedlist< valuetype >::append | ( | linkedlistnode< valuetype > * | node | ) |
Appends already created linkedlistnode "node" to the linkedlist.
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.
linkedlistnode<valuetype>* linkedlist< valuetype >::getFirstNode | ( | ) |
Returns the first node in the linkedlist.
linkedlistnode<valuetype>* linkedlist< valuetype >::getLastNode | ( | ) |
Returns the last node in the linkedlist.
uint64_t linkedlist< valuetype >::getLength | ( | ) | const |
Returns the number of nodes in the linkedlist.
linkedlistnode<valuetype>* linkedlist< valuetype >::getNodeByIndex | ( | uint64_t | index | ) |
Returns a pointer to the linkedlistnode at "index".
linkedlistnode<valuetype>* linkedlist< valuetype >::getNodeByValue | ( | valuetype | value | ) |
Returns a pointer to the first linkedlistnode containing "value".
linkedlistnode<valuetype>* linkedlist< valuetype >::getNodeByValue | ( | linkedlistnode< valuetype > * | startnode, |
valuetype | value | ||
) |
Returns a pointer to the firs linkedlistnode after "startnode" containing "value".
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.
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.
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.
void linkedlist< valuetype >::print | ( | ) | const |
Prints out a representation of the linkedlist.
bool linkedlist< valuetype >::removeAllByValue | ( | valuetype | value | ) |
Deletes all linkedlistnodes containing "value".
Returns true on success and false on failure.
bool linkedlist< valuetype >::removeByIndex | ( | uint64_t | index | ) |
Deletes the linkedlistnode at "index".
Returns true on success and false on failure.
bool linkedlist< valuetype >::removeByValue | ( | valuetype | value | ) |
Deletes the first linkedlistnode containing "value".
Returns true on success and false on failure.
bool linkedlist< valuetype >::removeNode | ( | linkedlistnode< valuetype > * | node | ) |
Removed linkedlistnode "node" from the linkedlist.
Returns true on success and false on failure.
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.