op_id_self()

Abstract

Obtains the object ID of the surrounding processor or queue.

Syntax

op_id_self ()
Argument Type Description
no arguments

Return Type

Objid

Object ID of the surrounding processor or queue.

The special value represented by the symbolic constant OPC_OBJID_INVALID will be returned if this KP is invoked from a non-process context (e.g., a context other than a processor or a queue).

Example

Excerpt from: example model (models/std/base); process model (acb_fifo); state (init); enter execs.

/* initially the server is idle */
server_busy = 0;
/* get queue module’s own object ID */
own_id = op_id_self ();
/* get assigned value of server processing rate */
op_ima_obj_attr_get (own_id, "service_rate", &service_rate);

Details

If this KP is not invoked from a process context (i.e., from a process that is running in a processor or queue), the returned value will be the constant OPC_OBJID_INVALID. Scheduled procedure calls, implemented via the op_intrpt_schedule_call() interface, inherit the context from which they were called; therefore if a procedure call is scheduled by a process, then it can expect a valid result from op_id_self(). However, pipeline stages are not considered process contexts, so they will be returned the value OPC_OBJID_INVALID.

Purpose

Provides a mechanism for a process to obtain its self object ID, so that it can access the values of its own attributes via the KP op_ima_obj_attr_get(). This is also the first step in obtaining the object ID of the surrounding node or subnet, via successive calls to the KP op_topo_parent().

op_id_self() can also be used in order to test that the current context is that of a process, since the constant OPC_OBJID_INVALID will be returned otherwise.

Errors

  • No errors are trapped.

Reference

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com