op_topo_object_count()

Abstract

Obtains the number of objects of the specified meta-type.

Syntax

op_topo_object_count (objmtype)
Argument Type Description
objmtype int object meta-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).]

Return Type

int

Number of objects of the specified type.

The special value represented by the symbolic constant OPC_INT_INVALID will be returned if a recoverable error occurs.

Example

Excerpt from: example model (models/std/sdr); process model (sdr_addr); state (INIT); enter execs.

/* Get the number of nodes. */
num_nodes = op_topo_object_count (OPC_OBJTYPE_NODE_FIX);
/* Set up the address distribution. */
address_dist = op_dist_load (“uniform_int”, 0, num_nodes - 1);
/* Initialize the ICI used for address announcement. */
ici_ptr = op_ici_create (“sdr_addr”);

Details

None.

Purpose

Provides a way to obtain the number of objects of a given type, regardless of their 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 might 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 and then call op_ima_obj_attr_set() to set the bit error rate attribute value.

Errors

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

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