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

13.13.1 The Package Streams

Static Semantics
The abstract type Root_Stream_Type is the root type of the class of stream types. The types in this class represent different kinds of streams. A new stream type is defined by extending the root type (or some other stream type), overriding the Read and Write operations, and optionally defining additional primitive subprograms, according to the requirements of the particular kind of stream. The predefined stream-oriented attributes like T'Read and T'Write make dispatching calls on the Read and Write procedures of the Root_Stream_Type. (User-defined T'Read and T'Write attributes can also make such calls, or can call the Read and Write attributes of other types.)
       package Ada.Streams is
           pragma Pure(Streams);
           type Root_Stream_Type is abstract tagged limited private;
           type Stream_Element is mod implementation-defined;
           type Stream_Element_Offset is range implementation-defined;
           subtype Stream_Element_Count is
               Stream_Element_Offset range 0..Stream_Element_Offset'Last;
           type Stream_Element_Array is
               array(Stream_Element_Offset range <>) of Stream_Element;
           procedure Read(
             Stream : in out Root_Stream_Type;
             Item   : out Stream_Element_Array;
             Last   : out Stream_Element_Offset) is abstract;
           procedure Write(
             Stream : in out Root_Stream_Type;
             Item   : in Stream_Element_Array) is abstract;
          ... -- not specified by the language
       end Ada.Streams;
The Read operation transfers Item'Length stream elements from the specified stream to fill the array Item. The index of the last stream element transferred is returned in Last. Last is less than Item'Last only if the end of the stream is reached.
The Write operation appends Item to the specified stream.


____ | 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