Posts

Showing posts from September, 2014

OmniOrb Snippets

Image
Obtaining the Implementation back from a Corba Object Assume that the implementation of a class named A is named AImp. A is-a Corba Object As soon as we encapsulate AImpl into an A_ptr in code such as (pseudocode): AImpl *aimp=new AImpl(orb); PortableServer::POA_var poa = PortableServer::POA::_narrow(root_poa); poa->activate_object(aimpl); CORBA::Object_var o; o = poa->servant_to_reference(aimpl); It seems as we have lost the implementation of A! Of course we have it present in the variable aimp, but as soon as we leave that method all we will be able to get is the remote interface of A as declared in its IDL. What if we have public methods in the declaration of A (AImpl.hh) that we want to keep public when locally to the object an private when remotely to it? There should be a way to recover the implementation when we are in the same process than it by using a dynamic_cast . Here it is (pseudocode): AImpl* aimp; corba::A_ptr ac= ... //obtain the corba ref