Prev | Up | Next | Back | Forward
TOC -- / --.-- / --.--.-- | Index | Search | Syntax | Help


A.9 The Generic Package Storage_IO

(1)
The generic package Storage_IO provides for reading from and writing to an in-memory buffer. This generic package supports the construction of user-defined input-output packages.
Static Semantics
(2)
The generic library package Storage_IO has the following declaration:
(3)
       with Ada.IO_Exceptions;
       with System.Storage_Elements;
       generic
          type Element_Type is private;
       package Ada.Storage_IO is
          pragma Preelaborate(Storage_IO);
(4)
          Buffer_Size : constant System.Storage_Elements.Storage_Count := implementation-defined;
          subtype Buffer_Type is System.Storage_Elements.Storage_Array(1..Buffer_Size);
(5)
          -- Input and output operations
(6)
          procedure Read (Buffer : in  Buffer_Type; Item : out Element_Type);
(7)
          procedure Write(Buffer : out Buffer_Type; Item : in  Element_Type);
(8)
          -- Exceptions
(9)
          Data_Error   : exception renames IO_Exceptions.Data_Error;
       end Ada.Storage_IO;
(10)
In each instance, the constant Buffer_Size has a value that is the size (in storage elements) of the buffer required to represent the content of an object of subtype Element_Type, including any implicit levels of indirection used by the implementation. The Read and Write procedures of Storage_IO correspond to the Read and Write procedures of Direct_IO (see A.8.4), but with the content of the Item parameter being read from or written into the specified Buffer, rather than an external file.

(11)


Prev | Up | Next | Back | Forward
TOC -- / --.-- / --.--.-- | Index | Search | Syntax | Help

Ada WWW Home -- Email comments, additions, corrections, gripes, kudos, etc. to:

Magnus Kempe -- Magnus.Kempe@di.epfl.ch
Copyright statement
Page last generated: 95-03-12