op_ima_obj_attr_get_str()

Abstract

Obtains the value of a string attribute in the specified object.

Syntax

op_ima_obj_attr_get_str (objid, attr_name, buffer_size, value_buffer)
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 attribute must be of type string and defined in the specified object, or an error will occur.]
buffer_size unsigned int size of value_buffer (including space for the ending '\0')
value_buffer char * pointer to a variable to be filled with the specified attribute’s value (maximum length of value is buffer_size – 1 characters)

Return Type

Compcode

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

Example

char     tx_nodename [128];

/* Determine the transmitting node id and name */
tx_nodeid = op_id_parent (op_td_get_int (pkptr, OPC_TDA_RA_TX_OBJID));
op_ima_obj_attr_get_str (tx_nodeid, "name", 128, tx_nodename);

Details

String attributes can be any length; however, a maximum of 2048 characters are displayed to the user. Make sure *value_buffer is large enough to hold the expected attribute value.

Purpose

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

Errors

  • Same as op_ima_obj_attr_get(), plus the following:
  • Program Abort: Attribute (<name>) is of type (<type>). Can’t get its value as type (string).

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