High Performance OPC UA Server SDK
1.2.0.193
|
Array of pointers with simple management functionality. More...
Data Structures | |
struct | util_pointerset |
The structured data type of the pointerset utility, see also pointer_set. More... | |
Macros | |
#define | util_pointerset_iterate(xIndex, xList, xIteratorType, xIterator) |
Iterate backwards over all set elements with an iterator variable. More... | |
#define | util_pointerset_foreach(xIndex, xList) for (xIndex = (&xList)->num_elements - 1; xIndex >= 0; --xIndex) |
Iterate backwards over all set elements. More... | |
Functions | |
static int | util_pointerset_init (struct util_pointerset *pointerset, void *data, uint16_t max_elements) |
Initialize the pointerset structure with 0 element count and data as element array. More... | |
static int | util_pointerset_addelement (struct util_pointerset *pointerset, void *element) |
Add (append) a new element to the pointerset. More... | |
static int | util_pointerset_removeelement (struct util_pointerset *pointerset, void *element) |
Remove the first element with the given pointervalue. More... | |
Array of pointers with simple management functionality.
Manages a set of void pointers and allows for easy iteration over its elements. The internal array must be provided to util_pointerset_init().
#define util_pointerset_foreach | ( | xIndex, | |
xList | |||
) | for (xIndex = (&xList)->num_elements - 1; xIndex >= 0; --xIndex) |
Iterate backwards over all set elements.
Elements have to be accessed with the index variable.
#define util_pointerset_iterate | ( | xIndex, | |
xList, | |||
xIteratorType, | |||
xIterator | |||
) |
Iterate backwards over all set elements with an iterator variable.
xIterator must be a pointer of type xIteratorType and is the iterator. xIndex is the index variable.
|
inlinestatic |
Add (append) a new element to the pointerset.
The new pointer will be appended to the end of the set. Adding the same pointer multiple times is possible. However, make sure to remove the element as often as it has been added.
|
inlinestatic |
Initialize the pointerset structure with 0 element count and data as element array.
data must be large enough to hold the maximum number of elements possible during runtime.
|
inlinestatic |
Remove the first element with the given pointervalue.
The last element in the set is moved into the newly freed slot to keep the set compact for easy iteration. If more than one element contain the same value, only the first is removed.