op_topo_assoc_count()

Abstract

Obtains the number of associations of the reference object that have the specified type and direction.

Syntax

op_topo_assoc_count (objid, direction, objmtype)
Argument Type Description
objid Objid object ID of the reference object
[An object ID can be obtained from several KPs in the Id package: op_id_self(), op_id_from_userid(), and op_id_from_name(). In addition, object IDs can be obtained from prior invocations of the Topo package KPs op_topo_parent(), op_topo_child(), op_topo_assoc(), and op_topo_connect().]
direction int direction of association
OPC_TOPO_ASSOC_IN for input associations
OPC_TOPO_ASSOC_OUT for output associations
objmtype int object meta-type of association
[This value is an integer code that specifies the object type of the association-of-interest (see Table 69 “Object Type Symbolic Constants“ on page 19).]

Return Type

int

Number of associations of specified direction and 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); state (INIT); enter execs

/* Set up routing and interface tables. */
num_out_assoc = op_topo_assoc_count (loc_mod_objid, OPC_TOPO_ASSOC_OUT, 
	OPC_OBJTYPE_STRM);
for (i = 0; i < num_out_assoc; i++)
	{
	strm_objid = op_topo_assoc (loc_mod_objid, OPC_TOPO_ASSSOC_OUT, 
		OPC_OBJTYPE_STRM, i);
	op_ima_obj_attr_get (strm_objid, "src stream", &strm);
	if (strm != 0)
	. . .
	}

Details

The input and output associations of an object are the objects directly connected to its input and output ports, respectively. Refer to Table 21 Objects and Associated Types for a list of the valid reference object/association type pairs.

Purpose

Provides a mechanism for determining the number of input or output associations an object has. This is useful for setting the bounds on a loop that performs some operation on each association object. In order to obtain the object ID of each association, the KP op_topo_assoc() can be invoked with the reference object ID and the index of the loop.

Errors

  • Recoverable Error: Object ID (<objid>) is out-of-range.
  • Recoverable Error: Association direction (<dir>) is unrecognized.
  • Recoverable Error: Object meta-type (<objmtype>) is unrecognized.
  • Recoverable Error: Object type (<objmtype>) doesn’t support associations.
  • Recoverable Error: Assoc. direction (<direction>) is not supported by ref. object.
  • Recoverable Error: Object ID (<objid>) refers to a restricted object.

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