Attribute mapping for generating SPARK 83 (Ada code)
For each Attribute, ACS generates a constant, variable, field within a record type, field within a variant record, or a discriminant:
If the Attribute has On Class storage and is read only, ACS generates a constant.
If the Attribute has On Class storage and is not read only, ACS generates a variable.
If the Attribute has On Instance storage, ACS generates a field within a record type or variant record type.
If the Attribute is stereotyped by the «Ada Discriminant» stereotype, ACS generates a discriminant in a variant record type.
If the Attribute is stereotyped by the «Ada Variant» stereotype, ACS generates a variant in a variant record type.
For multiple inheritances, inherited data member are contained within the record type of packages that represent inherited classes. They are represented as being fields of the record type of the inheriting package whose type is the type <inherited package>.object.
If the Multiplicity is 'zero or one', 'zero or more', 'one or more' or 'TBD', the Attribute is ignored.
The Behavior, Composite, Port and Unique properties are ignored.
Constant generation
The generation of a constant is derived from the properties of the Attribute and the Stereotypes and Tag Definitions that are applied to it:
The value of the Default property is generated as the value of the constant. For a character type variable, the Default value must include the single straight quotation marks.
If the Attribute is Read Only and has On Class storage, a constant is generated.
For Attributes that have On Class storage:
If the Attribute's Visibility property set to Public or Package, ACS generates a constant within the package specification.
If the Attribute's Visibility property set to Private, ACS generates a constant within the package body.
If the Attribute's Visibility property set to Protected, ACS generates a constant within the private area of the package specification.
If the Attribute is stereotyped by the «Ada Deferred Constant» stereotype, ACS generates a deferred constant.
If the Attribute is stereotyped by the «Ada Renames» stereotype, the Attribute is generated as a renames declaration.
If the Ada Rename Target Text tag definition (applied by the «Ada Renames» stereotype) specifies the name of a target constant, the renames declaration renames the specified constant.
If the Ada Rename Target Text is blank and the Ada Rename Target tag definition (applied by the «Ada Renames» stereotype) references an Attribute or Role in the Model, the renames declaration renames the constant that is generated from the referenced Attribute or Role.
If the Attribute is stereotyped by the «Ada Representation» stereotype, the generated constant declaration includes a representation clause. The tagged value of the Ada Representation Text tag definition is used to generate the representation clauses.
If the Attribute is stereotyped by the «Ada Type Binding» stereotype, the tagged value of the Ada Type Parameters tag definition is used to generate the parameters of the constant's type.
If the Attribute 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 Attribute is Read Only and it has no default value, an error is added to the Log.
Variable generation
The generation of a variable is derived from the properties of the Attribute and the Stereotypes and Tag Definitions that are applied to it:
The value of the Default property is generated as the default for the variable. For a character type variable, the Default value must include the single straight quotation marks.
If the Attribute is not Read Only and its Storage property is set to On Class, ACS generates a variable.
For Attributes that have On Class storage:
If the Attribute's Visibility property set to Public or Package, ACS generates a constant within the package specification.
If the Attribute's Visibility property set to Private, ACS generates a variable within the package body.
If the Attribute's Visibility property set to Protected, ACS generates a variable within the private area of the package specification.
If the Attribute is stereotyped by the «Ada Renames» stereotype, the Attribute is generated as a renames declaration.
If the Ada Rename Target Text tag definition (applied by the «Ada Renames» stereotype) specifies the name of a target variable, the renames declaration renames the specified variable.
If the Ada Rename Target Text is blank and the Ada Rename Target tag definition (applied by the «Ada Renames» stereotype) references an Attribute or Role in the Model, the renames declaration renames the variable that is generated from the referenced Attribute or Role.
If the Attribute 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 Attribute is stereotyped by the «Ada Type Binding» stereotype, the tagged value of the Ada Type Parameters tag definition is used to generate the parameters of the variable's type.
If the Attribute 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 Attribute is not Read Only and it has no data type, an error is added to the Log.
Field within a record type or variant record type generation
The generation of a Field within a record type is derived from the properties of the Attribute and the Stereotypes and Tag Definitions that are applied to it:
If the Attribute's Storage property is set to On Instance, ACS generates a field within the record type in the package specification, irrespective of the Attribute's Visibility.
If the Attribute is stereotyped by the «Ada Representation» stereotype, the generated field within a record type includes a representation clause. The tagged value of the Ada Representation Text tag definition is used to generate the representation clauses.
If the Attribute is stereotyped by the «Ada Type Binding» stereotype, the tagged value of the Ada Type Parameters tag definition is used to generate the parameters of the record type's type.
Discriminant generation in a variant record type
If the Attribute is stereotyped by the «Ada Discriminant» stereotype, ACS generates a discriminant. The «Ada Discriminant» stereotype is used only with Attributes that model the discriminants of a variant record type. For information about modeling variant record types in Modeler, see Modeling variant record types in Modeler (Ada code).
Variant generation in a variant record type
If the Attribute 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.
Was this helpful?