libamxd
6.4.1
Data Model Manager
|
Macros | |
#define | amxd_object_set_value(type, object, name, value) amxd_object_set_ ## type(object, name, value) |
Helper macro for setting a value. More... | |
#define | amxd_object_get_value(type, object, name, status) amxd_object_get_ ## type(object, name, status) |
Helper macro for getting a value. More... | |
Functions | |
amxd_status_t | amxd_object_add_param (amxd_object_t *const object, amxd_param_t *const param) |
Adds a parameter definition to an object. More... | |
amxd_param_t * | amxd_object_get_param_def (const amxd_object_t *const object, const char *name) |
Gets a parameter definition from an object. More... | |
amxd_status_t | amxd_object_set_param (amxd_object_t *const object, const char *name, amxc_var_t *const value) |
Sets a value for a parameter in a data model object. More... | |
amxd_status_t | amxd_object_set_params (amxd_object_t *const object, amxc_var_t *const values) |
Sets multiple parameter values in a data model object. More... | |
amxd_status_t | amxd_object_get_param (amxd_object_t *const object, const char *name, amxc_var_t *const value) |
Gets a single parameter value. More... | |
const amxc_var_t * | amxd_object_get_param_value (const amxd_object_t *const object, const char *name) |
Gets the variant in which the parameter value is stored. More... | |
amxd_status_t | amxd_object_get_params (amxd_object_t *const object, amxc_var_t *const params, amxd_dm_access_t access) |
Gets all parameter values of an object. More... | |
#define amxd_object_get_value | ( | type, | |
object, | |||
name, | |||
status | |||
) | amxd_object_get_ ## type(object, name, status) |
Helper macro for getting a value.
This helper macro gets a value, using a type indicator
type | the data type that must be returned |
object | pointer to a data model object |
name | parameter name |
status | optional pointer to a amxd_status_t or NULL |
Definition at line 100 of file amxd_object_parameter.h.
#define amxd_object_set_value | ( | type, | |
object, | |||
name, | |||
value | |||
) | amxd_object_set_ ## type(object, name, value) |
Helper macro for setting a value.
This helper macro sets a value for a certain parameter
type | the data type, must be a valid parameter type, or must be convertable to a valid parameter type |
object | pointer to a data model object |
name | parameter name |
value | the new value, must match the given type |
Definition at line 85 of file amxd_object_parameter.h.
amxd_status_t amxd_object_add_param | ( | amxd_object_t *const | object, |
amxd_param_t *const | param | ||
) |
Adds a parameter definition to an object.
The parameter definition can be created using amxd_param_new.
Adding the parameter definition to an object fails when:
When adding a parameter definition to a multi-instance object or an instance object and none of the following parameters attributes are set:
object | pointer to a data model object, the parameter definition is added to this object |
param | pointer to the parameter definition |
Definition at line 96 of file amxd_object_parameter.c.
amxd_status_t amxd_object_get_param | ( | amxd_object_t *const | object, |
const char * | name, | ||
amxc_var_t *const | value | ||
) |
Gets a single parameter value.
This function invokes an action_object_read and can read private and protected parameters.
The default implementation of the action_object_read will fetch the real value of the paranmeter.
The action_object_read implementation can be overriden.
As an alternative to get a single parameter value of an object the macro amxd_object_get_value can be used.
object | pointer to a data model object |
name | the name of the parameter |
value | an initialized variant, the value of the parameter will be copied in this variant. |
Definition at line 252 of file amxd_object_parameter.c.
amxd_param_t* amxd_object_get_param_def | ( | const amxd_object_t *const | object, |
const char * | name | ||
) |
Gets a parameter definition from an object.
object | pointer to a data model object |
name | name of the parameter |
Definition at line 146 of file amxd_object_parameter.c.
const amxc_var_t* amxd_object_get_param_value | ( | const amxd_object_t *const | object, |
const char * | name | ||
) |
Gets the variant in which the parameter value is stored.
This function will return the pointer to the amxc_var_t structure in which the value of the parameter is stored.
object | pointer to a data model object |
name | the name of the parameter |
Definition at line 301 of file amxd_object_parameter.c.
amxd_status_t amxd_object_get_params | ( | amxd_object_t *const | object, |
amxc_var_t *const | params, | ||
amxd_dm_access_t | access | ||
) |
Gets all parameter values of an object.
This function invokes an action_object_read and can read private and protected parameters, depending on the provided access value.
The default implementation of the action_object_read will fetch the real value of the paranmeters.
The action_object_read implementation can be overriden.
A provided variant will be initialized to a variant containing a hash table. For each parameter a key - value pair is added, The key is the parameter name and the value is the parameter value. The type is matching the parameter type.
Using the access value, it is possible to filter out some parameters. When providing amxd_dm_access_public, no private or protected parameters are returned, when using amxd_dm_access_protected no private parameters are returned.
object | pointer to a data model object |
params | an initialized variant, the variant will be initialized to the hash table type, the value of the parameters will be copied in this hash table. |
access | can be set to amxd_dm_access_public, amxd_dm_access_protected, or amxd_dm_access_private |
Definition at line 314 of file amxd_action_object_read.c.
amxd_status_t amxd_object_set_param | ( | amxd_object_t *const | object, |
const char * | name, | ||
amxc_var_t *const | value | ||
) |
Sets a value for a parameter in a data model object.
When the type of the new value doesn't match the type of the parameter definition, the new value is converted to the type of the parameter.
This function invokes an action_object_write and can change read-only parameters or private and protected parameters.
The default implementation of the action_object_write will set the new value if possible. The following sets are not allowed and will fail:
The new parameter value is also validated, the action_param_validate is invoked before applying the value to the parameter. The set fails if the provided value is not valid for the parameter.
The behavior of this function depends on the implementation of
As an alternative to set a single parameter value of an object the macro amxd_object_set_value can be used.
object | pointer to a data model object |
name | name of the parameter |
value | the new value |
Definition at line 221 of file amxd_object_parameter.c.
amxd_status_t amxd_object_set_params | ( | amxd_object_t *const | object, |
amxc_var_t *const | values | ||
) |
Sets multiple parameter values in a data model object.
The behavior of this function is the same as amxd_object_set_param. The only differences is that the value arguments is a variant containing a hash table where the keys are considered parameter names.
When the object is a template object, it is possible to pass for each instance or some instances a separate hash table as value in the top level table, the key must be the name of the instance.
When a parameter or instance is not found the function fails.
object | pointer to a data model object |
values | a variant containing a hash table where the keys are the parameter names and the values the new values for the parameters. |
Definition at line 270 of file amxd_action_object_write.c.