Issue 5768: Concern about the mapping of valuetypes to Ada (ada-rtf) Source: Daimler AG (Mr. Oliver M. Kellogg, oliver.kellogg@eads.com Oliver.Kellogg@t-online.de) Nature: Uncategorized Issue Severity: Summary: The IDL to Ada mapping version 1.2 (01-10-42) of valuetypes causes serious problems when combined with other IDL constructs. Here is an example: // file: my_module.idl module my_module { valuetype vtype { public short member; }; typedef vtype array_of_vtype[10]; /* Further sources of problems: * struct struct_with_vtype { vtype smember; }; union union_with_vtype switch (boolean) { case true: vtype umember; }; */ }; The array_of_vtype cannot be mapped to Ada, neither can the struct_with_vtype or union_with_vtype. I propose a change to the mapping for valuetypes as follows: " A valuetype shall be mapped to a package, or a nested package when the valuetype is declared within a module. " For clarity, here is the mapping that I propose for the above example: -- file: my_module.ads with CORBA.Value; package my_module is package vtype is type Value_Ref is new CORBA.Value.Base with null record; Null_Value : constant Value_Ref; procedure Set_member (Self : in Value_Ref; To : in CORBA.Short); function Get_member (Self : in Value_Ref) return CORBA.Short; private -- elided end vtype; type array_of_vtype is array (0 .. 9) of vtype.Value_Ref; end my_module; The change of mapping also affects the naming rules for the generated Value_Impl package because in Ada, it is not possible to formulate child packages of nested packages. I propose the following naming scheme for the Value_Impl package: The name of the Value_Impl package be formed from the name of the value type mapped package with "_Value_Impl" appended. Thus, the name of the Value_Impl package for the above example would be: my_module.vtype_Value_Impl. Resolution: Revised Text: Actions taken: November 27, 2002: received issue Discussion: End of Annotations:===== Sender: oliver.kellogg@sysde.eads.net Date: Wed, 27 Nov 2002 10:29:07 +0100 From: Oliver Kellogg Organization: EADS Deutschland GmbH X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.4.18-17.7.x i686) X-Accept-Language: en To: issues@omg.org Subject: Concern about the mapping of valuetypes to Ada The IDL to Ada mapping version 1.2 (01-10-42) of valuetypes causes serious problems when combined with other IDL constructs. Here is an example: // file: my_module.idl module my_module { valuetype vtype { public short member; }; typedef vtype array_of_vtype[10]; /* Further sources of problems: * struct struct_with_vtype { vtype smember; }; union union_with_vtype switch (boolean) { case true: vtype umember; }; */ }; The array_of_vtype cannot be mapped to Ada, neither can the struct_with_vtype or union_with_vtype. I propose a change to the mapping for valuetypes as follows: " A valuetype shall be mapped to a package, or a nested package when the valuetype is declared within a module. " For clarity, here is the mapping that I propose for the above example: -- file: my_module.ads with CORBA.Value; package my_module is package vtype is type Value_Ref is new CORBA.Value.Base with null record; Null_Value : constant Value_Ref; procedure Set_member (Self : in Value_Ref; To : in CORBA.Short); function Get_member (Self : in Value_Ref) return CORBA.Short; private -- elided end vtype; type array_of_vtype is array (0 .. 9) of vtype.Value_Ref; end my_module; The change of mapping also affects the naming rules for the generated Value_Impl package because in Ada, it is not possible to formulate child packages of nested packages. I propose the following naming scheme for the Value_Impl package: The name of the Value_Impl package be formed from the name of the value type mapped package with "_Value_Impl" appended. Thus, the name of the Value_Impl package for the above example would be: my_module.vtype_Value_Impl. -- Oliver M. Kellogg Naval and Ground Operations (NGO2) Systems and Defence Electronics EADS Deutschland GmbH D-89070 Ulm, Germany e-mail: oliver.kellogg@sysde.eads.net tel.: (+49) 731 392-7138 fax: (+49) 731 392-5826