[omniORB] Server-side access to non-IDL implementation methods.
David Riddoch
djr@uk.research.att.com
Mon, 11 Sep 2000 11:26:32 +0100 (BST)
Hi Dietmar,
This will not work in omniORB 3.0, because an object reference is a
completely separate c++ object from an object implementation (even when
local).
To get from a reference to the implementation you need to know which POA
the object is in. Then you can do:
PortableServer::Servant s = poa->reference_to_servant(_a);
MyImplA* p_a = dynamic_cast<MyImplA*>(s);
(NB. you may want to worry about ref counting the servant.)
Hope that helps,
David
On Sun, 10 Sep 2000, Dietmar May wrote:
> What is the correct way to access the member functions of a derived implementation class? I've always assumed that a dynamic_cast<> was appropriate, and it does indeed work in 2.8.0. However, I'm wondering if this will still be valid for 3.0?
>
>
> An example:
>
> interface ImplA
> {
> void exported_method ();
> };
>
> interface ImplB
> {
> void do_something (in ImplA it);
> };
>
>
> class MyImplA : public _sk_ImplA
> {
> public:
> virtual void exported_method ();
>
> Data* internal_helper_method ();
> };
>
> class MyImplB : public _sk_ImplB
> {
> public:
> virtual void do_something (ImplA_ptr _a)
> {
> MyImplA* p_a = dynamic_cast<MyImplA*>(_a);
> Data* p_data = p_a->internal_helper_method();
> }
> };
>
>
> This works in 2.8.0. Will it still in 3.0? If not, what is the correct way to handle this?
>
> Thanks,
> Dietmar May