--------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------- -- 23 package Asis.Data_Decomposition.Portable_Transfer --------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------- package Asis.Data_Decomposition.Portable_Transfer is --------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------- -- Asis.Data_Decomposition.Portable_Transfer -- -- This package is part of the optional Asis.Data_Decomposition package. -- It may or may not be present in all ASIS implementations. -- -- It provides support for logging and delogging of application data using -- ASIS. -- -- These interfaces do not make use of the normal ASIS implementation. -- This is a standalone package. It is not necessary to initialize ASIS -- before using this interface. -- -- This interface is intended to be separate from the normal ASIS -- implementation. That is, linking with this interface does not cause the -- full ASIS implementation to be linked with an application. This keeps the -- memory cost of this facility to a minimum. However, it also means that the -- normal ASIS exceptions, Status, and Diagnosis facilities are not available. -- This interface may propagate exceptions other than those defined in -- Asis.Errors. In particular, the I/O facilities may raise any of the -- normal Ada I/O exceptions from package Ada.Io_Exceptions. -- --------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------- -- Generics that create portable data streams. --------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------- -- 23.1 generic package Portable_Constrained_Subtype --------------------------------------------------------------------------------------- generic -- Ada notation for a constrained subtype. -- type Constrained_Subtype (<>) is private; type Constrained_Subtype is private; package Portable_Constrained_Subtype is function Convert (Value : in Constrained_Subtype) return Asis.Data_Decomposition.Portable_Data; end Portable_Constrained_Subtype; --------------------------------------------------------------------------------------- -- Value - Specifies a data value which is to be converted to a portable -- data stream -- -- Instantiated with a scalar subtype, or a fully constrained composite -- subtype, this function will correctly convert values of that subtype to a -- portable data value. "Correctly" means that no information is lost. No -- guarantee is made that the result will not be larger (larger 'Size) than -- the argument. -- -- Instantiation of this generic, with arguments other than scalar types or -- fully constrained subtypes, will fail to compile or will fail to execute -- and raise Constraint_Error. -- --------------------------------------------------------------------------------------- -- 23.2 generic package Portable_Unconstrained_Record_Type --------------------------------------------------------------------------------------- generic type Unconstrained_Record_Type is private; package Portable_Unconstrained_Record_Type is function Convert (Value : in Unconstrained_Record_Type) return Asis.Data_Decomposition.Portable_Data; end Portable_Unconstrained_Record_Type; --------------------------------------------------------------------------------------- -- Value - Specifies a record value which is to be converted to a portable -- data stream -- -- Instantiated with a record type, this function will correctly convert -- values of that type to a portable data value. "Correctly" means that no -- information is lost. No guarantee is made that the result will not be -- larger (larger 'Size) than the argument. -- -- This generic may also be instantiated with fully constrained subtypes. -- However, the Portable_Constrained_Subtype generic is likely to be a more -- efficient mechanism for these subtypes. -- -- Instantiation of this generic, with unconstrained array types, will not -- fail at compile time or at runtime. However, no guarantee is made that -- such instantiations will operate correctly; data could be lost. -- --------------------------------------------------------------------------------------- -- 23.3 generic package Portable_Array_Type_1 --------------------------------------------------------------------------------------- generic type Element_Type is private; type Index_Type is (<>); type Array_Type is array (Index_Type range <>) of Element_Type; package Portable_Array_Type_1 is function Convert (Value : in Array_Type) return Asis.Data_Decomposition.Portable_Data; end Portable_Array_Type_1; --------------------------------------------------------------------------------------- -- 23.4 generic package Portable_Array_Type_2 --------------------------------------------------------------------------------------- generic type Element_Type is private; type Index_Type_1 is (<>); type Index_Type_2 is (<>); type Array_Type is array (Index_Type_1 range <>, Index_Type_2 range <>) of Element_Type; package Portable_Array_Type_2 is function Convert (Value : in Array_Type) return Asis.Data_Decomposition.Portable_Data; end Portable_Array_Type_2; --------------------------------------------------------------------------------------- -- 23.5 generic package Portable_Array_Type_3 --------------------------------------------------------------------------------------- generic type Element_Type is private; type Index_Type_1 is (<>); type Index_Type_2 is (<>); type Index_Type_3 is (<>); type Array_Type is array (Index_Type_1 range <>, Index_Type_2 range <>, Index_Type_3 range <>) of Element_Type; package Portable_Array_Type_3 is function Convert (Value : in Array_Type) return Asis.Data_Decomposition.Portable_Data; end Portable_Array_Type_3; --------------------------------------------------------------------------------------- -- Value - Specifies an array value which is to be converted to a portable -- data stream -- -- Instantiated with an unconstrained array subtype, this function will -- correctly convert values of that subtype to a portable data value. -- "Correctly" means that no information is lost. No guarantee is made that -- the result will not be larger (larger 'Size) than the argument. -- This interface will correctly capture the array index (dope vector) -- information associated with the array value. -- -- Use the Portable_Constrained_Subtype generic for statically constrained -- array subtypes. -- -- Array types with more than 3 dimensions can be converted to portable data -- streams by placing them inside a discriminated record type (where the -- discriminants are the dynamic array index constraints) and then converting -- the record value. The record will then contain the necessary array index -- (dope vector) information. -- --------------------------------------------------------------------------------------- end Asis.Data_Decomposition.Portable_Transfer;