From: Simon Wright <simon@pogner.demon.co.uk>
Subject: Re: Design problem using Multiple Dispatch or Redispatch (long)
Date: 2000/03/14
Date: 2000-03-14T00:00:00+00:00 [thread overview]
Message-ID: <x7vln3l6y4t.fsf@pogner.demon.co.uk> (raw)
In-Reply-To: 38CDAA56.36B9E1C1@yahoo.com
The code below may do what you want. There will be lots more (creating
new Real_Commands, for example, for a specific Processor; keeping a
queue of Commands, popping, and dispatching; and, because Command is
(has to be) limited, you'll need to manage allocated Commands as
well).
No need for arrays, sparse or otherwise.
package Commands is
type Command is abstract tagged limited private;
type Command_P is access all Command'Class;
procedure Handle (The_Command : Command) is abstract;
private
type Command is abstract tagged limited null record;
end Commands;
package Processors is
type Processor is abstract tagged limited private;
private
type Processor is abstract tagged limited null record;
end Processors;
with Commands;
with Processors;
package Real_Processors is
type Real_Processor is new Processors.Processor with private;
type Real_Command (For_The_Processor : access Real_Processor)
is new Commands.Command with private;
procedure Handle (The_Command : Real_Command);
-- other Real_Commands here, each with its own Handle
private
type Real_Processor is new Processors.Processor
with null record;
type Real_Command (For_The_Processor : access Real_Processor)
is new Commands.Command with null record;
end Real_Processors;
package body Real_Processors is
procedure Handle (The_Command : Real_Command) is
The_Processor : Real_Processor renames The_Command.For_The_Processor.all;
begin
null; -- do stuff for this Command for this Processor
end Handle;
end Real_Processors;
next prev parent reply other threads:[~2000-03-14 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 ` Simon Wright [this message]
2000-03-15 0:00 ` Thom Brooke
2000-03-16 0:00 ` Simon Wright
2000-03-14 0:00 ` Nick Roberts
2000-03-15 0:00 ` Thom Brooke
2000-03-14 0:00 ` tmoran
2000-03-15 0:00 ` Thom Brooke
2000-03-14 0:00 ` David Kristola
2000-03-15 0:00 ` Thom Brooke
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox