Package: ASCL.OB.Persitant

Last update: 19 Sep 99 / 05:47


Overview

All objects derived from this package are persistant, which means before entring the scope of a object the instance data is retreived from the disk and after leaving the scope of a variable the instance data is stored on the disk. For this purpose each object has an object identifier which is allocted by the application code.

The instance data of one or more classes is stored is a so called object pool, which is identified by a pool identifier which is allocated by this package. Using the Add method, a class can be added to a pool. The storage pool has to be opend and closed by the application explicitly.


Synopsis

type Object_ID is Integer; type Object( this : Object_ID ) is abstract new Controlled with private; type Handle is access Object'Class;

function Id( this : in Object'Class ) return Object_ID;

type Pool_ID is private; Pool_ID_Null : constant Pool_ID;

function Open( name : in String; debug : in Debugging_Support.Handle := null ) return Pool_ID; procedure Close( pool : in Pool_ID ); procedure Add( pool : in Pool_ID; name : in Tag; debug : in Debugging_Support.Handle := null );

procedure Write( this : in out Object; stream : Stream_Access ) is abstract; procedure Read( this : in out Object; stream : Stream_Access ) is abstract;

Description

Object_ID

Each persitant object is identified by an identifier, which is a integer constant . This identifier is used in the object pool in order to locate the object in the data store.

Object

This is the root object for all persitant objects. The object identifier is a descriminant for each derived type. It is used to identify the object upon instanciation and finalizazion.

Handle

This is the access type (class wide pointer) for all derived types from Object.

Pool_ID

This type is used to identifiy the storage pool where an object is stored in.

Pool_ID_Null

This pool identifier is returned if a failure has occured during pool realted operations.


Id

Preconditions:

Object has to be initialized via the Initialize Primitive prior to all actions.

Postconditions:

Function:

This function returns the object identifier of an persistant object.

Open


Preconditions:

None.

Postconditions:

Function:

Open the object storage file named in the argument. The second argument is a pointer to a debugging object which may be assigned to the storage pool.

The function returns in case of success a Pool_ID value unequal to Pool_ID_Null.

Exceptions:


Close

Preconditions:

Pool has to be open.

Postconditions:

Pool identified by Pool_ID is closed. Pool_ID not valid any more.

Funtion:

Close the object storage identified by the pool identifier.

Exceptions:


Add

Discussion

References