Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:17

0001 // Created on: 1997-02-06
0002 // Created by: Kernel
0003 // Copyright (c) 1997-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _Storage_Data_HeaderFile
0018 #define _Storage_Data_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Storage_Error.hxx>
0024 #include <Standard_Transient.hxx>
0025 #include <TColStd_SequenceOfExtendedString.hxx>
0026 #include <Standard_Integer.hxx>
0027 #include <Storage_HSeqOfRoot.hxx>
0028 #include <TColStd_HSequenceOfAsciiString.hxx>
0029 class Storage_HeaderData;
0030 class Storage_RootData;
0031 class Storage_TypeData;
0032 class Storage_InternalData;
0033 class TCollection_ExtendedString;
0034 class Standard_Persistent;
0035 class Storage_Root;
0036 
0037 
0038 class Storage_Data;
0039 DEFINE_STANDARD_HANDLE(Storage_Data, Standard_Transient)
0040 
0041 //! A picture memorizing the data stored in a
0042 //! container (for example, in a file).
0043 //! A Storage_Data object represents either:
0044 //! -   persistent data to be written into a container,
0045 //! or
0046 //! -   persistent data which are read from a container.
0047 //! A Storage_Data object is used in both the
0048 //! storage and retrieval operations:
0049 //! -   Storage mechanism: create an empty
0050 //! Storage_Data object, then add successively
0051 //! persistent objects (roots) to be stored using
0052 //! the function AddRoot. When the set of data is
0053 //! complete, write it to a container using the
0054 //! function Write in your Storage_Schema
0055 //! storage/retrieval algorithm.
0056 //! -   Retrieval mechanism: a Storage_Data
0057 //! object is returned by the Read function from
0058 //! your Storage_Schema storage/retrieval
0059 //! algorithm. Use the functions NumberOfRoots
0060 //! and Roots to find the roots which were stored
0061 //! in the read container.
0062 //! The roots of a Storage_Data object may share
0063 //! references on objects. The shared internal
0064 //! references of a Storage_Data object are
0065 //! maintained by the storage/retrieval mechanism.
0066 //! Note: References shared by objects which are
0067 //! contained in two distinct Storage_Data objects
0068 //! are not maintained by the storage/retrieval
0069 //! mechanism: external references are not
0070 //! supported by Storage_Schema algorithm
0071 class Storage_Data : public Standard_Transient
0072 {
0073 
0074 public:
0075 
0076   
0077 
0078   //! Creates an empty set of data.
0079   //! You explicitly create a Storage_Data object
0080   //! when preparing the set of objects to be stored
0081   //! together in a container (for example, in a file).
0082   //! Then use the function AddRoot to add
0083   //! persistent objects to the set of data.
0084   //! A Storage_Data object is also returned by the
0085   //! Read function of a Storage_Schema
0086   //! storage/retrieval algorithm. Use the functions
0087   //! NumberOfRoots and Roots to find the roots
0088   //! which were stored in the read container.
0089   Standard_EXPORT Storage_Data();
0090   
0091   //! Returns Storage_VSOk if
0092   //! -   the last storage operation performed with the
0093   //! function Read, or
0094   //! -   the last retrieval operation performed with the function Write
0095   //! by a Storage_Schema algorithm, on this set of data was successful.
0096   //! If the storage or retrieval operation was not
0097   //! performed, the returned error status indicates the
0098   //! reason why the operation failed. The algorithm
0099   //! stops its analysis at the first detected error
0100   Standard_EXPORT Storage_Error ErrorStatus() const;
0101   
0102 
0103   //! Clears the error status positioned either by:
0104   //! -   the last storage operation performed with the
0105   //! Read function, or
0106   //! -   the last retrieval operation performed with the Write function
0107   //! by a Storage_Schema algorithm, on this set of data.
0108   //! This error status may be read by the function ErrorStatus.
0109   Standard_EXPORT void ClearErrorStatus();
0110   
0111   Standard_EXPORT TCollection_AsciiString ErrorStatusExtension() const;
0112   
0113   //! return the creation date
0114   Standard_EXPORT TCollection_AsciiString CreationDate() const;
0115   
0116   //! return the Storage package version
0117   Standard_EXPORT TCollection_AsciiString StorageVersion() const;
0118   
0119   //! get the version of the schema
0120   Standard_EXPORT TCollection_AsciiString SchemaVersion() const;
0121   
0122   //! get the schema's name
0123   Standard_EXPORT TCollection_AsciiString SchemaName() const;
0124   
0125   //! set the version of the application
0126   Standard_EXPORT void SetApplicationVersion (const TCollection_AsciiString& aVersion);
0127   
0128   //! get the version of the application
0129   Standard_EXPORT TCollection_AsciiString ApplicationVersion() const;
0130   
0131   //! set the name of the application
0132   Standard_EXPORT void SetApplicationName (const TCollection_ExtendedString& aName);
0133   
0134   //! get the name of the application
0135   Standard_EXPORT TCollection_ExtendedString ApplicationName() const;
0136   
0137   //! set the data type
0138   Standard_EXPORT void SetDataType (const TCollection_ExtendedString& aType);
0139   
0140   //! returns data type
0141   Standard_EXPORT TCollection_ExtendedString DataType() const;
0142   
0143   //! add <theUserInfo> to the user information
0144   Standard_EXPORT void AddToUserInfo (const TCollection_AsciiString& anInfo);
0145   
0146   //! return the user information
0147   Standard_EXPORT const TColStd_SequenceOfAsciiString& UserInfo() const;
0148   
0149   //! add <theUserInfo> to the user information
0150   Standard_EXPORT void AddToComments (const TCollection_ExtendedString& aComment);
0151   
0152   //! return the user information
0153   Standard_EXPORT const TColStd_SequenceOfExtendedString& Comments() const;
0154   
0155   //! the number of persistent objects
0156   //! Return:
0157   //! the number of persistent objects readed
0158   Standard_EXPORT Standard_Integer NumberOfObjects() const;
0159   
0160   //! Returns the number of root objects in this set of data.
0161   //! -   When preparing a storage operation, the
0162   //! result is the number of roots inserted into this
0163   //! set of data with the function AddRoot.
0164   //! -   When retrieving an object, the result is the
0165   //! number of roots stored in the read container.
0166   //! Use the Roots function to get these roots in a sequence.
0167   Standard_EXPORT Standard_Integer NumberOfRoots() const;
0168   
0169   //! add a persistent root to write. the name of the root
0170   //! is a driver reference number.
0171   Standard_EXPORT void AddRoot (const Handle(Standard_Persistent)& anObject) const;
0172   
0173   //! Adds the root anObject to this set of data.
0174   //! The name of the root is aName if given; if not, it
0175   //! will be a reference number assigned by the driver
0176   //! when writing the set of data into the container.
0177   //! When naming the roots, it is easier to retrieve
0178   //! objects by significant references rather than by
0179   //! references without any semantic values.
0180   Standard_EXPORT void AddRoot (const TCollection_AsciiString& aName, const Handle(Standard_Persistent)& anObject) const;
0181   
0182   //! Removes from this set of data the root object named aName.
0183   //! Warning
0184   //! Nothing is done if there is no root object whose
0185   //! name is aName in this set of data.
0186   Standard_EXPORT void RemoveRoot (const TCollection_AsciiString& aName);
0187   
0188   //! Returns the roots of this set of data in a sequence.
0189   //! -   When preparing a storage operation, the
0190   //! sequence contains the roots inserted into this
0191   //! set of data with the function AddRoot.
0192   //! -   When retrieving an object, the sequence
0193   //! contains the roots stored in the container read.
0194   //! -   An empty sequence is returned if there is no root in this set of data.
0195   Standard_EXPORT Handle(Storage_HSeqOfRoot) Roots() const;
0196   
0197   //! Gives the root object whose name is aName in
0198   //! this set of data. The returned object is a
0199   //! Storage_Root object, from which the object it
0200   //! encapsulates may be extracted.
0201   //! Warning
0202   //! A null handle is returned if there is no root object
0203   //! whose name is aName in this set of data.
0204   Standard_EXPORT Handle(Storage_Root) Find (const TCollection_AsciiString& aName) const;
0205   
0206   //! returns Standard_True if <me> contains a root named <aName>
0207   Standard_EXPORT Standard_Boolean IsRoot (const TCollection_AsciiString& aName) const;
0208   
0209   //! Returns the number of types of objects used in this set of data.
0210   Standard_EXPORT Standard_Integer NumberOfTypes() const;
0211   
0212   //! Returns true if this set of data contains an object of type aName.
0213   //! Persistent objects from this set of data must
0214   //! have types which are recognized by the
0215   //! Storage_Schema algorithm used to store or retrieve them.
0216   Standard_EXPORT Standard_Boolean IsType (const TCollection_AsciiString& aName) const;
0217   
0218 
0219   //! Gives the list of types of objects used in this set of data in a sequence.
0220   Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) Types() const;
0221 
0222 
0223 friend class Storage_Schema;
0224 
0225 
0226   DEFINE_STANDARD_RTTIEXT(Storage_Data,Standard_Transient)
0227 
0228  
0229   Standard_EXPORT Handle(Storage_HeaderData) HeaderData() const;
0230   
0231   Standard_EXPORT Handle(Storage_RootData) RootData() const;
0232   
0233   Standard_EXPORT Handle(Storage_TypeData) TypeData() const;
0234   
0235   Standard_EXPORT Handle(Storage_InternalData) InternalData() const;
0236   
0237   Standard_EXPORT void Clear() const;
0238 
0239 private:  
0240 
0241   Standard_EXPORT void SetErrorStatus (const Storage_Error anError);
0242   
0243   Standard_EXPORT void SetErrorStatusExtension (const TCollection_AsciiString& anErrorExt);
0244 
0245   Handle(Storage_HeaderData) myHeaderData;
0246   Handle(Storage_RootData) myRootData;
0247   Handle(Storage_TypeData) myTypeData;
0248   Handle(Storage_InternalData) myInternal;
0249   Storage_Error myErrorStatus;
0250   TCollection_AsciiString myErrorStatusExt;
0251 
0252 
0253 };
0254 
0255 
0256 
0257 
0258 
0259 
0260 
0261 #endif // _Storage_Data_HeaderFile