op_ima_obj_attr_set_int32()

Abstract

Assigns the value of an integer attribute in the specified object.

Syntax

op_ima_obj_attr_set_int32 (objid, attr_name, value)
Argument Type Description
objid Objid object ID of the object-of-interest
[An object ID can be obtained from several KPs in the Topo and Id packages: op_id_self(), op_topo_parent(), op_topo_child(), op_id_from_userid(), and op_id_from_name().]
attr_name const char* name of the attribute-of-interest
[This value must be a defined attribute of the specified object.]
value int new value for the specified attribute

Return Type

Compcode

OPC_COMPCODE_SUCCESS if the attribute value was successfully set; OPC_COMPCODE_FAILURE otherwise.

Example

if(pool_ptr->index == ToraC_Max_Domain_Node_Num)
	{
	/* There are more than allowed number of nodes in this domain. */
	op_sim_end("Too many nodes with the same domain ID detected.  Ending simulation.",
		OPC_NIL, OPC_NIL, OPC_NIL);
	}
else
	{
	/* We found an empty id to give out. */
	pool_ptr->id_pool[pool_ptr->index] = node_objid;
	op_ima_obj_attr_get_int32 (module_objid, "manet_mgr.Ad-Hoc Routing Parameters",
		&tmp_objid);
	 tmp_objid = op_topo_child (tmp_objid, OPC_OBJTYPE_GENERIC, 0);
	 op_ima_obj_attr_get_int32 (tmp_objid, "TORA/IMEP Parameters", &tmp_objid);
	 tmp_objid = op_topo_child (tmp_objid, OPC_OBJTYPE_GENERIC, 0);

	 op_ima_obj_attr_set_int32 (tmp_objid, "Router ID", pool_ptr->index);
	 }

Details

This KP will not report an error if the attribute is not found; you must check the return value to discover this. By not reporting errors, this KP eliminates the need to use op_ima_obj_attr_exists() beforehand to prevent warnings from being generated.

Purpose

Provides a mechanism to dynamically assign object attributes during the course of a simulation. This KP works identically to op_ima_obj_attr_set(), but applies only to object attributes of data type integer. Refer to op_ima_obj_attr_set() for full purpose and details.

Errors

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