op_topo_object()

Abstract

Obtains the object ID of an object specified by its type and index.

Syntax

op_topo_object (objmtype, index)
Argument Type Description
objmtype int object type
[This value is an integer code that specifies the object type of the object-of-interest (see Table 69 “Object Type Symbolic Constants“ on page 19).]
index int numeric index of the object
[Object indices start at 0 and increment by one, up to the number of objects of that type less one.]

Return Type

Objid

Object ID of the specified object. The special value represented by the symbolic constant OPC_OBJID_INVALID will be returned if a recoverable error occurs.

Example

/* Loop through the bus transmitter channels and abort all transmissions. */
/* Obtain the number of bus transmitter channels in the model. */
txch_count = op_topo_object_count (OPC_OBJTYPE_BUTXCH);
/* Loop through the channels and abort the transmission. */
for (i = 0; i < txch_count; i++)
	{
	ch_id = op_topo_object (OPC_OBJTYPE_BUTXCH, i);
	op_ima_obj_command (ch_id, “abort”);
	}

Details

None.

Purpose

Provides a mechanism to obtain the object ID of an object based on its type, regardless of its location in the object hierarchy. This is useful when a process needs to obtain or assign attributes that belong to objects of one type. For example, a process may need to set the bit error rate of all bus links to 0.0 at the beginning of the simulation. The KP op_topo_object_count() will provide the upper bound for the loop that will call op_topo_object() to obtain each bus link’s object ID followed by op_ima_obj_attr_set() to set the bit error rate attribute value.

Errors

  • Recoverable Error: Object meta-type (<objmtype>) is unrecognized.
  • Recoverable Error: Object index (<index>) is out-of-range.

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