https://github.com/stevencyb/securedlinkedlistmap
A Linked List Map implementation for Arduino, ESP 32 / 8266.
https://github.com/stevencyb/securedlinkedlistmap
Last synced: about 1 year ago
JSON representation
A Linked List Map implementation for Arduino, ESP 32 / 8266.
- Host: GitHub
- URL: https://github.com/stevencyb/securedlinkedlistmap
- Owner: StevenCyb
- License: mit
- Created: 2019-09-30T19:10:49.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-09-30T19:59:19.000Z (over 6 years ago)
- Last Synced: 2025-02-03T21:34:43.699Z (over 1 year ago)
- Language: C++
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Secured Linked List Map
The `SecuredLinkedList` is a library that provides the functionality of a Hashmap, without using hash.
Basically it is a linked list with key referencing. Furthermore, the implementation is thread-safe.
A small demo is given in `demo.ino`. A detailed description of the functions can be found below.
# Functions
- [SecuredLinkedListMap()](#SecuredLinkedListMap)
- [void put(T1 key, T2 value)](#put)
- [bool has(T1 key)](#has)
- [void getAll(SecuredLinkedListMapElement* copies)](#getAll)
- [T2 get(T1 key)](#get)
- [void remove(T1 key)](#remove)
- [int size()](#size)
- [void clear()](#clear)
## SecuredLinkedListMap()
The `SecuredLinkedListMap` can be instantiated as follows.
```
SecuredLinkedListMap mapA = SecuredLinkedListMap();
SecuredLinkedListMap *mapB = new SecuredLinkedListMap();
```
## void put(T1 key, T2 value)
Put a new key-value pair.
```
mapA.put("test", "hallo");
mapB->put(1, -1);
```
## bool has(T1 key)
Check whether the key exists.
```
Serial.println(mapA.has("hallo"));
Serial.println(mapB->has(-12));
```
## void getAll(SecuredLinkedListMapElement* copies)
Get a copy of all the elements in the map.
```
SecuredLinkedListMapElement mapAcopy[mapA.size()];
mapA.getAll(mapAcopy);
SecuredLinkedListMapElement mapBcopy[mapB->size()];
mapB->getAll(mapBcopy);
```
## T2 get(T1 key)
Get element by the key.
```
Serial.println(mapA.get("test"));
Serial.println(mapB->get(1));
```
## void remove(T1 key)
Remove element with key.
```
mapA.remove("test");
mapB->remove(1);
```
## int size()
Returns the number of elements in map.
```
Serial.println(mapA.size());
Serial.println(mapB->size());
```
## void clear()
Deletes all items from the list map.
```
mapA.clear();
mapB->clear();
```