Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-24 09:15:30

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