-- File: component.ads -- Component Class Interface -- -- Prepared by Prof. Spiegel -- Copyright © 1988-1998 Coronado Enterprises - Last update, February 1, 1998 -- Gordon Dodrill - dodrill@swcp.com with Ada.Text_IO, Ada.Finalization; use Ada.Text_IO, Ada.Finalization; package component is type WIDGET is new CONTROLLED with record Size : INTEGER; Number : INTEGER; end record; -- Initialize - When any object of this type is defined, this procedure is run -- automatically, without the programmer calling it explicitly. This is -- the place to initialize the components of the class or include any -- other initialization code that needs to be executed for each object -- of this type. procedure Initialize(Item : in out WIDGET); -- Adjust - Following an assignment, you may have some cleaning up of the data -- within the new copy. This procedure is called automatically for the new -- object after the new data has been assigned to it. procedure Adjust(Item : in out WIDGET); -- Finalize - When you assign something to a variable, the data contained in -- that variable is overwritten and lost forever. You may wish to do -- something special with the data before it is overwritten, and that -- is one of the jobs for this procedure. When you are finished with -- an object and you wish to destroy it, or it goes out of scope, you -- will need to do some cleaning up if it has an access variable to -- something on the heap that you are finished with, or some other job -- that must be done prior to destroying the object. This procedure is -- called automatically by the system. procedure Finalize(Item : in out WIDGET); end component;