Issue 3079: 2 of4 issues with Abstract interfaces (cxx_revision) Source: Floorboard Software (Mr. Jonathan Biggar, jon(at)floorboard.com) Nature: Uncategorized Issue Severity: Summary: 2. I do not understand this bullet in section 1.18.2: "o Inserting an abstract interface reference into a CORBA::Any operates polymorphically; either the object reference or valuetype to which the abstract interface reference refers is what actually gets inserted into the Any. Because abstract interfaces cannot actually be inserted into an Any, there is no need for abstract interface extraction operators, either. The CORBA::Any::to_abstract_base type allows the contents of an Any to be extracted as an AbstractBase if the entity stored in the Any is an object reference type or a valuetype directly or indirectly derived from the AbstractBase base class. See Section 1.16.6, Widening to Abstract Interface, on page 1-62 for details." This seems to make no sense. It seems to state that the actual reference or valuetype is inserted into the Any, which means that the TCKind associated with the any will be tk_objref or tk_value, not tk_abstract_interface. This seems to have particularly bad implications with the DII & DSI. How does the DII know to encode an abstract interface correctly in CDR if the Any it receives doesn't have a tk_abstract_interface TypeCode? It also means that an application which only knows the abstract interface type must handle the case where the Any has a tk_objref or tk_value instead, use Any::to_abstract_interface and then a narrow call to get the abstract interface pointer it needs. This seems needlessly complex and unnecessary. This bullet should be replaced with one that just states that abstract interfaces have inserters and extractors generated for them just like normal interfaces. Resolution: closed/resolved Revised Text: Replace the fourth bullet in Section 1.18.2 of formal/99-07-41 with: Normal Any insertion and extraction operators are generated for abstract interfaces. The Any::to_object, Any::to_abstract_base and Any::to_value types can be used to extract the contents of an Any as a generic object reference, abstract object reference, or valuetype. Add before the last paragraph of 1.16.6: The caller is responsible for releasing the returned AbstractBase_ptr. Add a new section 1.16.7, before the existing 1.16.7: 1.16.7 Widening to ValueBase The CORBA::Any::to_value type allows the contents of an Any to be extracted as an ValueBase * if the entity stored in the Any is a valuetype. The to_value type is shown below: // C++ class Any { public: ... struct to_value { to_value(ValueBase *& base) : ref(base) {} AbstractBase_ptr& ref; }; Boolean operator>>=(to_value val) const; ... }; The caller is responsible for calling _remove_ref() on the returned ValueBase pointer. See Section 1.17.5, ValueBase and Reference Counting, on page 1-XXX for a description of ValueBase. Actions taken: December 4, 1999: receive dissue June 13, 2000: closed issue Discussion: End of Annotations:===== Sender: jon@floorboard.com Message-ID: <38498A7B.7A705E6@floorboard.com> Date: Sat, 04 Dec 1999 13:41:15 -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: issues@omg.org, cxx_revision@omg.org Subject: 4 issues with Abstract interfaces 2. I do not understand this bullet in section 1.18.2: "o Inserting an abstract interface reference into a CORBA::Any operates polymorphically; either the object reference or valuetype to which the abstract interface reference refers is what actually gets inserted into the Any. Because abstract interfaces cannot actually be inserted into an Any, there is no need for abstract interface extraction operators, either. The CORBA::Any::to_abstract_base type allows the contents of an Any to be extracted as an AbstractBase if the entity stored in the Any is an object reference type or a valuetype directly or indirectly derived from the AbstractBase base class. See Section 1.16.6, Widening to Abstract Interface, on page 1-62 for details." This seems to make no sense. It seems to state that the actual reference or valuetype is inserted into the Any, which means that the TCKind associated with the any will be tk_objref or tk_value, not tk_abstract_interface. This seems to have particularly bad implications with the DII & DSI. How does the DII know to encode an abstract interface correctly in CDR if the Any it receives doesn't have a tk_abstract_interface TypeCode? It also means that an application which only knows the abstract interface type must handle the case where the Any has a tk_objref or tk_value instead, use Any::to_abstract_interface and then a narrow call to get the abstract interface pointer it needs. This seems needlessly complex and unnecessary. This bullet should be replaced with one that just states that abstract interfaces have inserters and extractors generated for them just like normal interfaces. ----------------------------------------------------------------------------------- X-Sender: vinoski@mail.boston.amer.iona.com X-Mailer: QUALCOMM Windows Eudora Pro Version 4.1 Date: Sat, 04 Dec 1999 21:25:14 -0500 To: Jonathan Biggar From: Steve Vinoski Subject: Re: 4 issues with Abstract interfaces Cc: cxx_revision@omg.org In-Reply-To: <38498A7B.7A705E6@floorboard.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-UIDL: N!7e9VQbd9;)W!!U58!! At 01:41 PM 12/4/99 -0800, Jonathan Biggar wrote: >2. I do not understand this bullet in section 1.18.2: > >"o Inserting an abstract interface reference into a CORBA::Any operates >polymorphically; either the object reference or valuetype to which the >abstract interface reference refers is what actually gets inserted into >the Any. Because abstract interfaces cannot actually be inserted into an >Any, there is no need for abstract interface extraction operators, >either. The CORBA::Any::to_abstract_base type allows the contents of an >Any to be extracted as an AbstractBase if the entity stored in the Any >is an object reference type or a valuetype directly or indirectly >derived from the AbstractBase base class. See Section 1.16.6, Widening >to Abstract Interface, on page 1-62 for details." > >This seems to make no sense. It seems to state that the actual >reference or valuetype is inserted into the Any, which means that the >TCKind associated with the any will be tk_objref or tk_value, not >tk_abstract_interface. That's because when it was written, there was no such thing as tk_abstract_interface. --steve Sender: jon@floorboard.com Message-ID: <3849D5B9.8B01B932@floorboard.com> Date: Sat, 04 Dec 1999 19:02: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: Steve Vinoski CC: cxx_revision@omg.org Subject: Re: 4 issues with Abstract interfaces References: <4.1.19991204212430.00d468f0@mail.boston.amer.iona.com> Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii X-UIDL: G;n!!@;J!!"lQ!!&<"!! Steve Vinoski wrote: > > At 01:41 PM 12/4/99 -0800, Jonathan Biggar wrote: > >2. I do not understand this bullet in section 1.18.2: > > > >"o Inserting an abstract interface reference into a CORBA::Any > operates > >polymorphically; either the object reference or valuetype to which > the > >abstract interface reference refers is what actually gets inserted > into > >the Any. Because abstract interfaces cannot actually be inserted > into an > >Any, there is no need for abstract interface extraction operators, > >either. The CORBA::Any::to_abstract_base type allows the contents > of an > >Any to be extracted as an AbstractBase if the entity stored in the > Any > >is an object reference type or a valuetype directly or indirectly > >derived from the AbstractBase base class. See Section 1.16.6, > Widening > >to Abstract Interface, on page 1-62 for details." > > > >This seems to make no sense. It seems to state that the actual > >reference or valuetype is inserted into the Any, which means that > the > >TCKind associated with the any will be tk_objref or tk_value, not > >tk_abstract_interface. > > That's because when it was written, there was no such thing as > tk_abstract_interface. Ok, then we need to strike this bullet and replace it with the appropriate text that exlains that abstract interfaces DO have inserters & extractors. On a related note, if I have an abstract interface value in an Any, can I call Any::to_object() to get an object reference, assuming that the actual type is a reference? -- Jon Biggar Floorboard Software jon@floorboard.com jon@biggar.org Received: from floorboard.com ([170.1.176.53]) by emerald.omg.org (8.9.2/8.9.2) with SMTP id CAA00598 for ; Tue, 14 Dec 1999 02:18:08 -0500 (EST) Received: from floorboard.com by floorboard.com (SMI-8.6/SMI-SVR4) id XAA22146; Mon, 13 Dec 1999 23:10:08 -0800 Sender: jon@floorboard.com Message-ID: <3855ED50.5213E406@floorboard.com> Date: Mon, 13 Dec 1999 23:10:08 -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: Proposals for issues 2498, 3079, 3081, 3092, and 3113 Issue 3079: 2 of 4 issues with Abstract interfaces Issue 3092: Need Any::to_value operation? Issue 3113: Any::to_abstract_base needs statement about memory management Proposal: Replace the fourth bullet in Section 1.18.2 with: o Normal Any insertion and extraction operators are generated for abstract interfaces. The Any::to_object, Any::to_abstract_base and Any::to_value types can be used to extract the contents of an Any as a generic object reference, abstract object reference, or valuetype. Add before the last paragraph of 1.16.6: The caller is responsible for releasing the returned AbstractBase_ptr. Add a new section 1.16.7, before the existing 1.16.7: 1.16.7 Widening to ValueBase The CORBA::Any::to_value type allows the contents of an Any to be extracted as an ValueBase * if the entity stored in the Any is a valuetype. The to_value type is shown below: // C++ class Any { public: ... struct to_value { to_value(ValueBase *& base) : ref(base) {} AbstractBase_ptr& ref; }; Boolean operator>>=(to_value val) const; ... }; The caller is responsible for calling _remove_ref() on the returned ValueBase pointer. See Section 1.17.5, ValueBase and Reference Counting, on page 1-XXX for a description of ValueBase. -- Jon Biggar Floorboard Software jon@floorboard.com jon@biggar.org