Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Copyright (c) 2015 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 
0015 #ifndef _StdPersistent_Naming_HeaderFile
0016 #define _StdPersistent_Naming_HeaderFile
0017 
0018 #include <StdObjMgt_Attribute.hxx>
0019 #include <StdObjMgt_Persistent.hxx>
0020 #include <StdPersistent_HArray1.hxx>
0021 #include <StdLPersistent_HArray1.hxx>
0022 #include <StdLPersistent_HString.hxx>
0023 
0024 #include <TNaming_Naming.hxx>
0025 
0026 class TNaming_Name;
0027 
0028 
0029 class StdPersistent_Naming
0030 {
0031 public:
0032   class NamedShape : public StdObjMgt_Attribute<TNaming_NamedShape>
0033   {
0034   public:
0035     //! Read persistent data from a file.
0036     inline void Read (StdObjMgt_ReadData& theReadData)
0037       { theReadData >> myOldShapes >> myNewShapes >> myShapeStatus >> myVersion; }
0038     //! Read persistent data from a file.
0039     inline void Write (StdObjMgt_WriteData& theWriteData) const
0040       { theWriteData << myOldShapes << myNewShapes << myShapeStatus << myVersion; }
0041     //! Gets persistent child objects
0042     inline void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const
0043     {
0044       if (!myOldShapes.IsNull()) theChildren.Append(myOldShapes);
0045       if (!myNewShapes.IsNull()) theChildren.Append(myNewShapes);
0046     }
0047     //! Returns persistent type name
0048     inline Standard_CString PName() const { return "PNaming_NamedShape"; }
0049 
0050     //! Import transient attribute from the persistent data.
0051     void Import (const Handle(TNaming_NamedShape)& theAttribute) const;
0052 
0053   private:
0054     Handle(StdPersistent_HArray1::Shape1) myOldShapes;
0055     Handle(StdPersistent_HArray1::Shape1) myNewShapes;
0056     Standard_Integer                      myShapeStatus;
0057     Standard_Integer                      myVersion;
0058   };
0059 
0060   class Name : public StdObjMgt_Persistent
0061   {
0062   public:
0063     //! Read persistent data from a file.
0064     Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
0065     //! Read persistent data from a file.
0066     Standard_EXPORT virtual void Write (StdObjMgt_WriteData& theWriteData) const;
0067     //! Gets persistent child objects
0068     inline void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const
0069     {
0070       if (!myArgs.IsNull()) theChildren.Append(myArgs);
0071       if (!myStop.IsNull()) theChildren.Append(myStop);
0072     }
0073     //! Returns persistent type name
0074     inline Standard_CString PName() const { return "PNaming_Name"; }
0075 
0076     //! Import transient object from the persistent data.
0077     Standard_EXPORT virtual void Import
0078       (TNaming_Name& theName, const Handle(TDF_Data)& theDF) const;
0079 
0080   private:
0081     Standard_Integer                           myType;
0082     Standard_Integer                           myShapeType;
0083     Handle(StdLPersistent_HArray1::Persistent) myArgs;
0084     Handle(StdObjMgt_Persistent)               myStop;
0085     Standard_Integer                           myIndex;
0086   };
0087 
0088   class Name_1 : public Name
0089   {
0090   public:
0091     //! Read persistent data from a file.
0092     Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
0093     //! Read persistent data from a file.
0094     Standard_EXPORT virtual void Write (StdObjMgt_WriteData& theWriteData) const;
0095     //! Gets persistent child objects
0096     inline void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const
0097     {
0098       Name::PChildren(theChildren);
0099       if (!myContextLabel.IsNull()) theChildren.Append(myContextLabel);
0100     }
0101     //! Returns persistent type name
0102     inline Standard_CString PName() const { return "PNaming_Name_1"; }
0103 
0104     //! Import transient object from the persistent data.
0105     Standard_EXPORT virtual void Import
0106       (TNaming_Name& theName, const Handle(TDF_Data)& theDF) const;
0107 
0108   private:
0109     Handle(StdLPersistent_HString::Ascii) myContextLabel;
0110   };
0111 
0112   class Name_2 : public Name_1
0113   {
0114   public:
0115     //! Read persistent data from a file.
0116     Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
0117     //! Read persistent data from a file.
0118     Standard_EXPORT virtual void Write (StdObjMgt_WriteData& theWriteData) const;
0119     //! Gets persistent child objects
0120     inline void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const
0121       { Name_1::PChildren(theChildren); }
0122     //! Returns persistent type name
0123     inline Standard_CString PName() const { return "PNaming_Name_2"; }
0124 
0125     //! Import transient object from the persistent data.
0126     Standard_EXPORT virtual void Import
0127       (TNaming_Name& theName, const Handle(TDF_Data)& theDF) const;
0128 
0129   private:
0130     Standard_Integer myOrientation;
0131   };
0132 
0133   class Naming : public StdObjMgt_Attribute<TNaming_Naming>::SingleRef
0134   {
0135   public:
0136     //! Import transient attribute from the persistent data.
0137     Standard_EXPORT virtual void ImportAttribute();
0138   };
0139 
0140   class Naming_1 : public Naming
0141   {
0142   public:
0143     //! Import transient attribute from the persistent data.
0144     Standard_EXPORT virtual void ImportAttribute();
0145   };
0146 
0147   typedef Naming Naming_2;
0148 };
0149 
0150 #endif