Next: , Previous: , Up: Defining Instruction Meta-classes   [Contents][Index]


4.2.2.2 Event Handling

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.

Macro: QSMM_EVT_ENT_INIT

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.

Macro: QSMM_EVT_ENT_DONE

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.

Macro: QSMM_EVT_INSTR_CLASS_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:

Macro: QSMM_EVT_INSTR_CLASS_DONE

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.

Macro: QSMM_EVT_ENGINE_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.

Macro: QSMM_EVT_ENGINE_DONE

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.

Macro: QSMM_EVT_ACTIVATE

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.


Next: , Previous: , Up: Defining Instruction Meta-classes   [Contents][Index]