op_id_from_hierarchical_name()
摘要
获取按分层名称指定的对象的对象 ID。
语法
op_id_from_hierarchical_name (hname)
| 参数 | 类型 | 说明 |
|---|---|---|
hname |
const char * |
目标对象的完整分层名称 |
返回类型
Objid
该对象的对象 ID;若没有现存对象符合指定条件,或发生可恢复错误,则返回 OPC_OBJID_INVALID。
示例
/* determine the object ID of the desired remote queue */
rem_node_objid = op_id_from_hierarchical_name ("top.office.frnt_end");
rem_queue_objid = op_id_from_name (rem_node_objid, OPC_OBJTYPE_QUEUE, "buffer_a");
/* obtain key state variables of queueing process */
prio_thresh_ptr = (int *) op_ima_obj_svar_get (rem_queue_objid, "prio_thresh");
protocol_version = (char *) op_ima_obj_svar_get (rem_queue_objid, "proto_ver");
/* modify the state variables */
*prio_thresh_ptr = 44;
sprintf (protocol_version, "Ver 5.1")
详情
无。
用途
提供一种将对象分层名称映射为对象 ID 的机制。
错误
- 程序中止:Segmentation violation。(由于格式错误的
hname参数) - 可恢复错误:传入
op_id_from_hierarchical_name ()的分层名称为 NULL。 - 可恢复错误:名称(
<hname>)无法匹配到对象 ID,原因是(<error_string>)。
参考
- 使用内核过程 op_id_from_userid() 根据用户 ID 获取网络对象的对象 ID
- 使用内核过程 op_ima_obj_attr_get() 获取对象属性的值
- 使用内核过程 op_ima_obj_attr_set() 为对象属性赋值
- 使用内核过程 op_topo_child() 按类型和索引获取子对象的对象 ID
- 使用内核过程 op_topo_parent() 获取某个对象的父对象的对象 ID
- 使用内核过程 op_ima_obj_hname_get() 根据对象 ID 获取分层名称