Ada Conformity Assessment Authority      Home Conformity Assessment   Test Suite ARGAda Standard
 
Ada Reference Manual (Ada 2022)Legal Information
Contents   Index   References   Search   Previous   Next 

A.18.32 The Generic Package Containers.Bounded_Indefinite_Holders

1/5
The language-defined generic package Containers.Bounded_Indefinite_Holders provides a private type Holder and a set of operations for that type. It provides the same operations as the package Containers.Indefinite_Holders (see A.18.18), with the difference that the maximum storage is bounded. 

Static Semantics

2/5
The declaration of the generic library package Containers.Bounded_Indefinite_Holders has the same contents and semantics as Containers.Indefinite_Holders except:
3/5
The following is added to the context clause:
4/5
   with System.Storage_Elements; use System.Storage_Elements;
5/5
An additional generic parameter follows Element_Type:
6/5
   Max_Element_Size_in_Storage_Elements : Storage_Count;
7/5
The aspect_definition for Preelaborable_Initialization for type Holder is changed to: 
8/5
  Preelaborable_Initialization =>
     Element_Type'Preelaborable_Initialization
9/5
Add to the precondition of To_Holder and Replace_Element:
10/5
  and then (New_Item'Size <=
               Max_Element_Size_in_Storage_Elements * System.Storage_Unit
            or else raise Program_Error)

Bounded (Run-Time) Errors

11/5
It is a bounded error to assign from a bounded holder object while tampering with elements of that object is prohibited. Either Program_Error is raised by the assignment, execution proceeds with the target object prohibiting tampering with elements, or execution proceeds normally. 

Implementation Requirements

12/5
For each instance of Containers.Indefinite_Holders and each instance of Containers.Bounded_Indefinite_Holders, if the two instances meet the following conditions, then the output generated by the Holder'Output or Holder'Write subprograms of either instance shall be readable by the Holder'Input or Holder'Read of the other instance, respectively:
13/5
the Element_Type parameters of the two instances are statically matching subtypes of the same type; and
14/5
the output generated by Element_Type'Output or Element_Type'Write is readable by Element_Type'Input or Element_Type'Read, respectively (where Element_Type denotes the type of the two actual Element_Type parameters). 

Implementation Advice

15/5
Bounded holder objects should be implemented without dynamic allocation and any finalization should be trivial unless Element_Type needs finalization. 
16/5
The Implementation Advice about the Move and Swap operations is deleted for bounded holders; these operations can copy elements as necessary.

Contents   Index   References   Search   Previous   Next 
Ada-Europe Ada 2005 and 2012 Editions sponsored in part by Ada-Europe