[omniORB] interface inheritance and _i inheritance

Richard Hardgrave hardgrav@ttd.teradyne.com
Tue, 13 Nov 2001 12:09:25 -0600 (CST)


> From owner-omniorb-list@uk.research.att.com Tue Nov 13 11:11 CST 2001
> From: =?iso-8859-1?B?RnLpZOlyaWMgUHJpbg==?= <frederic.prin@silvaco.com>
> To: "omni" <omniorb-list@uk.research.att.com>
> Subject: [omniORB] interface inheritance and _i inheritance
> 
> Hello,
> 
> I misunderstood something about inheritance.
> Why the _impl class does not reflect the interface inheritance ?
> Why superclass methods appear in both class as NON virtual methods ?

Let me see if I know what you're saying.  Virtual methods only
really need to be declared, "virtual", in the base class. It's
optional to redeclare them as virtual in the derived classes.

> 
> This is myIDL.idl:
> ------------------
> interface A {
>  void MethodA();
> };
> interface B : A {
>  void MethodB();
> };
> 
> I generate stub and skell with :
> omniidl -bcxx -Wbh=.h -Wbs=_skel.cpp -Wbexample myIDL.idl
> 
> the myIDL_i.cc generated file is:
> ---------------------------------
> //
> // Example class implementing IDL interface B
> //
> class B_i: public POA_B,
>                 public PortableServer::RefCountServantBase {
> private:
>   // Make sure all instances are built on the heap by making the
>   // destructor non-public
>   // virtual ~B_i();
> public:
>   // standard constructor
>   B_i();
>   virtual ~B_i();
> 
>   // methods corresponding to defined IDL attributes and operations
>   void MethodB();
>   void MethodA();
> };
> 
> If I try :
> class B_i : public POA_B,
>                public A_i
> 
> But I have an error when converting to Object_var (to pass to
> object-to-string):
> ...
> CORBA::Object_var ref = myA_i->_this(); <<<<<<<<<<< COMPILER ERROR
> <<<<<<<<<<<<

I believe _this() is returning a C++ pointer, but the Object_var
type wants to manage a more complex type that hides the implementation.

Regards,

Richard

> CORBA::String_var sior(orb->object_to_string(ref));
> ...
> 
> The compiler don't know which _this() to take :
> - the POA_A
> - the POA_B
> 
> Could you please tell me where am I wrong
> 
> Thanks
>        _____________________________
>       /                            /|
>      /___________________________ / |
>     |                            |  |
>     | Frédéric Prin              |  |
>     | Senior Software Engineer   |  |
>     |      S I L V A C O         |  |
>     | Grenoble REsearch CEnter   |  |
>     | Tel 04 56 38 10 33         | /|
>     |____________________________|/ /
>    /__/__/__/__/__/__/__/__/__/__/ /
>   /__/__/__/__/__/__/__/__/_____/ /
>  /__/__/__/__/__/__/__/__/__/__/ /
>  \_____________________________|/
> 
>