[omniORB] invocation of a method fails.

Rajshekhar Kishtaiah Chintapalli rajshekhar.chintapalli@wipro.com
Wed, 27 Jun 2001 15:52:07 +0530


Thanks Stefan,

For the interface definitions like this,
interface Server
{
	unsigned long GetClient(in unsigned long i,out Client cli);
};

On compiling this idl i get the out put as
	virtual CORBA::ULong GetClient(CORBA::ULong i, _CORBA_ObjRef_OUT_arg<
_objref_Client, Client_Helper > cli) = 0;
While i was expecting
	virtual CORBA::ULong GetClient(CORBA::ULong i,Client_out cli) = 0;
And so the confusion.

After going through the .hh files that get generated, found that
(_CORBA_ObjRef_OUT_arg< _objref_Client, Client_Helper >) has been
typedefined to  Client_out.
I am not sure ,But i think this was not the case in OmniORB 2.0.8 ,Currently
i am using OmniORB 3.0.4


Thanks  and Regards
Raj



-----Original Message-----
From: owner-omniorb-list@uk.research.att.com
[mailto:owner-omniorb-list@uk.research.att.com]On Behalf Of Stefan
Seefeld
Sent: Wednesday, June 27, 2001 12:17 PM
To: omniorb-list@uk.research.att.com
Subject: Re: [omniORB] invocation of a method fails.


Rajshekhar Kishtaiah Chintapalli wrote:

> I store the ObjectRef of the Callback client using
> CORBA::ULong PutIFace(IAFace_ptr aface);
> Now how to get back this object reference , when  some other client makes
a
> call to the server askign for the reference of the first client.
> I want some function like
>         CORBA::ULong GetIFace(....) so that what ever is returned the
second client
> can use it.
>
> In the  IDL i have declared the method as
> unsigned long GetIFace(out IAFace aFace);

I would suggest you focus on the design as if it was to be implemented in a
'normal' language
such as C++. Once you really understand the CORBA object model you'll see
that there is a good
mapping for a C++ API (interface) to IDL.
For example:

class Server
{
public:
  void add_client(Client *);
  unsigned long clients();
  Client *get_client(unsigned long);
};

simply maps to

interface Server
{
  void add_client(in Client c);
  unsigned long clients();
  Client get_client(in unsigned long i);
};

which maps back to C++ as

class POA_Server
{
public:
  virtual void add_client(Client_ptr c);
  virtual unsigned long clients();
  virtual Client_ptr get_client(unsigned long i);
};

so as a first try you can use the same design you would use in a traditional
C++ application.

> The correspoding signature thats generated on compilation of IDL is
> something like this.
>         GetIFace(_CORBA_ObjRef_OUT_arg< _objref_IAFace, IAFace_Helper >
aFace)
>
> How to go about implementing this?

don't look at the generated code, just stick with the IDL to C++ mapping.
All you need to remember is how the different IDL types map to C++ types
depending
on whether they are 'in' or 'out' parameters. That's quite tricky, but with
the
help of a good discussion on memory management issues (such as the one in
the Henning and Vinosky book) you'll easily remember the rules.

> Basically what i want is that all the clients that come up regiseter
> themself  with the Server.

Sounds like a simple Subject/Observer scheme.

> Also the clients will be querying the Server to return the Reference of
some
> other Client.

same as you do it in C++. If you want to ask for other clients, you have to
assign
some id to them, so you can refer to a client given its id (or may be just
an index...)
Again, don't be afraid of CORBA, you can design as if you were working on a
non-distributed
program (well, almost).

Regards,
		Stefan