1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Integration of OCCT 6.5.0 from SVN

This commit is contained in:
bugmaster
2011-03-16 07:30:28 +00:00
committed by bugmaster
parent 4903637061
commit 7fd59977df
16375 changed files with 3882564 additions and 0 deletions

5
src/Storage/FILES Executable file
View File

@@ -0,0 +1,5 @@
Storage_Macros.hxx
Storage_BucketOfPersistent.hxx
Storage_Position.hxx
Storage_Container.hxx
Storage_Container.cxx

167
src/Storage/Storage.cdl Executable file
View File

@@ -0,0 +1,167 @@
-- File: Storage.cdl
-- Created: Tue Apr 30 14:18:44 1996
-- Author: cle
-- <cle@ilebon>
---Copyright: Matra Datavision 1996
package Storage
---Purpose: Storage package is used to write and read persistent objects.
-- These objects are read and written by a retrieval or storage
-- algorithm (Storage_Schema object) in a container (disk, memory,
-- network ...). Drivers (FSD_File objects) assign a physical
-- container for data to be stored or retrieved.
-- The standard procedure for an application in
-- reading a container is the following:
-- - open the driver in reading mode,
-- - call the Read function from the schema,
-- setting the driver as a parameter. This function returns
-- an instance of the Storage_Data class which contains the data being read,
-- - close the driver.
-- The standard procedure for an application in writing a container is the following:
-- - open the driver in writing mode,
-- - create an instance of the Storage_Data class, then
-- add the persistent data to write with the function AddRoot,
-- - call the function Write from the schema,
-- setting the driver and the Storage_Data instance as parameters,
-- - close the driver.
uses TCollection,
TColStd,
MMgt
is
exception StreamModeError inherits Failure from Standard;
exception StreamFormatError inherits Failure from Standard;
exception StreamWriteError inherits Failure from Standard;
exception StreamReadError inherits Failure from Standard;
exception StreamUnknownTypeError inherits StreamReadError from Storage;
exception StreamTypeMismatchError inherits StreamReadError from Storage;
exception StreamExtCharParityError inherits StreamReadError from Storage;
enumeration Error
is
VSOk, -- no problem
VSOpenError, -- while opening the stream
VSModeError, -- the stream is opened with a wrong mode for operation
VSCloseError, -- while closing the stream
VSAlreadyOpen, -- stream is already opened
VSNotOpen, -- stream not opened
VSSectionNotFound, -- the section is not found
VSWriteError, -- error during writing
VSFormatError, -- wrong format error occured while reading
VSUnknownType, -- try to read an unknown type
VSTypeMismatch, -- try to read a wrong primitive type (read a char while expecting a real)
VSInternalError, -- internal error
VSExtCharParityError, -- problem with 16bit characters, may be a 8bit character is inserted inside 16bit string
VSWrongFileDriver -- we try to read a file with a wrong driver (occured while reading header section)
end;
---Purpose: Error codes returned by the ErrorStatus
-- function on a Storage_Data set of data during a
-- storage or retrieval operation :
-- - Storage_VSOk : no problem has been detected
-- - Storage_VSOpenError : an error has
-- occurred when opening the driver
-- - Storage_VSModeError : the driver has not
-- been opened in the correct mode
-- - Storage_VSCloseError : an error has
-- occurred when closing the driver
-- - Storage_VSAlreadyOpen : the driver is already open
-- - Storage_VSNotOpen : the driver is not open
-- - Storage_VSSectionNotFound : a section
-- has not been found in the driver
-- - Storage_VSWriteError : an error occurred when writing the driver
-- - Storage_VSFormatError : the file format is wrong
-- - Storage_VSUnknownType : a type is not known from the schema
-- - Storage_VSTypeMismatch : trying to read a wrong type
-- - Storage_VSInternalError : an internal error has been detected
-- - Storage_VSExtCharParityError : an error
-- has occurred while reading 16 bit characte
enumeration OpenMode
is
VSNone,
VSRead,
VSWrite,
VSReadWrite
end;
---Purpose:
-- Specifies opening modes for a file:
-- - Storage_VSNone : no mode is specified
-- - Storage_VSRead : the file is open for reading operations
-- - Storage_VSWrite : the file is open for writing operations
-- - Storage_VSReadWrite : the file is open
-- for both reading and writing operations.
enumeration SolveMode
is
AddSolve,
WriteSolve,
ReadSolve
end;
primitive Container inherits Storable from Standard;
imported BucketOfPersistent;
imported Position; -- typedef long
deferred class BaseDriver;
---Purpose: base class for storage drivers
deferred class CallBack;
class DefaultCallBack;
class HeaderData;
class Data;
class TypeData;
class RootData;
class Root;
class Schema;
class SeqOfRoot instantiates Sequence from TCollection(Root from Storage);
class HSeqOfRoot instantiates HSequence from TCollection(Root from Storage,SeqOfRoot);
-- PRIVATE
private class InternalData;
private class stCONSTclCOM;
private class TypedCallBack;
private class SeqOfPersistent instantiates Sequence from TCollection(Persistent from Standard);
private class HSeqOfPersistent instantiates HSequence from TCollection(Persistent from Standard,SeqOfPersistent);
private class MapPSDHasher instantiates MapHasher from TCollection(Persistent from Standard);
private class PType instantiates IndexedDataMap from TCollection(AsciiString from TCollection,
Integer from Standard,
AsciiString from TCollection);
private class MapOfPers instantiates DataMap from TCollection(AsciiString from TCollection,
Root from Storage,
AsciiString from TCollection);
private class MapOfCallBack instantiates DataMap from TCollection(AsciiString from TCollection,
TypedCallBack from Storage,
AsciiString from TCollection);
private class ArrayOfCallBack instantiates Array1 from TCollection(CallBack from Storage);
private class HArrayOfCallBack instantiates HArray1 from TCollection(CallBack from Storage,ArrayOfCallBack from Storage);
class ArrayOfSchema instantiates Array1 from TCollection(Schema from Storage);
class HArrayOfSchema instantiates HArray1 from TCollection(Schema from Storage,ArrayOfSchema from Storage);
private class SeqOfCallBack instantiates Sequence from TCollection(CallBack from Storage);
private class HSeqOfCallBack instantiates HSequence from TCollection(CallBack from Storage,SeqOfCallBack from Storage);
private class PArray instantiates Array1 from TCollection(Persistent from Standard);
private class HPArray instantiates HArray1 from TCollection(Persistent from Standard, PArray from Storage);
-- METHODS
Version returns AsciiString from TCollection;
---Purpose: returns the version of Storage's read/write routines
end;

10
src/Storage/Storage.cxx Executable file
View File

@@ -0,0 +1,10 @@
#include <TCollection_AsciiString.hxx>
#include <Storage.hxx>
TCollection_AsciiString Storage::Version()
{
TCollection_AsciiString v("1.3");
return v;
}

View File

