[omniORB] Re: distinguishing remote and local objects

Sai-Lai Lo S.Lo@uk.research.att.com
01 Oct 1999 18:26:41 +0100


I don't like to suggest you a hack that is neither portable nor will be
compatible with omniORB 3. But if you really need it now and you don't mind
changing your code later. You can use this internal function.

CORBA::Object_ptr obj;

if (!CORBA::is_nil(obj)) {
   if (obj->PR_getobj()->is_proxy()) {
      // This object reference points to a non-local object
   }
   else {
      // This object is a local object.
   }
}

With the POA (omniORB 3), you can ask if an object reference points to an
object in a particular POA. I think this in effect gives you the
information you want. Look up a CORBA text book for details.

Sai-Lai

>>>>> Chung, David writes:

> 	Does anyone know if there exists an interface or a function call
> (supported by omniORB) that I can make on a CORBA Object (reference) to test
> if it is in the same address space as the caller or not?  

> 	I understand that the point of using CORBA is to obtain location
> transparency; that is, it makes remote objects look local.  But my
> application need to handle remote and local calls differently -- hence, I
> need to somehow probe CORBA object to extract the information.

> 	Another approach to solving this problem is to use classes that are
> CORBA wrappers; that is, I can use class objects which simply contains both
> CORBA reference and a flag (to indicate whether it is remote or local).
> However, this is not the preferred approach as it incurs overhead.




-- 
Sai-Lai Lo                                   S.Lo@uk.research.att.com
AT&T Laboratories Cambridge           WWW:   http://www.uk.research.att.com 
24a Trumpington Street                Tel:   +44 1223 343000
Cambridge CB2 1QA                     Fax:   +44 1223 313542
ENGLAND