Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

JS: Hierarchy and Navigation

Hierarchy and Navigation

The gobjs build a tree of parents and children. The root is the yuno. The services are under the yuno. Each gobj has one parent, and the yuno has none.

Yuno
 ├── Service "auth"     (C_IEVENT_CLI)
 ├── Service "main"     (C_MY_SERVICE)
 │    └── Child "sub"   (C_SOME_GCLASS)
 └── Service "timer"    (C_TIMER)

Source code: src/gobj.js


The root and the services

gobj_yuno()

Gives the yuno, which is the root of the tree.

__yuno__

The variable that holds the yuno. Read it with gobj_yuno(), which is the public form.

gobj_services()

Gives the names of the registered services, as a list.

gobj_default_service()

Gives the default service.

gobj_find_service(service_name, verbose)

Finds a service by its name. With verbose set to true the function writes a log error when the service does not exist.


Names

gobj_name(gobj)

Gives the name of a gobj.

gobj_gclass_name(gobj)

Gives the name of the gclass of a gobj.

gobj_short_name(gobj)

Gives the short name, which is the gclass and the name. A log message uses it.

gobj_full_name(gobj)

Gives the full name, which carries the path from the yuno.

gobj_yuno_name()

Gives the name of the yuno.

gobj_yuno_role()

Gives the role of the yuno.

gobj_yuno_id()

Gives the identifier of the yuno.


Parents and children

gobj_parent(gobj)

Gives the parent of a gobj.

gobj_change_parent(gobj, parent)

Moves a gobj to another parent.

gobj_bottom_gobj(gobj)

Gives the bottom gobj, which is the gobj that carries the work of the layer below. A gclass of a protocol keeps its transport there.

gobj_set_bottom_gobj(gobj, bottom_gobj)

Writes the bottom gobj. The function writes a log warning when the gobj holds one already.


gobj_find_child(gobj, jn_filter)

Gives the first child that matches a filter of attributes.

gobj_match_children(gobj, jn_filter)

Gives every child that matches a filter, as a list.

gobj_match_children_tree(gobj, jn_filter)

Gives every gobj below this one that matches a filter, at any depth.

gobj_match_gobj(gobj, jn_filter)

Tells if one gobj matches a filter. The three functions above use it.

gobj_find_gobj(gobj, path)

Finds a gobj from a path.

gobj_search_path(gobj, path)

Finds a gobj from a path, and begins the search at gobj.


Walk the tree

walk_type_t

The order the two walks take. One of WALK_TOP2BOTTOM, WALK_BOTTOM2TOP or WALK_BYLEVEL must be given; with WALK_BYLEVEL, add WALK_FIRST2LAST or WALK_LAST2FIRST. Same names and same values as the C walk_type_t.

gobj_walk_gobj_children(gobj, walk_type, cb_walking, user_data, user_data2)

Calls cb_walking(gobj, user_data, user_data2) for each child. walk_type chooses the order. A callback that gives a value that is not 0 stops the walk.

gobj_walk_gobj_children_tree(gobj, walk_type, cb_walking, user_data, user_data2)

The same walk, and it goes down to every depth.