@@ -0,0 +1,357 @@
-- File: VStream_VDriverBase.cdl
-- Created: Mon Nov 25 10:50:21 1996
-- Author: Christophe LEYNADIER
-- <cle@parigox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1996
deferred class BaseDriver from Storage
---Purpose: Root class for drivers. A driver assigns a physical container
-- to data to be stored or retrieved, for instance a file.
-- The FSD package provides two derived concrete classes :
-- - FSD_File is a general driver which defines a
-- file as the container of data.
uses Position from Storage,
AsciiString from TCollection,
OpenMode from Storage,
Error from Storage,
ExtendedString from TCollection,
SequenceOfAsciiString from TColStd,
SequenceOfExtendedString from TColStd
raises StreamTypeMismatchError from Storage,
StreamFormatError from Storage,
StreamWriteError from Storage,
StreamExtCharParityError from Storage
is
Delete ( me : out ) ;
---C++: alias "Standard_EXPORT virtual ~Storage_BaseDriver(){Delete();}"
Initialize;
Open(me : in out; aName : AsciiString from TCollection; aMode : OpenMode from Storage) returns Error from Storage is deferred;
Name(me) returns AsciiString from TCollection;
---C++: inline
OpenMode(me) returns OpenMode from Storage;
---C++: inline
IsEnd(me : in out) returns Boolean from Standard is deferred;
---Purpose: returns True if we are at end of the stream
Tell( me : in out ) returns Position from Storage is deferred;
---Purpose: return position in the file. Return -1 upon error.
-- INFO SECTION
-- write
--
BeginWriteInfoSection(me : in out) returns Error from Storage is deferred;
WriteInfo(me : in out; nbObj : Integer from Standard;
dbVersion : AsciiString from TCollection;
date : AsciiString from TCollection;
schemaName : AsciiString from TCollection;
schemaVersion : AsciiString from TCollection;
appName : ExtendedString from TCollection;
appVersion : AsciiString from TCollection;
objectType : ExtendedString from TCollection;
userInfo : SequenceOfAsciiString from TColStd)
raises StreamWriteError
is deferred;
EndWriteInfoSection(me : in out) returns Error from Storage is deferred;
-- read
--
BeginReadInfoSection(me : in out) returns Error from Storage
is deferred;
ReadInfo(me : in out; nbObj : in out Integer from Standard;
dbVersion : in out AsciiString from TCollection;
date : in out AsciiString from TCollection;
schemaName : in out AsciiString from TCollection;
schemaVersion : in out AsciiString from TCollection;
appName : in out ExtendedString from TCollection;
appVersion : in out AsciiString from TCollection;
objectType : in out ExtendedString from TCollection;
userInfo : in out SequenceOfAsciiString from TColStd)
raises StreamTypeMismatchError,StreamExtCharParityError
is deferred;
EndReadInfoSection(me : in out) returns Error from Storage
is deferred;
-- COMMENTS SECTION
-- write
--
BeginWriteCommentSection(me : in out) returns Error from Storage is deferred;
WriteComment(me : in out; userComments : SequenceOfExtendedString from TColStd)
raises StreamWriteError is deferred;
EndWriteCommentSection(me : in out) returns Error from Storage is deferred;
-- read
--
BeginReadCommentSection(me : in out) returns Error from Storage is deferred;
ReadComment(me : in out; userComments : in out SequenceOfExtendedString from TColStd)
raises StreamTypeMismatchError,StreamExtCharParityError
is deferred;
EndReadCommentSection(me : in out) returns Error from Storage is deferred;
-- TYPE SECTION
-- write
--
BeginWriteTypeSection(me : in out) returns Error from Storage is deferred;
SetTypeSectionSize(me : in out; aSize : Integer from Standard)
raises StreamWriteError
is deferred;
WriteTypeInformations(me : in out; typeNum : Integer from Standard; typeName : AsciiString from TCollection)
raises StreamWriteError
is deferred;
EndWriteTypeSection(me : in out) returns Error from Storage is deferred;
-- read
--
BeginReadTypeSection(me : in out) returns Error from Storage
is deferred;
TypeSectionSize(me : in out) returns Integer from Standard
raises StreamTypeMismatchError
is deferred;
ReadTypeInformations(me : in out; typeNum : in out Integer from Standard; typeName : in out AsciiString from TCollection)
raises StreamTypeMismatchError
is deferred;
EndReadTypeSection(me : in out) returns Error from Storage
is deferred;
-- ROOT SECTION
-- write
--
BeginWriteRootSection(me : in out) returns Error from Storage is deferred;
SetRootSectionSize(me : in out; aSize : Integer from Standard)
raises StreamWriteError
is deferred;
WriteRoot(me : in out; rootName : AsciiString from TCollection; aRef : Integer from Standard; aType : AsciiString from TCollection)
raises StreamWriteError
is deferred;
EndWriteRootSection(me : in out) returns Error from Storage is deferred;
-- read
--
BeginReadRootSection(me : in out) returns Error from Storage
is deferred;
RootSectionSize(me : in out) returns Integer from Standard
raises StreamTypeMismatchError
is deferred;
ReadRoot(me : in out; rootName : in out AsciiString from TCollection; aRef : in out Integer from Standard; aType : in out AsciiString from TCollection)
raises StreamTypeMismatchError
is deferred;
EndReadRootSection(me : in out) returns Error from Storage
is deferred;
-- REF SECTION
-- write
--
BeginWriteRefSection(me : in out) returns Error from Storage is deferred;
SetRefSectionSize(me : in out; aSize : Integer from Standard)
raises StreamWriteError
is deferred;
WriteReferenceType(me : in out; reference : Integer from Standard; typeNum : Integer from Standard)
raises StreamWriteError
is deferred;
EndWriteRefSection(me : in out) returns Error from Storage is deferred;
-- read
--
BeginReadRefSection(me : in out) returns Error from Storage
is deferred;
RefSectionSize(me : in out) returns Integer from Standard
raises StreamTypeMismatchError
is deferred;
ReadReferenceType(me : in out; reference : in out Integer from Standard; typeNum : in out Integer from Standard)
raises StreamTypeMismatchError
is deferred;
EndReadRefSection(me : in out) returns Error from Storage
is deferred;
-- DATA SECTION
-- write
--
BeginWriteDataSection(me : in out) returns Error from Storage is deferred;
WritePersistentObjectHeader(me : in out; aRef : Integer from Standard; aType : Integer from Standard)
raises StreamWriteError
is deferred;
BeginWritePersistentObjectData(me : in out)
raises StreamWriteError
is deferred;
BeginWriteObjectData(me : in out)
raises StreamWriteError
is deferred;
EndWriteObjectData(me : in out)
raises StreamWriteError
is deferred;
EndWritePersistentObjectData(me : in out)
raises StreamWriteError
is deferred;
EndWriteDataSection(me : in out) returns Error from Storage is deferred;
-- read
--
BeginReadDataSection(me : in out) returns Error from Storage
is deferred;
ReadPersistentObjectHeader(me : in out; aRef : in out Integer from Standard; aType : in out Integer from Standard)
raises StreamTypeMismatchError,StreamFormatError
is deferred;
BeginReadPersistentObjectData(me : in out)
raises StreamFormatError
is deferred;
BeginReadObjectData(me : in out)
raises StreamFormatError
is deferred;
EndReadObjectData(me : in out)
raises StreamFormatError
is deferred;
EndReadPersistentObjectData(me : in out)
raises StreamFormatError
is deferred;
EndReadDataSection(me : in out) returns Error from Storage
is deferred;
-- jump to the next object to read
--
SkipObject(me : in out) is deferred;
--
PutReference(me : in out; aValue : Integer from Standard) returns BaseDriver from Storage
raises StreamWriteError
is deferred;
---C++: return &
PutCharacter(me : in out; aValue : Character from Standard) returns BaseDriver from Storage
raises StreamWriteError
is deferred;
---C++: alias operator <<
---C++: return &
PutExtCharacter(me : in out; aValue : ExtCharacter from Standard) returns BaseDriver from Storage
raises StreamWriteError
is deferred;
---C++: alias operator <<
---C++: return &
PutInteger(me : in out; aValue : Integer from Standard) returns BaseDriver from Storage
raises StreamWriteError
is deferred;
---C++: alias operator <<
---C++: return &
PutBoolean(me : in out; aValue : Boolean from Standard) returns BaseDriver from Storage
raises StreamWriteError
is deferred;
---C++: alias operator <<
---C++: return &
PutReal(me : in out; aValue : Real from Standard) returns BaseDriver from Storage
raises StreamWriteError
is deferred;
---C++: alias operator <<
---C++: return &
PutShortReal(me : in out; aValue : ShortReal from Standard) returns BaseDriver from Storage
raises StreamWriteError
is deferred;
---C++: alias operator <<
---C++: return &
GetReference(me : in out; aValue : in out Integer from Standard) returns BaseDriver from Storage
raises StreamTypeMismatchError
is deferred;
---C++: return &
GetCharacter(me : in out; aValue : in out Character from Standard) returns BaseDriver from Storage
raises StreamTypeMismatchError
is deferred;
---C++: alias operator >>
---C++: return &
GetExtCharacter(me : in out; aValue :in out ExtCharacter from Standard) returns BaseDriver from Storage
raises StreamTypeMismatchError
is deferred;
---C++: alias operator >>
---C++: return &
GetInteger(me : in out; aValue : in out Integer from Standard) returns BaseDriver from Storage
raises StreamTypeMismatchError
is deferred;
---C++: alias operator >>
---C++: return &
GetBoolean(me : in out; aValue : in out Boolean from Standard) returns BaseDriver from Storage
raises StreamTypeMismatchError
is deferred;
---C++: alias operator >>
---C++: return &
GetReal(me : in out; aValue :in out Real from Standard) returns BaseDriver from Storage
raises StreamTypeMismatchError
is deferred;
---C++: alias operator >>
---C++: return &
GetShortReal(me : in out; aValue : in out ShortReal from Standard) returns BaseDriver from Storage
raises StreamTypeMismatchError
is deferred;
---C++: alias operator >>
---C++: return &
Close(me : in out) returns Error from Storage is deferred;
-- PROTECTED
SetName(me : in out; aName : AsciiString from TCollection) is protected;
---C++: inline
SetOpenMode(me : in out; aMode : OpenMode from Storage) is protected;
---C++: inline
fields
myOpenMode : OpenMode from Storage;
myName : AsciiString from TCollection;
end;

View File

@@ -0,0 +1,8 @@
#include <Storage_BaseDriver.ixx>
Storage_BaseDriver::Storage_BaseDriver() : myOpenMode(Storage_VSNone)
{
}
void Storage_BaseDriver::Delete()
{}

View File

@@ -0,0 +1,20 @@
inline TCollection_AsciiString Storage_BaseDriver::Name() const
{
return myName;
}
inline Storage_OpenMode Storage_BaseDriver::OpenMode() const
{
return myOpenMode;
}
inline void Storage_BaseDriver::SetName(const TCollection_AsciiString& aName)
{
myName = aName;
}
inline void Storage_BaseDriver::SetOpenMode(const Storage_OpenMode aMode)
{
myOpenMode = aMode;
}

View File

