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 _ShapePersistent_HSequence_HeaderFile
16 #define _ShapePersistent_HSequence_HeaderFile
18 #include <Standard_NotImplemented.hxx>
20 #include <StdObjMgt_Persistent.hxx>
21 #include <StdObject_gp_Vectors.hxx>
23 #include <TColgp_HSequenceOfXYZ.hxx>
24 #include <TColgp_HSequenceOfPnt.hxx>
25 #include <TColgp_HSequenceOfDir.hxx>
26 #include <TColgp_HSequenceOfVec.hxx>
29 class ShapePersistent_HSequence
31 template <class SequenceClass>
32 class node : public StdObjMgt_Persistent
35 typedef typename SequenceClass::value_type ItemType;
38 //! Read persistent data from a file.
39 Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
41 //! Write persistent data to a file.
42 Standard_EXPORT virtual void Write (StdObjMgt_WriteData& theWriteData) const;
44 //! Gets persistent objects
45 Standard_EXPORT virtual void PChildren (SequenceOfPersistent& theChildren) const
47 theChildren.Append(this->myPreviuos);
48 theChildren.Append(this->myNext);
51 //! Returns persistent type name
52 Standard_EXPORT virtual Standard_CString PName() const
54 Standard_NotImplemented::Raise("ShapePersistent_HSequence::node::PName - not implemented");
58 const Handle(node)& Previuos() const { return myPreviuos; }
59 const Handle(node)& Next() const { return myNext; }
60 const ItemType& Item() const { return myItem; }
63 Handle(node) myPreviuos;
68 template <class SequenceClass>
69 class instance : public StdObjMgt_Persistent
72 typedef node<SequenceClass> Node;
75 //! Read persistent data from a file.
76 Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
78 //! Write persistent data to a file.
79 Standard_EXPORT virtual void Write (StdObjMgt_WriteData& theWriteData) const;
81 //! Gets persistent objects
82 Standard_EXPORT virtual void PChildren(SequenceOfPersistent& theChildren) const
84 theChildren.Append(this->myFirst);
85 theChildren.Append(this->myLast);
88 //! Returns persistent type name
89 Standard_EXPORT virtual Standard_CString PName() const
91 Standard_NotImplemented::Raise("ShapePersistent_HSequence::instance::PName - not implemented");
95 //! Import transient object from the persistent data.
96 Standard_EXPORT Handle(SequenceClass) Import() const;
101 Standard_Integer mySize;
105 typedef instance<TColgp_HSequenceOfXYZ> XYZ;
106 typedef instance<TColgp_HSequenceOfPnt> Pnt;
107 typedef instance<TColgp_HSequenceOfDir> Dir;
108 typedef instance<TColgp_HSequenceOfVec> Vec;
111 //=======================================================================
113 //=======================================================================
115 Standard_CString ShapePersistent_HSequence::instance<TColgp_HSequenceOfXYZ>
119 Standard_CString ShapePersistent_HSequence::node<TColgp_HSequenceOfXYZ>
122 //=======================================================================
124 //=======================================================================
126 Standard_CString ShapePersistent_HSequence::instance<TColgp_HSequenceOfPnt>
130 Standard_CString ShapePersistent_HSequence::node<TColgp_HSequenceOfPnt>
133 //=======================================================================
135 //=======================================================================
137 Standard_CString ShapePersistent_HSequence::instance<TColgp_HSequenceOfDir>
141 Standard_CString ShapePersistent_HSequence::node<TColgp_HSequenceOfDir>
144 //=======================================================================
146 //=======================================================================
148 Standard_CString ShapePersistent_HSequence::instance<TColgp_HSequenceOfVec>
152 Standard_CString ShapePersistent_HSequence::node<TColgp_HSequenceOfVec>