libamxs  0.6.0
Data Model Synchronization C API
Parameter synchronization API
Collaboration diagram for Parameter synchronization API:

Functions

amxs_status_t amxs_sync_param_new (amxs_sync_param_t **param, const char *param_a, const char *param_b, int attributes, amxs_translation_cb_t translation_cb, amxs_action_cb_t action_cb, void *priv)
 Synchronization parameter constructor function. More...
 
amxs_status_t amxs_sync_param_new_copy (amxs_sync_param_t **param, const char *param_a, const char *param_b, int attributes)
 Synchronization parameter constructor function. More...
 
void amxs_sync_param_delete (amxs_sync_param_t **param)
 Synchronization parameter destructor function. More...
 

Detailed Description

Function Documentation

◆ amxs_sync_param_delete()

void amxs_sync_param_delete ( amxs_sync_param_t **  param)

Synchronization parameter destructor function.

Frees all memory allocated for a synchronization parameter. Also removes the synchronization parameter from any synchronization object or context it was attached to.

Parameters
paramPointer to a synchronization parameter pointer.

Definition at line 101 of file amxs_sync_param.c.

101  {
102  when_null(param, exit);
103  when_null(*param, exit);
104  when_false((*param)->type == amxs_sync_type_param, exit);
105 
106  amxs_sync_entry_delete(param);
107 
108 exit:
109  return;
110 }
void amxs_sync_entry_delete(amxs_sync_entry_t **entry)
@ amxs_sync_type_param
Definition: amxs_types.h:102

◆ amxs_sync_param_new()

amxs_status_t amxs_sync_param_new ( amxs_sync_param_t **  param,
const char *  param_a,
const char *  param_b,
int  attributes,
amxs_translation_cb_t  translation_cb,
amxs_action_cb_t  action_cb,
void *  priv 
)

Synchronization parameter constructor function.

Allocates memory for a new synchronization parameter and initializes this parameter.

Use amxs_sync_param_delete to remove the synchronization parameter and free all allocated memory.

Parameters
paramPointer to a synchronization parameter pointer. The address of the new allocated synchronization parameter is stored in this pointer.
param_aName of the parameter in object A
param_bName of the parameter in object B
attributesBitwise OR of zero or more of the following attributes:
translation_cbCallback function to translate data coming from a parameter changed event. The output data of this function will be passed to the action callback function if this function executes succesfully. If this argument is NULL, the data from the event will be passed directly to the action callback function.
action_cbCallback function to act on a parameter changed event.
privPointer to user data which will be passed to the translation and action callbacks.
Returns
amxs_status_ok when the synchronization parameter is created, or another status code when failed to create the synchronization parameter.

Definition at line 70 of file amxs_sync_param.c.

76  {
77  return amxs_sync_entry_new(param,
78  param_a,
79  param_b,
80  attributes,
81  translation_cb,
82  action_cb,
84  priv);
85 }
amxs_status_t amxs_sync_entry_new(amxs_sync_entry_t **entry, const char *a, const char *b, int attributes, amxs_translation_cb_t translation_cb, amxs_action_cb_t action_cb, amxs_sync_entry_type_t type, void *priv)

◆ amxs_sync_param_new_copy()

amxs_status_t amxs_sync_param_new_copy ( amxs_sync_param_t **  param,
const char *  param_a,
const char *  param_b,
int  attributes 
)

Synchronization parameter constructor function.

Allocates memory for a new synchronization parameter and initializes this parameter.

Use amxs_sync_param_delete to remove the synchronization parameter and free all allocated memory.

Uses default translation amxs_sync_param_copy_trans_cb and action amxs_sync_param_copy_action_cb callbacks.

Parameters
paramPointer to a synchronization parameter pointer. The address of the new allocated synchronization parameter is stored in this pointer.
param_aName of the parameter in object A
param_bName of the parameter in object B
attributesBitwise OR of zero or more of the following attributes:
Returns
amxs_status_ok when the synchronization parameter is created, or another status code when failed to create the synchronization parameter.

Definition at line 87 of file amxs_sync_param.c.

90  {
91  return amxs_sync_entry_new(param,
92  param_a,
93  param_b,
94  attributes,
98  NULL);
99 }
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.