Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-19 09:29:19

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_Root.hxx>
0025 #include <NCollection_IndexedDataMap.hxx>
0026 #include <NCollection_Sequence.hxx>
0027 #include <NCollection_HSequence.hxx>
0028 class Storage_BaseDriver;
0029 class StdStorage_Root;
0030 
0031 //! Storage root data section contains root persistent objects
0032 class StdStorage_RootData : public Standard_Transient
0033 {
0034   friend class StdStorage_Data;
0035 
0036 public:
0037   DEFINE_STANDARD_RTTIEXT(StdStorage_RootData, Standard_Transient)
0038 
0039   //! Reads the root data section from the container defined by theDriver.
0040   //! Returns true in case of success. Otherwise, one need to get
0041   //! an error code and description using ErrorStatus and ErrorStatusExtension
0042   //! functions correspondingly.
0043   Standard_EXPORT bool Read(const occ::handle<Storage_BaseDriver>& theDriver);
0044 
0045   //! Writes the root data section to the container defined by theDriver.
0046   //! Returns true in case of success. Otherwise, one need to get
0047   //! an error code and description using ErrorStatus and ErrorStatusExtension
0048   //! functions correspondingly.
0049   Standard_EXPORT bool Write(const occ::handle<Storage_BaseDriver>& theDriver);
0050 
0051   //! Returns the number of roots.
0052   Standard_EXPORT int NumberOfRoots() const;
0053 
0054   //! Add a root to <me>. If a root with same name is present, it
0055   //! will be replaced by <aRoot>.
0056   Standard_EXPORT void AddRoot(const occ::handle<StdStorage_Root>& aRoot);
0057 
0058   //! Returns a sequence of all roots
0059   Standard_EXPORT occ::handle<NCollection_HSequence<occ::handle<StdStorage_Root>>> Roots() const;
0060 
0061   //! Finds a root with name <aName>.
0062   Standard_EXPORT occ::handle<StdStorage_Root> Find(const TCollection_AsciiString& aName) const;
0063 
0064   //! Returns true if <me> contains a root named <aName>
0065   Standard_EXPORT bool IsRoot(const TCollection_AsciiString& aName) const;
0066 
0067   //! Removes the root named <aName>.
0068   Standard_EXPORT void RemoveRoot(const TCollection_AsciiString& aName);
0069 
0070   //! Returns a status of the latest call to Read / Write functions
0071   Standard_EXPORT Storage_Error ErrorStatus() const;
0072 
0073   //! Returns an error message if any of the latest call to Read / Write functions
0074   Standard_EXPORT TCollection_AsciiString ErrorStatusExtension() const;
0075 
0076   //! Clears error status
0077   Standard_EXPORT void ClearErrorStatus();
0078 
0079   //! Removes all persistent root objects
0080   Standard_EXPORT void Clear();
0081 
0082 private:
0083   Standard_EXPORT StdStorage_RootData();
0084 
0085   Standard_EXPORT void SetErrorStatus(const Storage_Error anError);
0086 
0087   Standard_EXPORT void SetErrorStatusExtension(const TCollection_AsciiString& anErrorExt);
0088 
0089   NCollection_IndexedDataMap<TCollection_AsciiString, occ::handle<StdStorage_Root>> myObjects;
0090   Storage_Error                                                                     myErrorStatus;
0091   TCollection_AsciiString myErrorStatusExt;
0092 };
0093 
0094 #endif // _StdStorage_RootData_HeaderFile