![]() |
libyang
1.0.225
YANG data modeling language library
|
Data Structures | |
union | ly_set_set |
set array of ly_set It is kept in union to keep ly_set generic for data as well as schema trees More... | |
struct | ly_set |
Structure to hold a set of (not necessary somehow connected) lyd_node or lys_node objects. Caller is supposed to not mix the type of objects added to the set and according to its knowledge about the set content, it is supposed to access the set via the sset, dset or set members of the structure. More... | |
Macros | |
#define | LY_SET_OPT_USEASLIST 0x01 |
Option for ly_set_add() to allow duplicities in the ly_set structure so the set is not used as a set, but as a list of (container for) items. More... | |
Functions | |
struct ly_set * | ly_set_new (void) |
Create and initiate new ly_set structure. More... | |
struct ly_set * | ly_set_dup (const struct ly_set *set) |
Duplicate the existing set. More... | |
int | ly_set_add (struct ly_set *set, void *node, int options) |
Add a lyd_node or lys_node object into the set. More... | |
int | ly_set_merge (struct ly_set *trg, struct ly_set *src, int options) |
Add all objects from src to trg . More... | |
int | ly_set_contains (const struct ly_set *set, void *node) |
Get know if the set contains the specified object. More... | |
int | ly_set_clean (struct ly_set *set) |
Remove all objects from the set, but keep the set container for further use. More... | |
int | ly_set_rm (struct ly_set *set, void *node) |
Remove a lyd_node or lys_node object from the set. More... | |
int | ly_set_rm_index (struct ly_set *set, unsigned int index) |
Remove a lyd_node or lys_node object from the set index. More... | |
void | ly_set_free (struct ly_set *set) |
Free the ly_set data. Frees only the set structure content, not the referred data. More... | |
Structure and functions to hold and manipulate with sets of nodes from schema or data trees.
union ly_set_set |
struct ly_set |
Structure to hold a set of (not necessary somehow connected) lyd_node or lys_node objects. Caller is supposed to not mix the type of objects added to the set and according to its knowledge about the set content, it is supposed to access the set via the sset, dset or set members of the structure.
Until ly_set_rm() or ly_set_rm_index() is used, the set keeps the order of the inserted items as they were added into the set, so the first added item is on array index 0.
To free the structure, use ly_set_free() function, to manipulate with the structure, use other ly_set_* functions.
Data Fields | ||
---|---|---|
unsigned int | size |
allocated size of the set array |
unsigned int | number |
number of elements in (used size of) the set array |
union ly_set_set | set |
set array - union to keep ly_set generic for data as well as schema trees |
#define LY_SET_OPT_USEASLIST 0x01 |
Option for ly_set_add() to allow duplicities in the ly_set structure so the set is not used as a set, but as a list of (container for) items.
struct ly_set* ly_set_new | ( | void | ) |
Duplicate the existing set.
[in] | set | Original set to duplicate |
int ly_set_add | ( | struct ly_set * | set, |
void * | node, | ||
int | options | ||
) |
Add a lyd_node or lys_node object into the set.
Since it is a set, the function checks for duplicity and if the node is already in the set, the index of the previously added node is returned.
[in] | set | Set where the node will be added. |
[in] | node | The lyd_node or lys_node object to be added into the set ; |
[in] | options | Options to change behavior of the function. Accepted options are:
|
node
in the set on success Add all objects from src
to trg
.
Since it is a set, the function checks for duplicities. After success, src
is completely freed.
[in] | trg | Target (result) set. |
[in] | src | Source set. |
[in] | options | Options to change behavior of the function. Accepted options are:
|
trg
on success. int ly_set_contains | ( | const struct ly_set * | set, |
void * | node | ||
) |
Get know if the set contains the specified object.
[in] | set | Set to explore. |
[in] | node | Object to be found in the set. |
int ly_set_clean | ( | struct ly_set * | set | ) |
Remove all objects from the set, but keep the set container for further use.
[in] | set | Set to clean. |
int ly_set_rm | ( | struct ly_set * | set, |
void * | node | ||
) |
Remove a lyd_node or lys_node object from the set.
Note that after removing a node from a set, indexes of other nodes in the set can change (the last object is placed instead of the removed object).
[in] | set | Set from which the node will be removed. |
[in] | node | The lyd_node or lys_node object to be removed from the set ; |
int ly_set_rm_index | ( | struct ly_set * | set, |
unsigned int | index | ||
) |
Remove a lyd_node or lys_node object from the set index.
Note that after removing a node from a set, indexes of other nodes in the set can change (the last object is placed instead of the removed object).
[in] | set | Set from which a node will be removed. |
[in] | index | Index of the lyd_node or lys_node object in the set to be removed from the set ; |