Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-26 09:17:59

0001 // Created on: 1997-02-24
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_Root_HeaderFile
0018 #define _Storage_Root_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <TCollection_AsciiString.hxx>
0024 #include <Standard_Integer.hxx>
0025 #include <Standard_Transient.hxx>
0026 class Standard_Persistent;
0027 
0028 class Storage_Root;
0029 DEFINE_STANDARD_HANDLE(Storage_Root, Standard_Transient)
0030 
0031 //! A root object extracted from a Storage_Data object.
0032 //! A Storage_Root encapsulates a persistent
0033 //! object which is a root of a Storage_Data object.
0034 //! It contains additional information: the name and
0035 //! the data type of the persistent object.
0036 //! When retrieving a Storage_Data object from a
0037 //! container (for example, a file) you access its
0038 //! roots with the function Roots which returns a
0039 //! sequence of root objects. The provided functions
0040 //! allow you to request information about each root of the sequence.
0041 //! You do not create explicit roots: when inserting
0042 //! data in a Storage_Data object, you just provide
0043 //! the persistent object and optionally its name to the function AddRoot.
0044 class Storage_Root : public Standard_Transient
0045 {
0046 
0047 public:
0048   Standard_EXPORT Storage_Root();
0049 
0050   Standard_EXPORT Storage_Root(const TCollection_AsciiString&     theName,
0051                                const Handle(Standard_Persistent)& theObject);
0052 
0053   Standard_EXPORT Storage_Root(const TCollection_AsciiString& theName,
0054                                const Standard_Integer         theRef,
0055                                const TCollection_AsciiString& theType);
0056 
0057   Standard_EXPORT void SetName(const TCollection_AsciiString& theName);
0058 
0059   //! Returns the name of this root object.
0060   //! The name may have been given explicitly when
0061   //! the root was inserted into the Storage_Data
0062   //! object. If not, the name is a reference number
0063   //! which was assigned automatically by the driver
0064   //! when writing the set of data into the container.
0065   //! When naming the roots, it is easier to retrieve
0066   //! objects by significant references rather than by
0067   //! references without any semantic values.
0068   //! Warning
0069   //! The returned string will be empty if you call this
0070   //! function before having named this root object,
0071   //! either explicitly, or when writing the set of data
0072   //! into the container.
0073   Standard_EXPORT TCollection_AsciiString Name() const;
0074 
0075   Standard_EXPORT void SetObject(const Handle(Standard_Persistent)& anObject);
0076 
0077   //! Returns the persistent object encapsulated by this root.
0078   Standard_EXPORT Handle(Standard_Persistent) Object() const;
0079 
0080   //! Returns the name of this root type.
0081   Standard_EXPORT TCollection_AsciiString Type() const;
0082 
0083   Standard_EXPORT void SetReference(const Standard_Integer aRef);
0084 
0085   Standard_EXPORT Standard_Integer Reference() const;
0086 
0087   Standard_EXPORT void SetType(const TCollection_AsciiString& aType);
0088 
0089   friend class Storage_Schema;
0090 
0091   DEFINE_STANDARD_RTTIEXT(Storage_Root, Standard_Transient)
0092 
0093 protected:
0094 private:
0095   TCollection_AsciiString     myName;
0096   TCollection_AsciiString     myType;
0097   Handle(Standard_Persistent) myObject;
0098   Standard_Integer            myRef;
0099 };
0100 
0101 #endif // _Storage_Root_HeaderFile