Integrations (PTC products, 3rd party products and code) > Code integration (Ada, ARINC 653, C, C#, C++, IDL, Java, SQL and VB) > Ada Code > Reverse engineering legacy Ada code > Mapping information for Reverse engineering Ada > Variable mappings for reverse engineering Ada (Ada code)
  
Variable mappings for reverse engineering Ada (Ada code)
For each variable, the Reverser creates an Attribute or a Role.
When reverse engineering a variable, the Reverser will reverse engineer a variable as a Role if all of the following statements are true:
The underlying type of the variable can be identified as a class in the code being reverse engineered.
The Reverser cannot match the variable to an Attribute in the Model.
Reversing a variable as an Attribute
When a variable is reverse engineered as an Attribute, the Reverser creates an Attribute in the Package or Class that is created for the owning Ada package. The name of the Attribute is that of the variable.
Variables are reverse engineered as Attributes that are not read-only.
The Visibility property of the reverse engineered Attribute is set according to how the type is declared:
If the type is declared in the parent Ada package specification, the Visibility property is set to Public.
If the type is declared in the private region of the parent Ada package specification, the Visibility property is set to protected.
If the type is declared in the parent package body, the Visibility property is set to Private.
For each variable:
The Attribute is set to not Read-only.
The Default property of the Attribute is set to null.
The type of the variable is reverse engineered as the Type property of the Attribute:
If the Reverser can match the name of the type to a Type Definition or Basic Type in the Model, the Type property references the matching type.
If the Reverser cannot match the name of the type to a Type Definition or Basic Type in the Model, the Reverser creates a Basic Type, Type Definition or Class for the type. The Type property of the Attribute references the Basic type, Type Definition or Class that is created. For information about how the types are reverse engineered, click here
If the aliased keyword is used, the Attribute is stereotyped by the «Ada Aliased» stereotype.
If the variable has a parameterized type, the Attribute is stereotyped by the «Ada Type Binding» stereotype. The parameter text (the text between the opening and closing parentheses) is reverse engineered to the tagged value of the Ada Type Parameters tag definition, which is applied to the Type Definition by the «Ada Type Binding» stereotype.
For each renames declaration that renames a variable, the Reverser creates an Attribute for the renames declaration. The name of the new Attribute is as specified by the renames declaration, and the Attribute is created in the Package or Class created for the parent Ada package. The new Attribute is stereotyped by the «Ada Renames» stereotype:
If the Reverser can find the target Attribute in the Model, the Attribute that is renamed by the renames declaration is referenced through the tagged value of the Ada Rename Target tag definition (applied by the «Ada Renames» stereotype).
If the Reverser cannot find the target Package or Class in the Model, the tagged value of the Ada Rename Target Text tag definition (applied by the «Ada Renames» stereotype) is set to the name of the variable that is renamed by the renames declaration.
Reversing a variable as a Role
When a variable is reverse engineered as a Role, the Reverser creates an Association from the Class that is created for the owning Ada package to the Class that is identified as the underlying type of the variable. The name of the Role is set to that of the variable.
The Visibility property of the reverse engineered Role is set according to how the variable is declared:
If the variable is declared in the parent Ada package specification, the Visibility property is set to Public.
If the variable is declared in the private region of the parent Ada package specification, the Visibility property is set to protected.
If the variable is declared in the parent package body, the Visibility property is set to Private.
For each variable:
The Role is set to not Read-only.
The Default property of the Role is set to null.
If the aliased keyword is used, the Role is stereotyped by the «Ada Aliased» stereotype.