yumapro  20.10-12
YumaPro SDK
val_tree.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 - 2021, YumaWorks, Inc., All Rights Reserved.
3  *
4  * Unless required by applicable law or agreed to in writing,
5  * software distributed under the License is distributed on an
6  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
7  * KIND, either express or implied. See the License for the
8  * specific language governing permissions and limitations
9  * under the License.
10  */
11 #ifndef _H_val_tree
12 #define _H_val_tree
13 
14 /* FILE: val_tree.h
15 *********************************************************************
16 * *
17 * P U R P O S E *
18 * *
19 *********************************************************************/
20 
26 /*********************************************************************
27 * *
28 * C H A N G E H I S T O R Y *
29 * *
30 *********************************************************************
31 
32 date init comment
33 ----------------------------------------------------------------------
34 21-mar-16 abb Begun; start from obj_dict.c
35 
36 */
37 
38 #include "dict.h"
39 #include "dlq.h"
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 
46 /********************************************************************
47 * *
48 * T Y P E S *
49 * *
50 *********************************************************************/
51 
52 /* group defined in val_child.h */
60 #ifdef UCLINUX
61 typedef struct val_tree_t_ {
62  struct hb_tree *tree;
63 } val_tree_t;
64 #else
65 typedef struct val_tree_t_ {
66  hb_tree *tree;
67 } val_tree_t;
68 #endif // UCLINUX
69 
70 
71 /********************************************************************
72 * *
73 * F U N C T I O N S *
74 * *
75 *********************************************************************/
76 
77 
83 extern val_tree_t *
84  val_tree_new (void);
85 
86 
92 extern void
93  val_tree_free (val_tree_t *val_tree);
94 
95 
111 extern status_t
112  val_tree_insert (val_value_t *childval,
113  val_tree_t *val_tree,
114  boolean ignore_err,
115  boolean *inserted);
116 
117 
125 extern boolean
126  val_tree_remove (val_value_t *childval,
127  val_tree_t *val_tree);
128 
129 
138 extern status_t
139  val_tree_swap (val_value_t *newval,
140  val_value_t *childval,
141  val_tree_t *val_tree);
142 
143 
152 extern void
153  val_tree_remove_deleted (val_value_t *childval,
154  val_tree_t *val_tree);
155 
156 
168 extern status_t
169  val_tree_add_undeleted (val_value_t *childval,
170  val_tree_t *val_tree);
171 
172 
180 extern val_value_t *
181  val_tree_find (const val_value_t *childval,
182  val_tree_t *val_tree);
183 
184 
188 #ifdef __cplusplus
189 } /* end extern 'C' */
190 #endif
191 
192 #endif /* _H_val_tree */
val_tree.h
AVL Tree storage of YANG List Data.
ERR_NCX_WRONG_NODETYP
@ ERR_NCX_WRONG_NODETYP
282
Definition: status_enum.h:325
val_index_compare
int val_index_compare(const val_value_t *val1, const val_value_t *val2)
Check 2 val_value structs for the same instance ID.
Definition: val.c:9062
val.h
Value Node Basic Support.
ERR_NCX_MISSING_KEY
@ ERR_NCX_MISSING_KEY
383
Definition: status_enum.h:426
val_tree_free
void val_tree_free(val_tree_t *val_tree)
Clean and free the specified val_tree.
Definition: val_tree.c:214
val_tree_find
val_value_t * val_tree_find(const val_value_t *childval, val_tree_t *val_tree)
Find a value node from the specified val_tree.
Definition: val_tree.c:518
val_tree_remove
boolean val_tree_remove(val_value_t *childval, val_tree_t *val_tree)
Remove a value node from the specified val_tree.
Definition: val_tree.c:333
val_tree_new
val_tree_t * val_tree_new(void)
Create a new empty val_tree.
Definition: val_tree.c:186
val_tree_insert
status_t val_tree_insert(val_value_t *childval, val_tree_t *val_tree, boolean ignore_err, boolean *inserted)
Add a list entry to the val_tree.
Definition: val_tree.c:249
ERR_NCX_DUP_ENTRY
@ ERR_NCX_DUP_ENTRY
224
Definition: status_enum.h:263
VAL_NAME
#define VAL_NAME(V)
Access the value name.
Definition: val.h:399
obj_is_list
boolean obj_is_list(const obj_template_t *obj)
Check if object is a YANG list.
Definition: obj.c:13349
NO_ERR
@ NO_ERR
000
Definition: status_enum.h:188
NCX_BT_LIST
@ NCX_BT_LIST
internal, YANG list
Definition: ncxtypes.h:228
log_debug4
void void void void void void void void void void void void void log_debug4(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG4 log entry.
ERR_NCX_OPERATION_FAILED
@ ERR_NCX_OPERATION_FAILED
274
Definition: status_enum.h:315
val_util.h
Value Node Utilities.
get_error_string
const char * get_error_string(status_t res)
Get the error message for a specific internal error.
Definition: status.c:239
log_debug
void void void void void void void log_debug(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG log entry.
ncx_netconfd_running
boolean ncx_netconfd_running(void)
Check if netconfd running.
Definition: ncx.c:11805
LOGDEBUG4
#define LOGDEBUG4
Check if at least log-level=debug4.
Definition: log.h:302
LOGDEBUG
#define LOGDEBUG
Check if at least log-level=debug.
Definition: log.h:287
VAL_TYPE
#define VAL_TYPE(V)
Access the base type : same as VAL_BTYPE.
Definition: val.h:387
VAL_OBJ
#define VAL_OBJ(V)
Access the object template.
Definition: val.h:381
ncx.h
YANG module utility functions.
val_tree_remove_deleted
void val_tree_remove_deleted(val_value_t *childval, val_tree_t *val_tree)
A node is being removed from the tree but not the que because it is marked as VAL_FL_DELETED.
Definition: val_tree.c:443
obj.h
Data Object Support.
val_tree_t_
wrapper for the height-balanced tree struct
Definition: val_tree.h:65
val_get_index_count
uint32 val_get_index_count(const val_value_t *val)
Get the number of index nodes in this val.
Definition: val.c:10740
obj_key_count
uint32 obj_key_count(const obj_template_t *obj)
Get the number of keys for this object.
Definition: obj.c:9637
val_tree_add_undeleted
status_t val_tree_add_undeleted(val_value_t *childval, val_tree_t *val_tree)
A node is being added back to the the tree but not the que because it was marked as VAL_FL_DELETED.
Definition: val_tree.c:480
val_tree_swap
status_t val_tree_swap(val_value_t *newval, val_value_t *childval, val_tree_t *val_tree)
Change the node in the specified tree.
Definition: val_tree.c:386
val_tree_t_::tree
hb_tree * tree
AVL stree.
Definition: val_tree.h:66
VAL_IS_DELETED
#define VAL_IS_DELETED(V)
Access the deleted flag.
Definition: val.h:533
dlq.h
dlq provides general double-linked list and queue support: