From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED.vgGlwuxQpjN0s/naYp4vQQ.user.gioia.aioe.org!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: General circular buffer example not tied to any specific type Date: Fri, 25 Sep 2020 15:32:01 +0100 Organization: Aioe.org NNTP Server Message-ID: References: <6ca9747e-698f-4d60-8e23-b883da5d9f38o@googlegroups.com> NNTP-Posting-Host: vgGlwuxQpjN0s/naYp4vQQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (darwin) Cancel-Lock: sha1:cN7GFEb0JPxZtKMHIoUKZBdqE/U= X-Notice: Filtered by postfilter v. 0.9.2 Xref: reader02.eternal-september.org comp.lang.ada:60271 List-Id: Daniel 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