0024784: Move documentation in CDL files to proper location
[occt.git] / src / Storage / Storage.cdl
1 -- Created on: 1996-04-30
2 -- Created by: cle
3 -- Copyright (c) 1996-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
5 --
6 -- This file is part of Open CASCADE Technology software library.
7 --
8 -- This library is free software; you can redistribute it and/or modify it under
9 -- the terms of the GNU Lesser General Public License version 2.1 as published
10 -- by the Free Software Foundation, with special exception defined in the file
11 -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 -- distribution for complete text of the license and disclaimer of any warranty.
13 --
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
16
17 package Storage
18     
19         ---Purpose: Storage package is used to write and read persistent objects.
20         --     These objects are read and written by a retrieval or storage
21         --  algorithm (Storage_Schema object) in a container (disk, memory,
22         -- network ...). Drivers (FSD_File objects) assign a physical
23         -- container for data to be stored or retrieved.
24         -- The standard procedure for an application in
25         -- reading a container is the following:
26         -- -   open the driver in reading mode,
27         -- -   call the Read function from the schema,
28         --   setting the driver as a parameter. This   function returns 
29         -- an instance of the   Storage_Data class which contains the   data being read,
30         -- -   close the driver.
31         -- The standard procedure for an application in writing a container is the following:
32         -- -   open the driver in writing mode,
33         -- -   create an instance of the Storage_Data   class, then
34         --    add the persistent data to write   with the function AddRoot,
35         -- -   call the function Write from the schema,
36         --   setting the driver and the Storage_Data   instance as parameters,
37         -- -      close the driver. 
38    
39 uses TCollection,
40      TColStd,
41      MMgt
42 is
43     exception StreamModeError inherits Failure from Standard;
44     exception StreamFormatError inherits Failure from Standard;
45     exception StreamWriteError inherits Failure from Standard;
46     exception StreamReadError inherits Failure from Standard;
47             exception StreamUnknownTypeError inherits StreamReadError from Storage;
48             exception StreamTypeMismatchError inherits StreamReadError from Storage;
49             exception StreamExtCharParityError inherits StreamReadError from Storage;
50             
51     enumeration Error
52     is
53       VSOk,                 -- no problem
54       VSOpenError,          -- while opening the stream
55       VSModeError,          -- the stream is opened with a wrong mode for operation 
56       VSCloseError,         -- while closing the stream
57       VSAlreadyOpen,        -- stream is already opened
58       VSNotOpen,            -- stream not opened
59       VSSectionNotFound,    -- the section is not found
60       VSWriteError,         -- error during writing
61       VSFormatError,        -- wrong format error occured while reading
62       VSUnknownType,        -- try to read an unknown type
63       VSTypeMismatch,       -- try to read a wrong primitive type (read a char while expecting a real)
64       VSInternalError,      -- internal error
65       VSExtCharParityError, -- problem with 16bit characters, may be a 8bit character is inserted inside 16bit string
66       VSWrongFileDriver     -- we try to read a file with a wrong driver (occured while reading header section)
67     end;
68         ---Purpose: Error codes returned by the ErrorStatus
69         -- function on a Storage_Data set of data during a
70         -- storage or retrieval operation :
71         -- -   Storage_VSOk : no problem has been detected
72         -- -   Storage_VSOpenError : an error has
73         --  occurred when opening the driver
74         -- -   Storage_VSModeError : the driver has not
75         --  been opened in the correct mode
76         -- -   Storage_VSCloseError : an error has
77         --   occurred when closing the driver
78         -- -   Storage_VSAlreadyOpen : the driver is   already open
79         -- -   Storage_VSNotOpen : the driver is not   open
80         -- -   Storage_VSSectionNotFound : a section
81         --   has not been found in the driver
82         -- -   Storage_VSWriteError : an error occurred when writing the driver
83         -- -   Storage_VSFormatError : the file format is wrong
84         -- -   Storage_VSUnknownType : a type is not known from the schema
85         -- -   Storage_VSTypeMismatch : trying to read   a wrong type
86         -- -   Storage_VSInternalError : an internal error  has been detected
87         -- -   Storage_VSExtCharParityError : an error
88         --   has occurred while reading 16 bit characte   
89  
90     enumeration OpenMode
91     is
92         VSNone,
93         VSRead,
94         VSWrite,
95         VSReadWrite
96     end;
97         ---Purpose:
98         -- Specifies opening modes for a file:
99         -- -   Storage_VSNone : no mode is specified
100         -- -   Storage_VSRead : the file is open for  reading operations
101         -- -   Storage_VSWrite : the file is open for writing operations
102         -- -   Storage_VSReadWrite : the file is open
103         --   for both reading and writing operations.
104
105     enumeration SolveMode
106     is
107         AddSolve,
108         WriteSolve,
109         ReadSolve
110     end;
111     
112     primitive Container inherits Storable from Standard;
113     
114     imported BucketOfPersistent;
115     
116     imported Position; -- typedef long
117     
118     deferred class BaseDriver;
119
120     deferred class CallBack;
121       class DefaultCallBack;
122           
123     class HeaderData;
124           class Data;
125           
126     class TypeData;
127
128     class RootData;
129     class Root;
130     
131     class Schema;
132         
133     class SeqOfRoot instantiates Sequence from TCollection(Root from Storage);
134     
135     class HSeqOfRoot instantiates HSequence from TCollection(Root from Storage,SeqOfRoot);
136
137     -- PRIVATE
138     
139     private class InternalData;
140     private class stCONSTclCOM;
141
142     private class TypedCallBack;
143     
144     private class PType instantiates IndexedDataMap from TCollection(AsciiString from TCollection, 
145                                                              Integer from Standard, 
146                                                              AsciiString from TCollection);                     
147
148     private class MapOfPers instantiates DataMap from TCollection(AsciiString from TCollection, 
149                                                                   Root from Storage,
150                                                                   AsciiString from TCollection);
151         
152     private class MapOfCallBack instantiates DataMap from TCollection(AsciiString from TCollection, 
153                                                                       TypedCallBack from Storage,
154                                                                       AsciiString from TCollection);
155                                                           
156     private class ArrayOfCallBack instantiates Array1 from TCollection(CallBack from Storage);
157     private class HArrayOfCallBack instantiates HArray1 from TCollection(CallBack from Storage,ArrayOfCallBack from Storage);
158  
159     class ArrayOfSchema instantiates Array1 from TCollection(Schema from Storage);
160     class HArrayOfSchema instantiates HArray1 from TCollection(Schema from Storage,ArrayOfSchema from Storage);
161     
162     private class PArray instantiates Array1 from TCollection(Persistent from Standard);  
163     private class HPArray instantiates HArray1 from TCollection(Persistent from Standard, PArray from Storage);
164     
165     -- METHODS
166     
167     Version returns AsciiString from TCollection;
168     ---Purpose: returns the version of Storage's read/write routines
169
170 end;