comp.lang.ada
 help / color / mirror / Atom feed
* Finalization of package instance
@ 2000-01-18  0:00 Mario Amado Alves
  2000-01-18  0:00 ` Robert A Duff
  2000-01-18  0:00 ` Jeff Carter
  0 siblings, 2 replies; 8+ messages in thread
From: Mario Amado Alves @ 2000-01-18  0:00 UTC (permalink / raw)
  To: comp.lang.ada

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.




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2000-01-19  0:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-18  0:00 Finalization of package instance Mario Amado Alves
2000-01-18  0:00 ` Robert A Duff
2000-01-18  0:00 ` 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

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