0027241: Create a complete test case to verify reading of all attribute types from...
[occt.git] / src / ShapePersistent / ShapePersistent_Poly.hxx
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_Poly_HeaderFile
16 #define _ShapePersistent_Poly_HeaderFile
17
18 #include <StdObjMgt_SharedObject.hxx>
19 #include <StdObjMgt_ReadData.hxx>
20 #include <StdLPersistent_HArray1.hxx>
21 #include <ShapePersistent_HArray1.hxx>
22
23 class Poly_Polygon2D;
24 class Poly_Polygon3D;
25 class Poly_PolygonOnTriangulation;
26 class Poly_Triangulation;
27
28
29 class ShapePersistent_Poly : private StdObjMgt_SharedObject
30 {
31   class pPolygon2D : public Standard_Transient
32   {
33   public:
34     inline void Read (StdObjMgt_ReadData& theReadData)
35       { theReadData >> myDeflection >> myNodes; }
36
37     Handle(Poly_Polygon2D) Import() const;
38
39   private:
40     Standard_Real                          myDeflection;
41     Handle(ShapePersistent_HArray1::Pnt2d) myNodes;
42   };
43
44   class pPolygon3D : public Standard_Transient
45   {
46   public:
47     inline void Read (StdObjMgt_ReadData& theReadData)
48       { theReadData >> myDeflection >> myNodes >> myParameters; }
49
50     Handle(Poly_Polygon3D) Import() const;
51
52   private:
53     Standard_Real                        myDeflection;
54     Handle(ShapePersistent_HArray1::Pnt) myNodes;
55     Handle(StdLPersistent_HArray1::Real) myParameters;
56   };
57
58   class pPolygonOnTriangulation : public Standard_Transient
59   {
60   public:
61     inline void Read (StdObjMgt_ReadData& theReadData)
62       { theReadData >> myDeflection >> myNodes >> myParameters; }
63
64     Handle(Poly_PolygonOnTriangulation) Import() const;
65
66   private:
67     Standard_Real                           myDeflection;
68     Handle(StdLPersistent_HArray1::Integer) myNodes;
69     Handle(StdLPersistent_HArray1::Real)    myParameters;
70   };
71
72   class pTriangulation : public Standard_Transient
73   {
74   public:
75     inline void Read (StdObjMgt_ReadData& theReadData)
76       { theReadData >> myDeflection >> myNodes >> myUVNodes >> myTriangles; }
77
78     Handle(Poly_Triangulation) Import() const;
79
80   private:
81     Standard_Real                             myDeflection;
82     Handle(ShapePersistent_HArray1::Pnt)      myNodes;
83     Handle(ShapePersistent_HArray1::Pnt2d)    myUVNodes;
84     Handle(ShapePersistent_HArray1::Triangle) myTriangles;
85   };
86
87   template <class Persistent, class Transient>
88   struct instance
89     : Delayed <DelayedBase<StdObjMgt_Persistent, Transient, Persistent> > {};
90
91 public:
92   typedef instance <pPolygon2D, Poly_Polygon2D>         Polygon2D;
93   typedef instance <pPolygon3D, Poly_Polygon3D>         Polygon3D;
94   typedef instance <pPolygonOnTriangulation,
95                     Poly_PolygonOnTriangulation>        PolygonOnTriangulation;
96   typedef instance <pTriangulation, Poly_Triangulation> Triangulation;
97 };
98
99 #endif