1 // Copyright (c) 2017 OPEN CASCADE SAS 2 // 3 // This file is part of Open CASCADE Technology software library. 4 // 5 // This library is free software; you can redistribute it and/or modify it under 6 // the terms of the GNU Lesser General Public License version 2.1 as published 7 // by the Free Software Foundation, with special exception defined in the file 8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 9 // distribution for complete text of the license and disclaimer of any warranty. 10 // 11 // Alternatively, this file may be used under the terms of Open CASCADE 12 // commercial license or contractual agreement. 13 14 #ifndef _StdStorage_Data_HeaderFile 15 #define _StdStorage_Data_HeaderFile 16 17 #include <Standard_Transient.hxx> 18 #include <Standard_Macro.hxx> 19 #include <Standard_Handle.hxx> 20 21 class StdStorage_HeaderData; 22 class StdStorage_TypeData; 23 class StdStorage_RootData; 24 25 //! A picture memorizing the stored in a 26 //! container (for example, in a file). 27 //! A StdStorage_Data object represents either: 28 //! - persistent data to be written into a container, 29 //! or 30 //! - persistent data which are read from a container. 31 //! A StdStorage_Data object is used in both the 32 //! storage and retrieval operations: 33 //! - Storage mechanism: create an empty 34 //! StdStorage_Data object, then add successively 35 //! persistent objects (roots) to be stored using 36 //! the StdStorage_RootData's function AddRoot. When the set of 37 //! data is complete, write it to a container using the 38 //! function Write in your StdStorage algorithm. 39 //! - Retrieval mechanism: a StdStorage_Data 40 //! object is returned by the Read function from 41 //! your StdStorage algorithm. Use the StdStorage_RootData's 42 //! functions NumberOfRoots and Roots to find the roots which 43 //! were stored in the read container. 44 //! The roots of a StdStorage_Data object may share 45 //! references on objects. The shared internal 46 //! references of a StdStorage_Data object are 47 //! maintained by the storage/retrieval mechanism. 48 //! Note: References shared by objects which are 49 //! contained in two distinct StdStorage_Data objects 50 //! are not maintained by the storage/retrieval 51 //! mechanism: external references are not 52 //! supported by Storage_Schema algorithm 53 class StdStorage_Data 54 : public Standard_Transient 55 { 56 57 public: 58 59 //! Creates an empty set of data. 60 //! You explicitly create a StdStorage_Data object 61 //! when preparing the set of objects to be stored 62 //! together in a container (for example, in a file). 63 //! Then use the function StdStorage_RootData's AddRoot 64 //! to add persistent objects to the set of data. 65 //! A StdStorage_Data object is also returned by the 66 //! Read function of a StdStorage algorithm. Use the 67 //! StdStorage_RootData's functions NumberOfRoots and 68 //! Roots to find the roots which were stored in the 69 //! read container. 70 Standard_EXPORT StdStorage_Data(); 71 72 //! Makes the container empty 73 Standard_EXPORT void Clear(); 74 75 //! Returns the header data section HeaderData()76 Handle(StdStorage_HeaderData) HeaderData() { return myHeaderData; } 77 78 //! Returns the type data section TypeData()79 Handle(StdStorage_TypeData) TypeData() { return myTypeData; } 80 81 //! Returns the root data section RootData()82 Handle(StdStorage_RootData) RootData() { return myRootData; } 83 84 private: 85 86 Handle(StdStorage_HeaderData) myHeaderData; 87 Handle(StdStorage_TypeData) myTypeData; 88 Handle(StdStorage_RootData) myRootData; 89 90 }; 91 92 #endif // _StdStorage_Data_HeaderFile 93