op_hla_obj_notification_enable()
Note: Requires High-Level Architecture functionality
Abstract
Requests notification whenever an RTI attribute update is received for the specified object.
Syntax
op_hla_obj_notification_enable (objid, map_ec, attr_updt_ec, unmap_ec)
| Argument | Type | Description |
|---|---|---|
objid |
Objid |
object ID of object that will cause an interrupt to be generated for caller whenever RTI attribute updates are received |
map_ec |
int |
event code used in generated interrupt when Riverbed Modeler object is mapped to RTI object |
attr_updt_ec |
int |
event code used in generated interrupt when attribute(s) of Riverbed Modeler object modified from RTI updates |
unmap_ec |
int |
event code used in generated interrupt when Riverbed Modeler object no longer mapped to RTI object |
Return Type
Compcode
Completion code indicating success or failure in queuing the request. The procedure returns OPC_COMPCODE_SUCCESS if the request was successfully queued for later processing by the HLA-PM. It returns OPC_COMPCODE_FAILURE otherwise.
Example
static void traverse_topo (Objid subnet_id)
{
int i, child_count, child_id;
char model [200];
. . .
/* Fixed nodes */
child_count = op_topo_child_count (subnet_id, OPC_OBJTYPE_NODE_FIX);
for (i = 0; i < child_count; i++)
{
child_id = op_topo_child (subnet_id, OPC_OBJTYPE_NODE_FIX, i);
if (op_ima_obj_attr_get (child_id, "model", model) == OPC_COMPCODE_SUCCESS)
{
if (!strcmp (model, "HLA_Object"))
{
/* Found one, request notification of HLA mapping, */
/* attribute updates, and unmp using event codes */
/* set to 3 * object id + (0, 1, 2) respectively */
/* to be able to distinguish the events. */
op_hla_obj_notification_enable (child_id,
child_id * 3 + MAP_CODE_MOD,
child_id * 3 + UPDATE_CODE_MOD,
child_id * 3 + UNMAP_CODE_MOD);
Details
Several incoming RTI events can result in remote interrupts being scheduled for process models interested in being notified of these events. The events are:
- the mapping of a Riverbed Modeler object to a newly discovered RTI object
- the modification of some attributes of the Riverbed Modeler object based on incoming RTI attribute updates
- the termination of the mapping following the destruction of the RTI object
A process model can request notification when any of these three events happens to a specified object. When the event occurs for the specified object, a remote interrupt is scheduled for the caller of the Kernel Procedure. The event code associated with the remote interrupt will be the value provided in the last invocation of op_hla_obj_notification_enable() for the triggering object. The remote interrupt is delivered at the HLA time corresponding to the event.
The constant OPC_HLA_OBJ_IGNORE should be used as the event code to indicate that the corresponding event should not trigger a remote interrupt.
If a process model reinvokes op_hla_obj_notification_enable() for a previously used object ID, then the new set of event codes overwrites the previously defined set.
Purpose
Provides a mechanism to obtain notification whenever an RTI attribute update is received for the specified object, or that object is mapped or unmapped.
Errors
- Recoverable Error: Objid (
<id>): Unable to queue object notification request for<objid <id>;event codes<map_ec>,<attr_updt_ec>,<unmap_ec>).(due to memory allocation failure)
Reference
- Use the KP op_hla_attr_update_list_get() to obtain the list of names of attributes that were modified in the last update
- Use the KP op_hla_obj_notification_disable() to stop being notified whenever the attribute of an object are modified by external simulations, or the object is mapped or unmapped.