Next: Registering the Instruction Meta-class Function, Previous: Instruction Meta-class Function Declaration, Up: Defining Instruction Meta-classes [Contents][Index]
The event handler function of an instruction meta-class can process events with types represented by the macros listed below.
The argument qsmm_evt
of that event handler function specifies an event type.
Instruction meta-class initialization.
The function qsmm_reg_instr_meta_class
called to register the instruction meta-class sends this event.
This event can trigger initial assignments to variables and allocating resources used by the instruction meta-class for all model runs.
Instruction meta-class uninitialization.
The function qsmm_destroy
called to destroy the multinode model sends this event to all registered instruction meta-class event handlers.
This event can trigger deallocating resources allocated on processing an event QSMM_EVT_ENT_INIT
.
Instruction class initialization.
The function qsmm_reg_instr_class_v2
(see Registering Instruction Classes) called to register an instruction class derived from the instruction meta-class sends this event.
The event handler of an instruction class set usually calls qsmm_reg_instr_class_v2
on processing an event QSMM_EVT_ENT_INIT
to register the instruction class as belonging to this instruction class set.
This event typically triggers the following operations:
qsmm_set_eh_instr_param_str_f
if the instruction has parameters (see Setting Text Instruction Parameters);
qsmm_set_eh_noutcome
if the instruction has more than one outcome or should behave depending on the outcome of the previous instruction invoked (see Setting the Number of Instruction Outcomes).
Instruction class uninitialization.
The function qsmm_destroy
called to destroy the multinode model sends this event to instruction meta-class event handlers for instruction classes registered by the function qsmm_reg_instr_class_v2
and then sends the event QSMM_EVT_ENT_DONE
to those event handlers.
This event can trigger the uninitialization of binary instruction class parameters (see Accessing Binary Instruction Parameters) and the deallocation of additional resources associated with the instruction class allocated on processing an event QSMM_EVT_INSTR_CLASS_INIT
.
Model instance initialization.
The function qsmm_engine_create
called to create the model instance sends this event to all registered instruction meta-class event handlers at the end of execution of that function.
This event can trigger initial assignments to variables and allocating resources used by the instruction meta-class for a current model run.
Model instance uninitialization.
The function qsmm_engine_destroy
called to destroy the model instance sends this event to all registered instruction meta-class event handlers at the beginning of execution of that function in reverse order relative to the order of sending events QSMM_EVT_ENGINE_INIT
.
The function qsmm_engine_create
calls qsmm_engine_destroy
implicitly when recreating the model instance.
The function qsmm_destroy
calls qsmm_engine_destroy
implicitly when destroying the multinode model.
This event can trigger deallocating resources allocated on processing an event QSMM_EVT_ENGINE_INIT
.
Instruction invocation. See Handling Instruction Invocation.
On successful completion, the event handler function shall return a non-negative value.
A specific non-negative value has no effect on model operation.
On error, the event handler function shall return a negative value.
Such negative value causes the invocation of an error handler function with passing QSMM_ERR_EVTHNDLR
to it if the model has an error handler set.