libamxd
6.4.1
Data Model Manager
|
Functions | |
amxd_status_t | amxd_object_add_function (amxd_object_t *const object, amxd_function_t *const func) |
Adds an RPC method definition to the object definition. More... | |
amxd_status_t | amxd_object_change_function (amxd_object_t *const object, const char *name, amxd_object_fn_t impl) |
Changes the implementation of an object's RPC method. More... | |
amxd_function_t * | amxd_object_get_function (const amxd_object_t *const object, const char *name) |
Get the definition of a RPC method from an object. More... | |
amxd_status_t | amxd_object_list_functions (amxd_object_t *const object, amxc_var_t *const list, amxd_dm_access_t access) |
Builds a linked list variant containing all function names available in the object. More... | |
amxd_status_t | amxd_object_describe_functions (amxd_object_t *const object, amxc_var_t *const value, amxd_dm_access_t access) |
Fetches the full object RPC method definitions in a variant. More... | |
amxd_status_t | amxd_object_invoke_function (amxd_object_t *const object, const char *func_name, amxc_var_t *const args, amxc_var_t *const ret) |
Calls an object RPC method. More... | |
uint32_t | amxd_object_get_function_count (amxd_object_t *const object, amxd_dm_access_t access) |
Retruns the number of RPC methods available in an object. More... | |
amxd_status_t amxd_object_add_function | ( | amxd_object_t *const | object, |
amxd_function_t *const | func | ||
) |
Adds an RPC method definition to the object definition.
After defining a RPC method using amxd_function_new, the function can be added to an object.
All derived objects will inherit the method. It is possible to change the implementation on derived objects using amxd_object_change_function.
RPC methods added to template objects (multi-instance) objects will be available on all instances, if the attribute amxd_fattr_instance (default) is set in the RPC method definition. If the attribute amxd_fattr_template is set the RPC method can be called on the template object.
object | the object where the function must be added. |
func | the name of the RPC method |
Definition at line 140 of file amxd_object_function.c.
amxd_status_t amxd_object_change_function | ( | amxd_object_t *const | object, |
const char * | name, | ||
amxd_object_fn_t | impl | ||
) |
Changes the implementation of an object's RPC method.
Using this function it is possible to change the implementation of a RPC method in an object.
If the implementation is changed for a certain object which has derived objects, the implementation is changed for all these derived objects as well. When changing the implementation of a derived object (like an instance object), the implementation is only changed for this object (or any object derived from that object).
object | the object pointer |
name | the name of the RPC method |
impl | function pointer to the new implementation |
Definition at line 182 of file amxd_object_function.c.
amxd_status_t amxd_object_describe_functions | ( | amxd_object_t *const | object, |
amxc_var_t *const | value, | ||
amxd_dm_access_t | access | ||
) |
Fetches the full object RPC method definitions in a variant.
It can be very handy to get the full definitions of the object RPC methods.
This function is mainly intended for introspection.
object | the object pointer |
value | variant where the RPC method defintions can be stored |
access | must be one of amxd_dm_access_t |
Definition at line 420 of file amxd_action_object_describe.c.
amxd_function_t* amxd_object_get_function | ( | const amxd_object_t *const | object, |
const char * | name | ||
) |
Get the definition of a RPC method from an object.
Returns the RPC method definition, if found, with the given name.
When using a derived object, it is possible that the RPC method definition is not owned by the object, use amxd_function_get_owner to get a pointer to the data model object that owns the RPC method definition.
The returned RPC method can be removed from the object using amxd_function_delete. If the object has derived objects, the method is also removed from the derrived objects, unless it was overriden in the derived object using amxd_object_change_function
object | the object pointer |
name | the name of the RPC method |
Definition at line 210 of file amxd_object_function.c.
uint32_t amxd_object_get_function_count | ( | amxd_object_t *const | object, |
amxd_dm_access_t | access | ||
) |
Retruns the number of RPC methods available in an object.
object | the object pointer |
access | must be one of amxd_dm_access_t |
Definition at line 276 of file amxd_object_function.c.
amxd_status_t amxd_object_invoke_function | ( | amxd_object_t *const | object, |
const char * | func_name, | ||
amxc_var_t *const | args, | ||
amxc_var_t *const | ret | ||
) |
Calls an object RPC method.
Using this function a RPC method of an object in the local data model can be called (that is an object in the data model of the process you are running in).
To call a function of a remote data model (data model in another process), use the amxb (BAAPI) function amxb_invoke.
When status amxd_status_deferred is returned, the ret will contain the call id and the real return value and status will be returned later. Use amxd_function_set_deferred_cb to register a callback function.
object | the object pointer |
func_name | name of the function |
args | a hash table variant containing the function arguments |
ret | a variant pointer where the return value can be stored |
Definition at line 245 of file amxd_object_function.c.
amxd_status_t amxd_object_list_functions | ( | amxd_object_t *const | object, |
amxc_var_t *const | list, | ||
amxd_dm_access_t | access | ||
) |
Builds a linked list variant containing all function names available in the object.
Initializes the variant to amxc_llist_t type and adds all function names available in the object.
The list also includes the functions of the objects from which this object is derived.
It is possible to filter the functions on access. Access token can be one of
object | the object pointer |
list | an initialized variant, will be filled with the RPC method names |
access | filter functions at a certain access level |
Definition at line 363 of file amxd_action_object_list.c.