gobj_create2()
#
Creates a new gobj
(generic object) with the specified name, class, attributes, and parent. The function initializes the object, sets its attributes, and registers it if it is a service.
Prototype
hgobj gobj_create2(
const char *gobj_name,
gclass_name_t gclass_name,
json_t *kw, // owned
hgobj parent,
gobj_flag_t gobj_flag
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
The name of the |
|
The name of the |
|
|
|
A JSON object containing the attributes and configuration for the |
|
|
The parent |
|
Flags that define the behavior of the |
Return Value
Returns a handle to the newly created gobj
(hgobj
).
Returns NULL
if creation fails due to invalid parameters or memory allocation failure.
Notes
If the gobj
is marked as a service, it is registered globally.
If the gobj
is a Yuno, it is stored as the global Yuno instance.
The function checks for required attributes and applies global configuration variables.
If the gobj
has a mt_create2
method, it is called with the provided attributes.
If the gobj
has a parent, it is added to the parent’s child list.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples