|
LibJuno 1.0.1
LibJuno is a lightweight C11 library designed specifically for embedded systems.
|
Data Fields | |
| int | id |
| char | name [32] |
| float | value |
DOC
In this example we will implement a queue. Queue's are intended to be memory safe in LibJuno so we need to implement an array for our type that tell's the queue how to get, set, and remove values. We also need to implement a pointer API for this type to tell the queue how to safely access the memory.
For Context: The pointer API answers the question: "How should LibJuno access my type safely?" The array API answers the question: "How should I index into my array safely?"
The Queue uses the answers to these two questions to implement a queue. A similar paradigm is used on the stack, map, and heap APIs.
Typically users will use the scrips/create_array.py script to generate the boilerplate for arrays and pointers.
First we will define out type, and derive an array.
| int USER_DATA_T::id |
| char USER_DATA_T::name |
| float USER_DATA_T::value |