libamxs  0.6.0
Data Model Synchronization C API
amxs_util.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** SPDX-License-Identifier: BSD-2-Clause-Patent
4 **
5 ** SPDX-FileCopyrightText: Copyright (c) 2023 SoftAtHome
6 **
7 ** Redistribution and use in source and binary forms, with or without modification,
8 ** are permitted provided that the following conditions are met:
9 **
10 ** 1. Redistributions of source code must retain the above copyright notice,
11 ** this list of conditions and the following disclaimer.
12 **
13 ** 2. Redistributions in binary form must reproduce the above copyright notice,
14 ** this list of conditions and the following disclaimer in the documentation
15 ** and/or other materials provided with the distribution.
16 **
17 ** Subject to the terms and conditions of this license, each copyright holder
18 ** and contributor hereby grants to those receiving rights under this license
19 ** a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
20 ** (except for failure to satisfy the conditions of this license) patent license
21 ** to make, have made, use, offer to sell, sell, import, and otherwise transfer
22 ** this software, where such license applies only to those patent claims, already
23 ** acquired or hereafter acquired, licensable by such copyright holder or contributor
24 ** that are necessarily infringed by:
25 **
26 ** (a) their Contribution(s) (the licensed copyrights of copyright holders and
27 ** non-copyrightable additions of contributors, in source or binary form) alone;
28 ** or
29 **
30 ** (b) combination of their Contribution(s) with the work of authorship to which
31 ** such Contribution(s) was added by such copyright holder or contributor, if,
32 ** at the time the Contribution is added, such addition causes such combination
33 ** to be necessarily infringed. The patent license shall not apply to any other
34 ** combinations which include the Contribution.
35 **
36 ** Except as expressly stated above, no rights or licenses from any copyright
37 ** holder or contributor is granted under this license, whether expressly, by
38 ** implication, estoppel or otherwise.
39 **
40 ** DISCLAIMER
41 **
42 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
43 ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
44 ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
45 ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
46 ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
47 ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
48 ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
49 ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
50 ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
51 ** USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
52 **
53 ****************************************************************************/
54 
55 #if !defined(__AMXS_UTIL_H__)
56 #define __AMXS_UTIL_H__
57 
58 #ifdef __cplusplus
59 extern "C"
60 {
61 #endif
62 
63 #include <amxs/amxs_types.h>
64 #include <amxs/amxs_sync_ctx.h>
65 #include <amxs/amxs_sync_object.h>
66 #include <amxs/amxs_sync_param.h>
67 
74  amxs_sync_direction_t direction,
75  const char* path);
76 
78  amxs_sync_direction_t direction,
79  const char* path,
80  const char* opposite_path);
81 
83  amxs_sync_direction_t direction,
84  amxc_var_t* value,
85  const char* path,
86  const char* opposite_path);
87 
89 
91  amxs_sync_direction_t direction);
92 
93 bool amxs_sync_entry_is_batch_param(const amxs_sync_entry_t* const entry);
94 
95 const char* amxs_sync_entry_get_name(const amxs_sync_entry_t* entry,
96  amxs_sync_direction_t direction);
97 
99  amxs_sync_direction_t direction);
100 
102 
104 
105 amxp_signal_mngr_t* amxs_sync_entry_get_signal_manager(const amxs_sync_entry_t* const entry);
106 
107 amxb_bus_ctx_t* amxs_sync_ctx_get_opposite_bus_ctx(const amxs_sync_ctx_t* ctx,
108  amxs_sync_direction_t direction);
109 
110 amxb_bus_ctx_t* amxs_sync_ctx_get_bus_ctx(const amxs_sync_ctx_t* ctx,
111  amxs_sync_direction_t direction);
112 
113 amxd_dm_t* amxs_sync_ctx_get_opposite_dm(const amxs_sync_ctx_t* ctx,
114  amxs_sync_direction_t direction);
115 
116 amxd_dm_t* amxs_sync_ctx_get_dm(const amxs_sync_ctx_t* ctx,
117  amxs_sync_direction_t direction);
118 
120  amxs_sync_direction_t direction,
121  unsigned int index);
122 
124  amxs_sync_direction_t direction,
125  const char* old_path);
126 
128  amxs_sync_direction_t direction,
129  const char* old_path);
130 
131 char* amxs_sync_entry_get_regex_path(const amxs_sync_entry_t* const entry,
132  amxs_sync_direction_t direction);
133 
135  amxs_sync_direction_t direction);
136 
138  amxc_var_t* params,
139  amxs_sync_direction_t direction);
140 
155  amxs_sync_direction_t direction,
156  const amxc_var_t* input,
157  amxc_var_t* output,
158  void* priv);
174  amxs_sync_direction_t direction,
175  const amxc_var_t* input,
176  amxc_var_t* output,
177  void* priv);
196  amxs_sync_direction_t direction,
197  amxc_var_t* data,
198  void* priv);
199 
215  amxs_sync_direction_t direction,
216  const amxc_var_t* input,
217  amxc_var_t* output,
218  void* priv);
219 
233  amxs_sync_direction_t direction,
234  amxc_var_t* data,
235  void* priv);
236 
237 #ifdef __cplusplus
238 }
239 #endif
240 
241 #endif // __AMXS_UTIL_H__
242 
Ambiorix Object Synchronization API header file.
Ambiorix Object Synchronization API header file.
Ambiorix Object Synchronization API header file.
Ambiorix Object Synchronization API header file.
enum _amxs_sync_direction amxs_sync_direction_t
enum _amxs_status amxs_status_t
char * amxs_sync_entry_get_regex_parent_path(const amxs_sync_entry_t *const entry, amxs_sync_direction_t direction)
Definition: amxs_util.c:502
amxs_status_t amxs_sync_entry_get_batch_params(const amxs_sync_entry_t *const entry, amxc_var_t *params, amxs_sync_direction_t direction)
Definition: amxs_util.c:514
char * amxs_sync_entry_get_opposite_path(const amxs_sync_entry_t *entry, amxs_sync_direction_t direction, const char *old_path)
Definition: amxs_util.c:429
char * amxs_sync_entry_get_opposite_parent_path(const amxs_sync_entry_t *entry, amxs_sync_direction_t direction, const char *old_path)
Definition: amxs_util.c:456
bool amxs_sync_entry_direction_allowed(const amxs_sync_entry_t *entry, amxs_sync_direction_t direction)
Definition: amxs_util.c:231
char * amxs_sync_entry_get_regex_path(const amxs_sync_entry_t *const entry, amxs_sync_direction_t direction)
Definition: amxs_util.c:469
bool amxs_sync_entry_check_bidirectional_loop(const amxs_sync_entry_t *entry, amxs_sync_direction_t direction, amxc_var_t *value, const char *path, const char *opposite_path)
Definition: amxs_util.c:168
amxs_sync_ctx_t * amxs_sync_entry_get_ctx(const amxs_sync_entry_t *entry)
Definition: amxs_util.c:297
bool amxs_sync_entry_remove_bidrection_object(const amxs_sync_entry_t *entry, amxs_sync_direction_t direction, const char *path)
Definition: amxs_util.c:76
amxd_dm_t * amxs_sync_ctx_get_opposite_dm(const amxs_sync_ctx_t *ctx, amxs_sync_direction_t direction)
Definition: amxs_util.c:355
bool amxs_sync_entry_is_batch_param(const amxs_sync_entry_t *const entry)
Definition: amxs_util.c:251
bool amxs_sync_entry_check_bidrection_object(const amxs_sync_entry_t *entry, amxs_sync_direction_t direction, const char *path, const char *opposite_path)
Definition: amxs_util.c:101
const char * amxs_sync_entry_get_opposite_name(const amxs_sync_entry_t *entry, amxs_sync_direction_t direction)
Definition: amxs_util.c:275
unsigned int amxs_sync_entry_get_opposite_index(const amxs_sync_entry_t *entry, amxs_sync_direction_t direction, unsigned int index)
const char * amxs_sync_entry_get_name(const amxs_sync_entry_t *entry, amxs_sync_direction_t direction)
Definition: amxs_util.c:264
amxs_sync_entry_t * amxs_sync_entry_get_parent(const amxs_sync_entry_t *entry)
Definition: amxs_util.c:286
bool amxs_sync_entry_is_bidirectional(const amxs_sync_entry_t *entry)
Definition: amxs_util.c:219
amxp_signal_mngr_t * amxs_sync_entry_get_signal_manager(const amxs_sync_entry_t *const entry)
Definition: amxs_util.c:317
amxb_bus_ctx_t * amxs_sync_ctx_get_bus_ctx(const amxs_sync_ctx_t *ctx, amxs_sync_direction_t direction)
Definition: amxs_util.c:343
amxd_dm_t * amxs_sync_ctx_get_dm(const amxs_sync_ctx_t *ctx, amxs_sync_direction_t direction)
Definition: amxs_util.c:367
amxb_bus_ctx_t * amxs_sync_ctx_get_opposite_bus_ctx(const amxs_sync_ctx_t *ctx, amxs_sync_direction_t direction)
Definition: amxs_util.c:331
amxs_status_t amxs_sync_batch_param_copy_trans_cb(const amxs_sync_entry_t *entry, amxs_sync_direction_t direction, const amxc_var_t *input, amxc_var_t *output, void *priv)
Translates data from a dm:object-changed event to data suited for an amxb_set call for all parameters...
amxs_status_t amxs_sync_object_copy_trans_cb(const amxs_sync_entry_t *entry, amxs_sync_direction_t direction, const amxc_var_t *input, amxc_var_t *output, void *priv)
Translates data from a dm:instance-added or dm:instance-removed event to data suited for an amxb call...
amxs_status_t amxs_sync_param_copy_trans_cb(const amxs_sync_entry_t *entry, amxs_sync_direction_t direction, const amxc_var_t *input, amxc_var_t *output, void *priv)
Translates data from a dm:object-changed event to data suited for an amxb_set call for a single param...
amxs_status_t amxs_sync_param_copy_action_cb(const amxs_sync_entry_t *entry, amxs_sync_direction_t direction, amxc_var_t *data, void *priv)
Sets the new parameter value.
amxs_status_t amxs_sync_object_copy_action_cb(const amxs_sync_entry_t *entry, amxs_sync_direction_t direction, amxc_var_t *data, void *priv)
Adds, removes or updates an object with the given data using an amxb call.
Definition: amxs_types.h:161