wiki:League/IO

Input/Output

This page contains some ideas to implement input/output subsystem.

Input stream with notification capability

with Ada.Streams;
with Interfaces;

with League.Strings;

package League.Input_Streams is

   pragma Preelaborate;

   type Input_Stream is limited interface;

   type Input_Stream_Listener is limited interface;

   not overriding function At_End
    (Self : not null access constant Input_Stream) return Boolean is abstract;

   not overriding function Bytes_Available
    (Self : not null access constant Input_Stream) return Interfaces.Unsigned_64 is abstract;

   not overriding function Error_String
    (Self : not null access constant Input_Stream)
       return League.Strings.Universal_String is abstract;

   not overriding function Is_Open
    (Self : not null access constant Input_Stream)
       return Boolean is abstract;

   not overriding procedure Read
    (Self    : not null access Input_Stream;
     Buffer  : out Ada.Streams.Stream_Element_Array;
     Last    : out Ada.Streams.Stream_Element_Offset;
     Success : out Boolean) is abstract;

   not overriding procedure Read
    (Self    : not null access Input_Stream;
     Buffer  : out Ada.Streams.Stream_Element_Array;
     Last    : out Ada.Streams.Stream_Element_Offset;
     Success : out Boolean) is abstract;

   procedure Read
    (Self   : not null access Input_Stream'Class;
     Buffer : out Ada.Streams.Stream_Element_Array;
     Last   : out Ada.Streams.Stream_Element_Offset);

   not overriding procedure Add_Listener
    (Self     : not null access constant Input_Stream'Class;
     Listener : not null access Input_Stream_Listener'Class) is abstract;

   ---------------------------
   -- Input_Stream_Listener --
   ---------------------------

   not overriding procedure On_Ready_To_Read
    (Self   : not null access Input_Stream_Listener;
     Stream : not null access Input_Stream'Class) is abstract;

   not overriding procedure On_Stream_Finished
    (Self   : not null access Input_Stream_Listener;
     Stream : not null access Input_Stream'Class) is abstract;

end League.Input_Streams;
Last modified 11 years ago Last modified on Aug 3, 2010, 3:13:14 PM
Note: See TracWiki for help on using the wiki.