From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID, T_FILL_THIS_FORM_SHORT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,19d0849c68914783 X-Google-Attributes: gid103376,public From: Simon Wright Subject: Re: Design problem using Multiple Dispatch or Redispatch (long) Date: 2000/03/14 Message-ID: #1/1 X-Deja-AN: 597525095 X-NNTP-Posting-Host: pogner.demon.co.uk:158.152.70.98 References: <38CDAA56.36B9E1C1@yahoo.com> X-Trace: news.demon.co.uk 953071155 nnrp-12:17589 NO-IDENT pogner.demon.co.uk:158.152.70.98 Organization: At Home Newsgroups: comp.lang.ada X-Complaints-To: abuse@demon.net Date: 2000-03-14T00:00:00+00:00 List-Id: 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;