Integrations (PTC products, 3rd party products and code) > Code integration (Ada, ARINC 653, C, C#, C++, IDL, Java, SQL and VB) > Ada Code > Generating Ada code > Mapping information for generation > Mapping information for SPARK 95 generation scheme > Association and aggregation mapping for generating SPARK 95 (Ada code)
  
Association and aggregation mapping for generating SPARK 95 (Ada code)
This topic applies to both Associations and Aggregations.
For each valid Association, ACS generates a variable or a field within an Ada package, record type or variant record type. An Association is valid only if the following criteria are true:
The Association Type is Start-end or End-start. If the Association Type is Bi-directional or None, the Association is ignored.
The Class or Data Type at the source end of the Association is generated as an Ada package, record type or variant record type.
The Class or Data Type at the destination end of the Association is generated as a record type or variant record type.
The Association (Role) Multiplicity is Only One or User Defined with a bounded range. If the Association has a different Multiplicity, the Association is ignored and an error is added to log.
The type of the variable or field within the record type is the record type of the package that represents the associated Class or Data Type.
The generation of a variable or field within the record type is derived from the properties of the Association and Role, and the Stereotypes and Tag Definitions that are applied to the Role:
Unnamed Roles are generated with an 'r' prefix, and named Roles are generated without an 'r' prefix. Prefixing and suffixing of named and unnamed Roles is controlled through the [role] and [unnamed role] sections of the Ada_mangle.ini file. For example, if you want all Roles to be generated with an 'r' prefix, ensure that the Role sections of the Ada_mangle.ini file are as follows:
[role]
AddPrefix=r
AddSuffix=
[unnamed role]
AddPrefix=r
AddSuffix=
If the Role owned by the Class or Data Type at the source end of the valid Association has On Instance storage, ACS generates a field within record type in the package specification.
If the Role owned by the Class or Data Type at the source end of the valid Association has On Class storage, ACS generates a variable. The Visibility property of the Role determines where the variable is declared:
If the Role's Visibility property set to Public or Package, ACS generates a variable within the package specification.
If the Role's Visibility property set to Private, ACS generates a variable within the package body.
If the Role's Visibility property set to Protected, ACS generates a variable within the private area of the package specification.
The Name of the role is used to generate the name of the variable, prefixed an 'r'. If the Role is unnamed, the name of the target class prefixed with an 'r' is used.
If the Role is stereotyped by the «Ada Representation» stereotype, the generated variable declaration includes a representation clause. The tagged value of the Ada Representation Text tag definition is used to generate the representation clauses.
If the Role is stereotyped by the «Ada Pragma» stereotype, the tagged value of the Ada Pragma Text tag definition (applied by the «Ada Pragma» stereotype) is used to generate the pragmas.
If the Role is stereotyped by the «Ada Typed Role» stereotype and the tagged value of the Ada Role Data Type tag definition (applied by the «Ada Typed Role» stereotype) references a Type Definition, the referenced Type Definition is generated as the data type.
If the Role is stereotyped by the «Ada Variant» stereotype, ACS generates the component of the record as a variant. The value of the Ada Case tag definition (applied by the «Ada Variant» stereotype) is generated as the variant text.
* 
The package specification created for the Class or Data Type at the source end of the Association includes a dependency to the package specification created for the Class or Data Type at the target end of Association.