# FoundationClasses
TKernel
Storage

# Storage_Schema Class Reference

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

`#include <Storage_Schema.hxx>`

Inheritance diagram for Storage_Schema:

[legend]

## Public Member Functions

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

Standard_EXPORT void | SetVersion (const TCollection_AsciiString &aVersion)
| returns version of the schema
Standard_EXPORT TCollection_AsciiString | Version () const
| returns the version of the schema
Standard_EXPORT void | SetName (const TCollection_AsciiString &aSchemaName)
| set the schema's name
Standard_EXPORT TCollection_AsciiString | Name () const
| returns the schema's name
Standard_EXPORT 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. .
Standard_EXPORT Handle_Storage_Data | 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. .
Standard_EXPORT Handle_Storage_HeaderData | ReadHeaderSection (Storage_BaseDriver &s) const
| read the header part of the stream Arguments: s: driver to read
Standard_EXPORT Handle_Storage_TypeData | ReadTypeSection (Storage_BaseDriver &s) const
| fill the TypeData with the names of the type used in a stream Arguments: s: driver to read
Standard_EXPORT Handle_Storage_RootData | ReadRootSection (Storage_BaseDriver &s) const
| read root part of the file Arguments: s: driver to read
virtual Standard_EXPORT const TColStd_SequenceOfAsciiString & | SchemaKnownTypes () const
| returns the known types of a schema
Standard_EXPORT 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>.
Standard_EXPORT Handle_TColStd_HSequenceOfAsciiString | GetAllSchemaKnownTypes () const
| returns the all known types of a schema and their nested schemes.
Standard_EXPORT void | SetNestedSchemas (const Handle(Storage_HArrayOfSchema)&theSchemas)
Standard_EXPORT void | ClearNestedSchemas ()
Standard_EXPORT Handle_Storage_HArrayOfSchema | NestedSchemas () const
Standard_EXPORT void | AddReadUnknownTypeCallBack (const TCollection_AsciiString &aTypeName, const Handle(Storage_CallBack)&aCallBack)
| add two functions to the callback list
Standard_EXPORT void | RemoveReadUnknownTypeCallBack (const TCollection_AsciiString &aTypeName)
| remove a callback for a type
Standard_EXPORT Handle_TColStd_HSequenceOfAsciiString | InstalledCallBackList () const
| returns a list of type name with installed callback.
Standard_EXPORT void | ClearCallBackList ()
| clear all callback from schema instance.
Standard_EXPORT void | UseDefaultCallBack ()
| install a callback for all unknown type. the objects with unknown types will be skipped. (look SkipObject method in BaseDriver)
Standard_EXPORT void | DontUseDefaultCallBack ()
| tells schema to uninstall the default callback.
Standard_EXPORT Standard_Boolean | IsUsingDefaultCallBack () const
| ask if the schema is using the default callback.
Standard_EXPORT 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).
Standard_EXPORT void | ResetDefaultCallBack ()
| reset the default function defined by Storage package.
Standard_EXPORT Handle_Storage_CallBack | DefaultCallBack () const
| returns the read function used when the UseDefaultCallBack() is set.
virtual Standard_EXPORT Handle_Storage_CallBack | CallBackSelection (const TCollection_AsciiString &tName) const
virtual Standard_EXPORT Handle_Storage_CallBack | AddTypeSelection (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)
Standard_EXPORT void | ReadPersistentReference (Handle(Standard_Persistent)&sp, Storage_BaseDriver &s)
Standard_EXPORT Standard_Boolean | AddPersistent (const Handle(Standard_Persistent)&sp, const Standard_CString tName) const
Standard_EXPORT Standard_Boolean | PersistentToAdd (const Handle(Standard_Persistent)&sp) const
Standard_EXPORT const | Handle (Standard_Type)&DynamicType() const

## Static Public Member Functions

static Standard_EXPORT TCollection_AsciiString | ICreationDate ()

return a current date string
//! 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.

## Protected Member Functions

Standard_EXPORT Standard_Boolean | IsNested () const
Standard_EXPORT Handle_Storage_CallBack | ResolveUnknownType (const TCollection_AsciiString &aTypeName, const Handle(Standard_Persistent)&aPers, const Storage_SolveMode aMode) const
Standard_Boolean | HasTypeBinding (const TCollection_AsciiString &aTypeName) const
Standard_EXPORT void | BindType (const TCollection_AsciiString &aTypeName, const Handle(Storage_CallBack)&aCallBack) const
Standard_EXPORT Handle_Storage_CallBack | TypeBinding (const TCollection_AsciiString &aTypeName) const

## Private Member Functions

Standard_EXPORT Standard_Boolean | SetNested ()
Standard_EXPORT Standard_Boolean | UnsetNested ()
Standard_EXPORT void | Clear () const
Standard_EXPORT Standard_Boolean | IReadHeaderSection (Storage_BaseDriver &s, const Handle(Storage_HeaderData)&iData) const
Standard_EXPORT Standard_Boolean | IReadTypeSection (Storage_BaseDriver &s, const Handle(Storage_TypeData)&tData) const
Standard_EXPORT Standard_Boolean | IReadRootSection (Storage_BaseDriver &s, const Handle(Storage_RootData)&rData) const

## Static Private Member Functions

static Standard_EXPORT void | ISetCurrentData (const Handle(Storage_Data)&dData)
static Standard_EXPORT Handle_Storage_Data & | ICurrentData ()

## Private Attributes

Storage_MapOfCallBack | myCallBack
Standard_Boolean | myCallBackState
Handle_Storage_CallBack | myDefaultCallBack
TCollection_AsciiString | myName
TCollection_AsciiString | myVersion
Handle_Storage_HArrayOfSchema | myArrayOfSchema
Standard_Boolean | myNestedState

## Constructor & Destructor Documentation

Standard_EXPORT Storage_Schema::Storage_Schema | ( |  | ) |

## Member Function Documentation

Standard_EXPORT Standard_Boolean Storage_Schema::AddPersistent | ( | const Handle(Standard_Persistent)& | sp,
|  | const Standard_CString | tName
| ) | const

Standard_EXPORT void Storage_Schema::AddReadUnknownTypeCallBack | ( | const TCollection_AsciiString & | aTypeName,
|  | const Handle(Storage_CallBack)& | aCallBack
| ) |

virtual Standard_EXPORT Handle_Storage_CallBack Storage_Schema::AddTypeSelection | ( | const Handle(Standard_Persistent)& | sp | ) | const`[virtual]`

Standard_EXPORT void Storage_Schema::BindType | ( | const TCollection_AsciiString & | aTypeName,
|  | const Handle(Storage_CallBack)& | aCallBack
| ) | const`[protected]`

virtual Standard_EXPORT Handle_Storage_CallBack Storage_Schema::CallBackSelection | ( | const TCollection_AsciiString & | tName | ) | const`[virtual]`

Standard_EXPORT void Storage_Schema::Clear | ( |  | ) | const`[private]`

Standard_EXPORT void Storage_Schema::ClearCallBackList | ( |  | ) |

Standard_EXPORT void Storage_Schema::ClearNestedSchemas | ( |  | ) |

Standard_EXPORT Handle_Storage_CallBack Storage_Schema::DefaultCallBack | ( |  | ) | const

Standard_EXPORT void Storage_Schema::DontUseDefaultCallBack | ( |  | ) |

Standard_EXPORT Handle_TColStd_HSequenceOfAsciiString Storage_Schema::GetAllSchemaKnownTypes | ( |  | ) | const

Standard_EXPORT const Storage_Schema::Handle | ( | Standard_Type |  | ) | const

| Reimplemented from MMgt_TShared.

Standard_Boolean Storage_Schema::HasTypeBinding | ( | const TCollection_AsciiString & | aTypeName | ) | const`[inline, protected]`

Standard_EXPORT Standard_Boolean Storage_Schema::HasUnknownType | ( | Storage_BaseDriver & | aDriver,
|  | TColStd_SequenceOfAsciiString & | theUnknownTypes
| ) | const

static Standard_EXPORT TCollection_AsciiString Storage_Schema::ICreationDate | ( |  | ) | `[static]`

static Standard_EXPORT Handle_Storage_Data& Storage_Schema::ICurrentData | ( |  | ) | `[static, private]`

Standard_EXPORT Handle_TColStd_HSequenceOfAsciiString Storage_Schema::InstalledCallBackList | ( |  | ) | const

Standard_EXPORT Standard_Boolean Storage_Schema::IReadHeaderSection | ( | Storage_BaseDriver & | s,
|  | const Handle(Storage_HeaderData)& | iData
| ) | const`[private]`

Standard_EXPORT Standard_Boolean Storage_Schema::IReadRootSection | ( | Storage_BaseDriver & | s,
|  | const Handle(Storage_RootData)& | rData
| ) | const`[private]`

Standard_EXPORT Standard_Boolean Storage_Schema::IReadTypeSection | ( | Storage_BaseDriver & | s,
|  | const Handle(Storage_TypeData)& | tData
| ) | const`[private]`

