Class to manage a linked list. Utility that can be built on or used alone
Dependents: Waldo_Embed_V2 elevator_with_queue RaheeNew DS1820 ... more
LL< retT > Class Template Reference
Example using the LL Class. More...
#include <LL.h>
Public Member Functions | |
LL () | |
Create the LL object. | |
~LL () | |
Deconstructor for the LL object Removes any members. | |
retT * | push (void *data) |
Add a member to the begining of the list. | |
retT * | append (void *data) |
Add a member to some position in the list. | |
retT * | remove (uint32_t loc) |
Remove a member from the list. | |
retT * | pop (uint32_t loc) |
Get access to a member from the list. | |
uint32_t | length (void) |
Get the length of the list. |
Detailed Description
template<class retT>
class LL< retT >
Example using the LL Class.
#include "mbed.h" #include "LL.h" LL<node>list; int main() { node *tmp; list.push((char *)"Two\n"); list.append((char *)"Three\n"); list.append((char *)"Four\n"); list.push((char*)"One\n"); list.append((char*)"Five\n"); for(int i=1; i<=list.length(); i++) { tmp = list.pop(i); printf("%s", (char *)tmp->data ); } error("done\n"); }
API abstraction for a Linked List
Definition at line 72 of file LL.h.
Constructor & Destructor Documentation
Member Function Documentation
retT * append | ( | void * | data ) |
Add a member to some position in the list.
- Parameters:
-
data - Some data type that is added to the list loc - Place in the list to put the data
- Returns:
- The member that was just inserted (NULL if empty) Add a member to the end of the list
- Parameters:
-
data - Some data type that is added to the list
- Returns:
- The member that was just inserted (NULL if empty)
uint32_t length | ( | void | ) |
retT * pop | ( | uint32_t | loc ) |
retT * push | ( | void * | data ) |
Generated on Tue Jul 12 2022 20:42:50 by 1.7.2