Loading...
Searching...
No Matches
New value creation options
Trees » Data Tree
Collaboration diagram for New value creation options:

## Macros

#define | LYD_NEW_ANY_USE_VALUE 0x100
#define | LYD_NEW_META_CLEAR_DFLT 0x10
#define | LYD_NEW_PATH_OPAQ 0x40
#define | LYD_NEW_PATH_UPDATE 0x20
#define | LYD_NEW_PATH_WITH_OPAQ 0x80
#define | LYD_NEW_VAL_BIN 0x04
#define | LYD_NEW_VAL_CANON 0x08
#define | LYD_NEW_VAL_OUTPUT 0x01
#define | LYD_NEW_VAL_STORE_ONLY 0x02

## Detailed Description

Various options to change lyd_new_*() behavior. The LYD_NEW_VAL* can be used within any API, others are API specific

Default behavior:

- the input data nodes or RPC/Action is taken into account
- the value is being validated with all possible validations, which doesn't require existence of any other data nodes
- the input value is expected to be in JSON format
- RPC output schema children are completely ignored in all modules. Input is searched and nodes created normally.

Default behavior specific for lyd_new_path*() functions:

- if the target node already exists (and is not default), an error is returned.
- the whole path to the target node is created (with any missing parents) if necessary.
- during creation of new metadata, the nodes will have default flag set
- string value is copied and stored internally during any node creation

## Macro Definition Documentation

## LYD_NEW_ANY_USE_VALUE

#define LYD_NEW_ANY_USE_VALUE 0x100

Whether to use dynamic `value` or make a copy.

Definition at line 1294 of file tree_data.h.

## LYD_NEW_META_CLEAR_DFLT

#define LYD_NEW_META_CLEAR_DFLT 0x10

Whether to clear the default flag starting from `parent`, recursively all NP containers.

Definition at line 1284 of file tree_data.h.

## LYD_NEW_PATH_OPAQ

#define LYD_NEW_PATH_OPAQ 0x40

Enables the creation of opaque nodes with some specific rules. If the last node in the path is not uniquely defined ((leaf-)list without a predicate) or has an invalid value (leaf/leaf-list), it is created as opaque. Otherwise a regular node is created.

Definition at line 1292 of file tree_data.h.

## LYD_NEW_PATH_UPDATE

#define LYD_NEW_PATH_UPDATE 0x20

If the target node exists, is a leaf, and it is updated with a new value or its default flag is changed, it is returned. If the target node exists and is not a leaf or generally no change occurs in the `parent` tree, NULL is returned and no error set.

Definition at line 1288 of file tree_data.h.

## LYD_NEW_PATH_WITH_OPAQ

#define LYD_NEW_PATH_WITH_OPAQ 0x80

Consider opaque nodes normally when searching for existing nodes.

Definition at line 1293 of file tree_data.h.

## LYD_NEW_VAL_BIN

#define LYD_NEW_VAL_BIN 0x04

Interpret the provided leaf/leaf-list `value` as being in the binary LY_VALUE_LYB format, to learn what exactly is expected see LYB Binary Format.

Definition at line 1280 of file tree_data.h.

## LYD_NEW_VAL_CANON

#define LYD_NEW_VAL_CANON 0x08

Interpret the provided leaf/leaf-list `value` as being in the canonical (or JSON if no defined) LY_VALUE_CANON format. If it is not, it may lead to unexpected behavior.

Definition at line 1283 of file tree_data.h.

## LYD_NEW_VAL_OUTPUT

#define LYD_NEW_VAL_OUTPUT 0x01

Flag in case the `parent` is RPC/Action. If value is 0, the input's data nodes of the RPC/Action are taken into consideration. Otherwise, the output's data node is going to be created.

Definition at line 1277 of file tree_data.h.

## LYD_NEW_VAL_STORE_ONLY

#define LYD_NEW_VAL_STORE_ONLY 0x02

Whether to perform only storing operation with no or minimum valitions

Definition at line 1278 of file tree_data.h.