libamxd
6.4.1
Data Model Manager
|
Modules | |
Data Model Actions | |
Functions | |
amxd_status_t | amxd_dm_new (amxd_dm_t **dm) |
Instantiate a new data model. More... | |
void | amxd_dm_delete (amxd_dm_t **dm) |
Deletes a data model structure. More... | |
amxd_status_t | amxd_dm_init (amxd_dm_t *dm) |
Initializes a data model structure. More... | |
void | amxd_dm_clean (amxd_dm_t *dm) |
Cleans a data model structure. More... | |
amxd_status_t | amxd_dm_add_root_object (amxd_dm_t *const dm, amxd_object_t *const object) |
Adds an object to the root of the data model. More... | |
amxd_status_t | amxd_dm_remove_root_object (amxd_dm_t *const dm, const char *name) |
Removes an object from the root of the data model. More... | |
amxd_object_t * | amxd_dm_get_root (amxd_dm_t *const dm) |
Fetches the root object of the data model. More... | |
amxd_object_t amxd_status_t amxd_status_t const char * | amxd_dm_signal_get_path (amxd_dm_t *const dm, const amxc_var_t *const signal_data) |
Get the object path from a data model signal. More... | |
amxd_object_t * | amxd_dm_signal_get_object (amxd_dm_t *const dm, const amxc_var_t *const signal_data) |
Get the object from a data model using the path in the recieved signal. More... | |
amxd_status_t amxd_dm_add_root_object | ( | amxd_dm_t *const | dm, |
amxd_object_t *const | object | ||
) |
Adds an object to the root of the data model.
A data model object can be created with amxd_object_new and added to either the data model itself using this function, or added to another object using amxd_object_add_object
dm | the pointer to the data model structure |
object | the pointer to an object |
Definition at line 418 of file amxd_dm.c.
void amxd_dm_clean | ( | amxd_dm_t * | dm | ) |
Cleans a data model structure.
This function frees the full data model itself. It is not needed to free all individual allocated objects that are part of the data model object hierarchy.
dm | the pointer to the data model structure |
Definition at line 365 of file amxd_dm.c.
void amxd_dm_delete | ( | amxd_dm_t ** | dm | ) |
Deletes a data model structure.
This function frees the allocated memory for the data model structure and the full data model itself. It is not needed to free all individual allocated objects that are part of the data model object hierarchy.
dm | a pointer to the location where the pointer to the data model is store. |
Definition at line 321 of file amxd_dm.c.
amxd_object_t* amxd_dm_get_root | ( | amxd_dm_t *const | dm | ) |
Fetches the root object of the data model.
The root object has no name, it is used to add other objects to the data model using amxd_object_add_object
dm | the pointer to the data model structure |
Definition at line 456 of file amxd_dm.c.
amxd_status_t amxd_dm_init | ( | amxd_dm_t * | dm | ) |
Initializes a data model structure.
Typically only one data model is allocated/created for an application, preferable as a static variable, and initialized with this function
dm | the pointer to the data model structure |
Definition at line 334 of file amxd_dm.c.
amxd_status_t amxd_dm_new | ( | amxd_dm_t ** | dm | ) |
Instantiate a new data model.
Allocates and initializes memory to store a data model object hierarchy. This function allocates memory from the heap,
Typically only one data model is allocated/created for an application, preferable as a static variable, see amxd_dm_init
dm | a pointer to the location where the pointer to the new data model structure can be stored |
Definition at line 306 of file amxd_dm.c.
amxd_status_t amxd_dm_remove_root_object | ( | amxd_dm_t *const | dm, |
const char * | name | ||
) |
Removes an object from the root of the data model.
This function removes the object from the data model root and does delete the memory allocated for the object.
After calling this function the object is not accessible anymore.
dm | the pointer to the data model structure |
name | the name of the object |
Definition at line 433 of file amxd_dm.c.
amxd_object_t* amxd_dm_signal_get_object | ( | amxd_dm_t *const | dm, |
const amxc_var_t *const | signal_data | ||
) |
Get the object from a data model using the path in the recieved signal.
The data model emits amxp signals (see libamxp) for different kind of events, like object added, object deleted, ...
Each of these events contain an object path, with this function the object referenced by the path in the signal is retrieved,
If you need the path to the object in the data model use amxd_dm_signal_get_path.
dm | the pointer to the data model structure |
signal_data | the signal data |
Definition at line 573 of file amxd_dm.c.
amxd_object_t amxd_status_t amxd_status_t const char* amxd_dm_signal_get_path | ( | amxd_dm_t *const | dm, |
const amxc_var_t *const | signal_data | ||
) |
Get the object path from a data model signal.
The data model emits amxp signals (see libamxp) for different kind of events, like object added, object deleted, ...
Each of these events contain an object path, with this function the path can be extracted from the signal.
If you need the pointer to the object in the data model use amxd_dm_signal_get_object.
dm | the pointer to the data model structure |
signal_data | the signal data |
Definition at line 560 of file amxd_dm.c.