Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Copyright (c) 2017 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef _StdStorage_RootData_HeaderFile
0015 #define _StdStorage_RootData_HeaderFile
0016 
0017 #include <Standard.hxx>
0018 #include <Standard_Type.hxx>
0019 
0020 #include <Storage_Error.hxx>
0021 #include <TCollection_AsciiString.hxx>
0022 #include <Standard_Transient.hxx>
0023 #include <Standard_Integer.hxx>
0024 #include <StdStorage_MapOfRoots.hxx>
0025 #include <StdStorage_HSequenceOfRoots.hxx>
0026 class Storage_BaseDriver;
0027 class StdStorage_Root;
0028 
0029 class StdStorage_RootData;
0030 DEFINE_STANDARD_HANDLE(StdStorage_RootData, Standard_Transient)
0031 
0032 //! Storage root data section contains root persistent objects
0033 class StdStorage_RootData
0034   : public Standard_Transient
0035 {
0036   friend class StdStorage_Data;
0037 
0038 public:
0039 
0040   DEFINE_STANDARD_RTTIEXT(StdStorage_RootData, Standard_Transient)
0041 
0042   //! Reads the root data section from the container defined by theDriver. 
0043   //! Returns Standard_True in case of success. Otherwise, one need to get 
0044   //! an error code and description using ErrorStatus and ErrorStatusExtension
0045   //! functions correspondingly.
0046   Standard_EXPORT Standard_Boolean Read(const Handle(Storage_BaseDriver)& theDriver);
0047 
0048   //! Writes the root data section to the container defined by theDriver. 
0049   //! Returns Standard_True in case of success. Otherwise, one need to get 
0050   //! an error code and description using ErrorStatus and ErrorStatusExtension
0051   //! functions correspondingly.
0052   Standard_EXPORT Standard_Boolean Write(const Handle(Storage_BaseDriver)& theDriver);
0053 
0054   //! Returns the number of roots.
0055   Standard_EXPORT Standard_Integer NumberOfRoots() const;
0056 
0057   //! Add a root to <me>. If a root with same name is present, it
0058   //! will be replaced by <aRoot>.
0059   Standard_EXPORT void AddRoot(const Handle(StdStorage_Root)& aRoot);
0060 
0061   //! Returns a sequence of all roots
0062   Standard_EXPORT Handle(StdStorage_HSequenceOfRoots) Roots() const;
0063 
0064   //! Finds a root with name <aName>.
0065   Standard_EXPORT Handle(StdStorage_Root) Find(const TCollection_AsciiString& aName) const;
0066 
0067   //! Returns Standard_True if <me> contains a root named <aName>
0068   Standard_EXPORT Standard_Boolean IsRoot(const TCollection_AsciiString& aName) const;
0069 
0070   //! Removes the root named <aName>.
0071   Standard_EXPORT void RemoveRoot(const TCollection_AsciiString& aName);
0072 
0073   //! Returns a status of the latest call to Read / Write functions
0074   Standard_EXPORT Storage_Error ErrorStatus() const;
0075 
0076   //! Returns an error message if any of the latest call to Read / Write functions
0077   Standard_EXPORT TCollection_AsciiString ErrorStatusExtension() const;
0078 
0079   //! Clears error status
0080   Standard_EXPORT void ClearErrorStatus();
0081 
0082   //! Removes all persistent root objects
0083   Standard_EXPORT void Clear();
0084 
0085 private:
0086 
0087   Standard_EXPORT StdStorage_RootData();
0088 
0089   Standard_EXPORT void SetErrorStatus(const Storage_Error anError);
0090 
0091   Standard_EXPORT void SetErrorStatusExtension(const TCollection_AsciiString& anErrorExt);
0092 
0093   StdStorage_MapOfRoots myObjects;
0094   Storage_Error myErrorStatus;
0095   TCollection_AsciiString myErrorStatusExt;
0096 
0097 };
0098 
0099 #endif // _StdStorage_RootData_HeaderFile