comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: General circular buffer example not tied to any specific type
Date: Fri, 25 Sep 2020 15:32:01 +0100	[thread overview]
Message-ID: <lyy2kyyljy.fsf@pushface.org> (raw)
In-Reply-To: 6ca9747e-698f-4d60-8e23-b883da5d9f38o@googlegroups.com

Daniel <danielnorberto@gmail.com> writes:

> Hello, any theoric 
>  example of buffer i can find is always tied to an specific type.
>
> I'm looking for any example of ravenscar buffer able for using any
> type of data at the same time.
>
> I suppose it will need to serialize all data and manipulate it as a
> group of bytes.

As J-P has said, you could use 'Write and 'Read (or better, 'Output and
'Input) to write to a stream.

The beginnings of an alternative, which I last worked on a while ago, is
at [1]; it's an Ada implementation of part of MessagePack[2] (boolean,
integer, float, string). Still a way to go!

Writing arbitrary data to a stream using 'Write/'Output suffers from the
disadvantage that the reading side won't know what to expect unless you
have some protocol in place. This Message_Pack doesn't eliminate this at
all.

For a while, I supported a scheme where all the data to be transmitted
had to be instances of a tagged type e.g. Base; as far as I can
remember, you output the data using Base'Class'Output and read it in
using Base'Class'Input.

[1]
https://sourceforge.net/u/simonjwright/msgpack-ada/code/ci/master/tree/
[2] https://en.wikipedia.org/wiki/MessagePack

      parent reply	other threads:[~2020-09-25 14:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-04 17:00 General circular buffer example not tied to any specific type Daniel
2020-07-04 17:25 ` Dmitry A. Kazakov
2020-07-05  9:37   ` Simon Wright
2020-07-05  9:52     ` Simon Wright
2020-07-05 13:25       ` Jeffrey R. Carter
2020-07-05 15:36         ` Simon Wright
2020-07-05 18:46           ` Dmitry A. Kazakov
2020-07-05 19:51             ` Simon Wright
2020-07-06  8:11         ` Simon Wright
2020-07-06  8:58           ` Jeffrey R. Carter
2020-07-06 10:34             ` Simon Wright
2020-07-06 11:07               ` Dmitry A. Kazakov
2020-09-03 10:31 ` riya patel
2020-09-24  4:10 ` nimaopatel121
2020-09-24  4:39   ` J-P. Rosen
2020-09-25 14:32 ` Simon Wright [this message]
replies disabled

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