Back to home page

EIC code displayed by LXR

 
 

    


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

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