Make your own free website on Tripod.com

File : reference_finalization.ads


with System,Ada.Finalization;
package Reference_Finalization is

  type Controlled_Reference is abstract tagged private;
  procedure Destroy   (Object : in out Controlled_Reference) is abstract;

private  

  package AF renames Ada.Finalization;
  
  type Ref_Count is mod System.Max_Binary_Modulus;
  
  type Access_Count is access all Ref_Count;
  
  type Controlled_Reference is abstract
    new AF.Controlled with record
    Refer : Access_Count := new Ref_Count'(0);
  end record;
  procedure Adjust    (Object : in out Controlled_Reference);
  procedure Finalize  (Object : in out Controlled_Reference);

end Reference_Finalization