op_ima_obj_state_get()

摘要

获取先前通过 KP op_ima_obj_state_set() 设置在对象上的结构或值。

语法

op_ima_obj_state_get (objid)
参数 类型 说明
objid Objid 目标对象的对象 ID

返回类型

void*

返回指向先前通过 KP op_ima_obj_state_set() 设置的结构或值的指针。如果未设置任何状态,则返回值为 OPC_NIL。

示例

摘自 oms_bgutil.ex.c in models/std/utilities/oms。

/* Our client is not assuming responsibility for storing our routed */
/* state information.  We must do it ourselves. */

/* Get the current routed bgutil state off this channel object. If the object */
/* state pointer is OPC_NIL, we need to set up the routed utilization. */
/* The link object state ptr (accessed via op_ima_obj_state_get) by */
/* convention should be a pointer to a pointer to */
/* OmsT_Bgutil_Routed_State. */
bgutil_routed_state_pptr = (OmsT_Bgutil_Routed_State **)
	op_ima_obj_state_get (tx_ch_objid);
if (bgutil_routed_state_pptr == OPC_NIL)
	{...}

详情

对象可以以指向值或结构的指针的形式包含状态信息。KP op_ima_obj_state_set() 将这些值或结构附加到对象上,KP op_ima_obj_state_get() 则获取它们的副本。状态信息保留在对象上,可以再次获取。

用途

提供了一种检索与仿真对象关联的状态信息的机制。

错误

  • 可恢复错误:对象 ID(<objid>)超出范围。
  • 可恢复错误:对象 ID(<objid>)指向受限对象。

参考

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · 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