Issue 1535: Do POA servant classes need to use virtual inheritance? (cxx_revision) Source: (, ) Nature: Uncategorized Issue Severity: Summary: Summary: 2. The spec is silent on whether POA servant classes need to use virtual inheritence when an IDL class inherits from the same base interface more than once: // IDL interface A { void op(); }; interface B : A { }; interface C : A { }; value D : supports B, C { }; Must POA_B & POA_C inherit virtually from POA_A or can defined independently with all of interface A"s operations? This makes a big difference for values that support interfaces, since, for example, value D is defined by the C++ language mapping to inherit from both POA_B and POA_C. So, does value D inherit one or two versions of A::op()? Resolution: resolved Revised Text: Add the following to the end of section 1.36.6 of formal/99-07-41: For interfaces which inherit from one or more base interfaces, the generated POA skeleton class uses virtual inheritance: // IDL interface A { ... }; interface B : A { ... }; interface C : A { ... }; interface D : B, C { ... }; // C++ class POA_A : public virtual PortableServer::ServantBase { ... }; class POA_B : public virtual POA_A { ... }; class POA_C : public virtual POA_A { ... }; class POA_D : public virtual POA_B, public virtual POA_A { ... }; This guarantees that the POA skeleton class inherits only one version of each operation, and also allows optional inheritance of implementations. In this example, the implementation of interface B reuses the implementation of interface A: // C++ class A_impl: public virtual POA_A { ... }; class B_impl: public virtual POA_B, public virtual A_impl {}; For interfaces which inherit from an abstract interface, the POA skeleton class is also virtually derived directly from the abstract interface class, but with protected access: // IDL abstract interface A { ... }; interface B : A { ... }; // C++ class A { ... }; class POA_B : public virtual PortableServer::ServantBase, protected virtual A { ... }; The abstract interface is inherited with protected access to prevent accidental conversion of the POA skeleton pointer to an abstract interface reference, for ORBs which implement object references as pointers. This also allows implementation classes and valutypes to share an implementation of the abstract interface: // IDL valuetype V : supports A { ... }; // C++ class MyA : virtual A { ... }; class MyB : public virtual POA_B, protected virtual MyA { ... }; class MyV : public virtual V, public virtual MyA { ... }; Actions taken: June 18, 1998: received issue June 13, 2000: closded issue Discussion: A { }; End of Annotations:===== Return-Path: Sender: jon@floorboard.com Date: Thu, 18 Jun 1998 20:58:45 -0700 From: Jonathan Biggar To: cxx_revision@omg.org, issues@omg.org Subject: Problems with virtual inheritence of PortableServer::ServantBase 2. The spec is silent on whether POA servant classes need to use virtual inheritence when an IDL class inherits from the same base interface more than once: // IDL interface A { void op(); }; interface B : A { }; interface C : A { }; value D : supports B, C { }; Must POA_B & POA_C inherit virtually from POA_A or can defined independently with all of interface A's operations? This makes a big difference for values that support interfaces, since, for example, value D is defined by the C++ language mapping to inherit from both POA_B and POA_C. So, does value D inherit one or two versions of A::op()? -- Jon Biggar Floorboard Software jon@floorboard.com jon@biggar.org Sender: jon@floorboard.com Message-ID: <3855E705.B5069FD6@floorboard.com> Date: Mon, 13 Dec 1999 22:43:17 -0800 From: Jonathan Biggar X-Mailer: Mozilla 4.7 [en] (X11; U; SunOS 5.5.1 sun4m) X-Accept-Language: en MIME-Version: 1.0 To: cxx_revision@omg.org Subject: Proposal for issues 674, 1535 and 3078 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii X-UIDL: MZ'!!g41!!^S_!!dX8e9 Issue 674: Multiple inheritance of C++ Servants is ill-defined Issue 1535: Do POA servant classes need to use virtual inheritance? Another proposal already requires virtual! find it! Issue 3078: 1 of 4 issues with Abstract interfaces Proposal: Add the following to the end of section 1.36.6: For interfaces which inherit from one or more base interfaces, the generated POA skeleton class uses virtual inheritance: // IDL interface A { ... }; interface B : A { ... }; interface C : A { ... }; interface D : B, C { ... }; // C++ class POA_A : public virtual PortableServer::ServantBase { ... }; class POA_B : public virtual POA_A { ... }; class POA_C : public virtual POA_A { ... }; class POA_D : public virtual POA_B, public virtual POA_A { ... }; This guarantees that the POA skeleton class inherits only one version of each operation, and also allows optional inheritance of implementations. In this example, the implementation of interface B reuses the implementation of interface A: // C++ class A_impl: public virtual POA_A { ... }; class B_impl: public virtual POA_B, public virtual A_impl { }; For interfaces which inherit from an abstract interface, the POA skeleton class is also virtually derived directly from the abstract interface class, but with protected access: // IDL abstract interface A { ... }; interface B : A { ... }; // C++ class A { ... }; class POA_B : public virtual PortableServer::ServantBase, protected virtual A { ... }; The abstract interface is inherited with protected access to prevent accidental conversion of the POA skeleton pointer to an abstract interface reference, for ORBs which implement object references as pointers. This also allows implementation classes and valutypes to share an implementation of the abstract interface: // IDL valuetype V : supports A { ... }; // C++ class MyA : virtual A { ... }; class MyB : public virtual POA_B, protected virtual MyA { ... }; class MyV : public virtual V, public virtual MyA { ... }; -- Jon Biggar Floorboard Software jon@floorboard.com jon@biggar.org