comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: A custom stream type
Date: Sun, 27 Jul 2014 23:39:45 +0300
Date: 2014-07-27T23:39:45+03:00	[thread overview]
Message-ID: <c3l6ceFg8smU1@mid.individual.net> (raw)
In-Reply-To: <lr3m8f$q34$1@speranza.aioe.org>

On 14-07-27 23:08 , Victor Porton wrote:
> I want to create a custom stream type (not the files provided by the OS, but 
> something different, such as saving results of write operations into a 
> container, or calling a C stream library or whatever).
> 
> How to do it with Ada2012?

Derive your stream type from the root of all streams:


   with Ada.Streams;

   ...


   type My_Stream is new Ada.Streams.Root_Stream_Type
   with record ... end record;


and then override (i.e. implement) the Read and Write operations for
My_Stream.

See the package Ada.Streams, RM 13.13.1.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
      .      @       .



  reply	other threads:[~2014-07-27 20:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-27 20:08 A custom stream type Victor Porton
2014-07-27 20:39 ` Niklas Holsti [this message]
2014-07-28  7:21 ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox