libyang  3.7.5
libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
set.h
Go to the documentation of this file.
1 
16 #ifndef LY_SET_H_
17 #define LY_SET_H_
18 
19 #include <stdint.h>
20 
21 #include "log.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
47 struct ly_set {
48  uint32_t size;
49  uint32_t count;
51  union {
52  struct lyd_node **dnodes;
53  struct lysc_node **snodes;
54  void **objs;
55  };
56 };
57 
66 LIBYANG_API_DECL LY_ERR ly_set_new(struct ly_set **set_p);
67 
80 LIBYANG_API_DECL LY_ERR ly_set_dup(const struct ly_set *set, void *(*duplicator)(const void *obj), struct ly_set **newset_p);
81 
95 LIBYANG_API_DECL LY_ERR ly_set_add(struct ly_set *set, const void *object, ly_bool list, uint32_t *index_p);
96 
112 LIBYANG_API_DECL LY_ERR ly_set_merge(struct ly_set *trg, const struct ly_set *src, ly_bool list, void *(*duplicator)(const void *obj));
113 
122 LIBYANG_API_DECL ly_bool ly_set_contains(const struct ly_set *set, const void *object, uint32_t *index_p);
123 
130 LIBYANG_API_DECL void ly_set_clean(struct ly_set *set, void (*destructor)(void *obj));
131 
143 LIBYANG_API_DECL LY_ERR ly_set_rm(struct ly_set *set, void *object, void (*destructor)(void *obj));
144 
156 LIBYANG_API_DECL LY_ERR ly_set_rm_index(struct ly_set *set, uint32_t index, void (*destructor)(void *obj));
157 
168 LIBYANG_API_DECL LY_ERR ly_set_rm_index_ordered(struct ly_set *set, uint32_t index, void (*destructor)(void *obj));
169 
177 LIBYANG_API_DECL void ly_set_free(struct ly_set *set, void (*destructor)(void *obj));
178 
186 LIBYANG_API_DECL void ly_set_erase(struct ly_set *set, void (*destructor)(void *obj));
187 
190 #ifdef __cplusplus
191 }
192 #endif
193 
194 #endif /* LY_SET_H_ */
Compiled YANG data node.
Definition: tree_schema.h:1439
uint32_t size
Definition: set.h:48
Generic structure for a data node.
Definition: tree_data.h:803
LIBYANG_API_DECL LY_ERR ly_set_rm_index(struct ly_set *set, uint32_t index, void(*destructor)(void *obj))
Remove an object on the specific set index.
uint8_t ly_bool
Type to indicate boolean value.
Definition: log.h:28
LIBYANG_API_DECL LY_ERR ly_set_dup(const struct ly_set *set, void *(*duplicator)(const void *obj), struct ly_set **newset_p)
Duplicate the existing set.
LIBYANG_API_DECL LY_ERR ly_set_add(struct ly_set *set, const void *object, ly_bool list, uint32_t *index_p)
Add an object into the set.
LIBYANG_API_DECL void ly_set_free(struct ly_set *set, void(*destructor)(void *obj))
Free the ly_set data. If the destructor is not provided, it frees only the set structure content...
LIBYANG_API_DECL LY_ERR ly_set_rm_index_ordered(struct ly_set *set, uint32_t index, void(*destructor)(void *obj))
Remove an object on the specific set index.
LIBYANG_API_DECL void ly_set_erase(struct ly_set *set, void(*destructor)(void *obj))
Alternative to the ly_set_free() for static ly_set objects - in contrast to ly_set_free() it does not...
uint32_t count
Definition: set.h:49
Structure to hold a set of (not necessary somehow connected) objects. Usually used for lyd_node...
Definition: set.h:47
LIBYANG_API_DECL LY_ERR ly_set_rm(struct ly_set *set, void *object, void(*destructor)(void *obj))
Remove an object from the set.
LIBYANG_API_DECL LY_ERR ly_set_merge(struct ly_set *trg, const struct ly_set *src, ly_bool list, void *(*duplicator)(const void *obj))
Add all objects from src to trg.
LIBYANG_API_DECL LY_ERR ly_set_new(struct ly_set **set_p)
Create and initiate new ly_set structure.
LIBYANG_API_DECL ly_bool ly_set_contains(const struct ly_set *set, const void *object, uint32_t *index_p)
Learn whether the set contains the specified object.
Logger manipulation routines and error definitions.
LIBYANG_API_DECL void ly_set_clean(struct ly_set *set, void(*destructor)(void *obj))
Remove all objects from the set, but keep the set container for further use.
LY_ERR
libyang&#39;s error codes returned by the libyang functions.
Definition: log.h:240