0030675: Visualization - remove redundant proxy classes in hierarchy of PrsMgr_Presen...
[occt.git] / src / ShapePersistent / ShapePersistent_HSequence.hxx
CommitLineData
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
ec964372 18#include <Standard_NotImplemented.hxx>
19
ff205346 20#include <StdObjMgt_Persistent.hxx>
45d8465e 21#include <StdObject_gp_Vectors.hxx>
ff205346 22
23#include <TColgp_HSequenceOfXYZ.hxx>
24#include <TColgp_HSequenceOfPnt.hxx>
25#include <TColgp_HSequenceOfDir.hxx>
26#include <TColgp_HSequenceOfVec.hxx>
27
28
29class ShapePersistent_HSequence
30{
31 template <class SequenceClass>
32 class node : public StdObjMgt_Persistent
33 {
34 public:
35 typedef typename SequenceClass::value_type ItemType;
36
37 public:
38 //! Read persistent data from a file.
39 Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
40
ec964372 41 //! Write persistent data to a file.
42 Standard_EXPORT virtual void Write (StdObjMgt_WriteData& theWriteData) const;
43
44 //! Gets persistent objects
0f57ab75 45 virtual void PChildren (SequenceOfPersistent& theChildren) const
ec964372 46 {
47 theChildren.Append(this->myPreviuos);
48 theChildren.Append(this->myNext);
49 }
50
51 //! Returns persistent type name
0f57ab75 52 virtual Standard_CString PName() const
ec964372 53 {
54 Standard_NotImplemented::Raise("ShapePersistent_HSequence::node::PName - not implemented");
55 return "";
56 }
57
ff205346 58 const Handle(node)& Previuos() const { return myPreviuos; }
59 const Handle(node)& Next() const { return myNext; }
60 const ItemType& Item() const { return myItem; }
61
62 private:
45d8465e 63 Handle(node) myPreviuos;
64 Handle(node) myNext;
65 ItemType myItem;
ff205346 66 };
67
68 template <class SequenceClass>
69 class instance : public StdObjMgt_Persistent
70 {
71 public:
72 typedef node<SequenceClass> Node;
73
74 public:
75 //! Read persistent data from a file.
76 Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
77
ec964372 78 //! Write persistent data to a file.
79 Standard_EXPORT virtual void Write (StdObjMgt_WriteData& theWriteData) const;
80
81 //! Gets persistent objects
0f57ab75 82 virtual void PChildren(SequenceOfPersistent& theChildren) const
ec964372 83 {
84 theChildren.Append(this->myFirst);
85 theChildren.Append(this->myLast);
86 }
87
88 //! Returns persistent type name
0f57ab75 89 virtual Standard_CString PName() const
ec964372 90 {
91 Standard_NotImplemented::Raise("ShapePersistent_HSequence::instance::PName - not implemented");
92 return "";
93 }
94
ff205346 95 //! Import transient object from the persistent data.
96 Standard_EXPORT Handle(SequenceClass) Import() const;
97
98 private:
45d8465e 99 Handle(Node) myFirst;
100 Handle(Node) myLast;
101 Standard_Integer mySize;
ff205346 102 };
103
104public:
105 typedef instance<TColgp_HSequenceOfXYZ> XYZ;
106 typedef instance<TColgp_HSequenceOfPnt> Pnt;
107 typedef instance<TColgp_HSequenceOfDir> Dir;
108 typedef instance<TColgp_HSequenceOfVec> Vec;
109};
110
ec964372 111//=======================================================================
112// XYZ
113//=======================================================================
114template<>
115Standard_CString ShapePersistent_HSequence::instance<TColgp_HSequenceOfXYZ>
116 ::PName() const;
117
118template<>
119Standard_CString ShapePersistent_HSequence::node<TColgp_HSequenceOfXYZ>
120 ::PName() const;
121
122//=======================================================================
123// Pnt
124//=======================================================================
125template<>
126Standard_CString ShapePersistent_HSequence::instance<TColgp_HSequenceOfPnt>
127 ::PName() const;
128
129template<>
130Standard_CString ShapePersistent_HSequence::node<TColgp_HSequenceOfPnt>
131 ::PName() const;
132
133//=======================================================================
134// Dir
135//=======================================================================
136template<>
137Standard_CString ShapePersistent_HSequence::instance<TColgp_HSequenceOfDir>
138 ::PName() const;
139
140template<>
141Standard_CString ShapePersistent_HSequence::node<TColgp_HSequenceOfDir>
142 ::PName() const;
143
144//=======================================================================
145// Vec
146//=======================================================================
147template<>
148Standard_CString ShapePersistent_HSequence::instance<TColgp_HSequenceOfVec>
149 ::PName() const;
150
151template<>
152Standard_CString ShapePersistent_HSequence::node<TColgp_HSequenceOfVec>
153 ::PName() const;
154
ff205346 155#endif