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

Good information on linked list basics here.

Information

Dependencies not included with library:

#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");
}

History

mbed-os has files and a class named LinkedList. Rename the file and class name to match the files. default tip

2019-12-28, by sam_grove [Sat, 28 Dec 2019 19:06:07 +0000] rev 8

mbed-os has files and a class named LinkedList. Rename the file and class name to match the files.


Removed LogUtil dependency

2014-02-23, by Sissors [Sun, 23 Feb 2014 14:09:48 +0000] rev 7

Removed LogUtil dependency


removed old code that was commented out

2013-05-14, by sam_grove [Tue, 14 May 2013 23:06:11 +0000] rev 6

removed old code that was commented out


Fixed bug in remove member. Deconstructor was hanging due to logic problem when looping to clear the list (last member)

2013-05-13, by sam_grove [Mon, 13 May 2013 04:38:05 +0000] rev 5

Fixed bug in remove member. Deconstructor was hanging due to logic problem when looping to clear the list (last member)


removed setting _head->next to 0 in the constructor. Was writing to uninitialized (unallocated) memory location

2013-04-10, by sam_grove [Wed, 10 Apr 2013 06:17:21 +0000] rev 4

removed setting _head->next to 0 in the constructor. Was writing to uninitialized (unallocated) memory location


Updated class to offset such that 0 is empty or not a valid location. The start of the list logic is 1. Added documentation

2013-04-08, by sam_grove [Mon, 08 Apr 2013 22:23:25 +0000] rev 3

Updated class to offset such that 0 is empty or not a valid location. The start of the list logic is 1. Added documentation


Fixed a typo in the example that messed up the compiler rendering and import utility.

2013-04-05, by sam_grove [Fri, 05 Apr 2013 23:44:10 +0000] rev 2

Fixed a typo in the example that messed up the compiler rendering and import utility.


Pulled in from an offline project. Member insert needs some work. Updated documentation

2013-04-05, by sam_grove [Fri, 05 Apr 2013 23:14:49 +0000] rev 1

Pulled in from an offline project. Member insert needs some work. Updated documentation


Upload from different project and add documentation

2013-04-04, by sam_grove [Thu, 04 Apr 2013 20:34:38 +0000] rev 0

Upload from different project and add documentation