From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7e490a18b9688bd9 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.31.34 with SMTP id x2mr239892pbh.17.1316031180210; Wed, 14 Sep 2011 13:13:00 -0700 (PDT) X-FeedAbuse: http://nntpfeed.proxad.net/abuse.pl feeded by 88.191.131.2 Path: m9ni6332pbd.0!nntp.google.com!news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!nntpfeed.proxad.net!news.dougwise.org!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Stream_Element_Array Date: Wed, 14 Sep 2011 22:13:03 +0200 Organization: cbb software GmbH Message-ID: References: <1e6rw4vto3ldb.i8d7fxixapx4.dlg@40tude.net> <28u4e86fk8gn$.ialexttobgr0$.dlg@40tude.net> <276b8d0a-5b3c-4559-a275-98620657cc2f@s30g2000pri.googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: EkTvLkEqyIxcfrnqQC78nQ.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news1.google.com comp.lang.ada:17970 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2011-09-14T22:13:03+02:00 List-Id: On Wed, 14 Sep 2011 10:16:09 -0700 (PDT), Alexander Korolev wrote: > I've been advised and that worked out for many in few cases to use > Volatile_Streams.Memory_Resident_Stream. This is not what you need. It is a stream backed by the memory. I also implemented such, backed by a String object, that is when you write, you do into the string, when you read then from the string. In your case the other end is not the memory but the wire. This is what Serial_Port of GNAT.Serial_Communications is, an implementation of stream. So you simply derive or aggregate a new type from/into it, place there an output buffer of Stream_Element_Array of the maximal message size, and Stream_Element_Array for the input, usually just one element length. The pattern is: Root_Stream_Type -- abstract stream | Serial_Port -- concrete stream, transport layer | your type -- specific protocol implementation -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de