gobj_link_nodes()
#
The gobj_link_nodes()
function establishes a relationship between two nodes in a hierarchical data structure by linking a child node to a parent node using a specified hook.
Prototype
int gobj_link_nodes(
hgobj gobj,
const char *hook,
const char *parent_topic_name,
json_t *parent_record,
const char *child_topic_name,
json_t *child_record,
hgobj src
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
The GObj instance managing the hierarchical data structure. |
|
|
The name of the hook defining the relationship between the parent and child nodes. |
|
|
The topic name of the parent node. |
|
|
A JSON object representing the parent node. This parameter is owned by the function. |
|
|
The topic name of the child node. |
|
|
A JSON object representing the child node. This parameter is owned by the function. |
|
|
The source GObj initiating the link operation. |
Return Value
Returns 0 on success, or -1 if an error occurs (e.g., if gobj
is NULL, destroyed, or if the mt_link_nodes
method is not defined).
Notes
This function relies on the mt_link_nodes
method of the GObj’s class to perform the actual linking operation. If mt_link_nodes
is not defined, an error is logged and the function returns -1.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples