comp.lang.ada
 help / color / mirror / Atom feed
From: lutz@iks-jena.de (Lutz Donnerhacke)
Subject: Re: Generic abstract procedures
Date: 1999/10/14
Date: 1999-10-14T00:00:00+00:00	[thread overview]
Message-ID: <slrn80cetb.mmj.lutz@belenus.iks-jena.de> (raw)
In-Reply-To: 38062215_1@news1.prserv.net

* Matthew Heaney wrote:
>(Lutz Donnerhacke) wrote:
>> Does anybody knows a solution other than derivating the actual collection
>> from an abstract tagged type? Obviously I failed with a dumb generic attempt.
>
>What exactly are you trying to do?  It is certainly not obvious from
>your post.

I'm going to implement a Iterator pattern.
A class like approach requires the following code:

  type My_Item_Type is new Item_Type with record
    item: Real_Item_Type;
  end record;
  
  type My_Collection_Type is new Collection_Type with record
    collection: Real_Collection_Type;
  end record;
  
  type My_Iterator(c: access My_Collection_Type) is
  new Iterator_Type(Collection_Type(c.all)'Access) with record
    state: ...;
  end record;

followed by some overloaded functions to catch all the abstract functions of
the type <SeeAbove>_Type is abstract tagged limited null record;

The generic approach is able to provide a much simpler interface. I have to
test how a generic package can be used to generate the Types above.

My question is: Does anybody already solved such a problem in an elegant way?
  




  reply	other threads:[~1999-10-14  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-10-14  0:00 Generic abstract procedures Lutz Donnerhacke
1999-10-14  0:00 ` Matthew Heaney
1999-10-14  0:00   ` Lutz Donnerhacke [this message]
1999-10-14  0:00     ` Matthew Heaney
1999-10-14  0:00       ` Matthew Heaney
1999-10-15  0:00       ` Lutz Donnerhacke
replies disabled

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