@@ -0,0 +1,99 @@
#ifndef _Storage_BucketOfPersistent_HeaderFile
#define _Storage_BucketOfPersistent_HeaderFile
#include <Standard_Integer.hxx>
#include <Standard_Persistent.hxx>
class Storage_Schema;
class Storage_BucketOfPersistent;
class Storage_BucketIterator;
class Storage_Bucket {
friend class Storage_BucketIterator;
friend class Storage_Schema;
friend class Storage_BucketOfPersistent;
Standard_Persistent** mySpace;
Standard_Integer mySpaceSize;
Standard_Integer myCurrentSpace;
void Append(Standard_Persistent *);
Standard_Persistent* Value(const Standard_Integer theIndex) const;
public:
Storage_Bucket() : mySpace(0L), mySpaceSize(200000), myCurrentSpace(-1)
{
mySpace = (Standard_Persistent**)StandardCSFDB_Allocate(sizeof(Standard_Persistent*) * mySpaceSize);
}
Storage_Bucket(const Standard_Integer theSpaceSize) : mySpace(0L), mySpaceSize(theSpaceSize), myCurrentSpace(-1)
{
mySpace = (Standard_Persistent**)StandardCSFDB_Allocate(sizeof(Standard_Persistent*) * mySpaceSize);
}
void Clear();
~Storage_Bucket();
};
class Storage_BucketOfPersistent {
friend class Storage_BucketIterator;
Storage_Bucket** myBuckets;
Standard_Integer myNumberOfBucket;
Standard_Integer myNumberOfBucketAllocated;
Storage_Bucket* myCurrentBucket;
Standard_Integer myCurrentBucketNumber;
Standard_Integer myLength;
Standard_Integer myBucketSize;
public:
Storage_BucketOfPersistent(const Standard_Integer theBucketSize = 300000, const Standard_Integer theBucketNumber = 100);
Standard_Integer Length() const
{
return myLength;
}
void Append(const Handle(Standard_Persistent)& sp);
Standard_Persistent* Value(const Standard_Integer theIndex);
void Clear();
~Storage_BucketOfPersistent() ;
};
class Storage_BucketIterator {
Storage_BucketOfPersistent *myBucket;
Storage_Bucket *myCurrentBucket;
Standard_Integer myCurrentBucketIndex;
Standard_Integer myCurrentIndex;
Standard_Integer myBucketNumber;
Standard_Boolean myMoreObject;
public:
Storage_BucketIterator(Storage_BucketOfPersistent*);
void Init(Storage_BucketOfPersistent*);
void Reset();
Standard_Persistent* Value() const
{
if (myCurrentBucket) {
return myCurrentBucket->mySpace[myCurrentIndex];
}
else return 0L;
}
Standard_Boolean More() const
{
return myMoreObject;
}
void Next();
};
#endif

View File

@@ -0,0 +1,23 @@
-- File: Storage_CallBack.cdl
-- Created: Thu Feb 27 17:58:37 1997
-- Author: Christophe LEYNADIER
-- <cle@parigox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
deferred class CallBack from Storage
inherits TShared from MMgt
uses Schema from Storage,
BaseDriver from Storage
is
New(me) returns mutable Persistent is deferred;
Add(me; aPers : Persistent from Standard; aSchema : Schema from Storage) is deferred;
Write(me; aPers : Persistent from Standard; aDriver : in out BaseDriver from Storage; aSchema : Schema from Storage) is deferred;
Read(me; aPers : mutable Persistent from Standard; aDriver : in out BaseDriver from Storage; aSchema : Schema from Storage) is deferred;
end;

View File

@@ -0,0 +1 @@
#include <Storage_CallBack.ixx>

View File

@@ -0,0 +1,9 @@
#include <Storage_Container.hxx>
#include <Standard_Type.hxx>
const Handle_Standard_Type& Storage_Container_Type_()
{
static Handle_Standard_Type _aType = new Standard_Type("Storage_Container",sizeof(Storage_Container));
return _aType;
}

View File

@@ -0,0 +1,13 @@
#ifndef _Storage_Container_HeaderFile
#define _Storage_Container_HeaderFile
class Handle_Standard_Type;
const Handle_Standard_Type& Storage_Container_Type_();
class Storage_BaseDriver;
typedef Storage_BaseDriver* Storage_Container;
Storage_Container& Storage_CurrentContainer();
#endif

229
src/Storage/Storage_Data.cdl Executable file
View File

@@ -0,0 +1,229 @@
-- File: Storage_Data.cdl
-- Created: Thu Feb 6 15:10:29 1997
-- Author: Kernel
-- <kernel@parigox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
class Data from Storage
inherits TShared from MMgt
--- Purpose: A picture memorizing the data stored in a
-- container (for example, in a file).
-- A Storage_Data object represents either:
-- - persistent data to be written into a container,
-- or
-- - persistent data which are read from a container.
-- A Storage_Data object is used in both the
-- storage and retrieval operations:
-- - Storage mechanism: create an empty
-- Storage_Data object, then add successively
-- persistent objects (roots) to be stored using
-- the function AddRoot. When the set of data is
-- complete, write it to a container using the
-- function Write in your Storage_Schema
-- storage/retrieval algorithm.
-- - Retrieval mechanism: a Storage_Data
-- object is returned by the Read function from
-- your Storage_Schema storage/retrieval
-- algorithm. Use the functions NumberOfRoots
-- and Roots to find the roots which were stored
-- in the read container.
-- The roots of a Storage_Data object may share
-- references on objects. The shared internal
-- references of a Storage_Data object are
-- maintained by the storage/retrieval mechanism.
-- Note: References shared by objects which are
-- contained in two distinct Storage_Data objects
-- are not maintained by the storage/retrieval
-- mechanism: external references are not
-- supported by Storage_Schema algorithm
uses TypeData from Storage,
RootData from Storage,
Root from Storage,
InternalData from Storage,
HSeqOfRoot from Storage,
AsciiString from TCollection,
HSequenceOfAsciiString from TColStd,
SequenceOfAsciiString from TColStd,
HeaderData from Storage,
Error from Storage,
ExtendedString from TCollection,
SequenceOfExtendedString from TColStd
is
Create returns mutable Data from Storage;
---Purpose:
-- Creates an empty set of data.
-- You explicitly create a Storage_Data object
-- when preparing the set of objects to be stored
-- together in a container (for example, in a file).
-- Then use the function AddRoot to add
-- persistent objects to the set of data.
-- A Storage_Data object is also returned by the
-- Read function of a Storage_Schema
-- storage/retrieval algorithm. Use the functions
-- NumberOfRoots and Roots to find the roots
-- which were stored in the read container.
ErrorStatus(me) returns Error from Storage;
---Purpose: Returns Storage_VSOk if
-- - the last storage operation performed with the
-- function Read, or
-- - the last retrieval operation performed with the function Write
-- by a Storage_Schema algorithm, on this set of data was successful.
-- If the storage or retrieval operation was not
-- performed, the returned error status indicates the
-- reason why the operation failed. The algorithm
-- stops its analysis at the first detected error
ClearErrorStatus(me : mutable);
---Purpose:
-- Clears the error status positioned either by:
-- - the last storage operation performed with the
-- Read function, or
-- - the last retrieval operation performed with the Write function
-- by a Storage_Schema algorithm, on this set of data.
-- This error status may be read by the function ErrorStatus.
ErrorStatusExtension(me) returns AsciiString from TCollection;
-- HEADER
CreationDate(me) returns AsciiString from TCollection;
---Purpose: return the creation date
StorageVersion(me) returns AsciiString from TCollection;
---Purpose: return the Storage package version
SchemaVersion(me) returns AsciiString from TCollection;
---Purpose: get the version of the schema
SchemaName(me) returns AsciiString from TCollection;
---Purpose: get the schema's name
SetApplicationVersion(me : mutable; aVersion : AsciiString from TCollection);
---Purpose: set the version of the application
ApplicationVersion(me) returns AsciiString from TCollection;
---Purpose: get the version of the application
SetApplicationName(me : mutable; aName : ExtendedString from TCollection);
---Purpose: set the name of the application
ApplicationName(me) returns ExtendedString from TCollection;
---Purpose: get the name of the application
SetDataType(me : mutable; aType : ExtendedString from TCollection);
---Purpose: set the data type
DataType(me) returns ExtendedString from TCollection;
---Purpose: returns data type
AddToUserInfo(me : mutable; anInfo : AsciiString from TCollection);
---Purpose: add <theUserInfo> to the user informations
UserInfo(me) returns SequenceOfAsciiString from TColStd;
---Purpose: return the user informations
---C++: return const &
AddToComments(me : mutable; aComment : ExtendedString from TCollection);
---Purpose: add <theUserInfo> to the user informations
Comments(me) returns SequenceOfExtendedString from TColStd;
---Purpose: return the user informations
---C++: return const &
NumberOfObjects(me) returns Integer;
---Purpose: the the number of persistent objects
-- Return:
-- the number of persistent objects readed
-- ROOTS
NumberOfRoots(me) returns Integer from Standard;
---Purpose: Returns the number of root objects in this set of data.
-- - When preparing a storage operation, the
-- result is the number of roots inserted into this
-- set of data with the function AddRoot.
-- - When retrieving an object, the result is the
-- number of roots stored in the read container.
-- Use the Roots function to get these roots in a sequence.
AddRoot(me; anObject : mutable Persistent from Standard);
---Purpose: add a persistent root to write. the name of the root
-- is a driver reference number.
AddRoot(me; aName : AsciiString from TCollection; anObject : mutable Persistent from Standard);
---Purpose: Adds the root anObject to this set of data.
-- The name of the root is aName if given; if not, it
-- will be a reference number assigned by the driver
-- when writing the set of data into the container.
-- When naming the roots, it is easier to retrieve
-- objects by significant references rather than by
-- references without any semantic values.
RemoveRoot(me : mutable; aName : AsciiString from TCollection);
---Purpose: Removes from this set of data the root object named aName.
-- Warning
-- Nothing is done if there is no root object whose
-- name is aName in this set of data.
Roots(me) returns HSeqOfRoot from Storage;
---Purpose: Returns the roots of this set of data in a sequence.
-- - When preparing a storage operation, the
-- sequence contains the roots inserted into this
-- set of data with the function AddRoot.
-- - When retrieving an object, the sequence
-- contains the roots stored in the container read.
-- - An empty sequence is returned if there is no root in this set of data.
Find(me; aName : AsciiString from TCollection) returns mutable Root from Storage;
---Purpose: Gives the root object whose name is aName in
-- this set of data. The returned object is a
-- Storage_Root object, from which the object it
-- encapsulates may be extracted.
-- Warning
-- A null handle is returned if there is no root object
-- whose name is aName in this set of data.
IsRoot(me; aName : AsciiString from TCollection) returns Boolean from Standard;
---Purpose: returns Standard_True if <me> contains a root named <aName>
-- TYPES
NumberOfTypes(me) returns Integer from Standard;
---Purpose: Returns the number of types of objects used in this set of data.
IsType(me; aName : AsciiString from TCollection) returns Boolean from Standard;
---Purpose: Returns true if this set of data contains an object of type aName.
-- Persistent objects from this set of data must
-- have types which are recognized by the
-- Storage_Schema algorithm used to store or retrieve them.
Types(me) returns HSequenceOfAsciiString from TColStd;
---Purpose:
-- Gives the list of types of objects used in this set of data in a sequence.
-- PRIVATE
HeaderData(me) returns mutable HeaderData from Storage is private;
RootData(me) returns mutable RootData from Storage is private;
TypeData(me) returns mutable TypeData from Storage is private;
InternalData(me) returns mutable InternalData from Storage is private;
Clear(me) is private;
SetErrorStatus(me : mutable; anError : Error from Storage) is private;
SetErrorStatusExtension(me : mutable; anErrorExt : AsciiString from TCollection) is private;
fields
myHeaderData : HeaderData from Storage;
myRootData : RootData from Storage;
myTypeData : TypeData from Storage;
myInternal : InternalData from Storage;
myErrorStatus : Error from Storage;
myErrorStatusExt : AsciiString from TCollection;
friends class Schema from Storage
end;

