(2)stathandle op_stat_reg (const char* stat_name, int stat_index, int type),返回一个可以被用来指向一个进程/模型的节点或模块的统计量(局部或全局)句柄。其中,stat_index为相关统计量的数字索引,如果没有则为OPC_STAT_INDEX_NONE,type指OPC_STAT_GLOBAL 或 OPC_STAT_LOCAL 。如
ete_gsh=op_stat_reg(\T_INDEX_NONE,OPC_STAT_GLOBAL);
op_stat_write (ete_gsh, ete_delay);//ete_delay是计算得出的一个变量。
7、与拓扑结构相关:
(1)Objid op_topo_parent(Objid child_objid),获得指定实体ID的父实体的ID。
(2)Objid op_id_self (),返回所获取的周围处理器或队列的对象ID。
8、IMA 核心函数-操作对象(的属性等)
(1)Compcode op_ima_obj_attr_get (objid objid,const char* attr_name, void* value_ptr),获得对象objid的属性域attr_name的值。object ID 可通过如下函数获得:op_id_self(), op_topo_parent(), op_topo_child(), op_id_from_userid(), and op_id_from_name()。如:
op_ima_obj_attr_get (own_id, \
op_ima_obj_attr_get(op_topo_parent(op_id_self()),\
9、与队列相关:
子队列操作函数
(1)int op_subq_pk_insert (int subq_index, Packet* pkptr,int pos_index) ,将pkptr所指向的数据包插入到subq_index队列的pos_index处。队列出0开始,依次增加,pos_index可以是OPC_QPOS_HEAD,OPC_QPOS_TAIL,以及OPC_QPOS_PRIO。返回插入情况,可以是OPC_QINS_OK, OPC_QINS_FAIL, OPC_QINS_PK_ERROR, OPC_QINS_SEL_ERROR。如:
pkptr = op_pk_get (strm_index);
op_subq_pk_insert (strm_index, pkptr, OPC_QPOS_TAIL);
(2)Boolean op_subq_empty (subq_index),判断队列是否为空。是空返回OPC_TRUE,否则返回OPC_FALSE。
(3)Packet* op_subq_pk_remove (int subq_index, int pos_index),删除指定队列的指定数据包,并返回指向该删除数据包的指针。pos_index可以是:OPC_QPOS_HEAD, OPC_QPOS_TAIL, and OPC_QPOS_PRIO。
/* determine which subqueue is being accessed */
subq_index = op_intrpt_code ();
/* check if it is empty */
if (op_subq_empty (subq_index) == OPC_FALSE)
{
/* access the first packet in the subqueue */
pkptr = op_subq_pk_remove (subq_index, OPC_QPOS_HEAD);
/* forward it to the destination over requested stream */
/* use 'quiet' mode to avoid causing a stream interrupt. */
op_pk_send_quiet (pkptr, subq_index);
}
(4)Packet* op_subq_pk_access (int subq_index, int pos_index),返回子队列索引subq_index所向的队列的指定位置pos_index处的数据包的指针。
(5)void op_subq_sort (int subq_index),将子列队按包相关的优先级排序。优先级越大,越靠近队首。
10、与中断有关:
(1)int op_intrpt_code (),返回与调用进程当前中断相关的中断/事件码。
(2)int op_intrpt_strm (),返回与调用进程当前中断相关的流索引。
(3)int op_intrpt_type () ,返回调用进程当前中断的类型。常见的类型有:
OPC_INTRPT_ACCESS—access interrupt
OPC_INTRPT_BEGSIM—begin simulation interrupt
OPC_INTRPT_ENDSIM—end simulation interrupt
OPC_INTRPT_PROCEDURE—procedure interrupt
OPC_INTRPT_PROCESS—process interrupt
OPC_INTRPT_RECOVER—node/link recovery interrupt
OPC_INTRPT_REGULAR—regular interrupt
OPC_INTRPT_REMOTE—remote interrupt)
OPC_INTRPT_SELF—self interrupt
OPC_INTRPT_STAT—statistic interrupt
OPC_INTRPT_STRM—stream interrupt
11、与数据流相关:
(1)void* op_strm_flush (instrm_index),清除输入流中数据包。
(2)int op_strm_max_index_in ()获得任何与周围进程或队列相连接的输入流的索引中的最大值。
(3)Boolean op_strm_connected (int strm_type, int strm_index)判定周围处理器的指定的输入或输出流是否与一个包流实体相关联的。
(4)Boolean op_strm_empty (int instrm_index)判断当前指定的输入流是否有包。
(5)Compcode op_strm_access (int instrm_index)向与指定的输入流相关的模块发送一个访问
中断。
/** loop through all input streams, generating an access interrupt for each **/
/* determine the number of allocated input streams */
alloc_instrms = op_strm_max_index_in ();
/* loop through each allocated stream */
for (i = 0; i <= alloc_instrms; i++)
{
/* if an input stream is connected, and... */
if (op_strm_connected (OPC_STRM_IN, i) == OPC_TRUE)
{
/* if an input stream is connected, access a packet from the source module. */
op_strm_access (i);
/* Collect and forward the packet onto the bus, if one was obtained. */
if (op_strm_empty (i) == OPC_FALSE)
op_pk_send (op_pk_get (i), OUTSTRM_BUS);
}
}
12、与编程(Programming)有关:
(1)void* op_prg_mem_alloc (size),分配指定大小的内存。如:
doc_req_msg=(Doc_Req_Msg *)op_prg_mem_alloc (sizeof (Doc_Req_Msg));
(2)void op_prg_mem_free (Packet* ptr),释放指定内存。
(3)void* op_prg_mem_realloc (mem_ptr, size),为已存在的内存块重新分配大小。