pragma Pure(Streams);
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;
Stream : in out Root_Stream_Type;
Item : out Stream_Element_Array;
Last : out Stream_Element_Offset) is abstract;
Stream : in out Root_Stream_Type;
Item : in Stream_Element_Array) is abstract;
... -- not specified by the language
end Ada.Streams;
Stream : access Ada.Streams.Root_Stream_Type'Class;
Item : in T)
Stream : access Ada.Streams.Root_Stream_Type'Class;
Item : out T)
Stream : access Ada.Streams.Root_Stream_Type'Class;
Item : in T'Class)
Stream : access Ada.Streams.Root_Stream_Type'Class;
Item : out T'Class)
Stream : access Ada.Streams.Root_Stream_Type'Class;
Item : in T)
Stream : access Ada.Streams.Root_Stream_Type'Class)
return T
Stream : access Ada.Streams.Root_Stream_Type'Class;
Item : in T'Class)
Stream : access Ada.Streams.Root_Stream_Type'Class)
return T'Class
Stream : access Ada.Streams.Root_Stream_Type'Class; Item : My_Integer'Base);
for My_Integer'Write use My_Write;
generic
type Msg_Type(<>) is private;
package Network_IO is
-- Connect/Disconnect are used to establish the stream
procedure Connect(...);
procedure Disconnect(...);
procedure Send(X : in Msg_Type);
function Receive return Msg_Type;
private
type Network_Stream is new Root_Stream_Type with ...
procedure Read(...); -- define Read/Write for Network_Stream
procedure Write(...);
end Network_IO;
package body Network_IO is
Current_Stream : aliased Network_Stream;
. . .
procedure Connect(...) is ...;
procedure Disconnect(...) is ...;
begin
Msg_Type'Output(Current_Stream'Access, X);
end Send;
begin
return Msg_Type'Input(Current_Stream'Access);
end Receive;
end Network_IO;