194
src/Storage/Storage_Data.cxx Executable file
View File

@@ -0,0 +1,194 @@
#include <Storage_Data.ixx>
#include <Storage_Root.hxx>
Storage_Data::Storage_Data()
{
myRootData = new Storage_RootData;
myTypeData = new Storage_TypeData;
myInternal = new Storage_InternalData;
myHeaderData = new Storage_HeaderData;
}
void Storage_Data::AddRoot(const Handle(Standard_Persistent)& anObject) const
{
Handle(Storage_Root) aRoot = new Storage_Root(TCollection_AsciiString(myRootData->NumberOfRoots()+1),anObject);
myRootData->AddRoot(aRoot);
}
void Storage_Data::AddRoot(const TCollection_AsciiString& aName, const Handle(Standard_Persistent)& anObject) const
{
Handle(Storage_Root) aRoot = new Storage_Root(aName,anObject);
myRootData->AddRoot(aRoot);
}
void Storage_Data::RemoveRoot(const TCollection_AsciiString& anObject)
{
myRootData->RemoveRoot(anObject);
}
Handle(Storage_Root) Storage_Data::Find(const TCollection_AsciiString& aName) const
{
return myRootData->Find(aName);
}
Standard_Integer Storage_Data::NumberOfRoots() const
{
return myRootData->NumberOfRoots();
}
Standard_Boolean Storage_Data::IsRoot(const TCollection_AsciiString& aName) const
{
return myRootData->IsRoot(aName);
}
Handle(Storage_HSeqOfRoot) Storage_Data::Roots() const
{
return myRootData->Roots();
}
Standard_Integer Storage_Data::NumberOfTypes() const
{
return myTypeData->NumberOfTypes();
}
Standard_Boolean Storage_Data::IsType(const TCollection_AsciiString& aName) const
{
return myTypeData->IsType(aName);
}
Handle(TColStd_HSequenceOfAsciiString) Storage_Data::Types() const
{
return myTypeData->Types();
}
Handle(Storage_RootData) Storage_Data::RootData() const
{
return myRootData;
}
Handle(Storage_TypeData) Storage_Data::TypeData() const
{
return myTypeData;
}
Handle(Storage_InternalData) Storage_Data::InternalData() const
{
return myInternal;
}
Handle(Storage_HeaderData) Storage_Data::HeaderData() const
{
return myHeaderData;
}
void Storage_Data::Clear() const
{
myInternal->Clear();
myTypeData->Clear();
}
// HEADER
TCollection_AsciiString Storage_Data::CreationDate() const
{
return myHeaderData->CreationDate();
}
TCollection_AsciiString Storage_Data::SchemaVersion() const
{
return myHeaderData->SchemaVersion();
}
TCollection_AsciiString Storage_Data::SchemaName() const
{
return myHeaderData->SchemaName();
}
void Storage_Data::SetApplicationVersion(const TCollection_AsciiString& aVersion)
{
myHeaderData->SetApplicationVersion(aVersion);
}
TCollection_AsciiString Storage_Data::ApplicationVersion() const
{
return myHeaderData->ApplicationVersion();
}
void Storage_Data::SetApplicationName(const TCollection_ExtendedString& aName)
{
myHeaderData->SetApplicationName(aName);
}
TCollection_ExtendedString Storage_Data::ApplicationName() const
{
return myHeaderData->ApplicationName();
}
void Storage_Data::AddToUserInfo(const TCollection_AsciiString& theUserInfo)
{
myHeaderData->AddToUserInfo(theUserInfo);
}
const TColStd_SequenceOfAsciiString& Storage_Data::UserInfo() const
{
return myHeaderData->UserInfo();
}
void Storage_Data::AddToComments(const TCollection_ExtendedString& theUserInfo)
{
myHeaderData->AddToComments(theUserInfo);
}
const TColStd_SequenceOfExtendedString& Storage_Data::Comments() const
{
return myHeaderData->Comments();
}
Standard_Integer Storage_Data::NumberOfObjects() const
{
return myHeaderData->NumberOfObjects();
}
TCollection_AsciiString Storage_Data::StorageVersion() const
{
return myHeaderData->StorageVersion();
}
Storage_Error Storage_Data::ErrorStatus() const
{
return myErrorStatus;
}
void Storage_Data::SetErrorStatus(const Storage_Error anError)
{
myErrorStatus = anError;
}
void Storage_Data::ClearErrorStatus()
{
myErrorStatus = Storage_VSOk;
myErrorStatusExt.Clear();
myHeaderData->ClearErrorStatus();
myRootData->ClearErrorStatus();
myTypeData->ClearErrorStatus();
}
void Storage_Data::SetDataType(const TCollection_ExtendedString& aName)
{
myHeaderData->SetDataType(aName);
}
TCollection_ExtendedString Storage_Data::DataType() const
{
return myHeaderData->DataType();
}
TCollection_AsciiString Storage_Data::ErrorStatusExtension() const
{
return myErrorStatusExt;
}
void Storage_Data::SetErrorStatusExtension(const TCollection_AsciiString& anErrorExt)
{
myErrorStatusExt = anErrorExt;
}

View File

@@ -0,0 +1,25 @@
-- File: Storage_DefaultCallBack.cdl
-- Created: Mon Mar 3 09:25:19 1997
-- Author: Christophe LEYNADIER
-- <cle@parigox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
class DefaultCallBack from Storage
inherits CallBack from Storage
uses Schema from Storage,
BaseDriver from Storage
is
Create returns DefaultCallBack from Storage;
New(me) returns mutable Persistent;
Add(me; aPers : Persistent from Standard; aSchema : Schema from Storage);
Write(me; aPers : Persistent from Standard; aDriver : in out BaseDriver from Storage; aSchema : Schema from Storage);
Read(me; aPers : mutable Persistent from Standard; aDriver : in out BaseDriver from Storage; aSchema : Schema from Storage);
end;

View File

@@ -0,0 +1,25 @@
#include <Storage_DefaultCallBack.ixx>
Storage_DefaultCallBack::Storage_DefaultCallBack()
{
}
Handle(Standard_Persistent) Storage_DefaultCallBack::New() const
{
Handle(Standard_Persistent) res = new Standard_Persistent;
return res;
}
void Storage_DefaultCallBack::Add(const Handle(Standard_Persistent)&, const Handle(Storage_Schema)&) const
{
}
void Storage_DefaultCallBack::Write(const Handle(Standard_Persistent)&,Storage_BaseDriver&,const Handle(Storage_Schema)&) const
{
}
void Storage_DefaultCallBack::Read(const Handle(Standard_Persistent)&,Storage_BaseDriver& f,const Handle(Storage_Schema)&) const
{
f.SkipObject();
}

View File

@@ -0,0 +1,103 @@
-- File: Storage_InfoSection.cdl
-- Created: Thu Feb 6 15:37:03 1997
-- Author: Kernel
-- <kernel@parigox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
class HeaderData from Storage
inherits TShared from MMgt
uses AsciiString from TCollection,
SequenceOfAsciiString from TColStd,
Error from Storage,
ExtendedString from TCollection,
SequenceOfExtendedString from TColStd
is
Create returns mutable HeaderData from Storage;
CreationDate(me) returns AsciiString from TCollection;
---Purpose: return the creation date
StorageVersion(me) returns AsciiString from TCollection;
---Purpose: return the Storage package version
SchemaVersion(me) returns AsciiString from TCollection;
---Purpose: get the version of the schema
SchemaName(me) returns AsciiString from TCollection;
---Purpose: get the schema's name
SetApplicationVersion(me : mutable; aVersion : AsciiString from TCollection);
---Purpose: set the version of the application
ApplicationVersion(me) returns AsciiString from TCollection;
---Purpose: get the version of the application
SetApplicationName(me : mutable; aName : ExtendedString from TCollection);
---Purpose: set the name of the application
ApplicationName(me) returns ExtendedString from TCollection;
---Purpose: get the name of the application
SetDataType(me : mutable; aType : ExtendedString from TCollection);
---Purpose: set the data type
DataType(me) returns ExtendedString from TCollection;
---Purpose: returns data type
AddToUserInfo(me : mutable; theUserInfo : AsciiString from TCollection);
---Purpose: add <theUserInfo> to the user informations
UserInfo(me) returns SequenceOfAsciiString from TColStd;
---Purpose: return the user informations
---C++: return const &
AddToComments(me : mutable; aComment : ExtendedString from TCollection);
---Purpose: add <theUserInfo> to the user informations
Comments(me) returns SequenceOfExtendedString from TColStd;
---Purpose: return the user informations
---C++: return const &
NumberOfObjects(me) returns Integer;
---Purpose: the the number of persistent objects
-- Return:
-- the number of persistent objects readed
ErrorStatus(me) returns Error from Storage;
ErrorStatusExtension(me) returns AsciiString from TCollection;
ClearErrorStatus(me : mutable);
-- PRIVATE
SetNumberOfObjects(me : mutable; anObjectNumber : Integer from Standard) is private;
SetStorageVersion(me : mutable; aVersion : AsciiString from TCollection) is private;
SetCreationDate(me : mutable; aDate : AsciiString from TCollection) is private;
SetSchemaVersion(me : mutable; aVersion : AsciiString from TCollection) is private;
SetSchemaName(me : mutable; aName : AsciiString from TCollection) is private;
SetErrorStatus(me : mutable; anError : Error from Storage) is private;
SetErrorStatusExtension(me : mutable; anErrorExt : AsciiString from TCollection) is private;
fields
myNBObj : Integer from Standard;
myStorageVersion : AsciiString from TCollection;
mySchemaVersion : AsciiString from TCollection;
mySchemaName : AsciiString from TCollection;
myApplicationVersion : AsciiString from TCollection;
myApplicationName : ExtendedString from TCollection;
myDataType : ExtendedString from TCollection;
myDate : AsciiString from TCollection;
myUserInfo : SequenceOfAsciiString from TColStd;
myComments : SequenceOfExtendedString from TColStd;
myErrorStatus : Error from Storage;
myErrorStatusExt : AsciiString from TCollection;
friends class Schema from Storage
end;

View File

@@ -0,0 +1,132 @@
#include <Storage_HeaderData.ixx>
Storage_HeaderData::Storage_HeaderData() : myNBObj(0), myErrorStatus(Storage_VSOk)
{
}
TCollection_AsciiString Storage_HeaderData::CreationDate() const
{
return myDate;
}
void Storage_HeaderData::SetSchemaVersion(const TCollection_AsciiString& aVersion)
{
mySchemaVersion = aVersion;
}
TCollection_AsciiString Storage_HeaderData::SchemaVersion() const
{
return mySchemaVersion;
}
void Storage_HeaderData::SetSchemaName(const TCollection_AsciiString& aSchemaName)
{
mySchemaName = aSchemaName;
}
TCollection_AsciiString Storage_HeaderData::SchemaName() const
{
return mySchemaName;
}
void Storage_HeaderData::SetApplicationVersion(const TCollection_AsciiString& aVersion)
{
myApplicationVersion = aVersion;
}
TCollection_AsciiString Storage_HeaderData::ApplicationVersion() const
{
return myApplicationVersion;
}
void Storage_HeaderData::SetApplicationName(const TCollection_ExtendedString& aName)
{
myApplicationName = aName;
}
TCollection_ExtendedString Storage_HeaderData::ApplicationName() const
{
return myApplicationName;
}
void Storage_HeaderData::SetDataType(const TCollection_ExtendedString& aName)
{
myDataType = aName;
}
TCollection_ExtendedString Storage_HeaderData::DataType() const
{
return myDataType;
}
void Storage_HeaderData::AddToUserInfo(const TCollection_AsciiString& theUserInfo)
{
myUserInfo.Append(theUserInfo);
}
const TColStd_SequenceOfAsciiString& Storage_HeaderData::UserInfo() const
{
return myUserInfo;
}
void Storage_HeaderData::AddToComments(const TCollection_ExtendedString& aComments)
{
myComments.Append(aComments);
}
const TColStd_SequenceOfExtendedString& Storage_HeaderData::Comments() const
{
return myComments;
}
Standard_Integer Storage_HeaderData::NumberOfObjects() const
{
return myNBObj;
}
void Storage_HeaderData::SetNumberOfObjects(const Standard_Integer anObjectNumber)
{
myNBObj = anObjectNumber;
}
void Storage_HeaderData::SetStorageVersion(const TCollection_AsciiString& v)
{
myStorageVersion = v;
}
void Storage_HeaderData::SetCreationDate(const TCollection_AsciiString& d)
{
myDate = d;
}
TCollection_AsciiString Storage_HeaderData::StorageVersion() const
{
return myStorageVersion;
}
Storage_Error Storage_HeaderData::ErrorStatus() const
{
return myErrorStatus;
}
void Storage_HeaderData::SetErrorStatus(const Storage_Error anError)
{
myErrorStatus = anError;
}
TCollection_AsciiString Storage_HeaderData::ErrorStatusExtension() const
{
return myErrorStatusExt;
}
void Storage_HeaderData::SetErrorStatusExtension(const TCollection_AsciiString& anErrorExt)
{
myErrorStatusExt = anErrorExt;
}
void Storage_HeaderData::ClearErrorStatus()
{
myErrorStatus = Storage_VSOk;
myErrorStatusExt.Clear();
}

View File

@@ -0,0 +1,29 @@
-- File: Storage_InternalData.cdl
-- Created: Thu Feb 6 16:08:23 1997
-- Author: Kernel
-- <kernel@parigox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
private class InternalData from Storage
inherits TShared from MMgt
uses BucketOfPersistent from Storage,
HPArray from Storage,
MapOfCallBack from Storage
is
Create returns mutable InternalData from Storage;
Clear(me : mutable);
fields
myPtoA : BucketOfPersistent from Storage;
myObjId : Integer from Standard;
myTypeId : Integer from Standard;
myReadArray : HPArray from Storage;
myTypeBinding : MapOfCallBack from Storage;
friends class Schema from Storage
end;

View File

@@ -0,0 +1,15 @@
#include <Storage_InternalData.ixx>
Storage_InternalData::Storage_InternalData() : myObjId(1), myTypeId(1)
{
}
void Storage_InternalData::Clear()
{
myTypeId = 1;
myObjId = 1;
myReadArray.Nullify();
myPtoA.Clear();
myTypeBinding.Clear();
}

76
src/Storage/Storage_Macros.hxx Executable file
View File

@@ -0,0 +1,76 @@
#ifndef _Storage_Macros_HeaderFile
#define _Storage_Macros_HeaderFile 1
#include <Storage_SolveMode.hxx>
// PROTOTYPES
//
#define Storage_DECLARE_SCHEMA_METHODS(schema) public: \
Standard_EXPORT Handle(Storage_CallBack) CallBackSelection(const TCollection_AsciiString&) const; \
Standard_EXPORT Handle(Storage_CallBack) AddTypeSelection(const Handle(Standard_Persistent)&) const; \
Standard_EXPORT const TColStd_SequenceOfAsciiString& SchemaKnownTypes() const;
// Read_TypeSelection
//
#define Storage_BEGIN_READ_SELECTION(schema) \
extern "C" { \
Standard_EXPORT Handle(Storage_Schema) Create##schema() { return new schema; } \
} \
Handle(Storage_CallBack) schema::CallBackSelection(const TCollection_AsciiString& rt) const \
{ \
Handle(Standard_Persistent) p; \
Handle(Storage_CallBack) cback;
#define Storage_READ_SELECTION(schema,classe,callback) if (strcmp(rt.ToCString(),#classe) == 0) { \
cback = new callback ; \
return cback; \
}
#define Storage_END_READ_SELECTION(schema) cback = ResolveUnknownType(rt,p,Storage_WriteSolve); \
return cback; \
}
// SchemaKnownTypes
//
#define Storage_BEGIN_SCHEMA_TYPES(schema) const TColStd_SequenceOfAsciiString& schema::SchemaKnownTypes() const \
{ \
static TColStd_SequenceOfAsciiString aSeq; \
static Standard_Boolean jsuidjaalai = Standard_False; \
if (!jsuidjaalai) { \
jsuidjaalai = Standard_True;
#define Storage_SCHEMA_TYPES(classe) aSeq.Append(#classe);
#define Storage_END_SCHEMA_TYPES(schema) } return aSeq; \
}
// ADD_TypeSelection
//
#define Storage_BEGIN_ADD_TYPES(schema) Handle(Storage_CallBack) schema::AddTypeSelection(const Handle(Standard_Persistent)& p) const \
{ \
Handle(Storage_CallBack) cback; \
if (!p.IsNull()) { \
const Handle(Standard_Type)& t = p->DynamicType(); \
static TCollection_AsciiString theTypeName;\
theTypeName = t->Name(); \
if (HasTypeBinding(theTypeName)) { \
cback = TypeBinding(theTypeName); \
cback->Add(p,this); \
return cback; \
}
#define Storage_ADD_TYPES(schema,classe,callback) if (t == classe##_Type_()) { \
cback = new callback ; \
BindType(theTypeName,cback); \
cback->Add(p,this); \
return cback; \
}
#define Storage_END_ADD_TYPES(schema) cback = ResolveUnknownType(theTypeName,p,Storage_AddSolve); \
if (!cback.IsNull()) { \
cback->Add(p,this); \
} \
return cback; \
} \
return cback; \
}
#endif

View File

@@ -0,0 +1,12 @@
// File : Storage_Position.hxx
// Created : Fri Nov 22 15:42:05 2002
// Author : Edward AGAPOV (eap)
// Copyright : Open CASCADE
#ifndef Storage_Position_HeaderFile
#define Storage_Position_HeaderFile
typedef long Storage_Position;
#endif

70
src/Storage/Storage_Root.cdl Executable file
View File

@@ -0,0 +1,70 @@
-- File: Storage_Root.cdl
-- Created: Mon Feb 24 16:30:08 1997
-- Author: Kernel
-- <kernel@parigox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
class Root from Storage
inherits TShared from MMgt
---Purpose:
-- A root object extracted from a Storage_Data object.
-- A Storage_Root encapsulates a persistent
-- object which is a root of a Storage_Data object.
-- It contains additional information: the name and
-- the data type of the persistent object.
-- When retrieving a Storage_Data object from a
-- container (for example, a file) you access its
-- roots with the function Roots which returns a
-- sequence of root objects. The provided functions
-- allow you to request information about each root of the sequence.
-- You do not create explicit roots: when inserting
-- data in a Storage_Data object, you just provide
-- the persistent object and optionally its name to the function AddRoot.
uses AsciiString from TCollection
is
Create returns mutable Root from Storage;
Create(aName : AsciiString from TCollection;
anObject : Persistent from Standard) returns mutable Root from Storage;
SetName(me : mutable; aName : AsciiString from TCollection);
Name(me) returns AsciiString from TCollection;
---Purpose:
-- Returns the name of this root object.
-- The name may have been given explicitly when
-- the root was inserted into the Storage_Data
-- object. If not, the name is a reference number
-- which was assigned automatically by the driver
-- when writing the set of data into the container.
-- When naming the roots, it is easier to retrieve
-- objects by significant references rather than by
-- references without any semantic values.
-- Warning
-- The returned string will be empty if you call this
-- function before having named this root object,
-- either explicitly, or when writing the set of data
-- into the container.
SetObject(me : mutable; anObject : Persistent from Standard);
Object(me) returns mutable Persistent from Standard;
---Purpose:
-- Returns the persistent object encapsulated by this root.
Type(me) returns AsciiString from TCollection;
---Purpose: Returns the name of this root type.
SetReference(me : mutable; aRef : Integer from Standard) is private;
Reference(me) returns Integer from Standard is private;
SetType(me : mutable; aType : AsciiString from TCollection) is private;
fields
myName : AsciiString from TCollection;
myType : AsciiString from TCollection;
myObject : Persistent from Standard;
myRef : Integer from Standard;
friends class Schema from Storage
end;

59
src/Storage/Storage_Root.cxx Executable file
View File

@@ -0,0 +1,59 @@
#include <Storage_Root.ixx>
Storage_Root::Storage_Root() : myRef(0)
{
}
Storage_Root::Storage_Root(const TCollection_AsciiString& aName,const Handle(Standard_Persistent)& anObject) : myRef(0)
{
myName = aName;
myObject = anObject;
if (!anObject.IsNull()) {
myType = anObject->DynamicType()->Name();
}
}
void Storage_Root::SetName(const TCollection_AsciiString& aName)
{
myName = aName;
}
TCollection_AsciiString Storage_Root::Name() const
{
return myName;
}
void Storage_Root::SetObject(const Handle(Standard_Persistent)& anObject)
{
myObject = anObject;
if (!anObject.IsNull()) {
myType = anObject->DynamicType()->Name();
}
}
Handle(Standard_Persistent) Storage_Root::Object() const
{
return myObject;
}
TCollection_AsciiString Storage_Root::Type() const
{
return myType;
}
void Storage_Root::SetReference(const Standard_Integer aRef)
{
myRef = aRef;
}
Standard_Integer Storage_Root::Reference() const
{
return myRef;
}
void Storage_Root::SetType(const TCollection_AsciiString& aType)
{
myType = aType;
}

View File

@@ -0,0 +1,64 @@
-- File: Storage_RootData.cdl
-- Created: Thu Feb 6 17:00:10 1997
-- Author: Kernel
-- <kernel@parigox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
class RootData from Storage
inherits TShared from MMgt
uses SequenceOfAsciiString from TColStd,
AsciiString from TCollection,
MapOfPers from Storage,
HSeqOfRoot from Storage,
Error from Storage,
Root from Storage
raises NoSuchObject from Standard
is
Create returns mutable RootData from Storage;
NumberOfRoots(me) returns Integer from Standard;
---Purpose: returns the number of roots.
AddRoot(me : mutable; aRoot : Root from Storage);
---Purpose: add a root to <me>. If a root with same name is present, it
-- will be replaced by <aRoot>.
Roots(me) returns mutable HSeqOfRoot from Storage;
Find(me; aName : AsciiString from TCollection) returns mutable Root from Storage;
---Purpose: find a root with name <aName>.
IsRoot(me; aName : AsciiString from TCollection) returns Boolean from Standard;
---Purpose: returns Standard_True if <me> contains a root named <aName>
RemoveRoot(me : mutable; aName : AsciiString from TCollection);
---Purpose: remove the root named <aName>.
ErrorStatus(me) returns Error from Storage;
ErrorStatusExtension(me) returns AsciiString from TCollection;
ClearErrorStatus(me : mutable);
-- PRIVATE
UpdateRoot(me : mutable; aName : AsciiString from TCollection; aPers : mutable Persistent from Standard)
raises NoSuchObject
is private;
SetErrorStatus(me : mutable; anError : Error from Storage) is private;
SetErrorStatusExtension(me : mutable; anErrorExt : AsciiString from TCollection) is private;
fields
myObjects : MapOfPers from Storage;
myErrorStatus : Error from Storage;
myErrorStatusExt : AsciiString from TCollection;
friends class Schema from Storage
end;

View File

@@ -0,0 +1,87 @@
#include <Storage_RootData.ixx>
#include <Storage_DataMapIteratorOfMapOfPers.hxx>
Storage_RootData::Storage_RootData() : myErrorStatus(Storage_VSOk)
{
}
Standard_Integer Storage_RootData::NumberOfRoots() const
{
return myObjects.Extent();
}
void Storage_RootData::AddRoot(const Handle(Storage_Root)& aRoot)
{
myObjects.Bind(aRoot->Name(),aRoot);
}
Handle(Storage_HSeqOfRoot) Storage_RootData::Roots() const
{
Handle(Storage_HSeqOfRoot) anObjectsSeq = new Storage_HSeqOfRoot;
Storage_DataMapIteratorOfMapOfPers it(myObjects);
for(;it.More(); it.Next()) {
anObjectsSeq->Append(it.Value());
}
return anObjectsSeq;
}
Handle(Storage_Root) Storage_RootData::Find(const TCollection_AsciiString& aName) const
{
Handle(Storage_Root) p;
if (myObjects.IsBound(aName)) {
p = myObjects.Find(aName);
}
return p;
}
Standard_Boolean Storage_RootData::IsRoot(const TCollection_AsciiString& aName) const
{
return myObjects.IsBound(aName);
}
void Storage_RootData::RemoveRoot(const TCollection_AsciiString& aName)
{
if (myObjects.IsBound(aName)) {
myObjects.UnBind(aName);
}
}
void Storage_RootData::UpdateRoot(const TCollection_AsciiString& aName,const Handle(Standard_Persistent)& aPers)
{
if (myObjects.IsBound(aName)) {
myObjects.ChangeFind(aName)->SetObject(aPers);
}
else {
Standard_NoSuchObject::Raise();
}
}
Storage_Error Storage_RootData::ErrorStatus() const
{
return myErrorStatus;
}
void Storage_RootData::SetErrorStatus(const Storage_Error anError)
{
myErrorStatus = anError;
}
void Storage_RootData::ClearErrorStatus()
{
myErrorStatus = Storage_VSOk;
myErrorStatusExt.Clear();
}
TCollection_AsciiString Storage_RootData::ErrorStatusExtension() const
{
return myErrorStatusExt;
}
void Storage_RootData::SetErrorStatusExtension(const TCollection_AsciiString& anErrorExt)
{
myErrorStatusExt = anErrorExt;
}

