Next: , Previous: Pragma Short_Descriptors, Up: Implementation Defined Pragmas


2.156 Pragma Simple_Storage_Pool_Type

Syntax:

    pragma Simple_Storage_Pool_Type (type_LOCAL_NAME);

A type can be established as a 'simple storage pool type' by applying the representation pragma Simple_Storage_Pool_Type to the type. A type named in the pragma must be a library-level immutably limited record type or limited tagged type declared immediately within a package declaration. The type can also be a limited private type whose full type is allowed as a simple storage pool type.

For a simple storage pool type SSP, nonabstract primitive subprograms Allocate, Deallocate, and Storage_Size can be declared that are subtype conformant with the following subprogram declarations:

    procedure Allocate
      (Pool                     : in out SSP;
       Storage_Address          : out System.Address;
       Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
       Alignment                : System.Storage_Elements.Storage_Count);
    
    procedure Deallocate
      (Pool : in out SSP;
       Storage_Address          : System.Address;
       Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
       Alignment                : System.Storage_Elements.Storage_Count);
    
    function Storage_Size (Pool : SSP)
      return System.Storage_Elements.Storage_Count;

Procedure Allocate must be declared, whereas Deallocate and Storage_Size are optional. If Deallocate is not declared, then applying an unchecked deallocation has no effect other than to set its actual parameter to null. If Storage_Size is not declared, then the Storage_Size attribute applied to an access type associated with a pool object of type SSP returns zero. Additional operations can be declared for a simple storage pool type (such as for supporting a mark/release storage-management discipline).

An object of a simple storage pool type can be associated with an access type by specifying the attribute Simple_Storage_Pool. For example:

    My_Pool : My_Simple_Storage_Pool_Type;
    
    type Acc is access My_Data_Type;
    
    for Acc'Simple_Storage_Pool use My_Pool;

See attribute Simple_Storage_Pool for further details.