From: Lutz Donnerhacke <lutz@iks-jena.de>
Subject: Re: MI ammunition : linked lists
Date: Tue, 11 Nov 2003 09:32:12 +0000 (UTC)
Date: 2003-11-11T09:32:12+00:00 [thread overview]
Message-ID: <slrnbr1b4s.nt.lutz@taranis.iks-jena.de> (raw)
In-Reply-To: mailman.317.1068486781.25614.comp.lang.ada@ada-france.org
* Marius Amado Alves wrote:
> On Mon, 2003-11-10 at 14:51, Lutz Donnerhacke wrote:
>> Usually I need nodes which are member in multiple lists or trees.
>> That's why I prefer a mixin design which allows me to specify the
>> required list the node is member of directly.
>>
>> Please clarify how you approach deal with multiple membership.
>
> I think you mean you need your "data" (payload, cargo, element...) to
> participate in different structures. Not strictly the "node".
Yep.
> There are a number of ways to attach data to a node. If the data must be
> shared between different structures a straightforward way is to have the
> node type have a component that points to the (logical) data.
I do not like access types. They provide additional error sources.
> _______ _______
>| | | | _______
>| Next ----->| Next------>| |
>| |<-----Prev |<-----Prev | (List 1)
>| Datum | | | | |
>|___|___| | Datum | | Datum |
> | |___|___| |___|___|
> | | |
> _\|/_ _\|/_ _\|/_
> | | | | | | (Data)
> |_____| |_____| |_____|
> /|\ /|\ /|\
> ___|___ ___|___ |
>| | | | | | ___|___
>| Datum | | Datum | | | |
>| | | | | Datum | (List 2)
>| Next ----->| Next------>| |
>|_______|<-----Prev |<-----Prev |
> |_______| |_______|
My structure looks like the following:
Datum
Node1 <- List1
Node2 <- List2
--------------------
type Base is limited tagged record
d : Datum;
end record;
package Base_List1 is new Double_Linked_List (Base); use Base_List1;
package Base_List2 is new Double_Linked_List (List1); use Base_List2;
type Node is new Base_List2.Object;
list1 : Base_List1.List;
list2 : Base_List2.List;
--------------------
Choosing the right part of the data structure is done by static polymorphism
at compile time.
next prev parent reply other threads:[~2003-11-11 9:32 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-06 16:32 MI ammunition : linked lists amado.alves
2003-11-06 16:46 ` Stephen Leake
2003-11-06 17:15 ` Frank J. Lhota
2003-11-08 10:27 ` Dmitry A. Kazakov
2003-11-06 17:16 ` Jean-Pierre Rosen
2003-11-06 18:15 ` Wes Groleau
2003-11-06 21:03 ` Simon Wright
2003-11-07 10:39 ` Dmitry A. Kazakov
2003-11-07 10:29 ` Dmitry A. Kazakov
2003-11-10 14:51 ` Lutz Donnerhacke
2003-11-10 17:52 ` Marius Amado Alves
2003-11-11 9:32 ` Lutz Donnerhacke [this message]
2003-11-11 12:24 ` Marius Amado Alves
2003-11-11 12:58 ` Lutz Donnerhacke
2003-11-11 16:09 ` Robert I. Eachus
2003-11-11 17:11 ` Marius Amado Alves
2003-11-12 9:21 ` Lutz Donnerhacke
-- strict thread matches above, loose matches on Subject: below --
2003-11-06 17:26 amado.alves
2003-11-06 17:33 amado.alves
2003-11-06 19:01 amado.alves
2003-11-11 18:38 ` Georg Bauhaus
2003-11-11 21:27 ` Marius Amado Alves
2003-11-12 0:23 ` Georg Bauhaus
2003-11-12 11:29 amado.alves
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox