You should declare or define an instruction class set using the following macro.
This macro declares the prototype of a function named instr_class_set_name that represents an instruction class set with the same name and is the event handler function of this instruction class set.
You can prepend the macro with the static
keyword to declare or define the static function.
A pointer to the function has the type qsmm_instr_class_set_func_t
.
The function has the return type int
and the following arguments.
The handle of a multinode model containing the instruction class set.
The type of an event to process by the event handler function: QSMM_EVT_ENT_INIT
, QSMM_EVT_ENT_DONE
, QSMM_EVT_ENGINE_INIT
, QSMM_EVT_ENGINE_DONE
, QSMM_EVT_NODE_ENTER
, or QSMM_EVT_NODE_LEAVE
.
The identifier of a node that receives or returns control.
Is a valid identifier for events QSMM_EVT_NODE_ENTER
and QSMM_EVT_NODE_LEAVE
.
For other events is equal to -1.
The user parameter of this event handler function.
For events QSMM_EVT_ENT_INIT
, QSMM_EVT_ENT_DONE
, QSMM_EVT_ENGINE_INIT
, and QSMM_EVT_ENGINE_DONE
, the parameter is equal to the corresponding argument of qsmm_reg_instr_class_set
function invoked to register the instruction class set.
For events QSMM_EVT_NODE_ENTER
and QSMM_EVT_NODE_LEAVE
, the parameter is equal to the corresponding argument of qsmm_node_call_default
function invoked to call the node.
For example, declare the prototype of a static function representing the instruction class set ‘walker’ as follows:
static QSMM_INSTR_CLASS_SET(walker);
Define the static function ‘walker’ as follows:
static QSMM_INSTR_CLASS_SET(walker) { ... }
This is a type of a pointer to the event handler function of an instruction class set. The type has the following declaration:
typedef int (*qsmm_instr_class_set_func_t)( qsmm_t qsmm, int qsmm_evt, int qsmm_node, void *qsmm_param_p );
See above for a description of arguments of that event handler function.
To improve compatibility with future versions of QSMM library, avoid declaring event handler functions with this prototype explicitly—use the macro QSMM_INSTR_CLASS_SET
instead.