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 > Constant mappings for reverse engineering Ada (Ada code)
  
Constant mappings for reverse engineering Ada (Ada code)
When reverse engineering a constant, the Reverser will reverse engineer a constant as a Role if all of the following statements are true:
The underlying type of the constant can be identified as a class in the code being reverse engineered.
The Reverser cannot match the constant to an Attribute in the Model.
Reversing a constant as an Attribute
When a constant 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 constant.
Constants are Reverse engineered as read-only Attributes with a default value defined.
The Visibility property of the reverse engineered Attribute is set according to how the constant is declared:
If the constant is declared in the parent Ada package specification, the Visibility property is set to Public.
If the constant is declared in the private region of the parent Ada package specification, the Visibility property is set to protected.
If the constant is declared in the parent package body, the Visibility property is set to Private.
For each constant:
The Attribute is Read-only.
The constant value is reverse engineered to the Default property of the Attribute.
The type of the constant 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 constant is a deferred constant, the Attribute is stereotyped by the «Ada Deferred Constant» stereotype.
If the constant is a number, the Type property of the Attribute is set to null.
If the aliased keyword is used, the Attribute is stereotyped by the «Ada Aliased» stereotype.
If the constant 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 constant 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 constant that is renamed by the renames declaration.
Reversing a constant as a Role
When a constant 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 constant. The name of the Role is set to that of the constant.
The Visibility property of the reverse engineered Role is set according to how the constant is declared:
If the constant is declared in the parent Ada package specification, the Visibility property is set to Public.
If the constant is declared in the private region of the parent Ada package specification, the Visibility property is set to protected.
If the constant is declared in the parent package body, the Visibility property is set to Private.
For each constant:
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.