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_Naming.hxx>
29 class StdPersistent_Naming
32 class NamedShape : public StdObjMgt_Attribute<TNaming_NamedShape>
35 //! Read persistent data from a file.
36 inline void Read (StdObjMgt_ReadData& theReadData)
37 { theReadData >> myOldShapes >> myNewShapes >> myShapeStatus >> myVersion; }
38 //! Read persistent data from a file.
39 inline void Write (StdObjMgt_WriteData& theWriteData) const
40 { theWriteData << myOldShapes << myNewShapes << myShapeStatus << myVersion; }
41 //! Gets persistent child objects
42 inline void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const
44 if (!myOldShapes.IsNull()) theChildren.Append(myOldShapes);
45 if (!myNewShapes.IsNull()) theChildren.Append(myNewShapes);
47 //! Returns persistent type name
48 inline Standard_CString PName() const { return "PNaming_NamedShape"; }
50 //! Import transient attribute from the persistent data.
51 void Import (const Handle(TNaming_NamedShape)& theAttribute) const;
54 Handle(StdPersistent_HArray1::Shape1) myOldShapes;
55 Handle(StdPersistent_HArray1::Shape1) myNewShapes;
56 Standard_Integer myShapeStatus;
57 Standard_Integer myVersion;
60 class Name : public StdObjMgt_Persistent
63 //! Read persistent data from a file.
64 Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
65 //! Read persistent data from a file.
66 Standard_EXPORT virtual void Write (StdObjMgt_WriteData& theWriteData) const;
67 //! Gets persistent child objects
68 inline void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const
70 if (!myArgs.IsNull()) theChildren.Append(myArgs);
71 if (!myStop.IsNull()) theChildren.Append(myStop);
73 //! Returns persistent type name
74 inline Standard_CString PName() const { return "PNaming_Name"; }
76 //! Import transient object from the persistent data.
77 Standard_EXPORT virtual void Import
78 (TNaming_Name& theName, const Handle(TDF_Data)& theDF) const;
81 Standard_Integer myType;
82 Standard_Integer myShapeType;
83 Handle(StdLPersistent_HArray1::Persistent) myArgs;
84 Handle(StdObjMgt_Persistent) myStop;
85 Standard_Integer myIndex;
88 class Name_1 : public Name
91 //! Read persistent data from a file.
92 Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
93 //! Read persistent data from a file.
94 Standard_EXPORT virtual void Write (StdObjMgt_WriteData& theWriteData) const;
95 //! Gets persistent child objects
96 inline void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const
98 Name::PChildren(theChildren);
99 if (!myContextLabel.IsNull()) theChildren.Append(myContextLabel);
101 //! Returns persistent type name
102 inline Standard_CString PName() const { return "PNaming_Name_1"; }
104 //! Import transient object from the persistent data.
105 Standard_EXPORT virtual void Import
106 (TNaming_Name& theName, const Handle(TDF_Data)& theDF) const;
109 Handle(StdLPersistent_HString::Ascii) myContextLabel;
112 class Name_2 : public Name_1
115 //! Read persistent data from a file.
116 Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
117 //! Read persistent data from a file.
118 Standard_EXPORT virtual void Write (StdObjMgt_WriteData& theWriteData) const;
119 //! Gets persistent child objects
120 inline void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const
121 { Name_1::PChildren(theChildren); }
122 //! Returns persistent type name
123 inline Standard_CString PName() const { return "PNaming_Name_2"; }
125 //! Import transient object from the persistent data.
126 Standard_EXPORT virtual void Import
127 (TNaming_Name& theName, const Handle(TDF_Data)& theDF) const;
130 Standard_Integer myOrientation;
133 class Naming : public StdObjMgt_Attribute<TNaming_Naming>::SingleRef
136 //! Import transient attribute from the persistent data.
137 Standard_EXPORT virtual void ImportAttribute();
140 class Naming_1 : public Naming
143 //! Import transient attribute from the persistent data.
144 Standard_EXPORT virtual void ImportAttribute();
147 typedef Naming Naming_2;