From: Alexander Korolev <antonovkablog@gmail.com>
Subject: Re: Stream_Element_Array
Date: Wed, 14 Sep 2011 01:34:42 -0700 (PDT)
Date: 2011-09-14T01:34:42-07:00 [thread overview]
Message-ID: <a9805b8a-571f-4c81-aa5c-66e720d1d52d@x21g2000prd.googlegroups.com> (raw)
In-Reply-To: 4e703bcd$0$32104$a8266bb1@newsreader.readnews.com
On Sep 14, 9:29 am, Per Sandberg <per.sandb...@bredband.net> wrote:
> Why not just:
> Message_Header'Write(Output_Stream,My_Message_Header)
> That would serialize the Data into the stream.
>
> If the target stream is a blocked message why not do
> Message_Header'Write(Buffer_Stream,My_Message_Header)
> Buffer_Stream'Write(Output_Stream,Buffer_Stream)
>
> And the Buffer_Stream is a stream of the kind found in:
> http://sourceforge.net/projects/ada-spread/
> spread-memory_streams.*
> or
>
> https://github.com/persan/zeromq-Ada
> zmq-utilities-memory_streams.ad
>
> Which now is part of fedora15
> /Per
>
> On 09/14/2011 05:13 AM, Alexander Korolev wrote:
>
>
>
> > I have a Type
>
> > type Message_Header is
> > record
> > -- Components -- 8 bit
> > Length : Unsigned_16; -- 16 bit (MSB)
> > -- other components -- 8 bit
> > end record;
>
> > How I could split the Lenght component on two subsequent
> > Stream_Element ( 8-bit)?
>
> > Command: Stream_Element_Array (1 .. 64);
>
> > Thanks
Thanks Per
I've just tried with GNAT a similar to your suggestion aproach
In_Memory_Stream:Volatile_Streams.Memory_Resident_Stream (Size =>
128);
Message_Length:Stream_Element_Array(1..2);
Last:Stream_Element_Count;
Msg_Header_Instance:Message_Header;
Begin
Message_Header'Write(In_Memory_Stream, Msg_Header_Instance);
-- writes to meomory
read (In_Memory_Stream,Message_Length,Last);
-- retreives Message_Length wich is Stream_Element_Array -- and the
Last
-- I left only one component in Message_Header - the Lengh, expected
-- the Last = 2, and Message_Length instance filled in after read
(...).
--
End;
Complaints on compilation: "expected access to
Ada.Streams.Root_Stream_Type'Access"
next prev parent reply other threads:[~2011-09-14 8:34 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-14 3:13 Stream_Element_Array Alexander Korolev
2011-09-14 5:29 ` Stream_Element_Array Per Sandberg
2011-09-14 8:34 ` Alexander Korolev [this message]
2011-09-14 8:31 ` Stream_Element_Array Simon Wright
2011-09-14 9:09 ` Stream_Element_Array Alexander Korolev
2011-09-14 9:40 ` Stream_Element_Array Dmitry A. Kazakov
2011-09-14 9:41 ` Stream_Element_Array Dmitry A. Kazakov
2011-09-14 10:18 ` Stream_Element_Array Simon Wright
2011-09-14 12:42 ` Stream_Element_Array Dmitry A. Kazakov
2011-09-14 16:20 ` Stream_Element_Array Simon Wright
2011-09-14 19:53 ` Stream_Element_Array Dmitry A. Kazakov
2011-09-14 10:53 ` Stream_Element_Array Simon Wright
2011-09-14 12:48 ` Stream_Element_Array Dmitry A. Kazakov
2011-09-14 14:48 ` Stream_Element_Array Alexander Korolev
2011-09-14 15:08 ` Stream_Element_Array Dmitry A. Kazakov
2011-09-14 17:16 ` Stream_Element_Array Alexander Korolev
2011-09-14 20:13 ` Stream_Element_Array Dmitry A. Kazakov
2011-09-14 21:29 ` Stream_Element_Array Alexander Korolev
2011-09-15 8:20 ` Stream_Element_Array Dmitry A. Kazakov
2011-09-15 18:58 ` Stream_Element_Array Alexander Korolev
2011-09-15 20:48 ` Stream_Element_Array Dmitry A. Kazakov
2011-09-16 0:20 ` Stream_Element_Array Alexander Korolev
2011-09-15 19:15 ` Stream_Element_Array Alexander Korolev
2011-09-15 20:11 ` Stream_Element_Array Simon Wright
2011-09-15 20:34 ` Stream_Element_Array Alexander Korolev
2011-09-15 21:42 ` Stream_Element_Array Simon Wright
2011-09-15 21:50 ` Stream_Element_Array Simon Wright
2011-09-16 0:01 ` Stream_Element_Array Alexander Korolev
2011-09-16 0:18 ` Stream_Element_Array Adam Beneschan
2011-09-16 7:22 ` Stream_Element_Array Dmitry A. Kazakov
2011-09-16 10:21 ` Stream_Element_Array Simon Wright
2011-09-16 12:13 ` Stream_Element_Array Dmitry A. Kazakov
2011-09-16 17:20 ` Stream_Element_Array Simon Wright
2011-09-16 19:32 ` Stream_Element_Array Dmitry A. Kazakov
2011-09-16 22:18 ` Stream_Element_Array Simon Wright
2011-09-17 8:18 ` Stream_Element_Array Dmitry A. Kazakov
2011-09-19 23:22 ` Stream_Element_Array Randy Brukardt
2011-09-15 21:28 ` Stream_Element_Array Alexander Korolev
2011-09-15 2:33 ` Stream_Element_Array Alexander Korolev
2011-09-19 23:11 ` Stream_Element_Array Randy Brukardt
2011-09-14 12:19 ` Stream_Element_Array Gautier write-only
2011-09-16 11:17 ` Stream_Element_Array anon
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox