comp.lang.ada
 help / color / mirror / Atom feed
From: Dmitry A. Kazakov <mailbox@dmitry-kazakov.de>
Subject: Re: Dispatching problem.
Date: Mon, 10 Feb 2003 10:12:13 +0100
Date: 2003-02-10T10:12:13+01:00	[thread overview]
Message-ID: <rvne4vkbbgcnk7hv37mvbegbjafhonnmji@4ax.com> (raw)
In-Reply-To: f74cb448.0302070655.627e3520@posting.google.com

On 7 Feb 2003 06:55:49 -0800, petter.fryklund.konsult@dynamics.saab.se
(Petter Fryklund) wrote:

>Another way to explain our problem: a message (of which there are
>several variants) is received from another system in unit P. It is
>forwarded to unit B which decodes to message using procedures in
>package A. Package A can also be used for coding of outbound messages
>and for producing trace of messages contents, both inbound and
>outbound. We would like to dispatch both coding and tracing in A and
>subsequent usage of the decoded message in B. Perhaps inbound messages
>and outbound should be treated differently? In the original post there
>is a 1-to-1 relationship between ie B.B1 and A.M1. They have the same
>contents, apart from the tag. So, how do make an A.M1 a B.B1 (or
>really an A.Msg a B.Msg?)so that we can dispatch in code written in
>package B? (Dispatching in B ;-)

First of all, Ada does not have multiple inheritance, so B.Msg have to
be in A.Msg. What is wrong with the following design?

package A is
   type Msg is abstract tagged null record;
   procedure Y (X : in out Msg) is abstract;

   type M1 is new Msg with ...;
   procedure Y (X : in out Msg);

   type M2 is new Msg with ...;
   procedure Y (X : in out Msg);
end A;

with A;
package B is
   type M1 is new A.M1 with ...;
   procedure Y (X : in out M1);

   type M2 is new A.M2 with ...;
   procedure Y (X : in out M2);
end B;

BTW, the package B looks superfluos, as it possibly is, if you are
saying that A.Mi = B.Mi.

---
Regards,
Dmitry Kazakov
www.dmitry-kazakov.de



  reply	other threads:[~2003-02-10  9:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-06 14:04 Dispatching problem Petter Fryklund
2003-02-06 15:33 ` James S. Rogers
2003-02-07  7:35   ` Petter Fryklund
2003-02-07  9:01 ` Dmitry A. Kazakov
2003-02-07 14:55   ` Petter Fryklund
2003-02-10  9:12     ` Dmitry A. Kazakov [this message]
2003-02-11  8:31       ` Petter Fryklund
  -- strict thread matches above, loose matches on Subject: below --
2008-01-15 18:55 petter_fryklund
2008-01-15 19:49 ` Dmitry A. Kazakov
2008-01-15 20:01   ` petter_fryklund
replies disabled

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