From: Matthias Oltmanns <Matthias.Oltmanns@SO.SEMA.DE>
Subject: Dynamic Instantiation in Ada95 ?
Date: 1998/04/15
Date: 1998-04-15T00:00:00+00:00 [thread overview]
Message-ID: <01BD6867.17421990.Matthias.Oltmanns@so.sema.de> (raw)
Hi all,
I would like to implement a kind of runtime instantiation for class-wide
types, where the concrete type is not known
at compile time.
I've searched for a method in exact that way as S'Class'Input is working.
S'Class'Input first reads the external tag name from a stream and than
makes a dispatching call to the appropriate S'Input method.
Example:
...
type Base is tagged with null record;
function Create return Base;
--
function Create_Dynamic (Tag_Name : String) return Base'Class;
...
<< Some type-extensions for the type Base >>
...
I would like to implement the function as follows:
function Create_Dynamic (Tag_Name : String) return Base'Class is
T : Ada.Tags.Tag := Ada.Tags.Internal_Tag (Tag_Name);
begin
return <<dispatching call to Create using tag T>>;
end Create_Dynamic;
Is there a way to do that? I've found only some dirty hacks, using
unchecked_deallocation , for T'Address use ...
and so on.
I'am interresting for a more portable approach. Any suggestions?
Matthias Oltmanns, Email: Matthias.Oltmanns@so.sema.de, Phone: +49 4421
802 207, Fax: +49 4421 802 444,
SEMA GROUP GmbH Wilhelmshaven (Germany) - Special Systems Division -
next reply other threads:[~1998-04-15 0:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-04-15 0:00 Matthias Oltmanns [this message]
1998-04-15 0:00 ` Dynamic Instantiation in Ada95 ? Tucker Taft
1998-04-16 0:00 ` Stephen Leake
1998-04-16 0:00 ` Matthew Heaney
1998-04-17 0:00 ` Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox