From: Georg Bauhaus <sb463ba@d2-hrz.uni-duisburg.de>
Subject: Re: automatic tag conversion?
Date: Mon, 26 May 2003 18:16:05 +0000 (UTC)
Date: 2003-05-26T18:16:05+00:00 [thread overview]
Message-ID: <batll5$2ho$1@a1-hrz.uni-duisburg.de> (raw)
In-Reply-To: basj5q$32qm4$1@ID-77047.news.dfncis.de
Dmitry A. Kazakov <mailbox@dmitry-kazakov.de> wrote:
:> The system would always dispatch the most special case, am I right?
:
: No, Element is of NodeClassAccess which is different from anonymous "access
: Node" (that will dispatch). Thus LookProcedure.all is not dispatching at
: all. However it will be sort of "class-wide" when NodeClassAccess is
: class-wide, as it is. So you practically have everything to make it
: working. Just define a wrapper in the same package, where Node is defined:
:
: procedure Print_Any (Ptr : NodeClassAccess) is
: begin
: Print (Ptr); -- Dispatches
: end Print_Any;
Yes. I've made something similar, using a slightly modified set with
a generic "look" function,
generic
with procedure accessor(e: in Element);
procedure look(s: in Set);
(and also deriving Node from a Printable abstract tagged type,
type Printable is abstract tagged private;
procedure print(p: access Printable) is abstract;
)
Maybe both the Booch components and the Charles library
might provide some ideas (in addition to code :)
of how iteration can be done.
The slight change results in
with Sets;
with nodes; use nodes;
procedure run is -- testing
package Node_Sets is new Sets(Element => Node_ptr);
net: Node_sets.Set;
procedure print_any(n: Node_ptr) is
begin
print(n.all'access);
end print_any;
procedure print_all is
new node_sets.look(accessor => print_any);
begin
node_sets.insert(new Transition, net);
node_sets.insert(new Place, net);
node_sets.insert(new Transition, net);
node_sets.insert(new Transition, net);
print_all(net);
end run;
$ ./run
a transition
a transition
a place
a transition
$
Georg
next prev parent reply other threads:[~2003-05-26 18:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-23 23:04 automatic tag conversion? Stephan Heinemann
2003-05-23 23:57 ` Stephan Heinemann
2003-05-24 17:39 ` Georg Bauhaus
2003-05-25 20:59 ` Stephan Heinemann
2003-05-26 8:29 ` Dmitry A. Kazakov
2003-05-26 18:16 ` Georg Bauhaus [this message]
2003-05-26 18:27 ` Georg Bauhaus
2003-05-26 20:49 ` Stephan Heinemann
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox