Loading...
Searching...
No Matches
set.h File Reference

Generic set structure and manipulation routines. More...

`#include <stdint.h>`
`#include "log.h"`
Include dependency graph for set.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures

struct | ly_set
| Structure to hold a set of (not necessary somehow connected) objects. Usually used for lyd_node, lysp_node or lysc_node objects, but it is not limited to them. Caller is supposed to not mix the type of objects added to the set and according to its knowledge about the set content, it can access objects via the members of the set union. More...
union | ly_set.__unnamed1__

## Functions

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_clean (struct ly_set *set, void(*destructor)(void *obj))
| Remove all objects from the set, but keep the set container for further use.
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.
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 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 free the provided ly_set object.
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, not the referred data.
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_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_rm_index (struct ly_set *set, uint32_t index, void(*destructor)(void *obj))
| Remove an object on the specific set index.
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.

## Detailed Description

Generic set structure and manipulation routines.

Author
  Radek Krejci rkrej.nosp@m.ci@c.nosp@m.esnet.nosp@m..cz
  Michal Vasko mvask.nosp@m.o@ce.nosp@m.snet..nosp@m.cz

Copyright (c) 2015 - 2023 CESNET, z.s.p.o.

This source code is licensed under BSD 3-Clause License (the "License"). You may not use this file except in compliance with the License. You may obtain a copy of the License at

    https://opensource.org/licenses/BSD-3-Clause

Definition in file set.h.