[omniORB] invocation of a method fails.
Stefan Seefeld
seefeld@sympatico.ca
Wed, 27 Jun 2001 01:47:13 -0500
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