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_TopoDS_HeaderFile
16 #define _ShapePersistent_TopoDS_HeaderFile
18 #include <StdPersistent_TopoDS.hxx>
19 #include <StdPersistent_HArray1.hxx>
20 #include <StdLPersistent_HArray1.hxx>
21 #include <StdObject_Shape.hxx>
23 #include <TopoDS_TWire.hxx>
24 #include <TopoDS_TShell.hxx>
25 #include <TopoDS_TSolid.hxx>
26 #include <TopoDS_TCompSolid.hxx>
27 #include <TopoDS_TCompound.hxx>
30 class ShapePersistent_TopoDS : public StdPersistent_TopoDS
33 class HShape : public StdObjMgt_Persistent, public StdObject_Shape
36 //! Read persistent data from a file.
37 Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
40 Handle(StdObjMgt_Persistent) myEntry;
44 class pTBase : public pTShape
47 inline Handle(TopoDS_TShape) Import() const
49 Handle(TopoDS_TShape) aTShape = createTShape();
51 TopoDS_Shape aWrapperShape;
52 aWrapperShape.TShape (aTShape);
53 addShapes (aWrapperShape);
61 virtual Handle(TopoDS_TShape) createTShape() const = 0;
63 virtual void addShapes (TopoDS_Shape& theParent) const = 0;
65 void setFlags (const Handle(TopoDS_TShape)& theTShape) const;
68 template <class ShapesArray>
69 void addShapesT (TopoDS_Shape& theParent) const;
73 template <class Target>
74 class pTSimple : public pTBase
75 { virtual Handle(TopoDS_TShape) createTShape() const; };
77 template <class Persistent, class ShapesArray>
78 class pTObject : public Persistent
80 virtual void addShapes (TopoDS_Shape& theParent) const
82 pTBase::addShapesT<ShapesArray> (theParent);
86 template <class Persistent, class ShapesArray>
87 struct tObjectT : Delayed <DelayedBase<TShape, TopoDS_TShape, pTBase>,
88 pTObject<Persistent, ShapesArray> > {};
91 template <class Persistent>
92 struct tObject : tObjectT<Persistent, StdLPersistent_HArray1::Persistent> {};
94 template <class Persistent>
95 struct tObject1 : tObjectT<Persistent, StdPersistent_HArray1::Shape1> {};
98 typedef tObject <pTSimple<TopoDS_TWire> > TWire;
99 typedef tObject <pTSimple<TopoDS_TShell> > TShell;
100 typedef tObject <pTSimple<TopoDS_TSolid> > TSolid;
101 typedef tObject <pTSimple<TopoDS_TCompSolid> > TCompSolid;
102 typedef tObject <pTSimple<TopoDS_TCompound> > TCompound;
104 typedef tObject1 <pTSimple<TopoDS_TWire> > TWire1;
105 typedef tObject1 <pTSimple<TopoDS_TShell> > TShell1;
106 typedef tObject1 <pTSimple<TopoDS_TSolid> > TSolid1;
107 typedef tObject1 <pTSimple<TopoDS_TCompSolid> > TCompSolid1;
108 typedef tObject1 <pTSimple<TopoDS_TCompound> > TCompound1;