comp.lang.ada
 help / color / mirror / Atom feed
From: Shark8 <onewingedshark@gmail.com>
Subject: Re: What is the best method for transmitting objects/tagged records?
Date: Wed, 8 Jun 2011 18:12:35 -0700 (PDT)
Date: 2011-06-08T18:12:35-07:00	[thread overview]
Message-ID: <079df5fa-6b66-4475-948c-443ab95b372b@k16g2000yqm.googlegroups.com> (raw)
In-Reply-To: isp5b8$c3l$1@munin.nbi.dk

On Jun 8, 7:49 pm, "Randy Brukardt" <ra...@rrsoftware.com> wrote:
> "Shark8" <onewingedsh...@gmail.com> wrote in message
>
>
> >(WITH-ing Ada.Streams is fine because it is a Pure package.)
>
> Right, but you don't need to use Ada.Tags (or anything tags) in order to
> stream tagged types. Just use the provided T'Class'Input and T'Class'Output
> attributes. For those to have portable results, you need to specify your
> external tag values for your tagged types (we previously discussed that).
>
>                                             Randy.

Oh!
{ I assume you mean something like Function Parse( Input :
stream_type ) Return Hierarchy_Parent'Class; no? }

So I was right in that I need to redefine my interfaces.

I currently have a task; which cannot return values as a function
would, and therefore cannot be used to
directly initialize an class-wide variable.

What I'm going to have to do then, is 'hide' the task in the body;
something like this:
Package Parser is

Task Type Parser_Task is
 -- Get Text and get_Token do essentially the same thing; in my setup
 -- I would like to try the tokenizing on client- and server-side
 -- to compare the efficiencies of the two.
 --
 -- Sorry about the poor naming & invalid code; I'm just typing up
psudeocode.
 Entry Get_Token(Token_Stream : Access stream); -- reads a token
 Entry Get_Text( Text_Stream : access stream ); -- read text-stream
 Entry Get_Tag(  The_Tag : Out Tag  );
 Entry Get_Object( The_Object : Out Object'Class );
End Parser_Task;

[...]
The_Parser : Parser_Task;
[...]

Function Pars( Input : Access Ada.Streams.Stream'Class ) Return
Object'Class is
 T : Tag;
begin

The_Parser.Get_Text( Input );
The_Parser.Get_Tag( T );

-- use dispatching construction
Declare
 This_Object : Object'Class:= Dispatch( T );
Begin
 The_Parser.Get_Object( This_Object );
 Return This_Object;
End;

end Parse;

End parser;



  reply	other threads:[~2011-06-09  1:12 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-07  0:26 What is the best method for transmitting objects/tagged records? Shark8
2011-06-07  1:11 ` Jeffrey Carter
2011-06-07  1:24   ` Shark8
2011-06-07  2:53     ` tmoran
2011-06-07 14:18       ` Shark8
2011-06-07 18:06         ` tmoran
2011-06-08 23:16           ` Shark8
2011-06-09  0:49             ` Randy Brukardt
2011-06-09  1:12               ` Shark8 [this message]
2011-06-09  5:07               ` Simon Wright
2011-06-09 20:55                 ` Randy Brukardt
2011-06-09 20:57                   ` Randy Brukardt
2011-06-09 23:42                     ` tmoran
2011-06-11 16:52                       ` Marco
2011-06-10  7:16                   ` Simon Wright
2011-06-10  9:40                     ` AdaMagica
2011-06-10 13:32                     ` Robert A Duff
2011-06-10 22:06                       ` Simon Wright
2011-06-10 23:05                         ` Robert A Duff
2011-06-07  3:25     ` Randy Brukardt
2011-06-07 14:19       ` Shark8
replies disabled

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