Rudiments
|
Inherited by dictionarylist< char *, datatype >, dictionarylist< const char *, datatype >, and dictionarylist< int32_t, datatype >.
Public Member Functions | |
linkedlist () | |
virtual | ~linkedlist () |
void | append (datatype data) |
void | append (linkedlistnodetype *node) |
bool | insert (uint64_t index, datatype data) |
bool | insert (uint64_t index, linkedlistnodetype *node) |
bool | removeByIndex (uint64_t index) |
bool | removeByData (datatype data) |
bool | removeAllByData (datatype data) |
bool | removeNode (linkedlistnodetype *node) |
bool | setDataByIndex (uint64_t index, datatype data) |
bool | getDataByIndex (uint64_t index, datatype *data) |
uint64_t | getLength () const |
linkedlistnodetype * | getFirstNode () |
linkedlistnodetype * | getLastNode () |
linkedlistnodetype * | getNodeByIndex (uint64_t index) |
linkedlistnodetype * | getNodeByData (datatype data) |
linkedlistnodetype * | getNodeByData (linkedlistnodetype *startnode, datatype data) |
void | clear () |
void | print () const |
The linkedlist class allows you to store arbitrary amounts of data in a doubly-linked list. Since the linkedlist class is template-based, you can store arbitrary types of data as well.
Each linkedlist is composed of a series of linkedlistnode's. Each linkedlistnode contains the data.
linkedlist< datatype, linkedlistnodetype >::linkedlist | ( | ) |
Creates an empty instance of the linkedlist class.
virtual linkedlist< datatype, linkedlistnodetype >::~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.
void linkedlist< datatype, linkedlistnodetype >::append | ( | datatype | data | ) |
Creates a new linkedlistnode containing "data" and appends it to the linkedlist.
void linkedlist< datatype, linkedlistnodetype >::append | ( | linkedlistnodetype * | node | ) |
Appends already created linkedlistnode "node" to the linkedlist.
void linkedlist< datatype, linkedlistnodetype >::clear | ( | ) |
Deletes all linkedlistnodes currently in the linkedlist. Note however, that the daata stored in each linkedlistnode is not deleted by this call.
bool linkedlist< datatype, linkedlistnodetype >::getDataByIndex | ( | uint64_t | index, |
datatype * | data | ||
) |
Returns the data contained in the linkedlistnode at "index".
Returns true on success and false on failure.
linkedlistnodetype* linkedlist< datatype, linkedlistnodetype >::getFirstNode | ( | ) |
Returns the first node in the linkedlist.
linkedlistnodetype* linkedlist< datatype, linkedlistnodetype >::getLastNode | ( | ) |
Returns the last node in the linkedlist.
uint64_t linkedlist< datatype, linkedlistnodetype >::getLength | ( | ) | const |
Returns the number of nodes in the linkedlist.
linkedlistnodetype* linkedlist< datatype, linkedlistnodetype >::getNodeByData | ( | linkedlistnodetype * | startnode, |
datatype | data | ||
) |
Returns a pointer to the firs linkedlistnode after "startnode" containing "data".
linkedlistnodetype* linkedlist< datatype, linkedlistnodetype >::getNodeByData | ( | datatype | data | ) |
Returns a pointer to the first linkedlistnode containing "data".
linkedlistnodetype* linkedlist< datatype, linkedlistnodetype >::getNodeByIndex | ( | uint64_t | index | ) |
Returns a pointer to the linkedlistnode at "index".
bool linkedlist< datatype, linkedlistnodetype >::insert | ( | uint64_t | index, |
datatype | data | ||
) |
Creates a new linkedlistnode containing "data" and inserts it into the linkedlist at "index".
Returns true on success and false on failure.
bool linkedlist< datatype, linkedlistnodetype >::insert | ( | uint64_t | index, |
linkedlistnodetype * | node | ||
) |
Inserts already created linkedlistnode "node" into the linkedlist at "index".
Returns true on success and false on failure.
void linkedlist< datatype, linkedlistnodetype >::print | ( | ) | const |
Prints out a representation of the linkedlist.
bool linkedlist< datatype, linkedlistnodetype >::removeAllByData | ( | datatype | data | ) |
Deletes all linkedlistnodes containing "data".
Returns true on success and false on failure.
bool linkedlist< datatype, linkedlistnodetype >::removeByData | ( | datatype | data | ) |
Deletes the first linkedlistnode containing "data".
Returns true on success and false on failure.
bool linkedlist< datatype, linkedlistnodetype >::removeByIndex | ( | uint64_t | index | ) |
Deletes the linkedlistnode at "index".
Returns true on success and false on failure.
bool linkedlist< datatype, linkedlistnodetype >::removeNode | ( | linkedlistnodetype * | node | ) |
Removed linkedlistnode "node" from the linkedlist.
Returns true on success and false on failure.
bool linkedlist< datatype, linkedlistnodetype >::setDataByIndex | ( | uint64_t | index, |
datatype | data | ||
) |
Sets the data contained in the linkedlistnode at "index" to "data".
Returns true on success and false on failure.