Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-15 09:17:02

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