static Standard_EXPORT void Storage_Schema::ISetCurrentData | ( | const Handle(Storage_Data)& | dData | ) | `[static, private]`

Standard_EXPORT Standard_Boolean Storage_Schema::IsNested | ( |  | ) | const`[protected]`

Standard_EXPORT Standard_Boolean Storage_Schema::IsUsingDefaultCallBack | ( |  | ) | const

Standard_EXPORT TCollection_AsciiString Storage_Schema::Name | ( |  | ) | const

Standard_EXPORT Handle_Storage_HArrayOfSchema Storage_Schema::NestedSchemas | ( |  | ) | const

Standard_EXPORT Standard_Boolean Storage_Schema::PersistentToAdd | ( | const Handle(Standard_Persistent)& | sp | ) | const

Standard_EXPORT Handle_Storage_Data Storage_Schema::Read | ( | Storage_BaseDriver & | s | ) | const

Standard_EXPORT Handle_Storage_HeaderData Storage_Schema::ReadHeaderSection | ( | Storage_BaseDriver & | s | ) | const

void Storage_Schema::ReadPersistentObjectHeader | ( | Storage_BaseDriver & | s | ) | `[inline]`

Standard_EXPORT void Storage_Schema::ReadPersistentReference | ( | Handle(Standard_Persistent)& | sp,
|  | Storage_BaseDriver & | s
| ) |

Standard_EXPORT Handle_Storage_RootData Storage_Schema::ReadRootSection | ( | Storage_BaseDriver & | s | ) | const

Standard_EXPORT Handle_Storage_TypeData Storage_Schema::ReadTypeSection | ( | Storage_BaseDriver & | s | ) | const

Standard_EXPORT void Storage_Schema::RemoveReadUnknownTypeCallBack | ( | const TCollection_AsciiString & | aTypeName | ) |

Standard_EXPORT void Storage_Schema::ResetDefaultCallBack | ( |  | ) |

Standard_EXPORT Handle_Storage_CallBack Storage_Schema::ResolveUnknownType | ( | const TCollection_AsciiString & | aTypeName,
|  | const Handle(Standard_Persistent)& | aPers,
|  | const Storage_SolveMode | aMode
| ) | const`[protected]`

virtual Standard_EXPORT const TColStd_SequenceOfAsciiString& Storage_Schema::SchemaKnownTypes | ( |  | ) | const`[virtual]`

Standard_EXPORT void Storage_Schema::SetDefaultCallBack | ( | const Handle(Storage_CallBack)& | f | ) |

Standard_EXPORT void Storage_Schema::SetName | ( | const TCollection_AsciiString & | aSchemaName | ) |

Standard_EXPORT Standard_Boolean Storage_Schema::SetNested | ( |  | ) | `[private]`

Standard_EXPORT void Storage_Schema::SetNestedSchemas | ( | const Handle(Storage_HArrayOfSchema)& | theSchemas | ) |

Standard_EXPORT void Storage_Schema::SetVersion | ( | const TCollection_AsciiString & | aVersion | ) |

Standard_EXPORT Handle_Storage_CallBack Storage_Schema::TypeBinding | ( | const TCollection_AsciiString & | aTypeName | ) | const`[protected]`

Standard_EXPORT Standard_Boolean Storage_Schema::UnsetNested | ( |  | ) | `[private]`

Standard_EXPORT void Storage_Schema::UseDefaultCallBack | ( |  | ) |

Standard_EXPORT TCollection_AsciiString Storage_Schema::Version | ( |  | ) | const

Standard_EXPORT void Storage_Schema::Write | ( | Storage_BaseDriver & | s,
|  | const Handle(Storage_Data)& | aData
| ) | const

void Storage_Schema::WritePersistentObjectHeader | ( | const Handle(Standard_Persistent)& | sp,
|  | Storage_BaseDriver & | s
| ) | `[inline]`

void Storage_Schema::WritePersistentReference | ( | const Handle(Standard_Persistent)& | sp,
|  | Storage_BaseDriver & | s
| ) | `[inline]`

## Field Documentation

Handle_Storage_HArrayOfSchema Storage_Schema::myArrayOfSchema `[private]`

Storage_MapOfCallBack Storage_Schema::myCallBack `[private]`

Standard_Boolean Storage_Schema::myCallBackState `[private]`

Handle_Storage_CallBack Storage_Schema::myDefaultCallBack `[private]`

TCollection_AsciiString Storage_Schema::myName `[private]`

Standard_Boolean Storage_Schema::myNestedState `[private]`

TCollection_AsciiString Storage_Schema::myVersion `[private]`

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

- Storage_Schema.hxx
- Storage_Schema.lxx