From: "Alexander Boucke" <alexb@lufmech.rwth-aachen.de>
Subject: Re: Question about Finalization Control and reference counting
Date: Tue, 24 Apr 2001 18:10:47 +0200
Date: 2001-04-24T16:10:54+00:00 [thread overview]
Message-ID: <9c48ie$dvg$1@nets3.rz.RWTH-Aachen.DE> (raw)
In-Reply-To: slrn9e2vqb.aah.randhol+abuse@kiuk0156.chembio.ntnu.no
Hello!
I managed to do this in a little more complicated way, but it works:
type object is new ada.finalization.controlled with private;
-- some functions for object
private
type handled_object is record
ref_count : natural;
-- other Data
end record;
type handled_object_access is access handled_object;
type object is new ada.finalization.controlled with
record
the_object: handled_object_access;
end record;
This way adjust and finalize are called for the type object and can access
object.the_objetc.ref_count.
I implemented a package doing vector- and matrix-algebra that way, since I
wanted to minimize the overhead of having temporary objects while evaluating
statements like a:=b+c; and did not want to think about handling pointers
all the time. It even allowed me to write some sort of caching technique to
reuse some vectors.
There is probably an easier way to implement this, if somebody has one...
Regards,
Alexander Boucke
next prev parent reply other threads:[~2001-04-24 16:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-04-21 12:37 Question about Finalization Control and reference counting Preben Randhol
2001-04-21 12:44 ` Preben Randhol
2001-04-24 16:11 ` Jeffrey Carter
2001-04-25 15:58 ` Preben Randhol
2001-04-25 16:01 ` Preben Randhol
2001-04-25 22:22 ` Jeffrey Carter
2001-04-26 8:50 ` Preben Randhol
2001-04-25 16:57 ` Stanley R. Allen
2001-04-24 16:10 ` Alexander Boucke [this message]
2001-04-25 3:14 ` DuckE
-- strict thread matches above, loose matches on Subject: below --
2001-04-25 11:08 Christoph Grein
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox