ff205346 |
1 | // Copyright (c) 2015 OPEN CASCADE SAS |
2 | // |
3 | // This file is part of Open CASCADE Technology software library. |
4 | // |
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. |
10 | // |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
13 | |
14 | |
15 | #ifndef _ShapePersistent_HSequence_HeaderFile |
16 | #define _ShapePersistent_HSequence_HeaderFile |
17 | |
18 | #include <StdObjMgt_Persistent.hxx> |
45d8465e |
19 | #include <StdObject_gp_Vectors.hxx> |
ff205346 |
20 | |
21 | #include <TColgp_HSequenceOfXYZ.hxx> |
22 | #include <TColgp_HSequenceOfPnt.hxx> |
23 | #include <TColgp_HSequenceOfDir.hxx> |
24 | #include <TColgp_HSequenceOfVec.hxx> |
25 | |
26 | |
27 | class ShapePersistent_HSequence |
28 | { |
29 | template <class SequenceClass> |
30 | class node : public StdObjMgt_Persistent |
31 | { |
32 | public: |
33 | typedef typename SequenceClass::value_type ItemType; |
34 | |
35 | public: |
36 | //! Read persistent data from a file. |
37 | Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData); |
38 | |
39 | const Handle(node)& Previuos() const { return myPreviuos; } |
40 | const Handle(node)& Next() const { return myNext; } |
41 | const ItemType& Item() const { return myItem; } |
42 | |
43 | private: |
45d8465e |
44 | Handle(node) myPreviuos; |
45 | Handle(node) myNext; |
46 | ItemType myItem; |
ff205346 |
47 | }; |
48 | |
49 | template <class SequenceClass> |
50 | class instance : public StdObjMgt_Persistent |
51 | { |
52 | public: |
53 | typedef node<SequenceClass> Node; |
54 | |
55 | public: |
56 | //! Read persistent data from a file. |
57 | Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData); |
58 | |
59 | //! Import transient object from the persistent data. |
60 | Standard_EXPORT Handle(SequenceClass) Import() const; |
61 | |
62 | private: |
45d8465e |
63 | Handle(Node) myFirst; |
64 | Handle(Node) myLast; |
65 | Standard_Integer mySize; |
ff205346 |
66 | }; |
67 | |
68 | public: |
69 | typedef instance<TColgp_HSequenceOfXYZ> XYZ; |
70 | typedef instance<TColgp_HSequenceOfPnt> Pnt; |
71 | typedef instance<TColgp_HSequenceOfDir> Dir; |
72 | typedef instance<TColgp_HSequenceOfVec> Vec; |
73 | }; |
74 | |
75 | #endif |