0028564: Support of applications using old persistence (ShapeSchema)
[occt.git] / src / StdObject / StdObject_gp_Vectors.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 _StdObject_gp_Vectors_HeaderFile
16 #define _StdObject_gp_Vectors_HeaderFile
17
18
19 #include <StdObjMgt_ReadData.hxx>
20 #include <StdObjMgt_WriteData.hxx>
21
22 #include <gp_Pnt2d.hxx>
23 #include <gp_Vec2d.hxx>
24 #include <gp_Dir2d.hxx>
25 #include <gp_Pnt.hxx>
26 #include <gp_Vec.hxx>
27 #include <gp_Dir.hxx>
28
29
30 inline StdObjMgt_ReadData& operator >>
31   (StdObjMgt_ReadData::Object theReadData, gp_XY& theXY)
32 {
33   Standard_Real aX, aY;
34   theReadData >> aX >> aY;
35   theXY.SetCoord (aX, aY);
36   return theReadData;
37 }
38
39 inline StdObjMgt_WriteData& operator <<
40   (StdObjMgt_WriteData::Object theWriteData, const gp_XY& theXY)
41 {
42   Standard_Real aX = theXY.X(), aY = theXY.Y();
43   theWriteData << aX << aY;
44   return theWriteData;
45 }
46
47 inline StdObjMgt_ReadData& operator >>
48   (StdObjMgt_ReadData::Object theReadData, gp_Pnt2d& thePnt)
49 {
50   gp_XY aXY;
51   theReadData >> aXY;
52   thePnt.SetXY (aXY);
53   return theReadData;
54 }
55
56 inline StdObjMgt_WriteData& operator <<
57   (StdObjMgt_WriteData::Object theWriteData, const gp_Pnt2d& thePnt)
58 {
59   theWriteData << thePnt.XY();
60   return theWriteData;
61 }
62
63 inline StdObjMgt_ReadData& operator >>
64   (StdObjMgt_ReadData::Object theReadData, gp_Vec2d& theVec)
65 {
66   gp_XY aXY;
67   theReadData >> aXY;
68   theVec.SetXY (aXY);
69   return theReadData;
70 }
71
72 inline StdObjMgt_WriteData& operator <<
73   (StdObjMgt_WriteData::Object theWriteData, const gp_Vec2d& theVec)
74 {
75   theWriteData << theVec.XY();
76   return theWriteData;
77 }
78
79 inline StdObjMgt_ReadData& operator >>
80   (StdObjMgt_ReadData::Object theReadData, gp_Dir2d& theDir)
81 {
82   gp_XY aXY;
83   theReadData >> aXY;
84   theDir.SetXY (aXY);
85   return theReadData;
86 }
87
88 inline StdObjMgt_WriteData& operator <<
89   (StdObjMgt_WriteData::Object theWriteData, const gp_Dir2d& theDir)
90 {
91   theWriteData << theDir.XY();
92   return theWriteData;
93 }
94
95 inline StdObjMgt_ReadData& operator >>
96   (StdObjMgt_ReadData::Object theReadData, gp_XYZ& theXYZ)
97 {
98   Standard_Real aX, aY, aZ;
99   theReadData >> aX >> aY >> aZ;
100   theXYZ.SetCoord(aX, aY, aZ);
101   return theReadData;
102 }
103
104 inline StdObjMgt_WriteData& operator <<
105   (StdObjMgt_WriteData::Object theWriteData, const gp_XYZ& theXYZ)
106 {
107   Standard_Real aX = theXYZ.X(), aY = theXYZ.Y(), aZ = theXYZ.Z();
108   theWriteData << aX << aY << aZ;
109   return theWriteData;
110 }
111
112 inline StdObjMgt_ReadData& operator >>
113   (StdObjMgt_ReadData::Object theReadData, gp_Pnt& thePnt)
114 {
115   gp_XYZ aXYZ;
116   theReadData >> aXYZ;
117   thePnt.SetXYZ (aXYZ);
118   return theReadData;
119 }
120
121 inline StdObjMgt_WriteData& operator <<
122   (StdObjMgt_WriteData::Object theWriteData, const gp_Pnt& thePnt)
123 {
124   theWriteData << thePnt.XYZ();
125   return theWriteData;
126 }
127
128 inline StdObjMgt_ReadData& operator >>
129   (StdObjMgt_ReadData::Object theReadData, gp_Vec& theVec)
130 {
131   gp_XYZ aXYZ;
132   theReadData >> aXYZ;
133   theVec.SetXYZ (aXYZ);
134   return theReadData;
135 }
136
137 inline StdObjMgt_WriteData& operator <<
138   (StdObjMgt_WriteData::Object theWriteData, const gp_Vec& theVec)
139 {
140   theWriteData << theVec.XYZ();
141   return theWriteData;
142 }
143
144 inline StdObjMgt_ReadData& operator >>
145   (StdObjMgt_ReadData::Object theReadData, gp_Dir& theDir)
146 {
147   gp_XYZ aXYZ;
148   theReadData >> aXYZ;
149   theDir.SetXYZ(aXYZ);
150   return theReadData;
151 }
152
153 inline StdObjMgt_WriteData& operator <<
154   (StdObjMgt_WriteData::Object theWriteData, const gp_Dir& theDir)
155 {
156   theWriteData << theDir.XYZ();
157   return theWriteData;
158 }
159
160
161 #endif