From: Mario Amado Alves <maa@di.fct.unl.pt>
To: comp.lang.ada@list.deja.com
Subject: Finalization of package instance
Date: 2000/01/18
Date: 2000-01-18T00:00:00+00:00 [thread overview]
Message-ID: <Pine.LNX.4.10.10001181512310.27452-100000@lexis.di.fct.unl.pt> (raw)
How do I define the finalization of an instantiation of a generic package?
For example, generic package Datalink initializes a connection with a
database server; when the package instance dies, the connection must be
closed (cleanly) via the proper procedure call. How does one automatize
this? E.g.
generic
Database_Server_Address: String;
package Datalink is
...
end Datalink;
The body:
package body Datalink is
...
begin
Connect(Database_Server_Address);
finalize -- HERE, I WHICH THIS WAS POSSIBLE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Disconnect(Database_Server_Address);
end Datalink;
Then,
procedure Main is
package Main_Data_Server is
new Datalink("some.address.net");
begin
...
end Main
Now, when Main has complete running the disconnection should have been done
automatically. Is there an idiom to accomplish this in Ada?
Thanks.
| |,| | | |RuaFranciscoTaborda24RcD 2815-249CharnecaCaparica 351+212976751
|M|A|R|I|O| mob 939354005
|A|M|A|D|O|DepartmentoDeInformaticaFCT/UNL 2825-114 Caparica 351+212958536
|A|L|V|E|S| fax 212948541
| | | | | | maa@di.fct.unl.pt FCT 212948300
Sent via Deja.com http://www.deja.com/
Before you buy.
next reply other threads:[~2000-01-18 0:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-01-18 0:00 Mario Amado Alves [this message]
2000-01-18 0:00 ` Finalization of package instance Jeff Carter
2000-01-18 0:00 ` Matthew Heaney
2000-01-19 0:00 ` Jeff Carter
2000-01-19 0:00 ` Statements per function point Herv� BITTEUR
2000-01-19 0:00 ` Ehud Lamm
2000-01-19 0:00 ` Ted Dennison
2000-01-18 0:00 ` Finalization of package instance Robert A Duff
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox