Open CASCADE Technology  6.9.0
Public Member Functions | Static Public Member Functions | Protected Member Functions

Storage_Schema Class Reference

Root class for basic storage/retrieval algorithms. A Storage_Schema object processes: More...

#include <Storage_Schema.hxx>

Inheritance diagram for Storage_Schema:
Inheritance graph
[legend]

Public Member Functions

 Storage_Schema ()
 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 – -----------------------------------------------------------—


More...
 
void SetVersion (const TCollection_AsciiString &aVersion)
 returns version of the schema More...
 
TCollection_AsciiString Version () const
 returns the version of the schema More...
 
void SetName (const TCollection_AsciiString &aSchemaName)
 set the schema's name More...
 
TCollection_AsciiString Name () const
 returns the schema's name More...
 
void Write (Storage_BaseDriver &s, const Handle< Storage_Data > &aData) const
 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. More...
 
Handle< Storage_DataRead (Storage_BaseDriver &s) const
 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. More...
 
Handle< Storage_HeaderDataReadHeaderSection (Storage_BaseDriver &s) const
 read the header part of the stream Arguments: s: driver to read More...
 
Handle< Storage_TypeDataReadTypeSection (Storage_BaseDriver &s) const
 fill the TypeData with the names of the type used in a stream Arguments: s: driver to read More...
 
Handle< Storage_RootDataReadRootSection (Storage_BaseDriver &s) const
 read root part of the file Arguments: s: driver to read More...
 
virtual const
TColStd_SequenceOfAsciiString
SchemaKnownTypes () const
 returns the known types of a schema More...
 
Standard_Boolean HasUnknownType (Storage_BaseDriver &aDriver, TColStd_SequenceOfAsciiString &theUnknownTypes) const
 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>. More...
 
Handle
< TColStd_HSequenceOfAsciiString
GetAllSchemaKnownTypes () const
 returns the all known types of a schema and their nested schemes. More...
 
void SetNestedSchemas (const Handle< Storage_HArrayOfSchema > &theSchemas)
 
void ClearNestedSchemas ()
 
Handle< Storage_HArrayOfSchemaNestedSchemas () const
 
void AddReadUnknownTypeCallBack (const TCollection_AsciiString &aTypeName, const Handle< Storage_CallBack > &aCallBack)
 add two functions to the callback list More...
 
void RemoveReadUnknownTypeCallBack (const TCollection_AsciiString &aTypeName)
 remove a callback for a type More...
 
Handle
< TColStd_HSequenceOfAsciiString
InstalledCallBackList () const
 returns a list of type name with installed callback. More...
 
void ClearCallBackList ()
 clear all callback from schema instance. More...
 
void UseDefaultCallBack ()
 install a callback for all unknown type. the objects with unknown types will be skipped. (look SkipObject method in BaseDriver) More...
 
void DontUseDefaultCallBack ()
 tells schema to uninstall the default callback. More...
 
Standard_Boolean IsUsingDefaultCallBack () const
 ask if the schema is using the default callback. More...
 
void SetDefaultCallBack (const Handle< Storage_CallBack > &f)
 overload the default function for build.(use to set an error message or skip an object while reading an unknown type). More...
 
void ResetDefaultCallBack ()
 reset the default function defined by Storage package. More...
 
Handle< Storage_CallBackDefaultCallBack () const
 returns the read function used when the UseDefaultCallBack() is set. More...
 
virtual Handle< Storage_CallBackCallBackSelection (const TCollection_AsciiString &tName) const
 
virtual Handle< Storage_CallBackAddTypeSelection (const Handle< Standard_Persistent > &sp) const
 
void WritePersistentObjectHeader (const Handle< Standard_Persistent > &sp, Storage_BaseDriver &s)
 
void ReadPersistentObjectHeader (Storage_BaseDriver &s)
 
void WritePersistentReference (const Handle< Standard_Persistent > &sp, Storage_BaseDriver &s)
 
void ReadPersistentReference (Handle< Standard_Persistent > &sp, Storage_BaseDriver &s)
 
Standard_Boolean AddPersistent (const Handle< Standard_Persistent > &sp, const Standard_CString tName) const
 
Standard_Boolean PersistentToAdd (const Handle< Standard_Persistent > &sp) const
 
- Public Member Functions inherited from MMgt_TShared
virtual void Delete () const
 Memory deallocator for transient classes. More...
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor. More...
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing. More...
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter. More...
 
virtual ~Standard_Transient ()
 Destructor must be virtual. More...
 
virtual const
Handle_Standard_Type & 
DynamicType () const
 Returns a type information object about this object. More...
 
Standard_Boolean IsInstance (const Handle_Standard_Type &theType) const
 Returns a true value if this is an instance of Type. More...
 
Standard_Boolean IsInstance (const Standard_CString theTypeName) const
 Returns a true value if this is an instance of TypeName. More...
 
Standard_Boolean IsKind (const Handle_Standard_Type &theType) const
 Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More...
 
Standard_Boolean IsKind (const Standard_CString theTypeName) const
 Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More...
 
virtual Handle_Standard_Transient This () const
 Returns a Handle which references this object. Must never be called to objects created in stack. More...
 
Standard_Integer GetRefCount () const
 Get the reference counter of this object. More...
 

Static Public Member Functions

static TCollection_AsciiString ICreationDate ()
 return a current date string More...
 
static Standard_Boolean CheckTypeMigration (const TCollection_AsciiString &theTypeName, TCollection_AsciiString &theNewName)
 returns True if theType migration is identified 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. More...
 

Protected Member Functions

Standard_Boolean IsNested () const
 
Handle< Storage_CallBackResolveUnknownType (const TCollection_AsciiString &aTypeName, const Handle< Standard_Persistent > &aPers, const Storage_SolveMode aMode) const
 
Standard_Boolean HasTypeBinding (const TCollection_AsciiString &aTypeName) const
 
void BindType (const TCollection_AsciiString &aTypeName, const Handle< Storage_CallBack > &aCallBack) const
 
Handle< Storage_CallBackTypeBinding (const TCollection_AsciiString &aTypeName) const
 

Detailed Description

Root class for basic storage/retrieval algorithms. A Storage_Schema object processes:

Constructor & Destructor Documentation

Storage_Schema::Storage_Schema ( )

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 – -----------------------------------------------------------—


Member Function Documentation

Standard_Boolean Storage_Schema::AddPersistent ( const Handle< Standard_Persistent > &  sp,
const Standard_CString  tName 
) const
void Storage_Schema::AddReadUnknownTypeCallBack ( const TCollection_AsciiString aTypeName,
const Handle< Storage_CallBack > &  aCallBack 
)

add two functions to the callback list

virtual Handle< Storage_CallBack > Storage_Schema::AddTypeSelection ( const Handle< Standard_Persistent > &  sp) const
virtual
void Storage_Schema::BindType ( const TCollection_AsciiString aTypeName,
const Handle< Storage_CallBack > &  aCallBack 
) const
protected
virtual Handle< Storage_CallBack > Storage_Schema::CallBackSelection ( const TCollection_AsciiString tName) const
virtual
static Standard_Boolean Storage_Schema::CheckTypeMigration ( const TCollection_AsciiString theTypeName,
TCollection_AsciiString theNewName 
)
static

returns True if theType migration is identified 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.

void Storage_Schema::ClearCallBackList ( )

clear all callback from schema instance.

void Storage_Schema::ClearNestedSchemas ( )
Handle< Storage_CallBack > Storage_Schema::DefaultCallBack ( ) const

returns the read function used when the UseDefaultCallBack() is set.

void Storage_Schema::DontUseDefaultCallBack ( )

tells schema to uninstall the default callback.

Handle< TColStd_HSequenceOfAsciiString > Storage_Schema::GetAllSchemaKnownTypes ( ) const

