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.