Discussion:
[omniORB] Getting the IDL out or the IOR
Ramón Talavera
2014-09-05 09:53:48 UTC
Permalink
Good morning,
I am trying to get the Interface out of the stringified IOR, is it possible?
In other words, given a CORBA Object, is it possible to guess its
corresponding Interface Definition?

For example:

CORBA::Object_ptr obj=...
std::cout<<corbautil.getTypeStr(obj)<<std::endl

Should result in:
"IDL:meow.com/Test/A:1.0"

Is this possible at all? If so, I would appreciate any hints to implement
the method getTypeStr(CORBA::Object_ptr obj)

Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20140905/3cb773fa/attachment.html>
Duncan Grisby
2014-09-09 11:26:01 UTC
Permalink
Post by Ramón Talavera
I am trying to get the Interface out of the stringified IOR, is it possible?
In other words, given a CORBA Object, is it possible to guess its
corresponding Interface Definition?
[...]
Post by Ramón Talavera
CORBA::Object_ptr obj=...
std::cout<<corbautil.getTypeStr(obj)<<std::endl
"IDL:meow.com/Test/A:1.0"
I assume you mean you want to get its repository id, not the full
interface definition? To get the full interface definition, you need an
Interface Repository, and omniORB does not have its own one.

If you just want to get the repository id, which is the string like
"IDL:meow.com/Test/A:1.0", there is no CORBA standard way to get it, but
you can access some omniORB-specific details:

const char* id = obj->_PR_getobj()->_mostDerivedRepoId();

Beware that _PR_getobj() returns an invalid pointer for nil object
references and pseudo-objects, so make sure it's a valid normal object
reference first.

Also beware that what that does is get the repository id out of the
object reference, but it is valid for an object reference to have an
empty repository id, or even in id that you think is unrelated to the
one you were expecting. The only way to be completely sure if an object
supports a particular interface is to attempt to _narrow it, or call the
_is_a() method that's used by _narrow.

Cheers,

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