[omniORB] Compare CORBA Object Reference

Duncan Grisby duncan at grisby.org
Thu Feb 4 16:25:22 GMT 2010


On Wed, 2010-01-20 at 20:38 +0530, Lakshmeeshk wrote:

> I required the answers to below listed questions, could anyone look
> into these and provide me the solution.
> 
>  
> 1. Is there any method to compare CORBA Object references? Without
> using is_equivalent() method.

No.

As you may know, _is_equivalent compares CORBA object references. It
does not compare CORBA objects, so two references that compare equal
definitely refer to the same object; two references that are not
equivalent may or may not refer to the same object.

> Also, not doing by object_to_string() and then compare with strcmp()
> method.

That is not safe. If you call object_to_string() twice with the same
object reference, there is no guarantee that you will get the same
string. And, as with _is_equivalent, you can have two totally different
looking object references that refer to the same object.

> 2. This method should be generic and support other CORBA families. 

The normal way to support object comparisons is to define your own
comparison operation in a base interface. Then you can ask an object if
it is the same as another one.

Cheers,

Duncan.

-- 
 -- Duncan Grisby         --
  -- duncan at grisby.org     --
   -- http://www.grisby.org --





More information about the omniORB-list mailing list