您的位置:首页 > 运维架构

opnet之变量类型

2016-12-14 18:45 477 查看

Objid(对象id)和int(用户id)

对象id的变量类型是Objid

用户id的变量类型是int

Objid是系统分配的对象识别号,全局唯一,整数。

user id是节点模型(对象的一种)的一个属性,由用户设置,不唯一。

对象分为两种:

抽象对象:复合属性

具体对象:模块、收信机、发信机、节点、子网

lmz:

尽管对象id是一个整数,但是又不仅仅是一个整数。

可以想象,opnet内部肯定维持了一张表(或者称为数据结构),表中的id就是对象id,每一个对象id对应着很多对象的属性。IMA核心函数提供了操作这张表的接口。我们可以获取或者修改对象的属性。

Evhandle

我们对事件的操作需要一个表示事件的符号,这个符号就是事件句柄。

可以对事件进行删除等操作。

Prohandle

字面意思是进程句柄。

可以想象提供了一个操作进程的符号。

Stathandle

统计量句柄。

一声明、二注册、三写入

声明全局/局部统计量

注册统计量为统计量句柄

将SV/TV的值写入统计量句柄

shared*

/*Allocate, initialise, and install memory to be shared by the child process model*/
sharedptr = op_prg_mem_alloc(sizeof(shared));
sharedptr->partxsrcid = -1;
sharedptr->chitxsrcid = -1;
op_pro_modmem_install(sharedptr);


根进程创建子进程后,分配父子进程共享的内存空间。

lmz:

什么叫做句柄?

进程句柄、事件句柄、统计量句柄。

他们不是进程、事件、统计量。

只是提供了操作进程、事件、统计量的一个符号。

相应的核心函数通过这些符号来操作进程、事件、统计量。

Handle (computing)

In computer programming, a handle is an abstract reference to a resource. Handles are used when application software references blocks of memory or objects managed by another system, such as a database or an operating system. A resource handle can be an opaque identifier, in which case it is often an integer number (often an array index in an array or “table” that is used to manage that type of resource), or it can be a pointer that allows access to further information.

Common resource handles are file descriptors, network sockets, database connections, process identifiers (PIDs), and job IDs. Process IDs and job IDs are explicitly visible integers, while file descriptors and sockets (which are often implemented as a form of file descriptor) are represented as integers, but are typically considered opaque. In traditional implementations, file descriptors are indices into a (per-process) file descriptor table, thence a (system-wide) file table.

tags:opnet
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  opnet