returns the all known types of a schema and their nested schemes.

Standard_Boolean Storage_Schema::HasTypeBinding ( const TCollection_AsciiString aTypeName) const
protected
Standard_Boolean Storage_Schema::HasUnknownType ( Storage_BaseDriver aDriver,
TColStd_SequenceOfAsciiString theUnknownTypes 
) const

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>.

static TCollection_AsciiString Storage_Schema::ICreationDate ( )
static

return a current date string

Handle< TColStd_HSequenceOfAsciiString > Storage_Schema::InstalledCallBackList ( ) const

returns a list of type name with installed callback.

Standard_Boolean Storage_Schema::IsNested ( ) const
protected
Standard_Boolean Storage_Schema::IsUsingDefaultCallBack ( ) const

ask if the schema is using the default callback.

TCollection_AsciiString Storage_Schema::Name ( ) const

returns the schema's name

Handle< Storage_HArrayOfSchema > Storage_Schema::NestedSchemas ( ) const
Standard_Boolean Storage_Schema::PersistentToAdd ( const Handle< Standard_Persistent > &  sp) const
Handle< Storage_Data > Storage_Schema::Read ( Storage_BaseDriver s) const

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.

Handle< Storage_HeaderData > Storage_Schema::ReadHeaderSection ( Storage_BaseDriver s) const

read the header part of the stream Arguments: s: driver to read

void Storage_Schema::ReadPersistentObjectHeader ( Storage_BaseDriver s)
void Storage_Schema::ReadPersistentReference ( Handle< Standard_Persistent > &  sp,
Storage_BaseDriver s 
)
Handle< Storage_RootData > Storage_Schema::ReadRootSection ( Storage_BaseDriver s) const

read root part of the file Arguments: s: driver to read

Handle< Storage_TypeData > Storage_Schema::ReadTypeSection ( Storage_BaseDriver s) const

fill the TypeData with the names of the type used in a stream Arguments: s: driver to read

void Storage_Schema::RemoveReadUnknownTypeCallBack ( const TCollection_AsciiString aTypeName)

remove a callback for a type

void Storage_Schema::ResetDefaultCallBack ( )

reset the default function defined by Storage package.

Handle< Storage_CallBack > Storage_Schema::ResolveUnknownType ( const TCollection_AsciiString aTypeName,
const Handle< Standard_Persistent > &  aPers,
const Storage_SolveMode  aMode 
) const
protected
virtual const TColStd_SequenceOfAsciiString& Storage_Schema::SchemaKnownTypes ( ) const
virtual

returns the known types of a schema

void Storage_Schema::SetDefaultCallBack ( const Handle< Storage_CallBack > &  f)

overload the default function for build.(use to set an error message or skip an object while reading an unknown type).

void Storage_Schema::SetName ( const TCollection_AsciiString aSchemaName)

set the schema's name

void Storage_Schema::SetNestedSchemas ( const Handle< Storage_HArrayOfSchema > &  theSchemas)
void Storage_Schema::SetVersion ( const TCollection_AsciiString aVersion)

returns version of the schema

Handle< Storage_CallBack > Storage_Schema::TypeBinding ( const TCollection_AsciiString aTypeName) const
protected
void Storage_Schema::UseDefaultCallBack ( )

install a callback for all unknown type. the objects with unknown types will be skipped. (look SkipObject method in BaseDriver)

TCollection_AsciiString Storage_Schema::Version ( ) const

returns the version of the schema

void Storage_Schema::Write ( Storage_BaseDriver s,
const Handle< Storage_Data > &  aData 
) const

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.

void Storage_Schema::WritePersistentObjectHeader ( const Handle< Standard_Persistent > &  sp,
Storage_BaseDriver s 
)
void Storage_Schema::WritePersistentReference ( const Handle< Standard_Persistent > &  sp,
Storage_BaseDriver s 
)

The documentation for this class was generated from the following file: