* A custom stream type
@ 2014-07-27 20:08 Victor Porton
2014-07-27 20:39 ` Niklas Holsti
2014-07-28 7:21 ` Dmitry A. Kazakov
0 siblings, 2 replies; 3+ messages in thread
From: Victor Porton @ 2014-07-27 20:08 UTC (permalink / raw)
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?
--
Victor Porton - http://portonvictor.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: A custom stream type
2014-07-27 20:08 A custom stream type Victor Porton
@ 2014-07-27 20:39 ` Niklas Holsti
2014-07-28 7:21 ` Dmitry A. Kazakov
1 sibling, 0 replies; 3+ messages in thread
From: Niklas Holsti @ 2014-07-27 20:39 UTC (permalink / raw)
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
. @ .
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: A custom stream type
2014-07-27 20:08 A custom stream type Victor Porton
2014-07-27 20:39 ` Niklas Holsti
@ 2014-07-28 7:21 ` Dmitry A. Kazakov
1 sibling, 0 replies; 3+ messages in thread
From: Dmitry A. Kazakov @ 2014-07-28 7:21 UTC (permalink / raw)
On Sun, 27 Jul 2014 23:08:51 +0300, 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?
It was possible since Ada 95. Some custom stream implementations are here:
http://www.dmitry-kazakov.de/ada/components.htm#Streams
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-07-28 7:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-27 20:08 A custom stream type Victor Porton
2014-07-27 20:39 ` Niklas Holsti
2014-07-28 7:21 ` Dmitry A. Kazakov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox