--| --| Filename : $Source: /home/erdmann/ASCL/Template/RCS/template.ads,v $ --| Description : Template Specification --| Author : Michael Erdmann --| Created On : 25.3.1999 --| Last Modified By: $Author: erdmann $ --| Last Modified On: $Date: 1999/08/01 10:57:25 $ --| Status : $State: Exp $ --| --| --| Functional Description --| ====================== --| --| --| Component Data --| ============== --| --| Every component is based upon an data type. The data type --| is allwyas called "Object". This name is choosen fixed in --| oder to make the namin as simple as possible, because sometimes --| you will find redundant naming i.e. List.List_Type. --| --| Every Basic class will export a class wide pointer called --| Handle. --| --| The Object is self hides completly the implementation of the --| data structure because it is simply a reference to the --| actual Object_data. --| --| The lifecyle of an instance is alway between an Initialize --| an a Finalize call. --| --| Operations on the component data --| ================================ --| There are two basic types of operations assuemed. So called --| attribute functions and methods. --| --| Attribute functions are used to set and get data items. They --| do not change any internal state of the component. Please keep --| in mind, that a state is persisten over the life time of the --| instance. This methods allows the seperate the implmentation --| of data kept in the component from the outside representation. --| --| A method changes the internal state of the component (i.e --| a file pointer) and may pass data to or return data from --| the component. --| --| Error Handling --| ============== --| Design by contract should be applied, this means input parameter --| are not checked, the caller has to ensure the correct usage. --| The component has only to ensure some kind of fiendly behaiviour --| by raising an exception. --| --| Raising exceptions should always be prefered over return codes --| indicating a problem. --| --| Any how the following exceptions can be raised by any component: --| --| Not_Initialized - The object passed to the component was never --| initialized. --| Usage_Error - Some kind of handling error regarding the --| use case hase been done, i.e. read used --| before file opend. --| --| Out_of_Memory - We tried to initialize and instance, but the --| object could not be created because no memory --| is available any more. --| --| --| Extension --| ========= --| If the object is abstract normaly the class requires some --| extentsion to implemented. --| --| Restrictions --| ============ --| Tasking: yes/no --| Y2K : --| --| --| History --| ======= --| $Log: template.ads,v $ --| Revision 1.2 1999/08/01 10:57:25 erdmann --| Debugging support added and compiled --| --| Revision 1.1 1999/07/18 15:35:08 erdmann --| No comments --| --| with ASCL.Debugging_Support; use ASCL; package Template is ---=====================================================================--- ---=== C O M P O N E N T I N T E R F A C E ===--- ---=====================================================================--- type Object is abstract tagged private; type Handle is access Object'Class; procedure Initialize( this : in out Object'Class; debug : in Debugging_Support.Handle := null ); procedure Finalize( this : in out Object'Class ); ---=====================================================================--- ---=== A T T R I B U T E S ===--- ---=====================================================================--- procedure Set( this : in out Object'Class; value : in Integer ); function Get( this : in Object'Class ) return Integer; ---=====================================================================--- ---=== M E T H O D S ===--- ---=====================================================================--- --------------------------------------------------------------------------- --| Description : --| Preconditions : --| Postconditions : --| Exceptions : --| Note : --------------------------------------------------------------------------- procedure Perform( this : in out Object'Class ); ---=====================================================================--- ---=== E X T E N S I O N ===--- ---=====================================================================--- procedure Initialize( this : in out Object ) is abstract; procedure Finalize( this : in out Object ) is abstract; ---=====================================================================--- private type Object_Data; type Object_Data_Access is access Object_Data; type Object is abstract tagged record data : Object_Data_Access := null; end record; end Template;