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_Geom_HeaderFile
16 #define _ShapePersistent_Geom_HeaderFile
18 #include <StdObjMgt_SharedObject.hxx>
20 #include <StdObject_gp_Vectors.hxx>
21 #include <StdObject_gp_Axes.hxx>
22 #include <StdObject_gp_Curves.hxx>
23 #include <StdObject_gp_Surfaces.hxx>
24 #include <StdObject_gp_Trsfs.hxx>
26 #include <Geom_CartesianPoint.hxx>
27 #include <Geom_Direction.hxx>
28 #include <Geom_VectorWithMagnitude.hxx>
29 #include <Geom_Axis1Placement.hxx>
30 #include <Geom_Axis2Placement.hxx>
31 #include <Geom_Transformation.hxx>
32 #include <Geom_Curve.hxx>
33 #include <Geom_Surface.hxx>
36 class ShapePersistent_Geom : protected StdObjMgt_SharedObject
39 class Geometry : public StdObjMgt_Persistent
42 //! Read persistent data from a file.
43 Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
47 template <class Transient>
48 struct geometryBase : DelayedBase<Geometry, Transient> {};
50 template <class Base, class PData>
51 class subBase : public Base
54 //! Read persistent data from a file.
55 Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData)
56 { PData().Read (theReadData); }
59 template <class Base, class GpData>
60 struct subBase_gp : public Base
63 //! Read persistent data from a file.
64 Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData)
72 struct subBase_empty : Base {};
74 template <class Base, class Target, class Data = void>
75 class instance : public Base
78 //! Read persistent data from a file.
79 Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData)
83 this->myTransient = new Target (aData);
88 typedef geometryBase<Geom_Geometry> basic;
91 typedef subBase_empty<basic> Point;
92 typedef instance<Point, Geom_CartesianPoint, gp_Pnt> CartesianPoint;
94 typedef subBase_gp<basic, gp_Vec> Vector;
95 typedef instance<Vector, Geom_Direction , gp_Dir> Direction;
96 typedef instance<Vector, Geom_VectorWithMagnitude, gp_Vec> VectorWithMagnitude;
98 typedef subBase_gp<basic, gp_Ax1> AxisPlacement;
99 typedef instance<AxisPlacement, Geom_Axis1Placement, gp_Ax1> Axis1Placement;
100 typedef instance<AxisPlacement, Geom_Axis2Placement> Axis2Placement;
102 typedef instance <SharedBase<Geom_Transformation>,
104 gp_Trsf> Transformation;
106 typedef geometryBase<Geom_Curve> Curve;
107 typedef geometryBase<Geom_Surface> Surface;
111 void ShapePersistent_Geom::instance<ShapePersistent_Geom::AxisPlacement,
113 ::Read (StdObjMgt_ReadData& theReadData);