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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,51e16ccc6a07b0c7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-26 01:05:27 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!news.stgl.sel.alcatel.DE!not-for-mail From: Mirko Aigner Newsgroups: comp.lang.ada Subject: Re: circular unit dependency Date: Mon, 26 May 2003 10:05:28 +0200 Organization: Alcatel SEL AG Berlin Message-ID: <3ED1CAC8.1090808@alcatel.de> References: <3ECDE7D1.9010507@alcatel.de> NNTP-Posting-Host: news.stgl.sel.alcatel.de (194.113.59.80) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: fu-berlin.de 1053936326 3030725 194.113.59.80 (16 [131051]) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020903 X-Accept-Language: en-us, en X-Enigmail-Version: 0.63.3.0 X-Enigmail-Supports: pgp-inline, pgp-mime Cache-Post-Path: news.alcatel.de!unknown@slbpx8 X-Cache: nntpcache 2.4.0b5 (see http://www.nntpcache.org/) Xref: archiver1.google.com comp.lang.ada:37773 Date: 2003-05-26T10:05:28+02:00 List-Id: Stephen Leake wrote: > > You will have to change something. You'll have to post the code, so we > can help you figure out what to change. Try to simplify it first. > I'm Sorry, Ok here comes some code. Some words to the structure at first. There is a boundary subsystem where logical Messages are generated. These Messages can be from different type (class). All Messages are sent first to a dispatcher in the Control Subsystem. The dispatcher send them to subscribed Control-Classes. The Control-Classes react to the messages. The Control-Classes can be dynamically subscribed or unsubscribed to the dispatcher. Now there is used a design pattern called Visitor, so that the dispatcher can decide what kind of message he got. I can't change the design, i have to implement it in Ada. It is already imlemented in C++. here is some code ... -- Event.ads with Class_EventVisitor; use Class_EventVisitor; package Class_Event is type Event is tagged null record; type Event_Pointer is access all Event'Class; procedure acceptVisitor( this : in Event_Pointer; visitor : in EventVisitor_Pointer ) is abstract; end Class_Event; -- Event.Message with Class_EventVisitor; use Class_EventVisitor; package Class_Event.Class_Message is type Message is new Event with null record; type Message_Pointer is access all Message'Class; procedure acceptVisitor( this : in Message_Pointer; visitor : in EventVisitor_Pointer ); end Class_Event.Class_Message; -- Event.Message.PointMessage with Class_EventVisitor; use Class_EventVisitor; package Class_Event.Class_Message.Class_PointMessage is type PointMessage is new Message with private; type PointMessage_Pointer is access all PointMessage'Class; procedure acceptVisitor( this : in PointMessage_Pointer; visitor : in EventVisitor_Pointer ); function Create ... return PointMessage; private type PointMessage is new Message with record ... end record; end Class_Event.Class_Message.Class_PointMessage; -- EventVisitor with Class_Event.Class_Message.Class_PointMessage; use Class_Event.Class_Message.Class_PointMessage; package Class_EventVisitor is type EventVisitor is tagged private; type EventVisitor_Pointer is access all EventVisitor'Class; procedure handlePointMessage ( this : in EventVisitor_Pointer; pMessage : in PointMessage_Pointer ) is abstract; -- other message types ... private type EventVisitor is tagged null record; end Class_EventVisitor; The Control-Class handling the PointMessage will inherit from the EventVisitor.