comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pogner.demon.co.uk>
Subject: Re: Design problem using Multiple Dispatch or Redispatch (long)
Date: 2000/03/16
Date: 2000-03-16T00:00:00+00:00	[thread overview]
Message-ID: <x7vbt4fh1pi.fsf@pogner.demon.co.uk> (raw)
In-Reply-To: 38CEF549.90AD0C67@yahoo.com

Thom Brooke <tcb_cut_out_80908@yahoo.com> writes:

> Consider a command that has three fields: ID, Number, and Version.
> And two kinds of Processors.  I would do this, right?
> 
> with Commands;
> with Processors;
> package Real_Processor1 is
> 
>     type Processor1 is new Processors.Processor with private;
> 
>     type Command1 (For_The : access Processor1)
>     is new Commands.Command with private;
>     procedure Handle (The_Command : Command1);
>     -- and I added this as a new primitive abstract operation:
>     procedure Construct (The_Command : in out Command1;
>                          From : in Byte_Stream);
> 
> -- same thing for Real_Processor2
> 
> So the problem is, how can I write the "Construct" procedure one
> time (the resulting Commands will look identical, and they come from
> identical byte streams.  The only difference is one is of type
> Real_Processor1.Command1, and the other is of the completely
> different, but structurally identical type
> Real_Processor2.Command1)?

Are lots of commands repeated for different processors? in the
application form which this came, they were all wildly different.

I suppose you could have an intermediate Shared_Command with a
Construct? (could it still be abstract?)

  type Shared_Command is abstract new Command with private;
  procedure Construct (The_Command : in out Shared_Command;
                       From : in Byte_Stream);

and then in the Real_Processor1 package

  type Command1 is new Shared_Command with private;
  procedure Handle (The_Command : Command1);

-- 
Simon Wright                        Work Email: simon.j.wright@gecm.com
Alenia Marconi Systems                        Voice: +44(0)23-92-701778
Integrated Systems Division                     FAX: +44(0)23-92-701800




      reply	other threads:[~2000-03-16  0:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-14  0:00 Design problem using Multiple Dispatch or Redispatch (long) Thom Brooke
2000-03-14  0:00 ` tmoran
2000-03-15  0:00   ` Thom Brooke
2000-03-14  0:00 ` Nick Roberts
2000-03-15  0:00   ` Thom Brooke
2000-03-14  0:00 ` David Kristola
2000-03-15  0:00   ` Thom Brooke
2000-03-14  0:00 ` Simon Wright
2000-03-15  0:00   ` Thom Brooke
2000-03-16  0:00     ` 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