dcsimg
How to return different object refernces
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   sudheendra_rao
Posted On:   Sunday, November 25, 2001 10:24 PM

I have a CORBA server which provides an interface that should return the reference of diffent servants. How do i return differnt object references from the same funtion? The interface looks like this, interface ABC { XXX getReference (in string objName); }; interface XYZ { void fn (); }; interface ABCD { void fn1 (); }; Here ABC is my CORBA server. When client calls getReference API, getReference depending on the parameter passed (objName), will create that object and should return a refernce of the o   More>>


I have a CORBA server which provides an interface that should return
the reference of diffent servants. How do i return differnt object references
from the same funtion?

The interface looks like this,



interface ABC
{
XXX getReference (in string objName);
};




interface XYZ
{
void fn ();
};




interface ABCD
{
void fn1 ();
};





Here ABC is my CORBA server.

When client calls getReference API, getReference depending on the
parameter passed (objName), will create that object and should return
a refernce of the object to the client.

In getReference function how do i return the reference? As this funtion
can return a reference to XYZ or ABCD.

   <<Less

Re: How to return different object refernces

Posted By:   Anonymous  
Posted On:   Tuesday, November 27, 2001 09:18 PM

Change the IDL signature of the method XXX to

CORBA::Object getReference(in string objName);



Inside the getReference method implementation,



Use the following code





For object of type XYX


XYZ xyzRef = new XYZ();


CORBA::Object xyz = poaRef.servant_to_reference(xyzRef);



retrun xyz;



For object of type ABCD



ABCD abcdRef = new ABCD();



CORBA::Object abc= poaRef.servant_to_reference(abcdRef );



retrun abc;

About | Sitemap | Contact