300
src/Storage/Storage_Schema.cdl Executable file
View File

@@ -0,0 +1,300 @@
-- File: Storage_Schema.cdl
-- Created: Tue Dec 3 10:05:16 1996
-- Author: Christophe LEYNADIER
-- <cle@parigox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1996
class Schema from Storage inherits TShared from MMgt
---Purpose:
-- Root class for basic storage/retrieval algorithms.
-- A Storage_Schema object processes:
-- - writing of a set of persistent data into a
-- container (store mechanism),
-- - reading of a container to extract all the
-- contained persistent data (retrieve mechanism).
-- A Storage_Schema object is based on the data
-- schema for the persistent data of the application, i.e.:
-- - the list of all persistent objects which may be
-- known by the application,
-- - the organization of their data; a data schema
-- knows how to browse each persistent object it contains.
-- During the store or retrieve operation, only
-- persistent objects known from the data schema
-- can be processed; they are then stored or
-- retrieved according to their description in the schema.
-- A data schema is specific to the object classes to
-- be read or written. Tools dedicated to the
-- environment in use allow a description of the
-- application persistent data structure.
-- Storage_Schema algorithms are called basic
-- because they do not support external references
-- between containers.
uses SequenceOfAsciiString from TColStd,
HSequenceOfAsciiString from TColStd,
AsciiString from TCollection,
BaseDriver from Storage,
Data from Storage,
HeaderData from Storage,
MapOfCallBack from Storage,
CallBack from Storage,
CallBack from Storage,
RootData from Storage,
TypeData from Storage,
HArrayOfSchema from Storage,
SolveMode from Storage
raises StreamFormatError from Storage
is
Create returns Schema from Storage;
---Purpose: Builds a storage/retrieval algorithm based on a
-- given data schema.
-- Example
-- For example, if ShapeSchema is the class
-- inheriting from Storage_Schema and containing
-- the description of your application data schema,
-- you create a storage/retrieval algorithm as follows:
-- Handle(ShapeSchema) s = new
-- ShapeSchema;
-- -------- --
-- USER API -- --------------------------------------------------------------
-- -------- --
SetVersion(me : mutable; aVersion : AsciiString from TCollection);
---Purpose: returns version of the schema
Version(me) returns AsciiString from TCollection;
---Purpose: returns the version of the schema
SetName(me : mutable; aSchemaName : AsciiString from TCollection);
---Purpose: set the schema's name
Name(me) returns AsciiString from TCollection;
---Purpose: returns the schema's name
Write(me; s : in out BaseDriver from Storage;
aData : mutable Data from Storage);
---Purpose: Writes the data aggregated in aData into the
-- container defined by the driver s. The storage
-- operation is performed according to the data
-- schema with which this algorithm is working.
-- Note: aData may aggregate several root objects
-- to be stored together.
Read(me; s : in out BaseDriver from Storage)
returns mutable Data from Storage;
---Purpose: Returns the data read from the container defined
-- by the driver s. The retrieval operation is
-- performed according to the data schema with
-- which this algorithm is working.
-- These data are aggregated in a Storage_Data
-- object which may be browsed in order to extract
-- the root objects from the container.
ReadHeaderSection(me; s : in out BaseDriver from Storage)
returns mutable HeaderData from Storage;
---Purpose: read the header part of the stream
-- Arguments:
-- s: driver to read
ReadTypeSection(me; s : in out BaseDriver from Storage)
returns mutable TypeData from Storage;
---Purpose: fill the TypeData with the names of the type used
-- in a stream
-- Arguments:
-- s: driver to read
ReadRootSection(me; s : in out BaseDriver from Storage)
returns mutable RootData from Storage;
---Purpose: read root part of the file
-- Arguments:
-- s: driver to read
SchemaKnownTypes(me)
returns SequenceOfAsciiString from TColStd is virtual;
---C++: return const &
---Purpose: returns the known types of a schema
HasUnknownType(me; aDriver : in out BaseDriver from Storage;
theUnknownTypes : out SequenceOfAsciiString from TColStd)
returns Boolean from Standard;
---Purpose: indicates whether the are types in the driver
-- which are not known from the schema and for which
-- no callbacks have been set. The unknown types can
-- be read in <theUnknownTypes>.
GetAllSchemaKnownTypes(me)
returns HSequenceOfAsciiString from TColStd;
---Purpose: returns the all known types of a schema and their
-- nested schemes.
SetNestedSchemas(me : mutable; theSchemas : HArrayOfSchema from Storage);
ClearNestedSchemas(me : mutable);
NestedSchemas(me) returns HArrayOfSchema from Storage;
ICreationDate(myclass) returns AsciiString from TCollection;
---Purpose: return a current date string
CheckTypeMigration(myclass; theTypeName : AsciiString from TCollection;
theNewName : in out AsciiString from TCollection)
returns Boolean from Standard;
---Purpose: returns True if theType migration is identified
-- --------------------------- --
-- USER API : CALLBACK SUPPORT --
-- --------------------------- --
---Purpose: the callback support provides a way to read a file
-- with a incomplete schema.
-- ex. : A file contains 3 types a,b and c.
-- The application's schema contains only 2
-- type a and b. If you try to read the file in
-- the application, you will have an error.To
-- bypass this problem you can give to your
-- application's schema a callback used when
-- the schema dosent know how to handle this
-- type.
---Warning: : the callback can only be used with persistent
-- types (not with storable types). the constructor
-- function can return a null handle the read
-- function can be empty
AddReadUnknownTypeCallBack(me : mutable;
aTypeName : AsciiString from TCollection;
aCallBack : CallBack from Storage);
---Purpose: add two functions to the callback list
RemoveReadUnknownTypeCallBack(me : mutable;
aTypeName : AsciiString from TCollection);
---Purpose: remove a callback for a type
InstalledCallBackList(me)
returns HSequenceOfAsciiString from TColStd;
---Purpose: returns a list of type name with installed
-- callback.
ClearCallBackList(me : mutable);
---Purpose: clear all callback from schema instance.
UseDefaultCallBack(me : mutable);
---Purpose: install a callback for all unknown type. the
-- objects with unknown types will be skipped. (look
-- SkipObject method in BaseDriver)
DontUseDefaultCallBack(me : mutable);
---Purpose: tells schema to uninstall the default callback.
IsUsingDefaultCallBack(me) returns Boolean from Standard;
---Purpose: ask if the schema is using the default callback.
SetDefaultCallBack(me : mutable; f : CallBack from Storage);
---Purpose: overload the default function for build.(use to
-- set an error message or skip an object while
-- reading an unknown type).
ResetDefaultCallBack(me : mutable);
---Purpose: reset the default function defined by Storage
-- package.
DefaultCallBack(me) returns CallBack from Storage;
---Purpose: returns the read function used when the
-- UseDefaultCallBack() is set.
-- ---------------- --
-- INTERNAL METHODS --
-- ---------------- --
SetNested(me : mutable) returns Boolean from Standard is private;
IsNested(me) returns Boolean from Standard is protected;
UnsetNested(me : mutable) returns Boolean from Standard is private;
ResolveUnknownType(me; aTypeName : AsciiString from TCollection;
aPers : Persistent from Standard;
aMode : SolveMode from Storage)
returns CallBack from Storage is protected;
CallBackSelection(me; tName : AsciiString from TCollection)
returns CallBack from Storage is virtual;
---Level: Internal
AddTypeSelection(me; sp : Persistent from Standard)
returns CallBack from Storage is virtual;
---Level: Internal
HasTypeBinding(me; aTypeName : AsciiString from TCollection)
returns Boolean from Standard is protected;
---Level: Internal
---C++: inline
BindType(me; aTypeName : AsciiString from TCollection;
aCallBack : CallBack from Storage) is protected;
---Level: Internal
TypeBinding(me; aTypeName : AsciiString from TCollection)
returns CallBack from Storage is protected;
---Level: Internal
WritePersistentObjectHeader(me : mutable;
sp : Persistent;
s : in out BaseDriver from Storage);
---C++: inline
---Level: Internal
ReadPersistentObjectHeader(me : mutable; s : in out BaseDriver from Storage);
---C++: inline
---Level: Internal
WritePersistentReference(me : mutable; sp : Persistent;
s : in out BaseDriver from Storage);
---C++: inline
ReadPersistentReference(me : mutable; sp : in out Persistent;
s : in out BaseDriver from Storage);
---Level: Internal
AddPersistent(me; sp : Persistent; tName : CString) returns Boolean;
---Level: Internal
PersistentToAdd(me; sp : Persistent) returns Boolean;
---Level: Internal
Clear(me) is private;
---Level: Internal
IReadHeaderSection(me; s : in out BaseDriver from Storage;
iData : mutable HeaderData from Storage) returns Boolean
raises StreamFormatError is private;
---Level: Internal
IReadTypeSection(me; s : in out BaseDriver from Storage;
tData : mutable TypeData from Storage) returns Boolean
raises StreamFormatError is private;
---Level: Internal
IReadRootSection(me; s : in out BaseDriver from Storage;
rData : mutable RootData from Storage) returns Boolean
raises StreamFormatError is private;
---Level: Internal
ISetCurrentData(myclass; dData : mutable Data from Storage) is private;
---Level: Internal
ICurrentData(myclass) returns mutable Data from Storage is private;
---Level: Internal
---C++: return &
fields
myCallBack : MapOfCallBack from Storage;
myCallBackState : Boolean from Standard;
myDefaultCallBack : CallBack from Storage;
myName : AsciiString from TCollection;
myVersion : AsciiString from TCollection;
myArrayOfSchema : HArrayOfSchema from Storage;
myNestedState : Boolean from Standard;
end;

