gclass_add_state()

gclass_add_state()#

Adds a new state to the finite state machine of the specified hgclass. The state is identified by state_name and is used to define event transitions.

Prototype

int gclass_add_state(
    hgclass         gclass,
    gobj_state_t    state_name
);

Parameters

Key

Type

Description

gclass

hgclass

The handle to the gclass where the state will be added.

state_name

gobj_state_t

The name of the state to be added.


Return Value

Returns 0 on success, or -1 if an error occurs (e.g., gclass is NULL or memory allocation fails).

Notes

This function is used to define states in a gclass’s finite state machine. Each state can later be associated with event-action pairs using gclass_add_ev_action().

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples