The SecuredLinkedList
is a library that provides the functionality of a linked list (like in Java or C#). Furthermore, the implementation is thread-safe, see demo two_core_demo.ino
.
The following figure illustrates the available functions. A detailed description of the functions can be found below.
The SecuredLinkedList
can be instantiated as follows.
SecuredLinkedList<int> listA = SecuredLinkedList<int>();
SecuredLinkedList<int> *listB = new SecuredLinkedList<int>();
Adds an element to the end of the list.
int t = 4;
listA.push(t);
listB->push(t);
Takes the last element from the list. The list no longer contains the element.
Serial.println(listA.pop());
Serial.println(listB->pop());
Inserts an element into the according index.
int t = 2;
listA.push(3, t);
listB->push(3, t);
Remove an element on index.
listA.remove(3);
listB->remove(3);
Fetches the element from the according index. The list still contains the element.
Serial.println(listA.get(2));
Serial.println(listB->get()2);
Adds an element to the beginning of the list.
int t = 3;
listA.unshift(t);
listB->unshift(t);
Takes the first element from the list. The list no longer contains the element.
Serial.println(listA.shift());
Serial.println(listB->shift());
Returns the number of elements.
Serial.println(listA.size());
Serial.println(listB->size());
Deletes all items from the list.
listA.clear();
listB->clear();