Loading...
Searching...
No Matches
set.h
Go to the documentation of this file.
#ifndef LY_SET_H_
#define LY_SET_H_
#include <stdint.h>
#include "log.h"
#ifdef __cplusplus
extern "C" {
#endif
struct ly_set {
uint32_t size;
uint32_t count;
union {
struct lyd_node **dnodes;
struct lysc_node **snodes;
void **objs;
};
};
LIBYANG_API_DECL LY_ERR ly_set_new(struct ly_set **set_p);
LIBYANG_API_DECL LY_ERR ly_set_dup(const struct ly_set *set, void *(*duplicator)(const void *obj), struct ly_set **newset_p);
LIBYANG_API_DECL LY_ERR ly_set_add(struct ly_set *set, const void *object, ly_bool list, uint32_t *index_p);
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));
LIBYANG_API_DECL ly_bool ly_set_contains(const struct ly_set *set, const void *object, uint32_t *index_p);
LIBYANG_API_DECL void ly_set_clean(struct ly_set *set, void (*destructor)(void *obj));
LIBYANG_API_DECL LY_ERR ly_set_rm(struct ly_set *set, void *object, void (*destructor)(void *obj));
LIBYANG_API_DECL LY_ERR ly_set_rm_index(struct ly_set *set, uint32_t index, void (*destructor)(void *obj));
LIBYANG_API_DECL LY_ERR ly_set_rm_index_ordered(struct ly_set *set, uint32_t index, void (*destructor)(void *obj));
LIBYANG_API_DECL void ly_set_free(struct ly_set *set, void (*destructor)(void *obj));
LIBYANG_API_DECL void ly_set_erase(struct ly_set *set, void (*destructor)(void *obj));
#ifdef __cplusplus
}
#endif
#endif /* LY_SET_H_ */
LY_ERR
LY_ERR
libyang's error codes returned by the libyang functions.
Definition log.h:237
ly_set::count
uint32_t count
Definition set.h:49
ly_set::size
uint32_t size
Definition set.h:48
ly_set_rm_index_ordered
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.
ly_set_clean
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_set_erase
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...
ly_set_free
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,...
ly_set_merge
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.
ly_set_rm
LIBYANG_API_DECL LY_ERR ly_set_rm(struct ly_set *set, void *object, void(*destructor)(void *obj))
Remove an object from the set.
ly_set_dup
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.
ly_set_contains
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.
ly_set_add
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.
ly_set_new
LIBYANG_API_DECL LY_ERR ly_set_new(struct ly_set **set_p)
Create and initiate new ly_set structure.
ly_set_rm_index
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.
ly_set
Structure to hold a set of (not necessary somehow connected) objects. Usually used for lyd_node,...
Definition set.h:47
lysc_node
Compiled YANG data node.
Definition tree_schema.h:1421
log.h
Logger manipulation routines and error definitions.
ly_bool
uint8_t ly_bool
Type to indicate boolean value.
Definition log.h:35
lyd_node
Generic structure for a data node.
Definition tree_data.h:795