1604
src/Storage/Storage_Schema.cxx Executable file

File diff suppressed because it is too large Load Diff

32
src/Storage/Storage_Schema.lxx Executable file
View File

@@ -0,0 +1,32 @@
#include <Storage_Data.hxx>
#include <Storage_InternalData.hxx>
#include <Storage_BaseDriver.hxx>
inline void Storage_Schema::WritePersistentObjectHeader(const Handle(Standard_Persistent)& sp,Storage_BaseDriver& f)
{
f.WritePersistentObjectHeader(sp->_refnum,sp->_typenum);
}
inline void Storage_Schema::ReadPersistentObjectHeader(Storage_BaseDriver& f)
{
Standard_Integer i,j;
f.ReadPersistentObjectHeader(i,j);
}
inline Standard_Boolean Storage_Schema::HasTypeBinding(const TCollection_AsciiString& aTypeName) const
{
return Storage_Schema::ICurrentData()->InternalData()->myTypeBinding.IsBound(aTypeName);
}
inline void Storage_Schema::WritePersistentReference(const Handle(Standard_Persistent)& sp,Storage_BaseDriver& f)
{
if (!sp.IsNull()) {
f.PutReference(sp->_refnum);
}
else {
f.PutReference(0);
}
}

View File

@@ -0,0 +1,57 @@
-- File: Storage_TypeData.cdl
-- Created: Thu Feb 6 16:58:03 1997
-- Author: Kernel
-- <kernel@parigox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
class TypeData from Storage
inherits TShared from MMgt
uses HSequenceOfAsciiString from TColStd,
PType from Storage,
AsciiString from TCollection,
Error from Storage
raises NoSuchObject from Standard
is
Create returns mutable TypeData from Storage;
NumberOfTypes(me) returns Integer from Standard;
IsType(me; aName : AsciiString from TCollection) returns Boolean from Standard;
Types(me) returns HSequenceOfAsciiString from TColStd;
ErrorStatus(me) returns Error from Storage;
ErrorStatusExtension(me) returns AsciiString from TCollection;
ClearErrorStatus(me : mutable);
Clear(me : mutable);
-- PRIVATE
AddType(me : mutable; aName : AsciiString from TCollection; aTypeNum : Integer from Standard) is private;
---Purpose: add a type to the list
Type(me; aTypeNum : Integer from Standard) returns AsciiString from TCollection
raises NoSuchObject is private;
---Purpose: returns the name of the type with number <aTypeNum>
Type(me; aTypeName : AsciiString from TCollection) returns Integer from Standard
raises NoSuchObject is private;
---Purpose: returns the name of the type with number <aTypeNum>
SetErrorStatus(me : mutable; anError : Error from Storage) is private;
SetErrorStatusExtension(me : mutable; anErrorExt : AsciiString from TCollection) is private;
fields
myPt : PType from Storage;
myErrorStatus : Error from Storage;
myErrorStatusExt : AsciiString from TCollection;
friends class Schema from Storage
end;

View File

@@ -0,0 +1,91 @@
#include <Storage_TypeData.ixx>
Storage_TypeData::Storage_TypeData() : myErrorStatus(Storage_VSOk)
{
}
Standard_Integer Storage_TypeData::NumberOfTypes() const
{
return myPt.Extent();
}
Standard_Boolean Storage_TypeData::IsType(const TCollection_AsciiString& aName) const
{
return myPt.Contains(aName);
}
Handle(TColStd_HSequenceOfAsciiString) Storage_TypeData::Types() const
{
Handle(TColStd_HSequenceOfAsciiString) r = new TColStd_HSequenceOfAsciiString;
Standard_Integer i;
for (i = 1; i <= myPt.Extent(); i++) {
r->Append(myPt.FindKey(i));
}
return r;
}
void Storage_TypeData::AddType(const TCollection_AsciiString& aName,const Standard_Integer aTypeNum)
{
myPt.Add(aName,aTypeNum);
}
TCollection_AsciiString Storage_TypeData::Type(const Standard_Integer aTypeNum) const
{
TCollection_AsciiString r;
if (aTypeNum <= myPt.Extent() && aTypeNum > 0) {
r = myPt.FindKey(aTypeNum);
}
else {
Standard_NoSuchObject::Raise("Storage_TypeData::Type - aTypeNum not in range");
}
return r;
}
Standard_Integer Storage_TypeData::Type(const TCollection_AsciiString& aTypeName) const
{
Standard_Integer r = 0;
if (myPt.Contains(aTypeName)) {
r = myPt.FindFromKey(aTypeName);
}
else {
Standard_NoSuchObject::Raise("Storage_TypeData::Type - aTypeName not found");
}
return r;
}
void Storage_TypeData::Clear()
{
myPt.Clear();
}
Storage_Error Storage_TypeData::ErrorStatus() const
{
return myErrorStatus;
}
void Storage_TypeData::SetErrorStatus(const Storage_Error anError)
{
myErrorStatus = anError;
}
void Storage_TypeData::ClearErrorStatus()
{
myErrorStatus = Storage_VSOk;
myErrorStatusExt.Clear();
}
TCollection_AsciiString Storage_TypeData::ErrorStatusExtension() const
{
return myErrorStatusExt;
}
void Storage_TypeData::SetErrorStatusExtension(const TCollection_AsciiString& anErrorExt)
{
myErrorStatusExt = anErrorExt;
}

View File

@@ -0,0 +1,35 @@
-- File: Storage_TypedCallBack.cdl
-- Created: Fri Feb 28 10:44:18 1997
-- Author: Christophe LEYNADIER
-- <cle@parigox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
private class TypedCallBack from Storage
inherits TShared from MMgt
uses CallBack from Storage,
AsciiString from TCollection
is
Create returns mutable TypedCallBack from Storage;
Create(aTypeName : AsciiString from TCollection; aCallBack : CallBack from Storage)
returns mutable TypedCallBack from Storage;
SetType(me : mutable; aType : AsciiString from TCollection);
Type(me) returns AsciiString from TCollection;
SetCallBack(me : mutable; aCallBack : CallBack from Storage);
CallBack(me) returns CallBack from Storage;
SetIndex(me : mutable; anIndex : Integer from Standard);
Index(me) returns Integer from Standard;
fields
myType : AsciiString from TCollection;
myCallBack : CallBack from Storage;
myIndex : Integer from Standard;
end;

View File

@@ -0,0 +1,41 @@
#include <Storage_TypedCallBack.ixx>
Storage_TypedCallBack::Storage_TypedCallBack() : myIndex(0)
{
}
Storage_TypedCallBack::Storage_TypedCallBack(const TCollection_AsciiString& aTypeName,const Handle(Storage_CallBack)& aCallBack) : myIndex(0)
{
myType = aTypeName;
myCallBack = aCallBack;
}
void Storage_TypedCallBack::SetType(const TCollection_AsciiString& aType)
{
myType = aType;
}
TCollection_AsciiString Storage_TypedCallBack::Type() const
{
return myType;
}
void Storage_TypedCallBack::SetCallBack(const Handle(Storage_CallBack)& aCallBack)
{
myCallBack = aCallBack;
}
Handle(Storage_CallBack) Storage_TypedCallBack::CallBack() const
{
return myCallBack;
}
void Storage_TypedCallBack::SetIndex(const Standard_Integer anIndex)
{
myIndex = anIndex;
}
Standard_Integer Storage_TypedCallBack::Index() const
{
return myIndex;
}

View File

@@ -0,0 +1,9 @@
-- File: Storage_stCONSTclCOM.cdl
-- Created: Thu Jan 30 14:58:05 1997
-- Author: Christophe LEYNADIER
-- <cle@parigox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
private class stCONSTclCOM from Storage
is
end;

View File

@@ -0,0 +1 @@