Posted by: smallonely | December 3, 2003

[CORBA] POA 介面 – (2) the POA mapping II

我們從servant開始說起吧 🙂

指標的列表。這個資料結構叫做 EPV (entry point vector:入口點向量)。servant
資料結構持有這樣的一個 EPV。

for example,

// idl interface
module FruitsBasket {
interface Apple {
void EatMe ();
void ThrowMe ();

他 generate 出

typedef struct {
void *_private; /* ORB specific data */
void (*EatMe) (PortableServer_Servant servant, CORBA_Environment * ev);
void (*ThrowMe) (PortableServer_Servant servant, CORBA_Environment * ev);
} POA_FruitsBasket_Apple__epv;

typedef struct {
PortableServer_ServantBase__epv *_base_epv;
POA_FruitsBasket_Apple__epv *FruitsBasket_Apple_epv;
} POA_FruitsBasket_Apple__vepv;

typedef struct {
void *_private; /* ORB specific data */
POA_FruitsBasket_Apple__vepv *vepv;
} POA_FruitsBasket_Apple;

extern void POA_FruitsBasket_Apple__init(POA_FruitsBasket_Apple servant,
CORBA_Environment * ev);
extern void POA_FruitsBasket_Apple__fini(POA_FruitsBasket_Apple servant,
CORBA_Environment * ev);

A servant is thus nothing more than a structure which holds an EPV specific
to the object implementation and a generic EPV called the _base_epv.

這個特定 EPV 是自我說明的:等待填充的function pointers的列表。
The specific EPV is rather self explanatory: function pointers are listed
there, waiting to be filled. The base EPV was not shown there: it is used to
hold some information specific to the servant itself (in fact, a servant may
be responsible for more than one object implementation but it would be
overkill to care about this).

現在,這堿O一個 PortableServer_ServantBase__epv 結構:

typedef struct PortableServer_ServantBase__epv {
void *private; /* ORB specific data */
/* finalization routine called
* to destroy any Servant data
void (*finalize) (PortableServer_Servant, CORBA_Environment *);
/* The POA used by this Servant */
PortableServer_POA (*default_POA) (PortableServer_Servant,
CORBA_Environment *);
} PortableServant_ServantBase__epv;

如果 finalize 和 default_poa 是 NULL, 那把 servlant 傳遞給
POA_FruitsBasket_Apple__init 時,就會用default value,
default_POA is defaulted to the “RootPOA” (就是
CORBA_ORB_resolve_initial_reference (orb, “RootPOA”, &ev) 返回的那個 POA。

Typically, such a set of data structures would be initialized as follows:

void MyEatMe (PortableServer_Servant servant,
CORBA_Environment * ev) {
/* here is your own code which
* corresponds to the object implementation
* 這裡是我自己要implement的code
void MyThrowMe (PortableServer_Servant servant,
CORBA_Environment * ev)
/* here is your own code which
* corresponds to the object implementation

PortableServer_ServantBase__epv base_epv {
NULL, /* ORB specific data */
NULL, /* finalize method */
NULL /* default POA */

POA_FruitsBasket_Apple__epv Apple_epv {
NULL, /* ORB specific data */

POA_FruitsBasket_Apple__vepv Apple_vepv {

POA_FruitsBasket_Apple Apple_servant = {
NULL, /* ORB specific data */

我願陪你流浪 陪你飛翔 陪你尋找你的方向
有你的地方 就是我的家鄉

之器不得已BBS telnet:// 開個人板 超快 不用連署得志於天下
作者在 03/12/03 16:06:40 從 修改這篇文章



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: