1 // Copyright (c) 2015 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
15 #ifndef _StdPersistent_Naming_HeaderFile
16 #define _StdPersistent_Naming_HeaderFile
18 #include <StdObjMgt_Attribute.hxx>
19 #include <StdObjMgt_Persistent.hxx>
20 #include <StdPersistent_HArray1.hxx>
21 #include <StdLPersistent_HArray1.hxx>
22 #include <StdLPersistent_HString.hxx>
24 #include <TNaming_NamedShape.hxx>
25 #include <TNaming_Naming.hxx>
30 class StdPersistent_Naming
33 class NamedShape : public StdObjMgt_Attribute<TNaming_NamedShape>
36 //! Read persistent data from a file.
37 inline void Read (StdObjMgt_ReadData& theReadData)
38 { theReadData >> myOldShapes >> myNewShapes >> myShapeStatus >> myVersion; }
39 //! Read persistent data from a file.
40 inline void Write (StdObjMgt_WriteData& theWriteData) const
41 { theWriteData << myOldShapes << myNewShapes << myShapeStatus << myVersion; }
42 //! Gets persistent child objects
43 inline void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const
45 if (!myOldShapes.IsNull()) theChildren.Append(myOldShapes);
46 if (!myNewShapes.IsNull()) theChildren.Append(myNewShapes);
48 //! Returns persistent type name
49 inline Standard_CString PName() const { return "PNaming_NamedShape"; }
51 //! Import transient attribuite from the persistent data.
52 void Import (const Handle(TNaming_NamedShape)& theAttribute) const;
55 Handle(StdPersistent_HArray1::Shape1) myOldShapes;
56 Handle(StdPersistent_HArray1::Shape1) myNewShapes;
57 Standard_Integer myShapeStatus;
58 Standard_Integer myVersion;
61 class Name : public StdObjMgt_Persistent
64 //! Read persistent data from a file.
65 Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
66 //! Read persistent data from a file.
67 Standard_EXPORT virtual void Write (StdObjMgt_WriteData& theWriteData) const;
68 //! Gets persistent child objects
69 inline void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const
71 if (!myArgs.IsNull()) theChildren.Append(myArgs);
72 if (!myStop.IsNull()) theChildren.Append(myStop);
74 //! Returns persistent type name
75 inline Standard_CString PName() const { return "PNaming_Name"; }
77 //! Import transient object from the persistent data.
78 Standard_EXPORT virtual void Import
79 (TNaming_Name& theName, const Handle(TDF_Data)& theDF) const;
82 Standard_Integer myType;
83 Standard_Integer myShapeType;
84 Handle(StdLPersistent_HArray1::Persistent) myArgs;
85 Handle(StdObjMgt_Persistent) myStop;
86 Standard_Integer myIndex;
89 class Name_1 : public Name
92 //! Read persistent data from a file.
93 Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
94 //! Read persistent data from a file.
95 Standard_EXPORT virtual void Write (StdObjMgt_WriteData& theWriteData) const;
96 //! Gets persistent child objects
97 inline void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const
99 Name::PChildren(theChildren);
100 if (!myContextLabel.IsNull()) theChildren.Append(myContextLabel);
102 //! Returns persistent type name
103 inline Standard_CString PName() const { return "PNaming_Name_1"; }
105 //! Import transient object from the persistent data.
106 Standard_EXPORT virtual void Import
107 (TNaming_Name& theName, const Handle(TDF_Data)& theDF) const;
110 Handle(StdLPersistent_HString::Ascii) myContextLabel;
113 class Name_2 : public Name_1
116 //! Read persistent data from a file.
117 Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
118 //! Read persistent data from a file.
119 Standard_EXPORT virtual void Write (StdObjMgt_WriteData& theWriteData) const;
120 //! Gets persistent child objects
121 inline void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const
122 { Name_1::PChildren(theChildren); }
123 //! Returns persistent type name
124 inline Standard_CString PName() const { return "PNaming_Name_2"; }
126 //! Import transient object from the persistent data.
127 Standard_EXPORT virtual void Import
128 (TNaming_Name& theName, const Handle(TDF_Data)& theDF) const;
131 Standard_Integer myOrientation;
134 class Naming : public StdObjMgt_Attribute<TNaming_Naming>::SingleRef
137 //! Import transient attribuite from the persistent data.
138 Standard_EXPORT virtual void ImportAttribute();
141 class Naming_1 : public Naming
144 //! Import transient attribuite from the persistent data.
145 Standard_EXPORT virtual void ImportAttribute();
148 typedef Naming Naming_2;