0026961: Recover possibility to read files in old persistence format
authormyn <myn@opencascade.com>
Wed, 2 Mar 2016 20:04:30 +0000 (23:04 +0300)
committerabv <abv@opencascade.com>
Fri, 4 Mar 2016 04:31:08 +0000 (07:31 +0300)
Possibility to read shapes and OCAF documents from old persistence format (Std and StdL schema) is restored.

Test cases used old persistent files on input are restored with suffix "_std"

Removing toolkit from OS package

115 files changed:
adm/MODULES
adm/UDLIST
src/OS/ApplicationFramework.tcl
src/ShapePersistent/FILES
src/ShapePersistent/ShapePersistent.cxx
src/ShapePersistent/ShapePersistent_BRep.cxx [new file with mode: 0644]
src/ShapePersistent/ShapePersistent_BRep.hxx [new file with mode: 0644]
src/ShapePersistent/ShapePersistent_Geom.cxx [copied from src/StdLPersistent/StdLPersistent_PDataStd_Name.cxx with 60% similarity]
src/ShapePersistent/ShapePersistent_Geom.hxx [new file with mode: 0644]
src/ShapePersistent/ShapePersistent_Geom2d.hxx [new file with mode: 0644]
src/ShapePersistent/ShapePersistent_Geom2d_Curve.cxx [new file with mode: 0644]
src/ShapePersistent/ShapePersistent_Geom2d_Curve.hxx [new file with mode: 0644]
src/ShapePersistent/ShapePersistent_Geom_Curve.cxx [new file with mode: 0644]
src/ShapePersistent/ShapePersistent_Geom_Curve.hxx [new file with mode: 0644]
src/ShapePersistent/ShapePersistent_Geom_Surface.cxx [new file with mode: 0644]
src/ShapePersistent/ShapePersistent_Geom_Surface.hxx [new file with mode: 0644]
src/ShapePersistent/ShapePersistent_HArray1.cxx [new file with mode: 0644]
src/ShapePersistent/ShapePersistent_HArray1.hxx [new file with mode: 0644]
src/ShapePersistent/ShapePersistent_HArray2.cxx [new file with mode: 0644]
src/ShapePersistent/ShapePersistent_HArray2.hxx [new file with mode: 0644]
src/ShapePersistent/ShapePersistent_HSequence.cxx [new file with mode: 0644]
src/ShapePersistent/ShapePersistent_HSequence.hxx [new file with mode: 0644]
src/ShapePersistent/ShapePersistent_Poly.cxx [new file with mode: 0644]
src/ShapePersistent/ShapePersistent_Poly.hxx [new file with mode: 0644]
src/ShapePersistent/ShapePersistent_TopoDS.cxx [new file with mode: 0644]
src/ShapePersistent/ShapePersistent_TopoDS.hxx [new file with mode: 0644]
src/StdDrivers/StdDrivers_DocumentRetrievalDriver.cxx
src/StdDrivers/StdDrivers_DocumentRetrievalDriver.hxx
src/StdLDrivers/StdLDrivers_DocumentRetrievalDriver.cxx
src/StdLDrivers/StdLDrivers_DocumentRetrievalDriver.hxx
src/StdLObject/FILES [new file with mode: 0644]
src/StdLObject/StdLObject_GUID.cxx [copied from src/StdLPersistent/StdLPersistent_PColStd_HArray1Base.cxx with 61% similarity]
src/StdLObject/StdLObject_GUID.hxx [copied from src/StdLPersistent/StdLPersistent_PDataStd_Integer.hxx with 57% similarity]
src/StdLPersistent/FILES
src/StdLPersistent/StdLPersistent.cxx
src/StdLPersistent/StdLPersistent_Collection.cxx [new file with mode: 0644]
src/StdLPersistent/StdLPersistent_Collection.hxx [new file with mode: 0644]
src/StdLPersistent/StdLPersistent_Data.cxx [moved from src/StdLPersistent/StdLPersistent_PDF_Data.cxx with 63% similarity]
src/StdLPersistent/StdLPersistent_Data.hxx [moved from src/StdLPersistent/StdLPersistent_PDF_Data.hxx with 73% similarity]
src/StdLPersistent/StdLPersistent_Dependency.cxx [new file with mode: 0644]
src/StdLPersistent/StdLPersistent_Dependency.hxx [new file with mode: 0644]
src/StdLPersistent/StdLPersistent_Document.cxx [copied from src/StdLPersistent/StdLPersistent_PDocStd_Document.cxx with 73% similarity]
src/StdLPersistent/StdLPersistent_Document.hxx [moved from src/StdLPersistent/StdLPersistent_PDocStd_Document.hxx with 71% similarity]
src/StdLPersistent/StdLPersistent_Function.hxx [copied from src/StdLPersistent/StdLPersistent_PDataStd_Name.hxx with 55% similarity]
src/StdLPersistent/StdLPersistent_HArray1.cxx [new file with mode: 0644]
src/StdLPersistent/StdLPersistent_HArray1.hxx [new file with mode: 0644]
src/StdLPersistent/StdLPersistent_HArray1OfPersistent.hxx [copied from src/StdLPersistent/StdLPersistent_PCollection_HExtendedString.hxx with 56% similarity]
src/StdLPersistent/StdLPersistent_HArray2.cxx [new file with mode: 0644]
src/StdLPersistent/StdLPersistent_HArray2.hxx [new file with mode: 0644]
src/StdLPersistent/StdLPersistent_HString.cxx [new file with mode: 0644]
src/StdLPersistent/StdLPersistent_HString.hxx [new file with mode: 0644]
src/StdLPersistent/StdLPersistent_NamedData.cxx [new file with mode: 0644]
src/StdLPersistent/StdLPersistent_NamedData.hxx [new file with mode: 0644]
src/StdLPersistent/StdLPersistent_PColStd_HArray1.hxx [deleted file]
src/StdLPersistent/StdLPersistent_Real.hxx [copied from src/StdLPersistent/StdLPersistent_PDataStd_Name.hxx with 57% similarity]
src/StdLPersistent/StdLPersistent_TreeNode.cxx [moved from src/StdLPersistent/StdLPersistent_PDataStd_Name.cxx with 51% similarity]
src/StdLPersistent/StdLPersistent_TreeNode.hxx [copied from src/StdLPersistent/StdLPersistent_PDataStd_Name.hxx with 56% similarity]
src/StdLPersistent/StdLPersistent_Value.cxx [new file with mode: 0644]
src/StdLPersistent/StdLPersistent_Value.hxx [new file with mode: 0644]
src/StdLPersistent/StdLPersistent_Variable.hxx [copied from src/StdLPersistent/StdLPersistent_PDataStd_Name.hxx with 53% similarity]
src/StdLPersistent/StdLPersistent_Void.hxx [new file with mode: 0644]
src/StdLPersistent/StdLPersistent_XLink.hxx [moved from src/StdLPersistent/StdLPersistent_PDataStd_Name.hxx with 52% similarity]
src/StdObjMgt/FILES
src/StdObjMgt/StdObjMgt_Attribute.hxx [new file with mode: 0644]
src/StdObjMgt/StdObjMgt_ContentTypes.hxx [new file with mode: 0644]
src/StdObjMgt/StdObjMgt_MapOfInstantiators.hxx
src/StdObjMgt/StdObjMgt_Persistent.cxx
src/StdObjMgt/StdObjMgt_Persistent.hxx
src/StdObjMgt/StdObjMgt_ReadData.cxx
src/StdObjMgt/StdObjMgt_ReadData.hxx
src/StdObjMgt/StdObjMgt_SharedObject.hxx [new file with mode: 0644]
src/StdObject/FILES [new file with mode: 0644]
src/StdObject/StdObject_Location.cxx [moved from src/StdLPersistent/StdLPersistent_PColStd_HArray1Base.cxx with 56% similarity]
src/StdObject/StdObject_Location.hxx [copied from src/StdLPersistent/StdLPersistent_PDataStd_Integer.hxx with 61% similarity]
src/StdObject/StdObject_Shape.cxx [moved from src/StdLPersistent/StdLPersistent_PCollection_HExtendedString.cxx with 58% similarity]
src/StdObject/StdObject_Shape.hxx [moved from src/StdLPersistent/StdLPersistent_PCollection_HExtendedString.hxx with 51% similarity]
src/StdObject/StdObject_gp.hxx [new file with mode: 0644]
src/StdPersistent/FILES
src/StdPersistent/StdPersistent.cxx
src/StdPersistent/StdPersistent_DataXtd.cxx [moved from src/StdLPersistent/StdLPersistent_PDataStd_Integer.cxx with 68% similarity]
src/StdPersistent/StdPersistent_DataXtd.hxx [new file with mode: 0644]
src/StdPersistent/StdPersistent_DataXtd_Constraint.cxx [new file with mode: 0644]
src/StdPersistent/StdPersistent_DataXtd_Constraint.hxx [new file with mode: 0644]
src/StdPersistent/StdPersistent_DataXtd_PatternStd.cxx [new file with mode: 0644]
src/StdPersistent/StdPersistent_DataXtd_PatternStd.hxx [new file with mode: 0644]
src/StdPersistent/StdPersistent_HArray1.cxx [copied from src/StdLPersistent/StdLPersistent_PDataStd_Integer.hxx with 55% similarity]
src/StdPersistent/StdPersistent_HArray1.hxx [copied from src/StdLPersistent/StdLPersistent_PDataStd_Integer.hxx with 57% similarity]
src/StdPersistent/StdPersistent_HArray1OfShape1.hxx [moved from src/StdLPersistent/StdLPersistent_PDataStd_Integer.hxx with 55% similarity]
src/StdPersistent/StdPersistent_Naming.cxx [new file with mode: 0644]
src/StdPersistent/StdPersistent_Naming.hxx [new file with mode: 0644]
src/StdPersistent/StdPersistent_PPrsStd.cxx [new file with mode: 0644]
src/StdPersistent/StdPersistent_PPrsStd.hxx [new file with mode: 0644]
src/StdPersistent/StdPersistent_TopLoc.cxx [moved from src/StdLPersistent/StdLPersistent_PDocStd_Document.cxx with 54% similarity]
src/StdPersistent/StdPersistent_TopLoc.hxx [new file with mode: 0644]
src/StdPersistent/StdPersistent_TopoDS.hxx [moved from src/StdLPersistent/StdLPersistent_PColStd_HArray1Base.hxx with 53% similarity]
src/TKShape/CMakeLists.txt [deleted file]
src/TKShape/EXTERNLIB [deleted file]
src/TKShape/FILES [deleted file]
src/TKShape/PACKAGES [deleted file]
src/TKStd/EXTERNLIB
src/TKStd/PACKAGES
src/TKStdL/EXTERNLIB
src/TKStdL/PACKAGES
tests/bugs/caf/buc60756_std [new file with mode: 0644]
tests/bugs/caf/buc60867_std [new file with mode: 0644]
tests/bugs/caf/bug1454_std [new file with mode: 0644]
tests/bugs/caf/bug1726_std [new file with mode: 0644]
tests/bugs/caf/bug22788_1_std [new file with mode: 0644]
tests/bugs/caf/bug22788_2_std [new file with mode: 0644]
tests/bugs/caf/bug23766_2
tests/bugs/caf/bug5023_std [new file with mode: 0644]
tests/bugs/modalg_5/bug24849_1_std [new file with mode: 0644]
tests/bugs/modalg_5/bug24849_2_std [new file with mode: 0644]
tests/bugs/modalg_5/bug25969_std [new file with mode: 0644]
tests/bugs/moddata_3/bug23733_std [new file with mode: 0644]

index a057fde..e2ef484 100644 (file)
@@ -2,6 +2,6 @@ FoundationClasses TKernel TKMath
 ModelingData TKG2d TKG3d TKGeomBase TKBRep
 ModelingAlgorithms TKGeomAlgo TKTopAlgo TKPrim TKBO TKBool TKHLR TKFillet TKOffset TKFeat TKMesh TKXMesh TKShHealing
 Visualization TKService TKV3d TKOpenGl TKMeshVS TKIVtk TKD3DHost
-ApplicationFramework TKCDF TKLCAF TKCAF TKBinL TKXmlL TKBin TKXml TKStdL TKStd TKShape FWOSPlugin TKTObj TKBinTObj TKXmlTObj TKVCAF
+ApplicationFramework TKCDF TKLCAF TKCAF TKBinL TKXmlL TKBin TKXml TKStdL TKStd FWOSPlugin TKTObj TKBinTObj TKXmlTObj TKVCAF
 DataExchange TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES TKXCAF TKXDEIGES TKXDESTEP TKSTL TKVRML TKXmlXCAF TKBinXCAF
 Draw TKDraw TKTopTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw TKIVtkDraw DRAWEXE
index 9e95953..26cf2eb 100644 (file)
@@ -244,9 +244,11 @@ n CDM
 n FWOSDriver
 n PCDM
 n StdLDrivers
+n StdLObject
 n StdLPersistent
 n StdObjMgt
 n StdDrivers
+n StdObject
 n StdPersistent
 n ShapePersistent
 n TDF
@@ -279,7 +281,6 @@ t TKLCAF
 
 t TKStdL
 t TKStd
-t TKShape
 t TKTObj
 t TKXml
 t TKXmlL
index 57ae8ea..40b9820 100644 (file)
@@ -27,7 +27,6 @@ proc ApplicationFramework:toolkits { } {
                 FWOSPlugin \
                 TKStdL \
                 TKStd \
-                TKShape \
                 TKTObj \
                 TKBinTObj \
                 TKXmlTObj \
index 5385b7c..d90ed48 100644 (file)
@@ -1,3 +1,23 @@
-FILES
 ShapePersistent.cxx
 ShapePersistent.hxx
+ShapePersistent_BRep.cxx
+ShapePersistent_BRep.hxx
+ShapePersistent_Geom.cxx
+ShapePersistent_Geom.hxx
+ShapePersistent_Geom_Curve.cxx
+ShapePersistent_Geom_Curve.hxx
+ShapePersistent_Geom_Surface.cxx
+ShapePersistent_Geom_Surface.hxx
+ShapePersistent_Geom2d.hxx
+ShapePersistent_Geom2d_Curve.cxx
+ShapePersistent_Geom2d_Curve.hxx
+ShapePersistent_HArray1.cxx
+ShapePersistent_HArray1.hxx
+ShapePersistent_HArray2.cxx
+ShapePersistent_HArray2.hxx
+ShapePersistent_HSequence.cxx
+ShapePersistent_HSequence.hxx
+ShapePersistent_Poly.cxx
+ShapePersistent_Poly.hxx
+ShapePersistent_TopoDS.cxx
+ShapePersistent_TopoDS.hxx
index 7670fa9..ec9db1e 100644 (file)
 #include <ShapePersistent.hxx>
 #include <StdObjMgt_MapOfInstantiators.hxx>
 
+#include <StdLPersistent_HArray1.hxx>
+#include <StdPersistent_TopoDS.hxx>
+#include <ShapePersistent_TopoDS.hxx>
+#include <ShapePersistent_HArray1.hxx>
+#include <ShapePersistent_HArray2.hxx>
+#include <ShapePersistent_HSequence.hxx>
+#include <ShapePersistent_Geom2d.hxx>
+#include <ShapePersistent_Geom2d_Curve.hxx>
+#include <ShapePersistent_Geom.hxx>
+#include <ShapePersistent_Geom_Curve.hxx>
+#include <ShapePersistent_Geom_Surface.hxx>
+#include <ShapePersistent_Poly.hxx>
+#include <ShapePersistent_BRep.hxx>
+
+
 //=======================================================================
 //function : BindTypes
 //purpose  : Register types
 //=======================================================================
-void ShapePersistent::BindTypes (StdObjMgt_MapOfInstantiators& /*theMap*/)
+void ShapePersistent::BindTypes (StdObjMgt_MapOfInstantiators& theMap)
 {
+  theMap.Bind <StdLPersistent_HArray1::Persistent> ("PTopoDS_HArray1OfHShape");
+
+  theMap.Bind <ShapePersistent_TopoDS::Shape>       ("PTopoDS_HShape");
+  theMap.Bind <ShapePersistent_TopoDS::Shape>       ("PTopoDS_Vertex");
+  theMap.Bind <ShapePersistent_TopoDS::Shape>       ("PTopoDS_Edge");
+  theMap.Bind <ShapePersistent_TopoDS::Shape>       ("PTopoDS_Wire");
+  theMap.Bind <ShapePersistent_TopoDS::Shape>       ("PTopoDS_Face");
+  theMap.Bind <ShapePersistent_TopoDS::Shape>       ("PTopoDS_Shell");
+  theMap.Bind <ShapePersistent_TopoDS::Shape>       ("PTopoDS_Solid");
+  theMap.Bind <ShapePersistent_TopoDS::Shape>       ("PTopoDS_CompSolid");
+  theMap.Bind <ShapePersistent_TopoDS::Shape>       ("PTopoDS_Compound");
+
+  theMap.Bind <StdPersistent_TopoDS::TShape>        ("PTopoDS_TShape");
+
+  theMap.Bind <StdPersistent_TopoDS::TShape>        ("PTopoDS_TVertex");
+  theMap.Bind <StdPersistent_TopoDS::TShape>        ("PTopoDS_TVertex1");
+  theMap.Bind <StdPersistent_TopoDS::TShape>        ("PTopoDS_TEdge");
+  theMap.Bind <StdPersistent_TopoDS::TShape>        ("PTopoDS_TEdge1");
+  theMap.Bind <StdPersistent_TopoDS::TShape>        ("PTopoDS_TFace");
+  theMap.Bind <StdPersistent_TopoDS::TShape>        ("PTopoDS_TFace1");
+
+  theMap.Bind <ShapePersistent_TopoDS::TWire>       ("PTopoDS_TWire");
+  theMap.Bind <ShapePersistent_TopoDS::TWire1>      ("PTopoDS_TWire1");
+  theMap.Bind <ShapePersistent_TopoDS::TShell>      ("PTopoDS_TShell");
+  theMap.Bind <ShapePersistent_TopoDS::TShell1>     ("PTopoDS_TShell1");
+  theMap.Bind <ShapePersistent_TopoDS::TSolid>      ("PTopoDS_TSolid");
+  theMap.Bind <ShapePersistent_TopoDS::TSolid1>     ("PTopoDS_TSolid1");
+  theMap.Bind <ShapePersistent_TopoDS::TCompSolid>  ("PTopoDS_TCompSolid");
+  theMap.Bind <ShapePersistent_TopoDS::TCompSolid1> ("PTopoDS_TCompSolid1");
+  theMap.Bind <ShapePersistent_TopoDS::TCompound>   ("PTopoDS_TCompound");
+  theMap.Bind <ShapePersistent_TopoDS::TCompound1>  ("PTopoDS_TCompound1");
+
+  theMap.Bind <ShapePersistent_HArray1::XYZ>        ("PColgp_HArray1OfXYZ");
+  theMap.Bind <ShapePersistent_HArray1::Pnt>        ("PColgp_HArray1OfPnt");
+  theMap.Bind <ShapePersistent_HArray1::Dir>        ("PColgp_HArray1OfDir");
+  theMap.Bind <ShapePersistent_HArray1::Vec>        ("PColgp_HArray1OfVec");
+  theMap.Bind <ShapePersistent_HArray1::XY>         ("PColgp_HArray1OfXY");
+  theMap.Bind <ShapePersistent_HArray1::Pnt2d>      ("PColgp_HArray1OfPnt2d");
+  theMap.Bind <ShapePersistent_HArray1::Dir2d>      ("PColgp_HArray1OfDir2d");
+  theMap.Bind <ShapePersistent_HArray1::Vec2d>      ("PColgp_HArray1OfVec2d");
+  theMap.Bind <ShapePersistent_HArray1::Lin2d>      ("PColgp_HArray1OfLin2d");
+  theMap.Bind <ShapePersistent_HArray1::Circ2d>     ("PColgp_HArray1OfCirc2d");
+  theMap.Bind <ShapePersistent_HArray1::Triangle>   ("PPoly_HArray1OfTriangle");
+
+  theMap.Bind <ShapePersistent_HArray2::XYZ>        ("PColgp_HArray2OfXYZ");
+  theMap.Bind <ShapePersistent_HArray2::Pnt>        ("PColgp_HArray2OfPnt");
+  theMap.Bind <ShapePersistent_HArray2::Dir>        ("PColgp_HArray2OfDir");
+  theMap.Bind <ShapePersistent_HArray2::Vec>        ("PColgp_HArray2OfVec");
+  theMap.Bind <ShapePersistent_HArray2::XY>         ("PColgp_HArray2OfXY");
+  theMap.Bind <ShapePersistent_HArray2::Pnt2d>      ("PColgp_HArray2OfPnt2d");
+  theMap.Bind <ShapePersistent_HArray2::Dir2d>      ("PColgp_HArray2OfDir2d");
+  theMap.Bind <ShapePersistent_HArray2::Vec2d>      ("PColgp_HArray2OfVec2d");
+  theMap.Bind <ShapePersistent_HArray2::Lin2d>      ("PColgp_HArray2OfLin2d");
+  theMap.Bind <ShapePersistent_HArray2::Circ2d>     ("PColgp_HArray2OfCirc2d");
+
+  theMap.Bind <ShapePersistent_HSequence::XYZ>      ("PColgp_HSequenceOfXYZ");
+  theMap.Bind <ShapePersistent_HSequence::Pnt>      ("PColgp_HSequenceOfPnt");
+  theMap.Bind <ShapePersistent_HSequence::Dir>      ("PColgp_HSequenceOfDir");
+  theMap.Bind <ShapePersistent_HSequence::Vec>      ("PColgp_HSequenceOfVec");
+
+  theMap.Bind <ShapePersistent_HSequence::XYZ::Node>
+    ("PColgp_SeqNodeOfHSequenceOfXYZ");
+
+  theMap.Bind <ShapePersistent_HSequence::Pnt::Node>
+    ("PColgp_SeqNodeOfHSequenceOfPnt");
+
+  theMap.Bind <ShapePersistent_HSequence::Dir::Node>
+    ("PColgp_SeqNodeOfHSequenceOfDir");
+
+  theMap.Bind <ShapePersistent_HSequence::Vec::Node>
+    ("PColgp_SeqNodeOfHSequenceOfVec");
+
+  theMap.Bind <ShapePersistent_Geom2d::Transformation>
+    ("PGeom2d_Transformation");
+
+  theMap.Bind <ShapePersistent_Geom2d::Geometry>
+    ("PGeom2d_Geometry");
+
+  theMap.Bind <ShapePersistent_Geom2d::Point>
+    ("PGeom2d_Point");
+
+  theMap.Bind <ShapePersistent_Geom2d::CartesianPoint>
+    ("PGeom2d_CartesianPoint");
+
+  theMap.Bind <ShapePersistent_Geom2d::Vector>
+    ("PGeom2d_Vector");
+
+  theMap.Bind <ShapePersistent_Geom2d::Direction>
+    ("PGeom2d_Direction");
+
+  theMap.Bind <ShapePersistent_Geom2d::VectorWithMagnitude>
+    ("PGeom2d_VectorWithMagnitude");
+
+  theMap.Bind <ShapePersistent_Geom2d::AxisPlacement>
+    ("PGeom2d_AxisPlacement");
+
+  theMap.Bind <ShapePersistent_Geom2d::Curve>
+    ("PGeom2d_Curve");
+
+  theMap.Bind <ShapePersistent_Geom2d_Curve::Line>
+    ("PGeom2d_Line");
+
+  theMap.Bind <ShapePersistent_Geom2d_Curve::Conic>
+    ("PGeom2d_Conic");
+
+  theMap.Bind <ShapePersistent_Geom2d_Curve::Circle>
+    ("PGeom2d_Circle");
+
+  theMap.Bind <ShapePersistent_Geom2d_Curve::Ellipse>
+    ("PGeom2d_Ellipse");
+
+  theMap.Bind <ShapePersistent_Geom2d_Curve::Hyperbola>
+    ("PGeom2d_Hyperbola");
+
+  theMap.Bind <ShapePersistent_Geom2d_Curve::Parabola>
+    ("PGeom2d_Parabola");
+
+  theMap.Bind <ShapePersistent_Geom2d_Curve::Bounded>
+    ("PGeom2d_BoundedCurve");
+
+  theMap.Bind <ShapePersistent_Geom2d_Curve::Bezier>
+    ("PGeom2d_BezierCurve");
+
+  theMap.Bind <ShapePersistent_Geom2d_Curve::BSpline>
+    ("PGeom2d_BSplineCurve");
+
+  theMap.Bind <ShapePersistent_Geom2d_Curve::Trimmed>
+    ("PGeom2d_TrimmedCurve");
+
+  theMap.Bind <ShapePersistent_Geom2d_Curve::Offset>
+    ("PGeom2d_OffsetCurve");
+
+  theMap.Bind <ShapePersistent_Geom::Transformation>
+    ("PGeom_Transformation");
+
+  theMap.Bind <ShapePersistent_Geom::Geometry>
+    ("PGeom_Geometry");
+
+  theMap.Bind <ShapePersistent_Geom::Point>
+    ("PGeom_Point");
+
+  theMap.Bind <ShapePersistent_Geom::CartesianPoint>
+    ("PGeom_CartesianPoint");
+
+  theMap.Bind <ShapePersistent_Geom::Vector>
+    ("PGeom_Vector");
+
+  theMap.Bind <ShapePersistent_Geom::Direction>
+    ("PGeom_Direction");
+
+  theMap.Bind <ShapePersistent_Geom::VectorWithMagnitude>
+    ("PGeom_VectorWithMagnitude");
+
+  theMap.Bind <ShapePersistent_Geom::AxisPlacement>
+    ("PGeom_AxisPlacement");
+
+  theMap.Bind <ShapePersistent_Geom::Axis1Placement>
+    ("PGeom_Axis1Placement");
+
+  theMap.Bind <ShapePersistent_Geom::Axis2Placement>
+    ("PGeom_Axis2Placement");
+
+  theMap.Bind <ShapePersistent_Geom::Curve>
+    ("PGeom_Curve");
+
+  theMap.Bind <ShapePersistent_Geom_Curve::Line>
+    ("PGeom_Line");
+
+  theMap.Bind <ShapePersistent_Geom_Curve::Conic>
+    ("PGeom_Conic");
+
+  theMap.Bind <ShapePersistent_Geom_Curve::Circle>
+    ("PGeom_Circle");
+
+  theMap.Bind <ShapePersistent_Geom_Curve::Ellipse>
+    ("PGeom_Ellipse");
+
+  theMap.Bind <ShapePersistent_Geom_Curve::Hyperbola>
+    ("PGeom_Hyperbola");
+
+  theMap.Bind <ShapePersistent_Geom_Curve::Parabola>
+    ("PGeom_Parabola");
+
+  theMap.Bind <ShapePersistent_Geom_Curve::Bounded>
+    ("PGeom_BoundedCurve");
+
+  theMap.Bind <ShapePersistent_Geom_Curve::Bezier>
+    ("PGeom_BezierCurve");
+
+  theMap.Bind <ShapePersistent_Geom_Curve::BSpline>
+    ("PGeom_BSplineCurve");
+
+  theMap.Bind <ShapePersistent_Geom_Curve::Trimmed>
+    ("PGeom_TrimmedCurve");
+
+  theMap.Bind <ShapePersistent_Geom_Curve::Offset>
+    ("PGeom_OffsetCurve");
+
+  theMap.Bind <ShapePersistent_Geom::Surface>
+    ("PGeom_Surface");
+
+  theMap.Bind <ShapePersistent_Geom_Surface::Elementary>
+    ("PGeom_ElementarySurface");
+
+  theMap.Bind <ShapePersistent_Geom_Surface::Plane>
+    ("PGeom_Plane");
+
+  theMap.Bind <ShapePersistent_Geom_Surface::Conical>
+    ("PGeom_ConicalSurface");
+
+  theMap.Bind <ShapePersistent_Geom_Surface::Cylindrical>
+    ("PGeom_CylindricalSurface");
+
+  theMap.Bind <ShapePersistent_Geom_Surface::Spherical>
+    ("PGeom_SphericalSurface");
+
+  theMap.Bind <ShapePersistent_Geom_Surface::Toroidal>
+    ("PGeom_ToroidalSurface");
+
+  theMap.Bind <ShapePersistent_Geom_Surface::Swept>
+    ("PGeom_SweptSurface");
+
+  theMap.Bind <ShapePersistent_Geom_Surface::LinearExtrusion>
+    ("PGeom_SurfaceOfLinearExtrusion");
+
+  theMap.Bind <ShapePersistent_Geom_Surface::Revolution>
+    ("PGeom_SurfaceOfRevolution");
+
+  theMap.Bind <ShapePersistent_Geom_Surface::Bounded>
+    ("PGeom_BoundedSurface");
+
+  theMap.Bind <ShapePersistent_Geom_Surface::Bezier>
+    ("PGeom_BezierSurface");
+
+  theMap.Bind <ShapePersistent_Geom_Surface::BSpline>
+    ("PGeom_BSplineSurface");
+
+  theMap.Bind <ShapePersistent_Geom_Surface::RectangularTrimmed>
+    ("PGeom_RectangularTrimmedSurface");
+
+  theMap.Bind <ShapePersistent_Geom_Surface::Offset>
+    ("PGeom_OffsetSurface");
+
+  theMap.Bind <ShapePersistent_Poly::Polygon2D>
+    ("PPoly_Polygon2D");
+
+  theMap.Bind <ShapePersistent_Poly::Polygon3D>
+    ("PPoly_Polygon3D");
+
+  theMap.Bind <ShapePersistent_Poly::PolygonOnTriangulation>
+    ("PPoly_PolygonOnTriangulation");
+
+  theMap.Bind <ShapePersistent_Poly::Triangulation>
+    ("PPoly_Triangulation");
+
+  theMap.Bind <ShapePersistent_BRep::PointRepresentation>
+    ("PBRep_PointRepresentation");
+
+  theMap.Bind <ShapePersistent_BRep::PointOnCurve>
+    ("PBRep_PointOnCurve");
+
+  theMap.Bind <ShapePersistent_BRep::PointsOnSurface>
+    ("PBRep_PointsOnSurface");
+
+  theMap.Bind <ShapePersistent_BRep::PointOnCurveOnSurface>
+    ("PBRep_PointOnCurveOnSurface");
+
+  theMap.Bind <ShapePersistent_BRep::PointOnSurface>
+    ("PBRep_PointOnSurface");
+
+  theMap.Bind <ShapePersistent_BRep::CurveRepresentation>
+    ("PBRep_CurveRepresentation");
+
+  theMap.Bind <ShapePersistent_BRep::GCurve>
+    ("PBRep_GCurve");
+
+  theMap.Bind <ShapePersistent_BRep::Curve3D>
+    ("PBRep_Curve3D");
+
+  theMap.Bind <ShapePersistent_BRep::CurveOnSurface>
+    ("PBRep_CurveOnSurface");
+
+  theMap.Bind <ShapePersistent_BRep::CurveOnClosedSurface>
+    ("PBRep_CurveOnClosedSurface");
+
+  theMap.Bind <ShapePersistent_BRep::Polygon3D>
+    ("PBRep_Polygon3D");
+
+  theMap.Bind <ShapePersistent_BRep::PolygonOnTriangulation>
+    ("PBRep_PolygonOnTriangulation");
+
+  theMap.Bind <ShapePersistent_BRep::PolygonOnClosedTriangulation>
+    ("PBRep_PolygonOnClosedTriangulation");
+
+  theMap.Bind <ShapePersistent_BRep::PolygonOnSurface>
+    ("PBRep_PolygonOnSurface");
+
+  theMap.Bind <ShapePersistent_BRep::PolygonOnClosedSurface>
+    ("PBRep_PolygonOnClosedSurface");
+
+  theMap.Bind <ShapePersistent_BRep::CurveOn2Surfaces>
+    ("PBRep_CurveOn2Surfaces");
+
+  theMap.Bind <ShapePersistent_BRep::TVertex>  ("PBRep_TVertex");
+  theMap.Bind <ShapePersistent_BRep::TVertex1> ("PBRep_TVertex1");
+  theMap.Bind <ShapePersistent_BRep::TEdge>    ("PBRep_TEdge");
+  theMap.Bind <ShapePersistent_BRep::TEdge1>   ("PBRep_TEdge1");
+  theMap.Bind <ShapePersistent_BRep::TFace>    ("PBRep_TFace");
+  theMap.Bind <ShapePersistent_BRep::TFace1>   ("PBRep_TFace1");
 }
diff --git a/src/ShapePersistent/ShapePersistent_BRep.cxx b/src/ShapePersistent/ShapePersistent_BRep.cxx
new file mode 100644 (file)
index 0000000..cb401ca
--- /dev/null
@@ -0,0 +1,392 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <ShapePersistent_BRep.hxx>
+
+#include <BRep_PointOnCurve.hxx>
+#include <BRep_PointOnCurveOnSurface.hxx>
+#include <BRep_PointOnSurface.hxx>
+#include <BRep_Curve3D.hxx>
+#include <BRep_CurveOnSurface.hxx>
+#include <BRep_CurveOnClosedSurface.hxx>
+#include <BRep_Polygon3D.hxx>
+#include <BRep_PolygonOnTriangulation.hxx>
+#include <BRep_PolygonOnClosedTriangulation.hxx>
+#include <BRep_PolygonOnSurface.hxx>
+#include <BRep_PolygonOnClosedSurface.hxx>
+#include <BRep_CurveOn2Surfaces.hxx>
+
+#include <BRep_TVertex.hxx>
+#include <BRep_TEdge.hxx>
+#include <BRep_TFace.hxx>
+
+
+enum
+{
+  ParameterMask   = 1,
+  RangeMask       = 2,
+  DegeneratedMask = 4
+};
+
+
+//=======================================================================
+//function : Read
+//purpose  : Read persistent data from a file
+//=======================================================================
+void ShapePersistent_BRep::PointRepresentation::Read
+  (StdObjMgt_ReadData& theReadData)
+    { theReadData >> myLocation >> myParameter >> myNext; }
+
+//=======================================================================
+//function : Import
+//purpose  : Import transient object from the persistent data
+//=======================================================================
+void ShapePersistent_BRep::PointRepresentation::Import
+  (BRep_ListOfPointRepresentation& thePoints) const
+{
+  thePoints.Clear();
+  Handle(PointRepresentation) aPoint = this;
+  for (; aPoint; aPoint = aPoint->myNext)
+    thePoints.Prepend (aPoint->import());
+}
+
+Handle(BRep_PointRepresentation)
+  ShapePersistent_BRep::PointRepresentation::import() const
+    { return NULL; }
+
+void ShapePersistent_BRep::PointOnCurve::Read
+  (StdObjMgt_ReadData& theReadData)
+{
+  PointRepresentation::Read (theReadData);
+  theReadData >> myCurve;
+}
+
+Handle(BRep_PointRepresentation)
+  ShapePersistent_BRep::PointOnCurve::import() const
+{
+  if (myCurve.IsNull())
+    return NULL;
+
+  return new BRep_PointOnCurve
+    (myParameter, myCurve->Import(), myLocation.Import());
+}
+
+void ShapePersistent_BRep::PointsOnSurface::Read
+  (StdObjMgt_ReadData& theReadData)
+{
+  PointRepresentation::Read (theReadData);
+  theReadData >> mySurface;
+}
+
+void ShapePersistent_BRep::PointOnCurveOnSurface::Read
+  (StdObjMgt_ReadData& theReadData)
+{
+  PointsOnSurface::Read (theReadData);
+  theReadData >> myPCurve;
+}
+
+Handle(BRep_PointRepresentation)
+  ShapePersistent_BRep::PointOnCurveOnSurface::import() const
+{
+  if (mySurface.IsNull() || myPCurve.IsNull())
+    return NULL;
+
+  return new BRep_PointOnCurveOnSurface
+    (myParameter, myPCurve->Import(), mySurface->Import(), myLocation.Import());
+}
+
+void ShapePersistent_BRep::PointOnSurface::Read
+  (StdObjMgt_ReadData& theReadData)
+{
+  PointsOnSurface::Read (theReadData);
+  theReadData >> myParameter2;
+}
+
+Handle(BRep_PointRepresentation)
+  ShapePersistent_BRep::PointOnSurface::import() const
+{
+  if (mySurface.IsNull())
+    return NULL;
+
+  return new BRep_PointOnSurface
+    (myParameter, myParameter2, mySurface->Import(), myLocation.Import());
+}
+
+//=======================================================================
+//function : Read
+//purpose  : Read persistent data from a file
+//=======================================================================
+void ShapePersistent_BRep::CurveRepresentation::Read
+  (StdObjMgt_ReadData& theReadData)
+    { theReadData >> myLocation >> myNext; }
+
+//=======================================================================
+//function : Import
+//purpose  : Import transient object from the persistent data
+//=======================================================================
+void ShapePersistent_BRep::CurveRepresentation::Import
+  (BRep_ListOfCurveRepresentation& theCurves) const
+{
+  theCurves.Clear();
+  Handle(CurveRepresentation) aCurve = this;
+  for (; aCurve; aCurve = aCurve->myNext)
+    theCurves.Prepend (aCurve->import());
+}
+
+Handle(BRep_CurveRepresentation)
+  ShapePersistent_BRep::CurveRepresentation::import() const
+    { return NULL; }
+
+void ShapePersistent_BRep::GCurve::Read
+  (StdObjMgt_ReadData& theReadData)
+{
+  CurveRepresentation::Read (theReadData);
+  theReadData >> myFirst >> myLast;
+}
+
+void ShapePersistent_BRep::Curve3D::Read
+  (StdObjMgt_ReadData& theReadData)
+{
+  GCurve::Read (theReadData);
+  theReadData >> myCurve3D;
+}
+
+Handle(BRep_CurveRepresentation)
+  ShapePersistent_BRep::Curve3D::import() const
+{
+  Handle(Geom_Curve) aCurve;
+  if (myCurve3D)
+    aCurve = myCurve3D->Import();
+
+  Handle(BRep_Curve3D) aRepresentation =
+    new BRep_Curve3D (aCurve, myLocation.Import());
+
+  aRepresentation->SetRange (myFirst, myLast);
+  return aRepresentation;
+}
+
+void ShapePersistent_BRep::CurveOnSurface::Read
+  (StdObjMgt_ReadData& theReadData)
+{
+  GCurve::Read (theReadData);
+  theReadData >> myPCurve >> mySurface >> myUV1 >> myUV2;
+}
+
+Handle(BRep_CurveRepresentation)
+  ShapePersistent_BRep::CurveOnSurface::import() const
+{
+  if (myPCurve.IsNull() || mySurface.IsNull())
+    return NULL;
+
+  Handle(BRep_CurveOnSurface) aCurve =
+    new BRep_CurveOnSurface (myPCurve->Import(),
+                             mySurface->Import(),
+                             myLocation.Import());
+
+  aCurve->SetUVPoints (myUV1, myUV2);
+  aCurve->SetRange (myFirst, myLast);
+
+  return aCurve;
+}
+
+void ShapePersistent_BRep::CurveOnClosedSurface::Read
+  (StdObjMgt_ReadData& theReadData)
+{
+  CurveOnSurface::Read (theReadData);
+  theReadData >> myPCurve2 >> myContinuity >> myUV21 >> myUV22;
+}
+
+Handle(BRep_CurveRepresentation)
+  ShapePersistent_BRep::CurveOnClosedSurface::import() const
+{
+  if (myPCurve.IsNull() || mySurface.IsNull() || myPCurve2.IsNull())
+    return NULL;
+
+  Handle(BRep_CurveOnClosedSurface) aCurve =
+    new BRep_CurveOnClosedSurface (myPCurve->Import(),
+                                   myPCurve2->Import(),
+                                   mySurface->Import(),
+                                   myLocation.Import(),
+                                   myContinuity);
+
+  aCurve->SetUVPoints  (myUV1  , myUV2 );
+  aCurve->SetUVPoints2 (myUV21 , myUV22);
+  aCurve->SetRange     (myFirst, myLast);
+
+  return aCurve;
+}
+
+void ShapePersistent_BRep::Polygon3D::Read
+  (StdObjMgt_ReadData& theReadData)
+{
+  CurveRepresentation::Read (theReadData);
+  theReadData >> myPolygon3D;
+}
+
+Handle(BRep_CurveRepresentation)
+  ShapePersistent_BRep::Polygon3D::import() const
+{
+  if (myPolygon3D.IsNull())
+    return NULL;
+
+  return new BRep_Polygon3D (myPolygon3D->Import(), myLocation.Import());
+}
+
+void ShapePersistent_BRep::PolygonOnTriangulation::Read
+  (StdObjMgt_ReadData& theReadData)
+{
+  CurveRepresentation::Read (theReadData);
+  theReadData >> myPolygon >> myTriangulation;
+}
+
+Handle(BRep_CurveRepresentation)
+  ShapePersistent_BRep::PolygonOnTriangulation::import() const
+{
+  if (myPolygon.IsNull() || myTriangulation.IsNull())
+    return NULL;
+
+  return new BRep_PolygonOnTriangulation (myPolygon->Import(),
+                                          myTriangulation->Import(),
+                                          myLocation.Import());
+}
+
+void ShapePersistent_BRep::PolygonOnClosedTriangulation::Read
+  (StdObjMgt_ReadData& theReadData)
+{
+  PolygonOnTriangulation::Read (theReadData);
+  theReadData >> myPolygon2;
+}
+
+Handle(BRep_CurveRepresentation)
+  ShapePersistent_BRep::PolygonOnClosedTriangulation::import() const
+{
+  if (myPolygon.IsNull() || myTriangulation.IsNull() || myPolygon2.IsNull())
+    return NULL;
+
+  return new BRep_PolygonOnClosedTriangulation (myPolygon->Import(),
+                                                myPolygon2->Import(),
+                                                myTriangulation->Import(),
+                                                myLocation.Import());
+}
+
+void ShapePersistent_BRep::PolygonOnSurface::Read
+  (StdObjMgt_ReadData& theReadData)
+{
+  CurveRepresentation::Read (theReadData);
+  theReadData >> myPolygon2D >> mySurface;
+}
+
+Handle(BRep_CurveRepresentation)
+  ShapePersistent_BRep::PolygonOnSurface::import() const
+{
+  if (myPolygon2D.IsNull() || mySurface.IsNull())
+    return NULL;
+
+  return new BRep_PolygonOnSurface (myPolygon2D->Import(),
+                                    mySurface->Import(),
+                                    myLocation.Import());
+}
+
+void ShapePersistent_BRep::PolygonOnClosedSurface::Read
+  (StdObjMgt_ReadData& theReadData)
+{
+  PolygonOnSurface::Read (theReadData);
+  theReadData >> myPolygon2;
+}
+
+Handle(BRep_CurveRepresentation)
+  ShapePersistent_BRep::PolygonOnClosedSurface::import() const
+{
+  if (myPolygon2D.IsNull() || mySurface.IsNull() || myPolygon2.IsNull())
+    return NULL;
+
+  return new BRep_PolygonOnClosedSurface (myPolygon2D->Import(),
+                                          myPolygon2->Import(),
+                                          mySurface->Import(),
+                                          myLocation.Import());
+}
+
+void ShapePersistent_BRep::CurveOn2Surfaces::Read
+  (StdObjMgt_ReadData& theReadData)
+{
+  CurveRepresentation::Read (theReadData);
+  theReadData >> mySurface >> mySurface2 >> myLocation2 >> myContinuity;
+}
+
+Handle(BRep_CurveRepresentation)
+  ShapePersistent_BRep::CurveOn2Surfaces::import() const
+{
+  if (mySurface.IsNull() || mySurface2.IsNull())
+    return NULL;
+
+  return new BRep_CurveOn2Surfaces (mySurface->Import(),
+                                    mySurface2->Import(),
+                                    myLocation.Import(),
+                                    myLocation2.Import(),
+                                    myContinuity);
+}
+
+//=======================================================================
+//function : createTShape
+//purpose  : Create transient TShape object
+//=======================================================================
+Handle(TopoDS_TShape) ShapePersistent_BRep::pTVertex::createTShape() const
+{
+  Handle(BRep_TVertex) aTVertex = new BRep_TVertex;
+
+  aTVertex->Tolerance (myTolerance);
+  aTVertex->Pnt       (myPnt);
+
+  myPoints->Import (aTVertex->ChangePoints());
+
+  return aTVertex;
+}
+
+//=======================================================================
+//function : createTShape
+//purpose  : Create transient TShape object
+//=======================================================================
+Handle(TopoDS_TShape) ShapePersistent_BRep::pTEdge::createTShape() const
+{
+  Handle(BRep_TEdge) aTEdge = new BRep_TEdge;
+
+  aTEdge->Tolerance     (myTolerance);
+  aTEdge->SameParameter (myFlags & ParameterMask);
+  aTEdge->SameRange     (myFlags & RangeMask);
+  aTEdge->Degenerated   (myFlags & DegeneratedMask);
+
+  myCurves->Import (aTEdge->ChangeCurves());
+
+  return aTEdge;
+}
+
+//=======================================================================
+//function : createTShape
+//purpose  : Create transient TShape object
+//=======================================================================
+Handle(TopoDS_TShape) ShapePersistent_BRep::pTFace::createTShape() const
+{
+  Handle(BRep_TFace) aTFace = new BRep_TFace;
+
+  aTFace->NaturalRestriction (myNaturalRestriction);
+  aTFace->Tolerance          (myTolerance);
+  aTFace->Location           (myLocation.Import());
+
+  if (mySurface)
+    aTFace->Surface (mySurface->Import());
+
+  if (myTriangulation)
+    aTFace->Triangulation (myTriangulation->Import());
+
+  return aTFace;
+}
diff --git a/src/ShapePersistent/ShapePersistent_BRep.hxx b/src/ShapePersistent/ShapePersistent_BRep.hxx
new file mode 100644 (file)
index 0000000..6a660ac
--- /dev/null
@@ -0,0 +1,298 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#ifndef _ShapePersistent_BRep_HeaderFile
+#define _ShapePersistent_BRep_HeaderFile
+
+#include <ShapePersistent_TopoDS.hxx>
+#include <ShapePersistent_Geom.hxx>
+#include <ShapePersistent_Geom2d.hxx>
+#include <ShapePersistent_Poly.hxx>
+#include <StdObject_Location.hxx>
+#include <StdObject_gp.hxx>
+
+#include <BRep_ListOfPointRepresentation.hxx>
+#include <BRep_ListOfCurveRepresentation.hxx>
+
+#include <gp_Pnt.hxx>
+#include <gp_Pnt2d.hxx>
+#include <GeomAbs_Shape.hxx>
+
+class BRep_PointRepresentation;
+class BRep_CurveRepresentation;
+
+
+class ShapePersistent_BRep : public ShapePersistent_TopoDS
+{
+public:
+  class PointRepresentation : public StdObjMgt_Persistent
+  {
+  public:
+    //! Read persistent data from a file.
+    Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
+
+    //! Import transient object from the persistent data.
+    Standard_EXPORT void Import (BRep_ListOfPointRepresentation& thePoints)
+      const;
+
+  protected:
+    virtual Handle(BRep_PointRepresentation) import() const;
+
+  protected:
+    Object <StdObject_Location> myLocation;
+    Value  <Standard_Real>      myParameter;
+
+  private:
+    Reference<PointRepresentation> myNext;
+  };
+
+  class PointOnCurve : public PointRepresentation
+  {
+  public:
+    virtual void Read (StdObjMgt_ReadData& theReadData);
+    virtual Handle(BRep_PointRepresentation) import() const;
+
+  private:
+    Reference<ShapePersistent_Geom::Curve> myCurve;
+  };
+
+  class PointsOnSurface : public PointRepresentation
+  {
+  public:
+    virtual void Read (StdObjMgt_ReadData& theReadData);
+
+  protected:
+    Reference<ShapePersistent_Geom::Surface> mySurface;
+  };
+
+  class PointOnCurveOnSurface : public PointsOnSurface
+  {
+  public:
+    virtual void Read (StdObjMgt_ReadData& theReadData);
+    virtual Handle(BRep_PointRepresentation) import() const;
+
+  private:
+    Reference<ShapePersistent_Geom2d::Curve> myPCurve;
+  };
+
+  class PointOnSurface : public PointsOnSurface
+  {
+  public:
+    virtual void Read (StdObjMgt_ReadData& theReadData);
+    virtual Handle(BRep_PointRepresentation) import() const;
+
+  private:
+    Value<Standard_Real> myParameter2;
+  };
+
+  class CurveRepresentation : public StdObjMgt_Persistent
+  {
+  public:
+    //! Read persistent data from a file.
+    Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
+
+    //! Import transient object from the persistent data.
+    Standard_EXPORT void Import (BRep_ListOfCurveRepresentation& theCurves)
+      const;
+
+  protected:
+    virtual Handle(BRep_CurveRepresentation) import() const;
+
+  protected:
+    Object<StdObject_Location> myLocation;
+
+  private:
+    Reference<CurveRepresentation> myNext;
+  };
+
+  class GCurve : public CurveRepresentation
+  {
+  public:
+    virtual void Read (StdObjMgt_ReadData& theReadData);
+
+  protected:
+    Value<Standard_Real> myFirst;
+    Value<Standard_Real> myLast;
+  };
+
+  class Curve3D : public GCurve
+  {
+  public:
+    virtual void Read (StdObjMgt_ReadData& theReadData);
+    virtual Handle(BRep_CurveRepresentation) import() const;
+
+  private:
+    Reference<ShapePersistent_Geom::Curve> myCurve3D;
+  };
+
+  class CurveOnSurface : public GCurve
+  {
+  public:
+    virtual void Read (StdObjMgt_ReadData& theReadData);
+    virtual Handle(BRep_CurveRepresentation) import() const;
+
+  protected:
+    Reference<ShapePersistent_Geom2d::Curve> myPCurve;
+    Reference<ShapePersistent_Geom::Surface> mySurface;
+    StdObject_gp::Object<gp_Pnt2d>           myUV1;
+    StdObject_gp::Object<gp_Pnt2d>           myUV2;
+  };
+
+  class CurveOnClosedSurface : public CurveOnSurface
+  {
+  public:
+    virtual void Read (StdObjMgt_ReadData& theReadData);
+    virtual Handle(BRep_CurveRepresentation) import() const;
+
+  private:
+    Reference<ShapePersistent_Geom2d::Curve> myPCurve2;
+    Enum<GeomAbs_Shape>                      myContinuity;
+    StdObject_gp::Object<gp_Pnt2d>           myUV21;
+    StdObject_gp::Object<gp_Pnt2d>           myUV22;
+  };
+
+  class Polygon3D : public CurveRepresentation
+  {
+  public:
+    virtual void Read (StdObjMgt_ReadData& theReadData);
+    virtual Handle(BRep_CurveRepresentation) import() const;
+
+  private:
+    Reference<ShapePersistent_Poly::Polygon3D> myPolygon3D;
+  };
+
+  class PolygonOnTriangulation : public CurveRepresentation
+  {
+  public:
+    virtual void Read (StdObjMgt_ReadData& theReadData);
+    virtual Handle(BRep_CurveRepresentation) import() const;
+
+  protected:
+    Reference<ShapePersistent_Poly::PolygonOnTriangulation> myPolygon;
+    Reference<ShapePersistent_Poly::Triangulation>          myTriangulation;
+  };
+
+  class PolygonOnClosedTriangulation : public PolygonOnTriangulation
+  {
+  public:
+    virtual void Read (StdObjMgt_ReadData& theReadData);
+    virtual Handle(BRep_CurveRepresentation) import() const;
+
+  private:
+    Reference<ShapePersistent_Poly::PolygonOnTriangulation> myPolygon2;
+  };
+
+  class PolygonOnSurface : public CurveRepresentation
+  {
+  public:
+    virtual void Read (StdObjMgt_ReadData& theReadData);
+    virtual Handle(BRep_CurveRepresentation) import() const;
+
+  protected:
+    Reference<ShapePersistent_Poly::Polygon2D> myPolygon2D;
+    Reference<ShapePersistent_Geom::Surface>   mySurface;
+  };
+
+  class PolygonOnClosedSurface : public PolygonOnSurface
+  {
+  public:
+    virtual void Read (StdObjMgt_ReadData& theReadData);
+    virtual Handle(BRep_CurveRepresentation) import() const;
+
+  private:
+    Reference<ShapePersistent_Poly::Polygon2D> myPolygon2;
+  };
+
+  class CurveOn2Surfaces : public CurveRepresentation
+  {
+  public:
+    virtual void Read (StdObjMgt_ReadData& theReadData);
+    virtual Handle(BRep_CurveRepresentation) import() const;
+
+  private:
+    Reference <ShapePersistent_Geom::Surface> mySurface;
+    Reference <ShapePersistent_Geom::Surface> mySurface2;
+    Object    <StdObject_Location>            myLocation2;
+    Enum      <GeomAbs_Shape>                 myContinuity;
+  };
+
+private:
+  class pTVertex : public pTBase
+  {
+  public:
+    inline void Read (StdObjMgt_ReadData& theReadData)
+    {
+      pTBase::Read (theReadData);
+      theReadData >> myTolerance >> myPnt >> myPoints;
+    }
+
+  private:
+    virtual Handle(TopoDS_TShape) createTShape() const;
+
+  private:
+    Value<Standard_Real>           myTolerance;
+    StdObject_gp::Object<gp_Pnt>   myPnt;
+    Reference<PointRepresentation> myPoints;
+  };
+
+  class pTEdge : public pTBase
+  {
+  public:
+    inline void Read (StdObjMgt_ReadData& theReadData)
+    {
+      pTBase::Read (theReadData);
+      theReadData >> myTolerance >> myFlags >> myCurves;
+    }
+
+  private:
+    virtual Handle(TopoDS_TShape) createTShape() const;
+
+  private:
+    Value     <Standard_Real>       myTolerance;
+    Value     <Standard_Integer>    myFlags;
+    Reference <CurveRepresentation> myCurves;
+  };
+
+  class pTFace : public pTBase
+  {
+  public:
+    inline void Read (StdObjMgt_ReadData& theReadData)
+    {
+      pTBase::Read (theReadData);
+      theReadData >> mySurface >> myTriangulation >> myLocation;
+      theReadData >> myTolerance >> myNaturalRestriction;
+    }
+
+  private:
+    virtual Handle(TopoDS_TShape) createTShape() const;
+
+  private:
+    Reference <ShapePersistent_Geom::Surface>       mySurface;
+    Reference <ShapePersistent_Poly::Triangulation> myTriangulation;
+    Object    <StdObject_Location>                  myLocation;
+    Value     <Standard_Real>                       myTolerance;
+    Value     <Standard_Boolean>                    myNaturalRestriction;
+  };
+
+public:
+  typedef tObject  <pTVertex> TVertex;
+  typedef tObject  <pTEdge>   TEdge;
+  typedef tObject  <pTFace>   TFace;
+
+  typedef tObject1 <pTVertex> TVertex1;
+  typedef tObject1 <pTEdge>   TEdge1;
+  typedef tObject1 <pTFace>   TFace1;
+};
+
+#endif
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include <StdLPersistent_PDataStd_Name.hxx>
-#include <StdLPersistent_PCollection_HExtendedString.hxx>
+#include <ShapePersistent_Geom.hxx>
 
-#include <StdObjMgt_ReadData.hxx>
-
-#include <TCollection_HExtendedString.hxx>
-#include <TDataStd_Name.hxx>
 
 //=======================================================================
 //function : Read
 //purpose  : Read persistent data from a file
 //=======================================================================
-void StdLPersistent_PDataStd_Name::Read (StdObjMgt_ReadData& theReadData)
-{
-  theReadData >> myString;
-}
+void ShapePersistent_Geom::Geometry::Read (StdObjMgt_ReadData&) {}
 
 //=======================================================================
-//function : ImportAttribute
-//purpose  : Import transient attribuite from the persistent data
+//function : Read
+//purpose  : Read persistent data from a file
 //=======================================================================
-Handle(TDF_Attribute) StdLPersistent_PDataStd_Name::ImportAttribute() const
+template<>
+void ShapePersistent_Geom::instance<ShapePersistent_Geom::AxisPlacement,
+                                    Geom_Axis2Placement>
+  ::Read (StdObjMgt_ReadData& theReadData)
 {
-  if (myString.IsNull() || myString->Value().IsNull())
-    return NULL;
+  StdObject_gp::Object<gp_Ax1> anAxis;
+  StdObject_gp::Object<gp_Dir> anXDirection;
+
+  theReadData >> anAxis >> anXDirection;
 
-  Handle(TDataStd_Name) aName = new TDataStd_Name;
-  aName->Set (myString->Value()->String());
-  return aName;
+  myTransient = new Geom_Axis2Placement (anAxis.Location(),
+                                         anAxis.Direction(),
+                                         anXDirection);
 }
diff --git a/src/ShapePersistent/ShapePersistent_Geom.hxx b/src/ShapePersistent/ShapePersistent_Geom.hxx
new file mode 100644 (file)
index 0000000..9da47d7
--- /dev/null
@@ -0,0 +1,101 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#ifndef _ShapePersistent_Geom_HeaderFile
+#define _ShapePersistent_Geom_HeaderFile
+
+#include <StdObjMgt_SharedObject.hxx>
+#include <StdObject_gp.hxx>
+
+#include <Geom_CartesianPoint.hxx>
+#include <Geom_Direction.hxx>
+#include <Geom_VectorWithMagnitude.hxx>
+#include <Geom_Axis1Placement.hxx>
+#include <Geom_Axis2Placement.hxx>
+#include <Geom_Transformation.hxx>
+#include <Geom_Curve.hxx>
+#include <Geom_Surface.hxx>
+
+
+class ShapePersistent_Geom : protected StdObjMgt_SharedObject
+{
+public:
+  class Geometry : public StdObjMgt_Persistent
+  {
+  public:
+    //! Read persistent data from a file.
+    Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
+  };
+
+protected:
+  template <class Transient>
+  struct geometryBase : DelayedBase<Geometry, Transient> {};
+
+  template <class Base, class PData>
+  class subBase : public Base
+  {
+  public:
+    //! Read persistent data from a file.
+    Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData)
+      { PData().Read (theReadData); }
+  };
+
+  template <class Base, class GpData>
+  struct subBase_gp : subBase <Base, StdObject_gp::Object<GpData> > {};
+
+  template <class Base>
+  struct subBase_empty : Base {};
+
+  template <class Base, class Target, class Data = void>
+  class instance : public Base
+  {
+  public:
+    //! Read persistent data from a file.
+    Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData)
+    {
+      StdObject_gp::Object<Data> aData;
+      theReadData >> aData;
+      this->myTransient = new Target (aData);
+    }
+  };
+
+private:
+  typedef geometryBase<Geom_Geometry> basic;
+
+public:
+  typedef subBase_empty<basic>                                 Point;
+  typedef instance<Point, Geom_CartesianPoint, gp_Pnt>         CartesianPoint;
+
+  typedef subBase_gp<basic, gp_Vec>                            Vector;
+  typedef instance<Vector, Geom_Direction          , gp_Dir>   Direction;
+  typedef instance<Vector, Geom_VectorWithMagnitude, gp_Vec>   VectorWithMagnitude;
+
+  typedef subBase_gp<basic, gp_Ax1>                            AxisPlacement;
+  typedef instance<AxisPlacement, Geom_Axis1Placement, gp_Ax1> Axis1Placement;
+  typedef instance<AxisPlacement, Geom_Axis2Placement>         Axis2Placement;
+
+  typedef instance <SharedBase<Geom_Transformation>,
+                    Geom_Transformation,
+                    gp_Trsf>                                   Transformation;
+
+  typedef geometryBase<Geom_Curve>                             Curve;
+  typedef geometryBase<Geom_Surface>                           Surface;
+};
+
+template<>
+void ShapePersistent_Geom::instance<ShapePersistent_Geom::AxisPlacement,
+                                    Geom_Axis2Placement>
+  ::Read (StdObjMgt_ReadData& theReadData);
+
+#endif
diff --git a/src/ShapePersistent/ShapePersistent_Geom2d.hxx b/src/ShapePersistent/ShapePersistent_Geom2d.hxx
new file mode 100644 (file)
index 0000000..cd351ec
--- /dev/null
@@ -0,0 +1,51 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#ifndef _ShapePersistent_Geom2d_HeaderFile
+#define _ShapePersistent_Geom2d_HeaderFile
+
+#include <ShapePersistent_Geom.hxx>
+
+#include <Geom2d_CartesianPoint.hxx>
+#include <Geom2d_Direction.hxx>
+#include <Geom2d_VectorWithMagnitude.hxx>
+#include <Geom2d_AxisPlacement.hxx>
+#include <Geom2d_Transformation.hxx>
+#include <Geom2d_Curve.hxx>
+
+
+class ShapePersistent_Geom2d : protected ShapePersistent_Geom
+{
+  typedef geometryBase<Geom2d_Geometry> basic;
+
+public:
+  typedef ShapePersistent_Geom::Geometry                         Geometry;
+
+  typedef subBase_empty<basic>                                   Point;
+  typedef instance<Point, Geom2d_CartesianPoint, gp_Pnt2d>       CartesianPoint;
+
+  typedef subBase_gp<basic, gp_Vec2d>                            Vector;
+  typedef instance<Vector, Geom2d_Direction          , gp_Dir2d> Direction;
+  typedef instance<Vector, Geom2d_VectorWithMagnitude, gp_Vec2d> VectorWithMagnitude;
+
+  typedef instance<basic, Geom2d_AxisPlacement, gp_Ax2d>         AxisPlacement;
+
+  typedef instance <SharedBase<Geom2d_Transformation>,
+                    Geom2d_Transformation,
+                    gp_Trsf2d>                                   Transformation;
+
+  typedef geometryBase<Geom2d_Curve>                             Curve;
+};
+
+#endif
diff --git a/src/ShapePersistent/ShapePersistent_Geom2d_Curve.cxx b/src/ShapePersistent/ShapePersistent_Geom2d_Curve.cxx
new file mode 100644 (file)
index 0000000..92f9bd0
--- /dev/null
@@ -0,0 +1,76 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <ShapePersistent_Geom2d_Curve.hxx>
+
+#include <Geom2d_BezierCurve.hxx>
+#include <Geom2d_BSplineCurve.hxx>
+#include <Geom2d_TrimmedCurve.hxx>
+#include <Geom2d_OffsetCurve.hxx>
+
+
+Handle(Geom2d_Curve) ShapePersistent_Geom2d_Curve::pBezier::Import() const
+{
+  if (myPoles.IsNull())
+    return NULL;
+
+  if (myRational)
+  {
+    if (myWeights.IsNull())
+      return NULL;
+    return new Geom2d_BezierCurve (*myPoles->Array(), *myWeights->Array());
+  }
+  else
+    return new Geom2d_BezierCurve (*myPoles->Array());
+}
+
+Handle(Geom2d_Curve) ShapePersistent_Geom2d_Curve::pBSpline::Import() const
+{
+  if (myPoles.IsNull() || myKnots.IsNull() || myMultiplicities.IsNull())
+    return NULL;
+
+  if (myRational)
+  {
+    if (myWeights.IsNull())
+      return NULL;
+
+    return new Geom2d_BSplineCurve (*myPoles->Array(),
+                                    *myWeights->Array(),
+                                    *myKnots->Array(),
+                                    *myMultiplicities->Array(),
+                                    mySpineDegree,
+                                    myPeriodic);
+  }
+  else
+    return new Geom2d_BSplineCurve (*myPoles->Array(),
+                                    *myKnots->Array(),
+                                    *myMultiplicities->Array(),
+                                    mySpineDegree,
+                                    myPeriodic);
+}
+
+Handle(Geom2d_Curve) ShapePersistent_Geom2d_Curve::pTrimmed::Import() const
+{
+  if (myBasisCurve.IsNull())
+    return NULL;
+
+  return new Geom2d_TrimmedCurve (myBasisCurve->Import(), myFirstU, myLastU);
+}
+
+Handle(Geom2d_Curve) ShapePersistent_Geom2d_Curve::pOffset::Import() const
+{
+  if (myBasisCurve.IsNull())
+    return NULL;
+
+  return new Geom2d_OffsetCurve (myBasisCurve->Import(), myOffsetValue);
+}
diff --git a/src/ShapePersistent/ShapePersistent_Geom2d_Curve.hxx b/src/ShapePersistent/ShapePersistent_Geom2d_Curve.hxx
new file mode 100644 (file)
index 0000000..da39ac3
--- /dev/null
@@ -0,0 +1,119 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#ifndef _ShapePersistent_Geom2d_Curve_HeaderFile
+#define _ShapePersistent_Geom2d_Curve_HeaderFile
+
+#include <ShapePersistent_Geom2d.hxx>
+#include <ShapePersistent_HArray1.hxx>
+#include <StdLPersistent_HArray1.hxx>
+
+#include <Geom2d_Line.hxx>
+#include <Geom2d_Circle.hxx>
+#include <Geom2d_Ellipse.hxx>
+#include <Geom2d_Hyperbola.hxx>
+#include <Geom2d_Parabola.hxx>
+
+#include <gp_Circ2d.hxx>
+#include <gp_Elips2d.hxx>
+#include <gp_Hypr2d.hxx>
+#include <gp_Parab2d.hxx>
+
+
+class ShapePersistent_Geom2d_Curve : protected ShapePersistent_Geom2d
+{
+  typedef Curve::PersistentBase pBase;
+
+  typedef pBase pBounded;
+
+  class pBezier : public pBounded
+  {
+  public:
+    inline void Read (StdObjMgt_ReadData& theReadData)
+      { theReadData >> myRational >> myPoles >> myWeights; }
+
+    virtual Handle(Geom2d_Curve) Import() const;
+
+  private:
+    Value     <Standard_Boolean>               myRational;
+    Reference <ShapePersistent_HArray1::Pnt2d> myPoles;
+    Reference <StdLPersistent_HArray1::Real>   myWeights;
+  };
+
+  class pBSpline : public pBounded
+  {
+  public:
+    inline void Read (StdObjMgt_ReadData& theReadData)
+    {
+      theReadData >> myRational >> myPeriodic >> mySpineDegree;
+      theReadData >> myPoles >> myWeights >> myKnots >> myMultiplicities;
+    }
+
+    virtual Handle(Geom2d_Curve) Import() const;
+
+  private:
+    Value     <Standard_Boolean>                myRational;
+    Value     <Standard_Boolean>                myPeriodic;
+    Value     <Standard_Integer>                mySpineDegree;
+    Reference <ShapePersistent_HArray1::Pnt2d>  myPoles;
+    Reference <StdLPersistent_HArray1::Real>    myWeights;
+    Reference <StdLPersistent_HArray1::Real>    myKnots;
+    Reference <StdLPersistent_HArray1::Integer> myMultiplicities;
+  };
+
+  class pTrimmed : public pBounded
+  {
+  public:
+    inline void Read (StdObjMgt_ReadData& theReadData)
+      { theReadData >> myBasisCurve >> myFirstU >> myLastU; }
+
+    virtual Handle(Geom2d_Curve) Import() const;
+
+  private:
+    Reference<Curve>     myBasisCurve;
+    Value<Standard_Real> myFirstU;
+    Value<Standard_Real> myLastU;
+  };
+
+  class pOffset : public pBase
+  {
+  public:
+    inline void Read (StdObjMgt_ReadData& theReadData)
+      { theReadData >> myBasisCurve >> myOffsetValue; }
+
+    virtual Handle(Geom2d_Curve) Import() const;
+
+  private:
+    Reference<Curve>             myBasisCurve;
+    Value<Standard_Real>         myOffsetValue;
+  };
+
+public:
+  typedef instance<Curve, Geom2d_Line, gp_Ax2d>         Line;
+
+  typedef subBase_gp<Curve, gp_Ax22d>                   Conic;
+  typedef instance<Conic, Geom2d_Circle   , gp_Circ2d > Circle;
+  typedef instance<Conic, Geom2d_Ellipse  , gp_Elips2d> Ellipse;
+  typedef instance<Conic, Geom2d_Hyperbola, gp_Hypr2d > Hyperbola;
+  typedef instance<Conic, Geom2d_Parabola , gp_Parab2d> Parabola;
+
+  typedef subBase_empty<Curve>                          Bounded;
+  typedef Delayed<Bounded, pBezier>                     Bezier;
+  typedef Delayed<Bounded, pBSpline>                    BSpline;
+  typedef Delayed<Bounded, pTrimmed>                    Trimmed;
+
+  typedef Delayed<Curve, pOffset>                       Offset;
+};
+
+#endif
diff --git a/src/ShapePersistent/ShapePersistent_Geom_Curve.cxx b/src/ShapePersistent/ShapePersistent_Geom_Curve.cxx
new file mode 100644 (file)
index 0000000..11b667d
--- /dev/null
@@ -0,0 +1,77 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <ShapePersistent_Geom_Curve.hxx>
+
+#include <Geom_BezierCurve.hxx>
+#include <Geom_BSplineCurve.hxx>
+#include <Geom_TrimmedCurve.hxx>
+#include <Geom_OffsetCurve.hxx>
+
+
+Handle(Geom_Curve) ShapePersistent_Geom_Curve::pBezier::Import() const
+{
+  if (myPoles.IsNull())
+    return NULL;
+
+  if (myRational)
+  {
+    if (myWeights.IsNull())
+      return NULL;
+    return new Geom_BezierCurve (*myPoles->Array(), *myWeights->Array());
+  }
+  else
+    return new Geom_BezierCurve (*myPoles->Array());
+}
+
+Handle(Geom_Curve) ShapePersistent_Geom_Curve::pBSpline::Import() const
+{
+  if (myPoles.IsNull() || myKnots.IsNull() || myMultiplicities.IsNull())
+    return NULL;
+
+  if (myRational)
+  {
+    if (myWeights.IsNull())
+      return NULL;
+
+    return new Geom_BSplineCurve (*myPoles->Array(),
+                                  *myWeights->Array(),
+                                  *myKnots->Array(),
+                                  *myMultiplicities->Array(),
+                                  mySpineDegree,
+                                  myPeriodic);
+  }
+  else
+    return new Geom_BSplineCurve (*myPoles->Array(),
+                                  *myKnots->Array(),
+                                  *myMultiplicities->Array(),
+                                  mySpineDegree,
+                                  myPeriodic);
+}
+
+Handle(Geom_Curve) ShapePersistent_Geom_Curve::pTrimmed::Import() const
+{
+  if (myBasisCurve.IsNull())
+    return NULL;
+
+  return new Geom_TrimmedCurve (myBasisCurve->Import(), myFirstU, myLastU);
+}
+
+Handle(Geom_Curve) ShapePersistent_Geom_Curve::pOffset::Import() const
+{
+  if (myBasisCurve.IsNull())
+    return NULL;
+
+  return new Geom_OffsetCurve
+    (myBasisCurve->Import(), myOffsetValue, myOffsetDirection);
+}
diff --git a/src/ShapePersistent/ShapePersistent_Geom_Curve.hxx b/src/ShapePersistent/ShapePersistent_Geom_Curve.hxx
new file mode 100644 (file)
index 0000000..7ba8b41
--- /dev/null
@@ -0,0 +1,122 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#ifndef _ShapePersistent_Geom_Curve_HeaderFile
+#define _ShapePersistent_Geom_Curve_HeaderFile
+
+#include <ShapePersistent_Geom.hxx>
+#include <ShapePersistent_HArray1.hxx>
+#include <StdLPersistent_HArray1.hxx>
+
+#include <Geom_Line.hxx>
+#include <Geom_Circle.hxx>
+#include <Geom_Ellipse.hxx>
+#include <Geom_Hyperbola.hxx>
+#include <Geom_Parabola.hxx>
+
+#include <gp_Circ.hxx>
+#include <gp_Elips.hxx>
+#include <gp_Hypr.hxx>
+#include <gp_Parab.hxx>
+
+class gp_Dir;
+
+
+class ShapePersistent_Geom_Curve : private ShapePersistent_Geom
+{
+  typedef Curve::PersistentBase pBase;
+
+  typedef pBase pBounded;
+
+  class pBezier : public pBounded
+  {
+  public:
+    inline void Read (StdObjMgt_ReadData& theReadData)
+      { theReadData >> myRational >> myPoles >> myWeights; }
+
+    virtual Handle(Geom_Curve) Import() const;
+
+  private:
+    Value     <Standard_Boolean>             myRational;
+    Reference <ShapePersistent_HArray1::Pnt> myPoles;
+    Reference <StdLPersistent_HArray1::Real> myWeights;
+  };
+
+  class pBSpline : public pBounded
+  {
+  public:
+    inline void Read (StdObjMgt_ReadData& theReadData)
+    {
+      theReadData >> myRational >> myPeriodic >> mySpineDegree;
+      theReadData >> myPoles >> myWeights >> myKnots >> myMultiplicities;
+    }
+
+    virtual Handle(Geom_Curve) Import() const;
+
+  private:
+    Value     <Standard_Boolean>                myRational;
+    Value     <Standard_Boolean>                myPeriodic;
+    Value     <Standard_Integer>                mySpineDegree;
+    Reference <ShapePersistent_HArray1::Pnt>    myPoles;
+    Reference <StdLPersistent_HArray1::Real>    myWeights;
+    Reference <StdLPersistent_HArray1::Real>    myKnots;
+    Reference <StdLPersistent_HArray1::Integer> myMultiplicities;
+  };
+
+  class pTrimmed : public pBounded
+  {
+  public:
+    inline void Read (StdObjMgt_ReadData& theReadData)
+      { theReadData >> myBasisCurve >> myFirstU >> myLastU; }
+
+    virtual Handle(Geom_Curve) Import() const;
+
+  private:
+    Reference<Curve>     myBasisCurve;
+    Value<Standard_Real> myFirstU;
+    Value<Standard_Real> myLastU;
+  };
+
+  class pOffset : public pBase
+  {
+  public:
+    inline void Read (StdObjMgt_ReadData& theReadData)
+      { theReadData >> myBasisCurve >> myOffsetDirection >> myOffsetValue; }
+
+    virtual Handle(Geom_Curve) Import() const;
+
+  private:
+    Reference<Curve>             myBasisCurve;
+    StdObject_gp::Object<gp_Dir> myOffsetDirection;
+    Value<Standard_Real>         myOffsetValue;
+  };
+
+public:
+  typedef instance<Curve, Geom_Line, gp_Ax1>        Line;
+
+  typedef subBase_gp<Curve, gp_Ax2>                 Conic;
+  typedef instance<Conic, Geom_Circle   , gp_Circ > Circle;
+  typedef instance<Conic, Geom_Ellipse  , gp_Elips> Ellipse;
+  typedef instance<Conic, Geom_Hyperbola, gp_Hypr > Hyperbola;
+  typedef instance<Conic, Geom_Parabola , gp_Parab> Parabola;
+
+  typedef subBase_empty<Curve>                      Bounded;
+  typedef Delayed<Bounded, pBezier>                 Bezier;
+  typedef Delayed<Bounded, pBSpline>                BSpline;
+  typedef Delayed<Bounded, pTrimmed>                Trimmed;
+
+  typedef Delayed<Curve, pOffset>                   Offset;
+};
+
+#endif
diff --git a/src/ShapePersistent/ShapePersistent_Geom_Surface.cxx b/src/ShapePersistent/ShapePersistent_Geom_Surface.cxx
new file mode 100644 (file)
index 0000000..ba383a0
--- /dev/null
@@ -0,0 +1,110 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <ShapePersistent_Geom_Surface.hxx>
+
+#include <Geom_SurfaceOfLinearExtrusion.hxx>
+#include <Geom_SurfaceOfRevolution.hxx>
+#include <Geom_BezierSurface.hxx>
+#include <Geom_BSplineSurface.hxx>
+#include <Geom_RectangularTrimmedSurface.hxx>
+#include <Geom_OffsetSurface.hxx>
+
+#include <gp_Ax1.hxx>
+
+
+Handle(Geom_Surface) ShapePersistent_Geom_Surface::pLinearExtrusion::Import()
+  const
+{
+  if (myBasisCurve.IsNull())
+    return NULL;
+
+  return new Geom_SurfaceOfLinearExtrusion
+    (myBasisCurve->Import(), myDirection);
+}
+
+Handle(Geom_Surface) ShapePersistent_Geom_Surface::pRevolution::Import() const
+{
+  if (myBasisCurve.IsNull())
+    return NULL;
+
+  return new Geom_SurfaceOfRevolution
+    (myBasisCurve->Import(), gp_Ax1 (myLocation, myDirection));
+}
+
+Handle(Geom_Surface) ShapePersistent_Geom_Surface::pBezier::Import() const
+{
+  if (myPoles.IsNull())
+    return NULL;
+
+  if (myURational || myVRational)
+  {
+    if (myWeights.IsNull())
+      return NULL;
+    return new Geom_BezierSurface (*myPoles->Array(), *myWeights->Array());
+  }
+  else
+    return new Geom_BezierSurface (*myPoles->Array());
+}
+
+Handle(Geom_Surface) ShapePersistent_Geom_Surface::pBSpline::Import() const
+{
+  if (myPoles.IsNull() || myUKnots.IsNull() || myVKnots.IsNull()
+   || myUMultiplicities.IsNull() || myVMultiplicities.IsNull())
+    return NULL;
+
+  if (myURational || myVRational)
+  {
+    if (myWeights.IsNull())
+      return NULL;
+
+    return new Geom_BSplineSurface (*myPoles->Array(),
+                                    *myWeights->Array(),
+                                    *myUKnots->Array(),
+                                    *myVKnots->Array(),
+                                    *myUMultiplicities->Array(),
+                                    *myVMultiplicities->Array(),
+                                    myUSpineDegree,
+                                    myVSpineDegree,
+                                    myUPeriodic,
+                                    myVPeriodic);
+  }
+  else
+    return new Geom_BSplineSurface (*myPoles->Array(),
+                                    *myUKnots->Array(),
+                                    *myVKnots->Array(),
+                                    *myUMultiplicities->Array(),
+                                    *myVMultiplicities->Array(),
+                                    myUSpineDegree,
+                                    myVSpineDegree,
+                                    myUPeriodic,
+                                    myVPeriodic);
+}
+
+Handle(Geom_Surface) ShapePersistent_Geom_Surface::pRectangularTrimmed::Import()
+  const
+{
+  if (myBasisSurface.IsNull())
+    return NULL;
+
+  return new Geom_RectangularTrimmedSurface
+    (myBasisSurface->Import(), myFirstU, myLastU, myFirstV, myLastV);
+}
+
+Handle(Geom_Surface) ShapePersistent_Geom_Surface::pOffset::Import() const
+{
+  if (myBasisSurface.IsNull())
+    return NULL;
+
+  return new Geom_OffsetSurface (myBasisSurface->Import(), myOffsetValue);
+}
diff --git a/src/ShapePersistent/ShapePersistent_Geom_Surface.hxx b/src/ShapePersistent/ShapePersistent_Geom_Surface.hxx
new file mode 100644 (file)
index 0000000..380a958
--- /dev/null
@@ -0,0 +1,177 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#ifndef _ShapePersistent_Geom_Surface_HeaderFile
+#define _ShapePersistent_Geom_Surface_HeaderFile
+
+#include <ShapePersistent_Geom.hxx>
+#include <ShapePersistent_HArray2.hxx>
+#include <StdLPersistent_HArray1.hxx>
+#include <StdLPersistent_HArray2.hxx>
+
+#include <Geom_Plane.hxx>
+#include <Geom_ConicalSurface.hxx>
+#include <Geom_CylindricalSurface.hxx>
+#include <Geom_SphericalSurface.hxx>
+#include <Geom_ToroidalSurface.hxx>
+
+#include <gp_Ax3.hxx>
+#include <gp_Cone.hxx>
+#include <gp_Cylinder.hxx>
+#include <gp_Sphere.hxx>
+#include <gp_Torus.hxx>
+
+class gp_Dir;
+class gp_Pnt;
+
+
+class ShapePersistent_Geom_Surface : private ShapePersistent_Geom
+{
+  typedef Surface::PersistentBase pBase;
+
+  class pSweptData : protected StdObjMgt_ContentTypes
+  {
+  public:
+    inline void Read (StdObjMgt_ReadData& theReadData)
+      { theReadData >> myBasisCurve >> myDirection; }
+
+  protected:
+    Reference            <Curve>  myBasisCurve;
+    StdObject_gp::Object <gp_Dir> myDirection;
+  };
+
+  struct pSwept : pBase, pSweptData {};
+
+  class pLinearExtrusion : public pSwept
+  {
+  public:
+    virtual Handle(Geom_Surface) Import() const;
+  };
+
+  class pRevolution : public pSwept
+  {
+  public:
+    inline void Read (StdObjMgt_ReadData& theReadData)
+    {
+      pSwept::Read (theReadData);
+      theReadData >> myLocation;
+    }
+
+    virtual Handle(Geom_Surface) Import() const;
+
+  private:
+    StdObject_gp::Object<gp_Pnt> myLocation;
+  };
+
+  typedef pBase pBounded;
+
+  class pBezier : public pBounded
+  {
+  public:
+    inline void Read (StdObjMgt_ReadData& theReadData)
+      { theReadData >> myURational >> myVRational >> myPoles >> myWeights; }
+
+    virtual Handle(Geom_Surface) Import() const;
+
+  private:
+    Value     <Standard_Boolean>             myURational;
+    Value     <Standard_Boolean>             myVRational;
+    Reference <ShapePersistent_HArray2::Pnt> myPoles;
+    Reference <StdLPersistent_HArray2::Real> myWeights;
+  };
+
+  class pBSpline : public pBounded
+  {
+  public:
+    inline void Read (StdObjMgt_ReadData& theReadData)
+    {
+      theReadData >> myURational >> myVRational;
+      theReadData >> myUPeriodic >> myVPeriodic;
+      theReadData >> myUSpineDegree >> myVSpineDegree;
+      theReadData >> myPoles;
+      theReadData >> myWeights;
+      theReadData >> myUKnots >> myVKnots;
+      theReadData >> myUMultiplicities >> myVMultiplicities;
+    }
+
+    virtual Handle(Geom_Surface) Import() const;
+
+  private:
+    Value     <Standard_Boolean>                myURational;
+    Value     <Standard_Boolean>                myVRational;
+    Value     <Standard_Boolean>                myUPeriodic;
+    Value     <Standard_Boolean>                myVPeriodic;
+    Value     <Standard_Integer>                myUSpineDegree;
+    Value     <Standard_Integer>                myVSpineDegree;
+    Reference <ShapePersistent_HArray2::Pnt>    myPoles;
+    Reference <StdLPersistent_HArray2::Real>    myWeights;
+    Reference <StdLPersistent_HArray1::Real>    myUKnots;
+    Reference <StdLPersistent_HArray1::Real>    myVKnots;
+    Reference <StdLPersistent_HArray1::Integer> myUMultiplicities;
+    Reference <StdLPersistent_HArray1::Integer> myVMultiplicities;
+  };
+
+  class pRectangularTrimmed : public pBounded
+  {
+  public:
+    inline void Read (StdObjMgt_ReadData& theReadData)
+    {
+      theReadData >> myBasisSurface;
+      theReadData >> myFirstU >> myLastU >> myFirstV >> myLastV;
+    }
+
+    virtual Handle(Geom_Surface) Import() const;
+
+  private:
+    Reference<Surface>   myBasisSurface;
+    Value<Standard_Real> myFirstU;
+    Value<Standard_Real> myLastU;
+    Value<Standard_Real> myFirstV;
+    Value<Standard_Real> myLastV;
+  };
+
+  class pOffset : public pBase
+  {
+  public:
+    inline void Read (StdObjMgt_ReadData& theReadData)
+      { theReadData >> myBasisSurface >> myOffsetValue; }
+
+    virtual Handle(Geom_Surface) Import() const;
+
+  private:
+    Reference<Surface>   myBasisSurface;
+    Value<Standard_Real> myOffsetValue;
+  };
+
+public:
+  typedef subBase_gp<Surface, gp_Ax3>                                Elementary;
+  typedef instance<Elementary, Geom_Plane             , gp_Ax3>      Plane;
+  typedef instance<Elementary, Geom_ConicalSurface    , gp_Cone>     Conical;
+  typedef instance<Elementary, Geom_CylindricalSurface, gp_Cylinder> Cylindrical;
+  typedef instance<Elementary, Geom_SphericalSurface  , gp_Sphere>   Spherical;
+  typedef instance<Elementary, Geom_ToroidalSurface   , gp_Torus>    Toroidal;
+
+  typedef subBase<Surface, pSweptData>                               Swept;
+  typedef Delayed<Swept, pLinearExtrusion>                           LinearExtrusion;
+  typedef Delayed<Swept, pRevolution>                                Revolution;
+
+  typedef subBase_empty<Surface>                                     Bounded;
+  typedef Delayed<Bounded, pBezier>                                  Bezier;
+  typedef Delayed<Bounded, pBSpline>                                 BSpline;
+  typedef Delayed<Bounded, pRectangularTrimmed>                      RectangularTrimmed;
+
+  typedef Delayed<Surface, pOffset>                                  Offset;
+};
+
+#endif
diff --git a/src/ShapePersistent/ShapePersistent_HArray1.cxx b/src/ShapePersistent/ShapePersistent_HArray1.cxx
new file mode 100644 (file)
index 0000000..2c363f6
--- /dev/null
@@ -0,0 +1,45 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <ShapePersistent_HArray1.hxx>
+#include <StdObjMgt_ReadData.hxx>
+#include <StdObject_gp.hxx>
+
+
+template <class ArrayClass>
+void ShapePersistent_HArray1::instance<ArrayClass>::readValue
+  (StdObjMgt_ReadData& theReadData, const Standard_Integer theIndex)
+{
+  theReadData.ReadObject (StdObject_gp::Ref (this->myArray->ChangeValue (theIndex)));
+}
+
+template<>
+void ShapePersistent_HArray1::instance<Poly_HArray1OfTriangle>::readValue
+  (StdObjMgt_ReadData& theReadData, const Standard_Integer theIndex)
+{
+  Value<Standard_Integer> N1, N2, N3;
+  theReadData >> N1 >> N2 >> N3;
+  this->myArray->ChangeValue (theIndex).Set (N1, N2, N3);
+}
+
+template class ShapePersistent_HArray1::instance<TColgp_HArray1OfXYZ>;
+template class ShapePersistent_HArray1::instance<TColgp_HArray1OfPnt>;
+template class ShapePersistent_HArray1::instance<TColgp_HArray1OfDir>;
+template class ShapePersistent_HArray1::instance<TColgp_HArray1OfVec>;
+template class ShapePersistent_HArray1::instance<TColgp_HArray1OfXY>;
+template class ShapePersistent_HArray1::instance<TColgp_HArray1OfPnt2d>;
+template class ShapePersistent_HArray1::instance<TColgp_HArray1OfDir2d>;
+template class ShapePersistent_HArray1::instance<TColgp_HArray1OfVec2d>;
+template class ShapePersistent_HArray1::instance<TColgp_HArray1OfLin2d>;
+template class ShapePersistent_HArray1::instance<TColgp_HArray1OfCirc2d>;
+template class ShapePersistent_HArray1::instance<Poly_HArray1OfTriangle>;
diff --git a/src/ShapePersistent/ShapePersistent_HArray1.hxx b/src/ShapePersistent/ShapePersistent_HArray1.hxx
new file mode 100644 (file)
index 0000000..7619baa
--- /dev/null
@@ -0,0 +1,56 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#ifndef _ShapePersistent_HArray1_HeaderFile
+#define _ShapePersistent_HArray1_HeaderFile
+
+#include <StdLPersistent_HArray1.hxx>
+
+#include <TColgp_HArray1OfXYZ.hxx>
+#include <TColgp_HArray1OfPnt.hxx>
+#include <TColgp_HArray1OfDir.hxx>
+#include <TColgp_HArray1OfVec.hxx>
+#include <TColgp_HArray1OfXY.hxx>
+#include <TColgp_HArray1OfPnt2d.hxx>
+#include <TColgp_HArray1OfDir2d.hxx>
+#include <TColgp_HArray1OfVec2d.hxx>
+#include <TColgp_HArray1OfLin2d.hxx>
+#include <TColgp_HArray1OfCirc2d.hxx>
+#include <Poly_HArray1OfTriangle.hxx>
+
+
+class ShapePersistent_HArray1 : private StdLPersistent_HArray1
+{
+  template <class ArrayClass>
+  class instance : public StdLPersistent_HArray1::base<ArrayClass>
+  {
+    virtual void readValue (StdObjMgt_ReadData& theReadData,
+                            const Standard_Integer theIndex);
+  };
+
+public:
+  typedef instance<TColgp_HArray1OfXYZ>    XYZ;
+  typedef instance<TColgp_HArray1OfPnt>    Pnt;
+  typedef instance<TColgp_HArray1OfDir>    Dir;
+  typedef instance<TColgp_HArray1OfVec>    Vec;
+  typedef instance<TColgp_HArray1OfXY>     XY;
+  typedef instance<TColgp_HArray1OfPnt2d>  Pnt2d;
+  typedef instance<TColgp_HArray1OfDir2d>  Dir2d;
+  typedef instance<TColgp_HArray1OfVec2d>  Vec2d;
+  typedef instance<TColgp_HArray1OfLin2d>  Lin2d;
+  typedef instance<TColgp_HArray1OfCirc2d> Circ2d;
+  typedef instance<Poly_HArray1OfTriangle> Triangle;
+};
+
+#endif
diff --git a/src/ShapePersistent/ShapePersistent_HArray2.cxx b/src/ShapePersistent/ShapePersistent_HArray2.cxx
new file mode 100644 (file)
index 0000000..6879e17
--- /dev/null
@@ -0,0 +1,38 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <ShapePersistent_HArray2.hxx>
+#include <StdObjMgt_ReadData.hxx>
+#include <StdObject_gp.hxx>
+
+
+template <class ArrayClass>
+void ShapePersistent_HArray2::instance<ArrayClass>::readValue (
+  StdObjMgt_ReadData&    theReadData,
+  const Standard_Integer theRow,
+  const Standard_Integer theCol)
+{
+  theReadData.ReadObject (
+    StdObject_gp::Ref (this->myArray->ChangeValue (theRow, theCol)));
+}
+
+template class ShapePersistent_HArray2::instance<TColgp_HArray2OfXYZ>;
+template class ShapePersistent_HArray2::instance<TColgp_HArray2OfPnt>;
+template class ShapePersistent_HArray2::instance<TColgp_HArray2OfDir>;
+template class ShapePersistent_HArray2::instance<TColgp_HArray2OfVec>;
+template class ShapePersistent_HArray2::instance<TColgp_HArray2OfXY>;
+template class ShapePersistent_HArray2::instance<TColgp_HArray2OfPnt2d>;
+template class ShapePersistent_HArray2::instance<TColgp_HArray2OfDir2d>;
+template class ShapePersistent_HArray2::instance<TColgp_HArray2OfVec2d>;
+template class ShapePersistent_HArray2::instance<TColgp_HArray2OfLin2d>;
+template class ShapePersistent_HArray2::instance<TColgp_HArray2OfCirc2d>;
diff --git a/src/ShapePersistent/ShapePersistent_HArray2.hxx b/src/ShapePersistent/ShapePersistent_HArray2.hxx
new file mode 100644 (file)
index 0000000..bd3d6c8
--- /dev/null
@@ -0,0 +1,55 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#ifndef _ShapePersistent_HArray2_HeaderFile
+#define _ShapePersistent_HArray2_HeaderFile
+
+#include <StdLPersistent_HArray2.hxx>
+
+#include <TColgp_HArray2OfXYZ.hxx>
+#include <TColgp_HArray2OfPnt.hxx>
+#include <TColgp_HArray2OfDir.hxx>
+#include <TColgp_HArray2OfVec.hxx>
+#include <TColgp_HArray2OfXY.hxx>
+#include <TColgp_HArray2OfPnt2d.hxx>
+#include <TColgp_HArray2OfDir2d.hxx>
+#include <TColgp_HArray2OfVec2d.hxx>
+#include <TColgp_HArray2OfLin2d.hxx>
+#include <TColgp_HArray2OfCirc2d.hxx>
+
+
+class ShapePersistent_HArray2 : private StdLPersistent_HArray2
+{
+  template <class ArrayClass>
+  class instance : public StdLPersistent_HArray2::base<ArrayClass>
+  {
+    virtual void readValue (StdObjMgt_ReadData&    theReadData,
+                            const Standard_Integer theRow,
+                            const Standard_Integer theCol);
+  };
+
+public:
+  typedef instance<TColgp_HArray2OfXYZ>    XYZ;
+  typedef instance<TColgp_HArray2OfPnt>    Pnt;
+  typedef instance<TColgp_HArray2OfDir>    Dir;
+  typedef instance<TColgp_HArray2OfVec>    Vec;
+  typedef instance<TColgp_HArray2OfXY>     XY;
+  typedef instance<TColgp_HArray2OfPnt2d>  Pnt2d;
+  typedef instance<TColgp_HArray2OfDir2d>  Dir2d;
+  typedef instance<TColgp_HArray2OfVec2d>  Vec2d;
+  typedef instance<TColgp_HArray2OfLin2d>  Lin2d;
+  typedef instance<TColgp_HArray2OfCirc2d> Circ2d;
+};
+
+#endif
diff --git a/src/ShapePersistent/ShapePersistent_HSequence.cxx b/src/ShapePersistent/ShapePersistent_HSequence.cxx
new file mode 100644 (file)
index 0000000..35af5f9
--- /dev/null
@@ -0,0 +1,52 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <ShapePersistent_HSequence.hxx>
+#include <StdObjMgt_ReadData.hxx>
+
+
+template <class SequenceClass>
+void ShapePersistent_HSequence::node<SequenceClass>::Read
+  (StdObjMgt_ReadData& theReadData)
+{
+  theReadData >> myPreviuos >> myItem >> myNext;
+}
+
+template <class SequenceClass>
+void ShapePersistent_HSequence::instance<SequenceClass>::Read
+  (StdObjMgt_ReadData& theReadData)
+{
+  theReadData >> myFirst >> myLast >> mySize;
+}
+
+template <class SequenceClass>
+Handle(SequenceClass)
+  ShapePersistent_HSequence::instance<SequenceClass>::Import() const
+{
+  Handle(SequenceClass) aSequence = new SequenceClass;
+  
+  for (Handle(Node) aNode = myFirst; aNode; aNode = aNode->Next())
+    aSequence->Append (aNode->Item());
+
+  return aSequence;
+}
+
+template class ShapePersistent_HSequence::node<TColgp_HSequenceOfXYZ>;
+template class ShapePersistent_HSequence::node<TColgp_HSequenceOfPnt>;
+template class ShapePersistent_HSequence::node<TColgp_HSequenceOfDir>;
+template class ShapePersistent_HSequence::node<TColgp_HSequenceOfVec>;
+
+template class ShapePersistent_HSequence::instance<TColgp_HSequenceOfXYZ>;
+template class ShapePersistent_HSequence::instance<TColgp_HSequenceOfPnt>;
+template class ShapePersistent_HSequence::instance<TColgp_HSequenceOfDir>;
+template class ShapePersistent_HSequence::instance<TColgp_HSequenceOfVec>;
diff --git a/src/ShapePersistent/ShapePersistent_HSequence.hxx b/src/ShapePersistent/ShapePersistent_HSequence.hxx
new file mode 100644 (file)
index 0000000..ad96e71
--- /dev/null
@@ -0,0 +1,75 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#ifndef _ShapePersistent_HSequence_HeaderFile
+#define _ShapePersistent_HSequence_HeaderFile
+
+#include <StdObjMgt_Persistent.hxx>
+#include <StdObject_gp.hxx>
+
+#include <TColgp_HSequenceOfXYZ.hxx>
+#include <TColgp_HSequenceOfPnt.hxx>
+#include <TColgp_HSequenceOfDir.hxx>
+#include <TColgp_HSequenceOfVec.hxx>
+
+
+class ShapePersistent_HSequence
+{
+  template <class SequenceClass>
+  class node : public StdObjMgt_Persistent
+  {
+  public:
+    typedef typename SequenceClass::value_type ItemType;
+
+  public:
+    //! Read persistent data from a file.
+    Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
+
+    const Handle(node)& Previuos() const  { return myPreviuos; } 
+    const Handle(node)& Next()     const  { return myNext; } 
+    const ItemType&     Item()     const  { return myItem; }
+
+  private:
+    Reference<node>                myPreviuos;
+    Reference<node>                myNext;
+    StdObject_gp::Object<ItemType> myItem;
+  };
+
+  template <class SequenceClass>
+  class instance : public StdObjMgt_Persistent
+  {
+  public:
+    typedef node<SequenceClass> Node;
+
+  public:
+    //! Read persistent data from a file.
+    Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
+
+    //! Import transient object from the persistent data.
+    Standard_EXPORT Handle(SequenceClass) Import() const;
+
+  private:
+    Reference<Node>         myFirst;
+    Reference<Node>         myLast;
+    Value<Standard_Integer> mySize;
+  };
+
+public:
+  typedef instance<TColgp_HSequenceOfXYZ> XYZ;
+  typedef instance<TColgp_HSequenceOfPnt> Pnt;
+  typedef instance<TColgp_HSequenceOfDir> Dir;
+  typedef instance<TColgp_HSequenceOfVec> Vec;
+};
+
+#endif
diff --git a/src/ShapePersistent/ShapePersistent_Poly.cxx b/src/ShapePersistent/ShapePersistent_Poly.cxx
new file mode 100644 (file)
index 0000000..8691385
--- /dev/null
@@ -0,0 +1,83 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <ShapePersistent_Poly.hxx>
+
+#include <Poly_Polygon2D.hxx>
+#include <Poly_Polygon3D.hxx>
+#include <Poly_PolygonOnTriangulation.hxx>
+#include <Poly_Triangulation.hxx>
+
+
+Handle(Poly_Polygon2D) ShapePersistent_Poly::pPolygon2D::Import() const
+{
+  if (myNodes.IsNull())
+    return NULL;
+
+  Handle(Poly_Polygon2D) aPolygon = new Poly_Polygon2D (*myNodes->Array());
+  aPolygon->Deflection (myDeflection);
+  return aPolygon;
+}
+
+Handle(Poly_Polygon3D) ShapePersistent_Poly::pPolygon3D::Import() const
+{
+  if (myNodes.IsNull() || myParameters.IsNull())
+    return NULL;
+
+  Handle(Poly_Polygon3D) aPolygon = new Poly_Polygon3D (*myNodes->Array(),
+                                                        *myParameters->Array());
+  aPolygon->Deflection (myDeflection);
+  return aPolygon;
+}
+
+Handle(Poly_PolygonOnTriangulation)
+  ShapePersistent_Poly::pPolygonOnTriangulation::Import() const
+{
+  Handle(Poly_PolygonOnTriangulation) aPolygon;
+
+  if (myNodes)
+  {
+    if (myParameters)
+      aPolygon = new Poly_PolygonOnTriangulation (*myNodes->Array(),
+                                                  *myParameters->Array());
+    else
+      aPolygon = new Poly_PolygonOnTriangulation (*myNodes->Array());
+
+    aPolygon->Deflection (myDeflection);
+  }
+
+  return aPolygon;
+}
+
+Handle(Poly_Triangulation) ShapePersistent_Poly::pTriangulation::Import() const
+{
+  Handle(Poly_Triangulation) aTriangulation;
+
+// Triangulation is not used
+#if 0
+  if (myNodes && myTriangles)
+  {
+    if (myUVNodes)
+      aTriangulation = new Poly_Triangulation (*myNodes->Array(),
+                                               *myUVNodes->Array(),
+                                               *myTriangles->Array());
+    else
+      aTriangulation = new Poly_Triangulation (*myNodes->Array(),
+                                               *myTriangles->Array());
+
+    aTriangulation->Deflection (myDeflection);
+  }
+#endif
+
+  return aTriangulation;
+}
diff --git a/src/ShapePersistent/ShapePersistent_Poly.hxx b/src/ShapePersistent/ShapePersistent_Poly.hxx
new file mode 100644 (file)
index 0000000..e97a949
--- /dev/null
@@ -0,0 +1,99 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#ifndef _ShapePersistent_Poly_HeaderFile
+#define _ShapePersistent_Poly_HeaderFile
+
+#include <StdObjMgt_SharedObject.hxx>
+#include <StdObjMgt_ReadData.hxx>
+#include <StdLPersistent_HArray1.hxx>
+#include <ShapePersistent_HArray1.hxx>
+
+class Poly_Polygon2D;
+class Poly_Polygon3D;
+class Poly_PolygonOnTriangulation;
+class Poly_Triangulation;
+
+
+class ShapePersistent_Poly : private StdObjMgt_SharedObject
+{
+  class pPolygon2D : public PersistentBase
+  {
+  public:
+    inline void Read (StdObjMgt_ReadData& theReadData)
+      { theReadData >> myDeflection >> myNodes; }
+
+    Handle(Poly_Polygon2D) Import() const;
+
+  private:
+    Value     <Standard_Real>                  myDeflection;
+    Reference <ShapePersistent_HArray1::Pnt2d> myNodes;
+  };
+
+  class pPolygon3D : public PersistentBase
+  {
+  public:
+    inline void Read (StdObjMgt_ReadData& theReadData)
+      { theReadData >> myDeflection >> myNodes >> myParameters; }
+
+    Handle(Poly_Polygon3D) Import() const;
+
+  private:
+    Value     <Standard_Real>                myDeflection;
+    Reference <ShapePersistent_HArray1::Pnt> myNodes;
+    Reference <StdLPersistent_HArray1::Real> myParameters;
+  };
+
+  class pPolygonOnTriangulation : public PersistentBase
+  {
+  public:
+    inline void Read (StdObjMgt_ReadData& theReadData)
+      { theReadData >> myDeflection >> myNodes >> myParameters; }
+
+    Handle(Poly_PolygonOnTriangulation) Import() const;
+
+  private:
+    Value     <Standard_Real>                   myDeflection;
+    Reference <StdLPersistent_HArray1::Integer> myNodes;
+    Reference <StdLPersistent_HArray1::Real>    myParameters;
+  };
+
+  class pTriangulation : public PersistentBase
+  {
+  public:
+    inline void Read (StdObjMgt_ReadData& theReadData)
+      { theReadData >> myDeflection >> myNodes >> myUVNodes >> myTriangles; }
+
+    Handle(Poly_Triangulation) Import() const;
+
+  private:
+    Value     <Standard_Real>                     myDeflection;
+    Reference <ShapePersistent_HArray1::Pnt>      myNodes;
+    Reference <ShapePersistent_HArray1::Pnt2d>    myUVNodes;
+    Reference <ShapePersistent_HArray1::Triangle> myTriangles;
+  };
+
+  template <class Persistent, class Transient>
+  struct instance
+    : Delayed <DelayedBase<StdObjMgt_Persistent, Transient, Persistent> > {};
+
+public:
+  typedef instance <pPolygon2D, Poly_Polygon2D>         Polygon2D;
+  typedef instance <pPolygon3D, Poly_Polygon3D>         Polygon3D;
+  typedef instance <pPolygonOnTriangulation,
+                    Poly_PolygonOnTriangulation>        PolygonOnTriangulation;
+  typedef instance <pTriangulation, Poly_Triangulation> Triangulation;
+};
+
+#endif
diff --git a/src/ShapePersistent/ShapePersistent_TopoDS.cxx b/src/ShapePersistent/ShapePersistent_TopoDS.cxx
new file mode 100644 (file)
index 0000000..0e4e315
--- /dev/null
@@ -0,0 +1,96 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <ShapePersistent_TopoDS.hxx>
+
+#include <BRep_Builder.hxx>
+
+
+enum
+{
+  ModifiedMask   = 2,
+  CheckedMask    = 4,
+  OrientableMask = 8,
+  ClosedMask     = 16,
+  InfiniteMask   = 32,
+  ConvexMask     = 64
+};
+
+
+//=======================================================================
+//function : Read
+//purpose  : Read persistent data from a file
+//=======================================================================
+void ShapePersistent_TopoDS::Shape::Read (StdObjMgt_ReadData& theReadData)
+{
+  theReadData >> myEntry;
+  myShape.Read (theReadData);
+}
+
+void ShapePersistent_TopoDS::pTBase::setFlags
+  (const Handle(TopoDS_TShape)& theTShape) const
+{
+  theTShape->Free       (Standard_False); // Always frozen when coming from DB
+  theTShape->Modified   (myFlags & ModifiedMask);
+  theTShape->Checked    (myFlags & CheckedMask);
+  theTShape->Orientable (myFlags & OrientableMask);
+  theTShape->Closed     (myFlags & ClosedMask);
+  theTShape->Infinite   (myFlags & InfiniteMask);
+  theTShape->Convex     (myFlags & ConvexMask);
+}
+
+static inline void AddShape
+  (TopoDS_Shape& theParent, const Handle(StdObjMgt_Persistent)& theRef)
+{
+  Handle(ShapePersistent_TopoDS::Shape) aShape =
+    Handle(ShapePersistent_TopoDS::Shape)::DownCast (theRef);
+
+  if (aShape)
+    BRep_Builder().Add (theParent, aShape->Import());
+}
+
+static inline void AddShape
+  (TopoDS_Shape& theParent, const StdObject_Shape& theShape)
+{
+  BRep_Builder().Add (theParent, theShape.Import());
+}
+
+template <class ShapesArray>
+void ShapePersistent_TopoDS::pTBase::addShapesT
+  (TopoDS_Shape& theParent) const
+{
+  Handle(ShapesArray) aShapes;
+  if (myShapes.Cast (aShapes))
+  {
+    typename ShapesArray::Iterator anIter (*aShapes->Array());
+    for (; anIter.More(); anIter.Next())
+      AddShape (theParent, anIter.Value());
+  }
+}
+
+template void ShapePersistent_TopoDS::pTBase::addShapesT
+  <StdLPersistent_HArray1::Persistent> (TopoDS_Shape& theParent) const;
+
+template void ShapePersistent_TopoDS::pTBase::addShapesT
+  <StdPersistent_HArray1::Shape1> (TopoDS_Shape& theParent) const;
+
+template <class Target>
+Handle(TopoDS_TShape)
+  ShapePersistent_TopoDS::pTSimple<Target>::createTShape() const
+    { return new Target; }
+
+template class ShapePersistent_TopoDS::pTSimple<TopoDS_TWire>;
+template class ShapePersistent_TopoDS::pTSimple<TopoDS_TShell>;
+template class ShapePersistent_TopoDS::pTSimple<TopoDS_TSolid>;
+template class ShapePersistent_TopoDS::pTSimple<TopoDS_TCompSolid>;
+template class ShapePersistent_TopoDS::pTSimple<TopoDS_TCompound>;
diff --git a/src/ShapePersistent/ShapePersistent_TopoDS.hxx b/src/ShapePersistent/ShapePersistent_TopoDS.hxx
new file mode 100644 (file)
index 0000000..ecee607
--- /dev/null
@@ -0,0 +1,115 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#ifndef _ShapePersistent_TopoDS_HeaderFile
+#define _ShapePersistent_TopoDS_HeaderFile
+
+#include <StdPersistent_TopoDS.hxx>
+#include <StdPersistent_HArray1.hxx>
+#include <StdLPersistent_HArray1.hxx>
+#include <StdObject_Shape.hxx>
+
+#include <TopoDS_TWire.hxx>
+#include <TopoDS_TShell.hxx>
+#include <TopoDS_TSolid.hxx>
+#include <TopoDS_TCompSolid.hxx>
+#include <TopoDS_TCompound.hxx>
+
+
+class ShapePersistent_TopoDS : public StdPersistent_TopoDS
+{
+public:
+  class Shape : public StdObjMgt_Persistent
+  {
+  public:
+    //! Read persistent data from a file.
+    Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
+
+    //! Import transient object from the persistent data.
+    TopoDS_Shape Import() const  { return myShape.Import(); }
+
+  private:
+    Reference<>     myEntry;
+    StdObject_Shape myShape;
+  };
+
+protected:
+  class pTBase : public pTShape
+  {
+  public:
+    inline Handle(TopoDS_TShape) Import() const
+    {
+      Handle(TopoDS_TShape) aTShape = createTShape();
+
+      TopoDS_Shape aWrapperShape;
+      aWrapperShape.TShape (aTShape);
+      addShapes (aWrapperShape);
+
+      setFlags (aTShape);
+
+      return aTShape;
+    }
+
+  private:
+    virtual Handle(TopoDS_TShape) createTShape() const = 0;
+
+    virtual void addShapes (TopoDS_Shape& theParent) const = 0;
+
+    void setFlags (const Handle(TopoDS_TShape)& theTShape) const;
+
+  protected:
+    template <class ShapesArray>
+    void addShapesT (TopoDS_Shape& theParent) const;
+  };
+
+private:
+  template <class Target>
+  class pTSimple : public pTBase
+    { virtual Handle(TopoDS_TShape) createTShape() const; };
+
+  template <class Persistent, class ShapesArray>
+  class pTObject : public Persistent
+  {
+    virtual void addShapes (TopoDS_Shape& theParent) const
+    {
+      pTBase::addShapesT<ShapesArray> (theParent);
+    }
+  };
+
+  template <class Persistent, class ShapesArray>
+  struct tObjectT : Delayed <DelayedBase<TShape, TopoDS_TShape, pTBase>,
+                             pTObject<Persistent, ShapesArray> > {};
+
+protected:
+  template <class Persistent>
+  struct tObject  : tObjectT<Persistent, StdLPersistent_HArray1::Persistent> {};
+
+  template <class Persistent>
+  struct tObject1 : tObjectT<Persistent, StdPersistent_HArray1::Shape1> {};
+
+public:
+  typedef tObject  <pTSimple<TopoDS_TWire>      > TWire;
+  typedef tObject  <pTSimple<TopoDS_TShell>     > TShell;
+  typedef tObject  <pTSimple<TopoDS_TSolid>     > TSolid;
+  typedef tObject  <pTSimple<TopoDS_TCompSolid> > TCompSolid;
+  typedef tObject  <pTSimple<TopoDS_TCompound>  > TCompound;
+
+  typedef tObject1 <pTSimple<TopoDS_TWire>      > TWire1;
+  typedef tObject1 <pTSimple<TopoDS_TShell>     > TShell1;
+  typedef tObject1 <pTSimple<TopoDS_TSolid>     > TSolid1;
+  typedef tObject1 <pTSimple<TopoDS_TCompSolid> > TCompSolid1;
+  typedef tObject1 <pTSimple<TopoDS_TCompound>  > TCompound1;
+};
+
+#endif
index 4f2cfc1..02d5613 100644 (file)
 IMPLEMENT_STANDARD_RTTIEXT (StdDrivers_DocumentRetrievalDriver, StdLDrivers_DocumentRetrievalDriver)
 
 //=======================================================================
-//function : BindTypes
+//function : bindTypes
 //purpose  : Register types
 //=======================================================================
-void StdDrivers_DocumentRetrievalDriver::BindTypes (StdObjMgt_MapOfInstantiators& theMap)
+void StdDrivers_DocumentRetrievalDriver::bindTypes (StdObjMgt_MapOfInstantiators& theMap)
 {
   StdDrivers::BindTypes (theMap);
 }
index d683397..2abfdb0 100644 (file)
 class StdDrivers_DocumentRetrievalDriver : public StdLDrivers_DocumentRetrievalDriver
 {
 public:
-  //! Register types.
-  Standard_EXPORT virtual void BindTypes (StdObjMgt_MapOfInstantiators& theMap) Standard_OVERRIDE;
-
   DEFINE_STANDARD_RTTIEXT (StdDrivers_DocumentRetrievalDriver, StdLDrivers_DocumentRetrievalDriver)
+
+protected:
+  //! Register types.
+  Standard_EXPORT virtual void bindTypes (StdObjMgt_MapOfInstantiators& theMap) Standard_OVERRIDE;
 };
 
 #endif // _StdDrivers_DocumentRetrievalDriver_HeaderFile
index 05ce4ef..3559780 100644 (file)
@@ -13,8 +13,8 @@
 
 #include <StdLDrivers_DocumentRetrievalDriver.hxx>
 #include <StdLDrivers.hxx>
-#include <StdLPersistent_PDocStd_Document.hxx>
 
+#include <StdObjMgt_Persistent.hxx>
 #include <StdObjMgt_MapOfInstantiators.hxx>
 #include <StdObjMgt_ReadData.hxx>
 
@@ -32,6 +32,7 @@
 #include <Standard_ErrorHandler.hxx>
 #include <Standard_NotImplemented.hxx>
 #include <NCollection_Array1.hxx>
+#include <NCollection_Handle.hxx>
 #include <TDocStd_Document.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT (StdLDrivers_DocumentRetrievalDriver, PCDM_RetrievalDriver)
@@ -49,23 +50,47 @@ Handle(CDM_Document) StdLDrivers_DocumentRetrievalDriver::CreateDocument()
 //function : Read
 //purpose  : Retrieve the content of a file into a new document
 //=======================================================================
-void StdLDrivers_DocumentRetrievalDriver::Read (const TCollection_ExtendedString& theFileName,
+void StdLDrivers_DocumentRetrievalDriver::Read (
+  const TCollection_ExtendedString& theFileName,
                                                 const Handle(CDM_Document)&       theNewDocument,
                                                 const Handle(CDM_Application)&)
 {
+  // Read header data and persistent document
+  Storage_HeaderData aHeaderData;
+  Handle(StdObjMgt_Persistent) aPDocument = read (theFileName, aHeaderData);
+
+  // Import transient document from the persistent one
+  if (!aPDocument.IsNull())
+  {
+    aPDocument->ImportDocument (
+      Handle(TDocStd_Document)::DownCast (theNewDocument));
+
+    // Copy comments from the header data
+    theNewDocument->SetComments (aHeaderData.Comments());
+  }
+}
+
+//=======================================================================
+//function : read
+//purpose  : Read persistent document from a file
+//=======================================================================
+Handle(StdObjMgt_Persistent) StdLDrivers_DocumentRetrievalDriver::read (
+  const TCollection_ExtendedString& theFileName,
+  Storage_HeaderData&               theHeaderData)
+{
   Standard_Integer i;
 
   // Create a driver appropriate for the given file
-  PCDM_BaseDriverPointer aFileDriver;
-  if (PCDM::FileDriverType (TCollection_AsciiString (theFileName), aFileDriver) == PCDM_TOFD_Unknown)
+  PCDM_BaseDriverPointer aFileDriverPtr;
+  if (PCDM::FileDriverType (TCollection_AsciiString (theFileName), aFileDriverPtr) == PCDM_TOFD_Unknown)
   {
     myReaderStatus = PCDM_RS_UnknownFileDriver;
-    return;
+    return NULL;
   }
 
+  NCollection_Handle<Storage_BaseDriver> aFileDriver (aFileDriverPtr);
+
   // Try to open the file
-  {
-    Standard_SStream aMsg;
     try
     {
       OCC_CATCH_SIGNALS
@@ -74,67 +99,51 @@ void StdLDrivers_DocumentRetrievalDriver::Read (const TCollection_ExtendedString
     } 
     catch (Standard_Failure)
     {
-      aMsg << Standard_Failure::Caught() << endl;
       myReaderStatus = PCDM_RS_OpenError;
-    }
 
-    if (myReaderStatus != PCDM_RS_OK)
-    {
+      Standard_SStream aMsg;
+      aMsg << Standard_Failure::Caught() << endl;
       Standard_Failure::Raise (aMsg);
-      return;
     }
-  }
   
   // Read header section
-  Storage_HeaderData hData;
-  if (!hData.Read (*aFileDriver))
-  {
-    RaiseOnStorageError (hData.ErrorStatus());
-    return;
-  }
+  if (!theHeaderData.Read (*aFileDriver))
+    raiseOnStorageError (theHeaderData.ErrorStatus());
 
   // Read type section
-  Storage_TypeData tData;
-  if (!tData.Read (*aFileDriver))
-  {
-    RaiseOnStorageError (tData.ErrorStatus());
-    return;
-  }
+  Storage_TypeData aTypeData;
+  if (!aTypeData.Read (*aFileDriver))
+    raiseOnStorageError (aTypeData.ErrorStatus());
 
   // Read root section
-  Storage_RootData rData;
-  if (!rData.Read (*aFileDriver))
-  {
-    RaiseOnStorageError (rData.ErrorStatus());
-    return;
-  }
+  Storage_RootData aRootData;
+  if (!aRootData.Read (*aFileDriver))
+    raiseOnStorageError (aRootData.ErrorStatus());
 
-  if (rData.NumberOfRoots() < 1)
+  if (aRootData.NumberOfRoots() < 1)
   {
     myReaderStatus = PCDM_RS_NoDocument;
 
     Standard_SStream aMsg;
     aMsg << "could not find any document in this file" << endl;
     Standard_Failure::Raise (aMsg);
-
-    return;
   }
 
   // Select instantiators for the used types
   NCollection_Array1<StdObjMgt_Persistent::Instantiator>
-    anInstantiators (1, tData.NumberOfTypes());
+    anInstantiators (1, aTypeData.NumberOfTypes());
   {
     StdObjMgt_MapOfInstantiators aMapOfInstantiators;
-    BindTypes (aMapOfInstantiators);
+    bindTypes (aMapOfInstantiators);
 
     TColStd_SequenceOfAsciiString anUnknownTypes;
     Standard_Integer        aCurTypeNum;
     TCollection_AsciiString aCurTypeName;
 
-    for (i = 1; i <= tData.NumberOfTypes(); i++)
+    for (i = 1; i <= aTypeData.NumberOfTypes(); i++)
     {
-      aCurTypeName = tData.Type (i);
-      aCurTypeNum  = tData.Type (aCurTypeName);
+      aCurTypeName = aTypeData.Type (i);
+      aCurTypeNum  = aTypeData.Type (aCurTypeName);
 
       StdObjMgt_Persistent::Instantiator anInstantiator;
       if (aMapOfInstantiators.Find (aCurTypeName, anInstantiator))
@@ -158,15 +167,13 @@ void StdLDrivers_DocumentRetrievalDriver::Read (const TCollection_ExtendedString
       }
 
       Standard_Failure::Raise (aMsg);
-      return;
     }
   }
 
   // Read and parse reference section
-  StdObjMgt_ReadData aReadData (*aFileDriver, hData.NumberOfObjects());
+  StdObjMgt_ReadData aReadData (*aFileDriver, theHeaderData.NumberOfObjects());
 
-  if (RaiseOnStorageError (aFileDriver->BeginReadRefSection()))
-    return;
+  raiseOnStorageError (aFileDriver->BeginReadRefSection());
 
   Standard_Integer len = aFileDriver->RefSectionSize();
   for (i = 1; i <= len; i++)
@@ -184,66 +191,36 @@ void StdLDrivers_DocumentRetrievalDriver::Read (const TCollection_ExtendedString
       anError = Storage_VSTypeMismatch;
     }
 
-    if (RaiseOnStorageError (anError))
-      return;
+    raiseOnStorageError (anError);
 
-    aReadData.CreateObject (aRef, anInstantiators (aType));
+    aReadData.CreatePersistentObject (aRef, anInstantiators (aType));
   }
 
-  if (RaiseOnStorageError (aFileDriver->EndReadRefSection()))
-    return;
+  raiseOnStorageError (aFileDriver->EndReadRefSection());
 
   // Read and parse data section
-  if (RaiseOnStorageError (aFileDriver->BeginReadDataSection()))
-    return;
+  raiseOnStorageError (aFileDriver->BeginReadDataSection());
 
-  for (i = 1; i <= hData.NumberOfObjects(); i++)
+  for (i = 1; i <= theHeaderData.NumberOfObjects(); i++)
   {
-    Handle(StdObjMgt_Persistent) aPersistent = aReadData.Object (i);
-    if (!aPersistent.IsNull())
+    Storage_Error anError;
+    try
     {
-      Standard_Integer aRef = 0, aType = 0;
-      Storage_Error anError;
-      try
-      {
-        OCC_CATCH_SIGNALS
-        aFileDriver->ReadPersistentObjectHeader (aRef, aType);
-        aFileDriver->BeginReadPersistentObjectData();
-        aPersistent->Read (aReadData);
-        aFileDriver->EndReadPersistentObjectData();
-        anError = Storage_VSOk;
-      }
-      catch (Storage_StreamTypeMismatchError) { anError = Storage_VSTypeMismatch; }
-      catch (Storage_StreamFormatError      ) { anError = Storage_VSFormatError;  }
-      catch (Storage_StreamReadError        ) { anError = Storage_VSFormatError;  }
-
-      if (RaiseOnStorageError (anError))
-        return;
+      OCC_CATCH_SIGNALS
+      aReadData.ReadPersistentObject (i);
+      anError = Storage_VSOk;
     }
-  }
-
-  if (RaiseOnStorageError (aFileDriver->EndReadDataSection()))
-    return;
+    catch (Storage_StreamTypeMismatchError) { anError = Storage_VSTypeMismatch; }
+    catch (Storage_StreamFormatError      ) { anError = Storage_VSFormatError;  }
+    catch (Storage_StreamReadError        ) { anError = Storage_VSFormatError;  }
 
-  // Close the file
-  aFileDriver->Close();
-  delete aFileDriver;
-
-  // Initialize transient document using the root object and comments
-  Handle(Storage_HSeqOfRoot) aRoots = rData.Roots();
-
-  Handle(Storage_Root) aFirstRoot = aRoots->First();
-
-  Handle(StdObjMgt_Persistent) aFirstRootObject =
-    aReadData.Object (aFirstRoot->Reference());
-
-  Handle(StdLPersistent_PDocStd_Document) aPDocument =
-    Handle(StdLPersistent_PDocStd_Document)::DownCast (aFirstRootObject);
+    raiseOnStorageError (anError);
+  }
 
-  if (!aPDocument.IsNull())
-    aPDocument->Import (theNewDocument);
+  raiseOnStorageError (aFileDriver->EndReadDataSection());
 
-  theNewDocument->SetComments (hData.Comments());
+  // Get persistent document from the root object
+  return aReadData.PersistentObject (aRootData.Roots()->First()->Reference());
 }
 
 //=======================================================================
@@ -260,65 +237,63 @@ void StdLDrivers_DocumentRetrievalDriver::Read (Standard_IStream&
 }
 
 //=======================================================================
-//function : RaiseOnStorageError
+//function : raiseOnStorageError
 //purpose  : Update the reader status and raise an exception
 //           appropriate for the given storage error
 //=======================================================================
-Standard_Boolean StdLDrivers_DocumentRetrievalDriver::RaiseOnStorageError (Storage_Error theError)
+void StdLDrivers_DocumentRetrievalDriver::raiseOnStorageError (Storage_Error theError)
 {
   Standard_SStream aMsg;
 
   switch (theError)
   {
   case Storage_VSOk:
-    return Standard_False;
+    break;
 
   case Storage_VSOpenError:
   case Storage_VSNotOpen:
   case Storage_VSAlreadyOpen:
     myReaderStatus = PCDM_RS_OpenError;
     aMsg << "Stream Open Error" << endl;
-    break;
+    Standard_Failure::Raise (aMsg);
 
   case Storage_VSModeError:
     myReaderStatus = PCDM_RS_WrongStreamMode;
     aMsg << "Stream is opened with a wrong mode for operation" << endl;
-    break;
+    Standard_Failure::Raise (aMsg);
 
   case Storage_VSSectionNotFound:
     myReaderStatus = PCDM_RS_FormatFailure;
     aMsg << "Section is not found" << endl;
-    break;
+    Standard_Failure::Raise (aMsg);
 
   case Storage_VSFormatError:
     myReaderStatus = PCDM_RS_FormatFailure;
     aMsg << "Wrong format error" << endl;
-    break;
+    Standard_Failure::Raise (aMsg);
 
   case Storage_VSUnknownType:
     myReaderStatus = PCDM_RS_TypeFailure;
     aMsg << "Try to read an unknown type" << endl;
-    break;
+    Standard_Failure::Raise (aMsg);
 
   case Storage_VSTypeMismatch:
     myReaderStatus = PCDM_RS_TypeFailure;
     aMsg << "Try to read a wrong primitive type" << endl;
-    break;
+    Standard_Failure::Raise (aMsg);
 
   default:
     myReaderStatus = PCDM_RS_DriverFailure;
     aMsg << "Retrieval Driver Failure" << endl;
+    Standard_Failure::Raise (aMsg);
   }
-
-  Standard_Failure::Raise (aMsg);
-  return Standard_True;
 }
 
 //=======================================================================
-//function : BindTypes
+//function : bindTypes
 //purpose  : Register types
 //=======================================================================
-void StdLDrivers_DocumentRetrievalDriver::BindTypes (StdObjMgt_MapOfInstantiators& theMap)
+void StdLDrivers_DocumentRetrievalDriver::bindTypes (StdObjMgt_MapOfInstantiators& theMap)
 {
   StdLDrivers::BindTypes (theMap);
 }
index c5af92a..dc076de 100644 (file)
@@ -18,6 +18,7 @@
 #include <Storage_Error.hxx>
 
 class StdObjMgt_MapOfInstantiators;
+class StdObjMgt_Persistent;
 
 //! retrieval driver of a Part document
 class StdLDrivers_DocumentRetrievalDriver : public PCDM_RetrievalDriver
@@ -27,7 +28,8 @@ public:
   Standard_EXPORT virtual Handle(CDM_Document) CreateDocument() Standard_OVERRIDE;
 
   //! Retrieve the content of a file into a new document.
-  Standard_EXPORT virtual void Read (const TCollection_ExtendedString& theFileName,
+  Standard_EXPORT virtual void Read (
+    const TCollection_ExtendedString& theFileName,
                                      const Handle(CDM_Document)&       theNewDocument,
                                      const Handle(CDM_Application)&    theApplication) Standard_OVERRIDE;
 
@@ -39,12 +41,18 @@ public:
 
   DEFINE_STANDARD_RTTIEXT (StdLDrivers_DocumentRetrievalDriver, PCDM_RetrievalDriver)
 
+protected:
+  //! Register types.
+  Standard_EXPORT virtual void bindTypes (StdObjMgt_MapOfInstantiators& theMap);
+
 private:
-  //! Update the reader status and raise an exception appropriate for the given storage error.
-  Standard_EXPORT Standard_Boolean RaiseOnStorageError (Storage_Error theError);
+  //! Read persistent document from a file.
+  Handle(StdObjMgt_Persistent) read (
+    const TCollection_ExtendedString& theFileName,
+    Storage_HeaderData&               theHeaderData);
 
-  //! Register types.
-  Standard_EXPORT virtual void BindTypes (StdObjMgt_MapOfInstantiators& theMap);
+  //! Update the reader status and raise an exception appropriate for the given storage error.
+  Standard_EXPORT void raiseOnStorageError (Storage_Error theError);
 };
 
 #endif // _StdLDrivers_DocumentRetrievalDriver_HeaderFile
diff --git a/src/StdLObject/FILES b/src/StdLObject/FILES
new file mode 100644 (file)
index 0000000..1df0b8c
--- /dev/null
@@ -0,0 +1,2 @@
+StdLObject_GUID.cxx
+StdLObject_GUID.hxx
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include <StdLPersistent_PColStd_HArray1Base.hxx>
+#include <StdLObject_GUID.hxx>
 
-#include <StdObjMgt_ReadData.hxx>
 
 //=======================================================================
 //function : Read
 //purpose  : Read persistent data from a file
 //=======================================================================
-void StdLPersistent_PColStd_HArray1Base::Read (StdObjMgt_ReadData& theReadData)
+void StdLObject_GUID::Read (StdObjMgt_ReadData& theReadData)
 {
-  Standard_Integer aLowerBound, anUpperBound;
-  theReadData >> aLowerBound >> anUpperBound;
-  CreateArray (aLowerBound, anUpperBound);
+  Value<Standard_Integer>      a32b;
+  Value<Standard_ExtCharacter> a16b[3];
+  Value<Standard_Character>    a8b [6];
 
-  theReadData.Driver().BeginReadObjectData();
+  theReadData >> a32b >> a16b[0] >> a16b[1] >> a16b[2];
+  theReadData >> a8b[0] >> a8b[1] >> a8b[2] >> a8b[3] >> a8b[4] >> a8b[5];
 
-  Standard_Integer aSize;
-  theReadData >> aSize;
-
-  for (Standard_Integer i = aLowerBound; i <= anUpperBound; i++)
-    ReadValue (theReadData, i);
-
-  theReadData.Driver().EndReadObjectData();
+  *static_cast<Standard_GUID*> (this) =
+    Standard_GUID (a32b, a16b[0], a16b[1], a16b[2],
+                   a8b[0], a8b[1], a8b[2], a8b[3], a8b[4], a8b[5]);
 }
 // commercial license or contractual agreement.
 
 
-#ifndef _StdLPersistent_PDataStd_Integer_HeaderFile
-#define _StdLPersistent_PDataStd_Integer_HeaderFile
+#ifndef _StdLObject_GUID_HeaderFile
+#define _StdLObject_GUID_HeaderFile
 
-#include <StdObjMgt_Persistent.hxx>
+#include <StdObjMgt_Attribute.hxx>
 
+#include <Standard_GUID.hxx>
 
-class StdLPersistent_PDataStd_Integer : public StdObjMgt_Persistent
+
+class StdLObject_GUID : public Standard_GUID, private StdObjMgt_ContentTypes
 {
 public:
-  //! Read persistent data from a file.
-  Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
-
-  //! Import transient attribuite from the persistent data.
-  Standard_EXPORT virtual Handle(TDF_Attribute) ImportAttribute() const;
-
-private:
-  Standard_Integer myValue;
+  void Read (StdObjMgt_ReadData& theReadData);
 };
 
 #endif
index df9d0dc..dafe9dd 100644 (file)
@@ -1,16 +1,28 @@
-FILES
 StdLPersistent.cxx
 StdLPersistent.hxx
-StdLPersistent_PCollection_HExtendedString.cxx
-StdLPersistent_PCollection_HExtendedString.hxx
-StdLPersistent_PColStd_HArray1.hxx
-StdLPersistent_PColStd_HArray1Base.cxx
-StdLPersistent_PColStd_HArray1Base.hxx
-StdLPersistent_PDataStd_Integer.cxx
-StdLPersistent_PDataStd_Integer.hxx
-StdLPersistent_PDataStd_Name.cxx
-StdLPersistent_PDataStd_Name.hxx
-StdLPersistent_PDF_Data.cxx
-StdLPersistent_PDF_Data.hxx
-StdLPersistent_PDocStd_Document.cxx
-StdLPersistent_PDocStd_Document.hxx
+StdLPersistent_Collection.cxx
+StdLPersistent_Collection.hxx
+StdLPersistent_Data.cxx
+StdLPersistent_Data.hxx
+StdLPersistent_Dependency.cxx
+StdLPersistent_Dependency.hxx
+StdLPersistent_Document.cxx
+StdLPersistent_Document.hxx
+StdLPersistent_Function.hxx
+StdLPersistent_HArray1OfPersistent.hxx
+StdLPersistent_HArray1.cxx
+StdLPersistent_HArray1.hxx
+StdLPersistent_HArray2.cxx
+StdLPersistent_HArray2.hxx
+StdLPersistent_HString.cxx
+StdLPersistent_HString.hxx
+StdLPersistent_NamedData.cxx
+StdLPersistent_NamedData.hxx
+StdLPersistent_Real.hxx
+StdLPersistent_TreeNode.cxx
+StdLPersistent_TreeNode.hxx
+StdLPersistent_Value.cxx
+StdLPersistent_Value.hxx
+StdLPersistent_Variable.hxx
+StdLPersistent_Void.hxx
+StdLPersistent_XLink.hxx
index e5e23f4..d4f00d9 100644 (file)
 #include <StdLPersistent.hxx>
 #include <StdObjMgt_MapOfInstantiators.hxx>
 
-#include <StdLPersistent_PDocStd_Document.hxx>
-#include <StdLPersistent_PDF_Data.hxx>
-#include <StdLPersistent_PColStd_HArray1.hxx>
-#include <StdLPersistent_PCollection_HExtendedString.hxx>
-#include <StdLPersistent_PDataStd_Name.hxx>
-#include <StdLPersistent_PDataStd_Integer.hxx>
+#include <StdLPersistent_Document.hxx>
+#include <StdLPersistent_Data.hxx>
+#include <StdLPersistent_HString.hxx>
+#include <StdLPersistent_HArray1.hxx>
+#include <StdLPersistent_HArray2.hxx>
+#include <StdLPersistent_Void.hxx>
+#include <StdLPersistent_Real.hxx>
+#include <StdLPersistent_Value.hxx>
+#include <StdLPersistent_Collection.hxx>
+#include <StdLPersistent_Dependency.hxx>
+#include <StdLPersistent_Variable.hxx>
+#include <StdLPersistent_XLink.hxx>
+#include <StdLPersistent_Function.hxx>
+#include <StdLPersistent_TreeNode.hxx>
+#include <StdLPersistent_NamedData.hxx>
+
 
 //=======================================================================
 //function : BindTypes
 //=======================================================================
 void StdLPersistent::BindTypes (StdObjMgt_MapOfInstantiators& theMap)
 {
-  theMap.Bind <StdLPersistent_PDocStd_Document> ("PDocStd_Document");
-  theMap.Bind <StdLPersistent_PDF_Data>         ("PDF_Data");
-  theMap.Bind <StdLPersistent_PDataStd_Name>    ("PDataStd_Name");
-  theMap.Bind <StdLPersistent_PDataStd_Integer> ("PDataStd_Integer");
+  // Non-attribute data
+  theMap.Bind <StdLPersistent_Document> ("PDocStd_Document");
+  theMap.Bind <StdLPersistent_Data>     ("PDF_Data");
+
+  theMap.Bind <StdLPersistent_HString::Ascii>      ("PCollection_HAsciiString");
+  theMap.Bind <StdLPersistent_HString::Extended>   ("PCollection_HExtendedString");
+
+  theMap.Bind <StdLPersistent_HArray1::Integer>    ("PColStd_HArray1OfInteger");
+  theMap.Bind <StdLPersistent_HArray1::Real>       ("PColStd_HArray1OfReal");
+  theMap.Bind <StdLPersistent_HArray1::Persistent> ("PColStd_HArray1OfExtendedString");
+  theMap.Bind <StdLPersistent_HArray1::Persistent> ("PDF_HAttributeArray1");
+  theMap.Bind <StdLPersistent_HArray1::Persistent> ("PDataStd_HArray1OfHAsciiString");
+  theMap.Bind <StdLPersistent_HArray1::Persistent> ("PDataStd_HArray1OfHArray1OfInteger");
+  theMap.Bind <StdLPersistent_HArray1::Persistent> ("PDataStd_HArray1OfHArray1OfReal");
+  theMap.Bind <StdLPersistent_HArray1::Byte>       ("PDataStd_HArray1OfByte");
+
+  theMap.Bind <StdLPersistent_HArray2::Integer>    ("PColStd_HArray2OfInteger");
+
+  // Attributes
+  theMap.Bind <StdLPersistent_Void::Directory>     ("PDataStd_Directory");
+  theMap.Bind <StdLPersistent_Void::Tick>          ("PDataStd_Tick");
+  theMap.Bind <StdLPersistent_Void::NoteBook>      ("PDataStd_NoteBook");
+
+  theMap.Bind <StdLPersistent_Value::Integer>      ("PDataStd_Integer");
+  theMap.Bind <StdLPersistent_Value::TagSource>    ("PDF_TagSource");
+  theMap.Bind <StdLPersistent_Value::Reference>    ("PDF_Reference");
+  theMap.Bind <StdLPersistent_Value::UAttribute>   ("PDataStd_UAttribute");
+
+  theMap.Bind <StdLPersistent_Value::Name>         ("PDataStd_Name");
+  theMap.Bind <StdLPersistent_Value::Comment>      ("PDataStd_Comment");
+  theMap.Bind <StdLPersistent_Value::AsciiString>  ("PDataStd_AsciiString");
+
+  theMap.Bind <StdLPersistent_Collection::IntegerArray>     ("PDataStd_IntegerArray");
+  theMap.Bind <StdLPersistent_Collection::RealArray>        ("PDataStd_RealArray");
+  theMap.Bind <StdLPersistent_Collection::ByteArray>        ("PDataStd_ByteArray");
+  theMap.Bind <StdLPersistent_Collection::ExtStringArray>   ("PDataStd_ExtStringArray");
+  theMap.Bind <StdLPersistent_Collection::BooleanArray>     ("PDataStd_BooleanArray");
+  theMap.Bind <StdLPersistent_Collection::ReferenceArray>   ("PDataStd_ReferenceArray");
+
+  theMap.Bind <StdLPersistent_Collection::IntegerArray_1>   ("PDataStd_IntegerArray_1");
+  theMap.Bind <StdLPersistent_Collection::RealArray_1>      ("PDataStd_RealArray_1");
+  theMap.Bind <StdLPersistent_Collection::ByteArray_1>      ("PDataStd_ByteArray_1");
+  theMap.Bind <StdLPersistent_Collection::ExtStringArray_1> ("PDataStd_ExtStringArray_1");
 
-  theMap.Bind <StdLPersistent_PColStd_HArray1OfInteger>
-    ("PColStd_HArray1OfInteger");
+  theMap.Bind <StdLPersistent_Collection::IntegerList>      ("PDataStd_IntegerList");
+  theMap.Bind <StdLPersistent_Collection::RealList>         ("PDataStd_RealList");
+  theMap.Bind <StdLPersistent_Collection::BooleanList>      ("PDataStd_BooleanList");
+  theMap.Bind <StdLPersistent_Collection::ExtStringList>    ("PDataStd_ExtStringList");
+  theMap.Bind <StdLPersistent_Collection::ReferenceList>    ("PDataStd_ReferenceList");
 
-  theMap.Bind <StdLPersistent_PDF_HAttributeArray1>
-    ("PDF_HAttributeArray1");
+  theMap.Bind <StdLPersistent_Collection::IntPackedMap>     ("PDataStd_IntPackedMap");
+  theMap.Bind <StdLPersistent_Collection::IntPackedMap_1>   ("PDataStd_IntPackedMap_1");
 
-  theMap.Bind <StdLPersistent_PCollection_HExtendedString>
-    ("PCollection_HExtendedString");
+  theMap.Bind <StdLPersistent_Real>                   ("PDataStd_Real");
+  theMap.Bind <StdLPersistent_Dependency::Expression> ("PDataStd_Expression");
+  theMap.Bind <StdLPersistent_Dependency::Relation>   ("PDataStd_Relation");
+  theMap.Bind <StdLPersistent_Variable>               ("PDataStd_Variable");
+  theMap.Bind <StdLPersistent_XLink>                  ("PDocStd_XLink");
+  theMap.Bind <StdLPersistent_Function>               ("PFunction_Function");
+  theMap.Bind <StdLPersistent_TreeNode>               ("PDataStd_TreeNode");
+  theMap.Bind <StdLPersistent_NamedData>              ("PDataStd_NamedData");
 }
diff --git a/src/StdLPersistent/StdLPersistent_Collection.cxx b/src/StdLPersistent/StdLPersistent_Collection.cxx
new file mode 100644 (file)
index 0000000..ec44de4
--- /dev/null
@@ -0,0 +1,260 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <StdLPersistent_Collection.hxx>
+
+#include <TColStd_HPackedMapOfInteger.hxx>
+#include <TCollection_HExtendedString.hxx>
+
+
+struct StdLPersistent_Collection::noConversion
+{
+  noConversion (const Handle(TDF_Data)&) {}
+
+  template <class Type>
+  Type operator() (Type theValue) const { return theValue; }
+};
+
+struct StdLPersistent_Collection::byteConverter
+{
+  byteConverter (const Handle(TDF_Data)&) {}
+
+  Standard_Byte operator() (Standard_Integer theValue) const
+    { return static_cast<Standard_Byte> (theValue); }
+};
+
+struct StdLPersistent_Collection::stringConverter
+{
+  stringConverter (const Handle(TDF_Data)&) {}
+
+  const TCollection_ExtendedString& operator()
+    (const Handle(StdObjMgt_Persistent)& theValue) const
+  {
+    Handle(TCollection_HExtendedString) aString = theValue->ExtString();
+    if (aString)
+      return aString->String();
+    else
+    {
+      static TCollection_ExtendedString anEmptyString;
+      return anEmptyString;
+    }
+  }
+};
+
+struct StdLPersistent_Collection::referenceConverter
+{
+  referenceConverter (const Handle(TDF_Data)& theDF) : myDF (theDF) {}
+
+  TDF_Label operator() (const Handle(StdObjMgt_Persistent)& theValue) const
+    { return theValue->Label (myDF); }
+
+private:
+  Handle(TDF_Data) myDF;
+};
+
+//=======================================================================
+//function : Read
+//purpose  : Read persistent data from a file
+//=======================================================================
+template <class Persistent>
+void StdLPersistent_Collection::booleanArrayBase<Persistent>::Read
+  (StdObjMgt_ReadData& theReadData)
+{
+  StdLPersistent_Collection::booleanArrayBase<Persistent>::SingleRef::Read (theReadData);
+  theReadData >> myLower >> myUpper;
+}
+
+template <class Persistent>
+template <class ArrayHandle, class Converter>
+void StdLPersistent_Collection::booleanArrayBase<Persistent>::import
+  (const ArrayHandle& theArray, Converter theConverter) const
+{
+  Handle(TColStd_HArray1OfByte) aByteArray =
+    new TColStd_HArray1OfByte (theArray->Lower(), theArray->Upper());
+
+  for (Standard_Integer i = theArray->Lower(); i <= theArray->Upper(); i++)
+    aByteArray->SetValue (i, theConverter (theArray->Value(i)));
+
+  this->myTransient->Init (myLower, myUpper);
+  this->myTransient->SetInternalArray (aByteArray);
+}
+
+template <class Persistent>
+template <class ArrayHandle, class Converter>
+void StdLPersistent_Collection::directArrayBase<Persistent>::import
+  (const ArrayHandle& theArray, Converter) const
+{
+  this->myTransient->ChangeArray (theArray);
+}
+
+template <class Persistent>
+template <class ArrayHandle, class Converter>
+void StdLPersistent_Collection::arrayBase<Persistent>::import
+  (const ArrayHandle& theArray, Converter theConverter) const
+{
+  this->myTransient->Init (theArray->Lower(), theArray->Upper());
+  for (Standard_Integer i = theArray->Lower(); i <= theArray->Upper(); i++)
+    this->myTransient->SetValue (i, theConverter (theArray->Value(i)));
+}
+
+template <class Persistent>
+template <class ArrayHandle, class Converter>
+void StdLPersistent_Collection::listBase<Persistent>::import
+  (const ArrayHandle& theArray, Converter theConverter) const
+{
+  for (Standard_Integer i = theArray->Lower(); i <= theArray->Upper(); i++)
+    this->myTransient->Append (theConverter (theArray->Value(i)));
+}
+
+template <class Persistent>
+template <class ArrayHandle, class Converter>
+void StdLPersistent_Collection::mapBase<Persistent>::import
+  (const ArrayHandle& theArray, Converter theConverter) const
+{
+  Handle(TColStd_HPackedMapOfInteger) anHMap = new TColStd_HPackedMapOfInteger;
+  for (Standard_Integer i = theArray->Lower(); i <= theArray->Upper(); i++)
+    anHMap->ChangeMap().Add (theConverter (theArray->Value(i)));
+  this->myTransient->ChangeMap (anHMap);
+}
+
+//=======================================================================
+//function : ImportAttribute
+//purpose  : Import transient attribuite from the persistent data
+//=======================================================================
+template <template<class> class BaseT,
+          class HArrayClass,
+          class AttribClass,
+          class Converter>
+void StdLPersistent_Collection::
+       instance<BaseT, HArrayClass, AttribClass, Converter>::ImportAttribute()
+{
+  Handle(HArrayClass) anHArray;
+  if (this->myData.Cast (anHArray))
+  {
+    typename HArrayClass::ArrayHandle anArray = anHArray->Array();
+    if (anArray)
+      this->import (anArray, Converter (this->myTransient->Label().Data()));
+    this->myData.Nullify();
+  }
+}
+
+//=======================================================================
+//function : Read
+//purpose  : Read persistent data from a file
+//=======================================================================
+template <class Instance>
+void StdLPersistent_Collection::instance_1<Instance>::Read
+  (StdObjMgt_ReadData& theReadData)
+{
+  Instance::Read (theReadData);
+  theReadData >> myDelta;
+}
+
+//=======================================================================
+//function : ImportAttribute
+//purpose  : Import transient attribuite from the persistent data
+//=======================================================================
+template <class Instance>
+void StdLPersistent_Collection::instance_1<Instance>::ImportAttribute()
+{
+  Instance::ImportAttribute();
+  this->myTransient->SetDelta (myDelta);
+}
+
+
+template class StdLPersistent_Collection::instance
+  <StdLPersistent_Collection::booleanArrayBase,
+   StdLPersistent_Collection::integer,
+   TDataStd_BooleanArray,
+   StdLPersistent_Collection::byteConverter>;
+
+template class StdLPersistent_Collection::instance
+  <StdLPersistent_Collection::directArrayBase,
+   StdLPersistent_Collection::integer,
+   TDataStd_IntegerArray,
+   StdLPersistent_Collection::noConversion>;
+
+template class StdLPersistent_Collection::instance
+  <StdLPersistent_Collection::directArrayBase,
+   StdLPersistent_Collection::real,
+   TDataStd_RealArray,
+   StdLPersistent_Collection::noConversion>;
+
+template class StdLPersistent_Collection::instance
+  <StdLPersistent_Collection::arrayBase,
+   StdLPersistent_Collection::integer,
+   TDataStd_ByteArray,
+   StdLPersistent_Collection::byteConverter>;
+
+template class StdLPersistent_Collection::instance
+  <StdLPersistent_Collection::arrayBase,
+   StdLPersistent_Collection::persistent,
+   TDataStd_ExtStringArray,
+   StdLPersistent_Collection::stringConverter>;
+
+template class StdLPersistent_Collection::instance
+  <StdLPersistent_Collection::arrayBase,
+   StdLPersistent_Collection::persistent,
+   TDataStd_ReferenceArray,
+   StdLPersistent_Collection::referenceConverter>;
+
+template class StdLPersistent_Collection::instance
+  <StdLPersistent_Collection::listBase,
+   StdLPersistent_Collection::integer,
+   TDataStd_IntegerList,
+   StdLPersistent_Collection::noConversion>;
+
+template class StdLPersistent_Collection::instance
+  <StdLPersistent_Collection::listBase,
+   StdLPersistent_Collection::real,
+   TDataStd_RealList,
+   StdLPersistent_Collection::noConversion>;
+
+template class StdLPersistent_Collection::instance
+  <StdLPersistent_Collection::listBase,
+   StdLPersistent_Collection::integer,
+   TDataStd_BooleanList,
+   StdLPersistent_Collection::noConversion>;
+
+template class StdLPersistent_Collection::instance
+  <StdLPersistent_Collection::listBase,
+   StdLPersistent_Collection::persistent,
+   TDataStd_ExtStringList,
+   StdLPersistent_Collection::stringConverter>;
+
+template class StdLPersistent_Collection::instance
+  <StdLPersistent_Collection::listBase,
+   StdLPersistent_Collection::persistent,
+   TDataStd_ReferenceList,
+   StdLPersistent_Collection::referenceConverter>;
+
+template class StdLPersistent_Collection::instance
+  <StdLPersistent_Collection::mapBase,
+   StdLPersistent_Collection::integer,
+   TDataStd_IntPackedMap,
+   StdLPersistent_Collection::noConversion>;
+
+template class StdLPersistent_Collection::instance_1
+  <StdLPersistent_Collection::IntegerArray>;
+
+template class StdLPersistent_Collection::instance_1
+  <StdLPersistent_Collection::RealArray>;
+
+template class StdLPersistent_Collection::instance_1
+  <StdLPersistent_Collection::ByteArray>;
+
+template class StdLPersistent_Collection::instance_1
+  <StdLPersistent_Collection::ExtStringArray>;
+
+template class StdLPersistent_Collection::instance_1
+  <StdLPersistent_Collection::IntPackedMap>;
diff --git a/src/StdLPersistent/StdLPersistent_Collection.hxx b/src/StdLPersistent/StdLPersistent_Collection.hxx
new file mode 100644 (file)
index 0000000..643e89d
--- /dev/null
@@ -0,0 +1,197 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#ifndef _StdLPersistent_Collection_HeaderFile
+#define _StdLPersistent_Collection_HeaderFile
+
+#include <StdObjMgt_Attribute.hxx>
+#include <StdLPersistent_HArray1.hxx>
+
+#include <TDataStd_IntegerArray.hxx>
+#include <TDataStd_RealArray.hxx>
+#include <TDataStd_ByteArray.hxx>
+#include <TDataStd_ExtStringArray.hxx>
+#include <TDataStd_BooleanArray.hxx>
+#include <TDataStd_ReferenceArray.hxx>
+#include <TDataStd_IntegerList.hxx>
+#include <TDataStd_RealList.hxx>
+#include <TDataStd_ExtStringList.hxx>
+#include <TDataStd_BooleanList.hxx>
+#include <TDataStd_ReferenceList.hxx>
+#include <TDataStd_IntPackedMap.hxx>
+
+
+class StdLPersistent_Collection : private StdObjMgt_ContentTypes
+{
+  // Converters
+  struct noConversion;
+  struct byteConverter;
+  struct stringConverter;
+  struct referenceConverter;
+
+  // Base templates
+  template <class Base>
+  class booleanArrayBase : public Base
+  {
+  public:
+    //! Read persistent data from a file.
+    Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
+
+  protected:
+    template <class ArrayHandle, class Converter>
+    inline void import (const ArrayHandle& theArray, Converter theConverter)
+      const;
+
+  protected:
+    Value<Standard_Integer> myLower;
+    Value<Standard_Integer> myUpper;
+  };
+
+  template <class Base>
+  class directArrayBase : public Base
+  {
+  protected:
+    template <class ArrayHandle, class Converter>
+    inline void import (const ArrayHandle& theArray, Converter theConverter)
+      const;
+  };
+
+  template <class Base>
+  class arrayBase : public Base
+  {
+  protected:
+    template <class ArrayHandle, class Converter>
+    inline void import (const ArrayHandle& theArray, Converter theConverter)
+      const;
+  };
+
+  template <class Base>
+  class listBase : public Base
+  {
+  protected:
+    template <class ArrayHandle, class Converter>
+    inline void import (const ArrayHandle& theArray, Converter theConverter)
+      const;
+  };
+
+  template <class Base>
+  class mapBase : public Base
+  {
+  protected:
+    template <class ArrayHandle, class Converter>
+    inline void import (const ArrayHandle& theArray, Converter theConverter)
+      const;
+  };
+
+  // Instance templates
+  template <template<class> class BaseT,
+            class HArrayClass,
+            class AttribClass,
+            class Converter>
+  class instance
+    : public BaseT <typename StdObjMgt_Attribute<AttribClass>::SingleRef>
+  {
+  public:
+    //! Import transient attribuite from the persistent data.
+    Standard_EXPORT virtual void ImportAttribute();
+  };
+
+  template <class Instance>
+  class instance_1 : public Instance
+  {
+  public:
+    //! Read persistent data from a file.
+    Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
+
+    //! Import transient attribuite from the persistent data.
+    Standard_EXPORT virtual void ImportAttribute();
+
+  private:
+    Value<Standard_Boolean> myDelta;
+  };
+
+
+  // Collection type specialization
+  template<class HArrayClass, class AttribClass, class Converter = noConversion>
+  struct booleanArrayT
+    : instance<booleanArrayBase, HArrayClass, AttribClass, Converter> {};
+
+  template<class HArrayClass, class AttribClass, class Converter = noConversion>
+  struct directArrayT
+    : instance<directArrayBase, HArrayClass, AttribClass, Converter> {};
+
+  template<class HArrayClass, class AttribClass, class Converter = noConversion>
+  struct arrayT
+    : instance<arrayBase, HArrayClass, AttribClass, Converter> {};
+
+  template<class HArrayClass, class AttribClass, class Converter = noConversion>
+  struct listT
+    : instance<listBase, HArrayClass, AttribClass, Converter> {};
+
+  template<class HArrayClass, class AttribClass, class Converter = noConversion>
+  struct mapT
+    : instance<mapBase, HArrayClass, AttribClass, Converter> {};
+
+
+  // Internal array types
+  typedef StdLPersistent_HArray1::Integer    integer;
+  typedef StdLPersistent_HArray1::Real       real;
+  typedef StdLPersistent_HArray1::Persistent persistent;
+
+public:
+  // Final specialization
+  typedef booleanArrayT <integer, TDataStd_BooleanArray, byteConverter>
+    BooleanArray;
+
+  typedef directArrayT <integer, TDataStd_IntegerArray>
+    IntegerArray;
+
+  typedef directArrayT <real, TDataStd_RealArray>
+    RealArray;
+
+  typedef arrayT <integer, TDataStd_ByteArray, byteConverter>
+    ByteArray;
+
+  typedef arrayT <persistent, TDataStd_ExtStringArray, stringConverter>
+    ExtStringArray;
+
+  typedef arrayT <persistent, TDataStd_ReferenceArray, referenceConverter>
+    ReferenceArray;
+
+  typedef listT <integer, TDataStd_IntegerList>
+    IntegerList;
+
+  typedef listT <real, TDataStd_RealList>
+    RealList;
+
+  typedef listT <integer, TDataStd_BooleanList>
+    BooleanList;
+
+  typedef listT <persistent, TDataStd_ExtStringList, stringConverter>
+    ExtStringList;
+
+  typedef listT <persistent, TDataStd_ReferenceList, referenceConverter>
+    ReferenceList;
+
+  typedef mapT <integer, TDataStd_IntPackedMap>
+    IntPackedMap;
+
+  typedef instance_1<IntegerArray>    IntegerArray_1;
+  typedef instance_1<RealArray>       RealArray_1;
+  typedef instance_1<ByteArray>       ByteArray_1;
+  typedef instance_1<ExtStringArray>  ExtStringArray_1;
+  typedef instance_1<IntPackedMap>    IntPackedMap_1;
+};
+
+#endif
similarity index 63%
rename from src/StdLPersistent/StdLPersistent_PDF_Data.cxx
rename to src/StdLPersistent/StdLPersistent_Data.cxx
index 0ff63ea..c36bb49 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include <StdLPersistent_PDF_Data.hxx>
-
+#include <StdLPersistent_Data.hxx>
 #include <StdObjMgt_ReadData.hxx>
 
 #include <TDF_Data.hxx>
 #include <TDF_Attribute.hxx>
 
+
 //! Create a transient label tree from persistent data
-class StdLPersistent_PDF_Data::Parser
+class StdLPersistent_Data::Parser
 {
 public:
   //! Start parsing a persistent data.
-  Parser (const StdLPersistent_PDF_Data& theSource)
-    : myLabelsIter (theSource.myLabels->Array())
-    , myAttribIter (theSource.myAttributes->Array()) {}
+  Parser (const TColStd_HArray1OfInteger&    theLabels,
+          const StdLPersistent_HArray1OfPersistent& theAttributes)
+    : myLabelsIter (theLabels)
+    , myAttribIter (theAttributes) {}
 
   //! Fill a transient label with data.
   void FillLabel (TDF_Label theLabel)
   {
     Standard_Integer i;
 
-    // Read count of attributes
+    // Read attributes count
     myLabelsIter.Next();
     Standard_Integer anAttribCount = myLabelsIter.Value();
 
     // Add attributes to the label
-    for (i = 0 ; i < anAttribCount; i++)
+    for (i = 0; i < anAttribCount; i++)
     {
       // read persistent attribute
-      const Handle(StdObjMgt_Persistent)& aPAttrib = myAttribIter.Value();
+      Handle(StdObjMgt_Persistent)& aPAttrib = myAttribIter.ChangeValue();
       myAttribIter.Next();
 
       // create transient attribute and add it to the label
-      if (!aPAttrib.IsNull())
-      {
-        Handle(TDF_Attribute) aTAttrib = aPAttrib->ImportAttribute();
-        if (!aTAttrib.IsNull())
-          theLabel.AddAttribute (aTAttrib);
-      }
+      if (aPAttrib)
+        theLabel.AddAttribute (aPAttrib->CreateAttribute());
     }
 
-    // Read count of child labels
+    // Read child labels count
     myLabelsIter.Next();
     Standard_Integer aSubLabelsCount = myLabelsIter.Value();
 
     // Create child labels
-    for (i = 0 ; i < aSubLabelsCount; i++)
+    for (i = 0; i < aSubLabelsCount; i++)
     {
       // read tag of child label
       myLabelsIter.Next();
@@ -70,15 +67,15 @@ public:
   }
 
 private:
-  NCollection_Array1<Standard_Integer            >::Iterator myLabelsIter;
-  NCollection_Array1<Handle(StdObjMgt_Persistent)>::Iterator myAttribIter;
+  TColStd_HArray1OfInteger   ::Iterator myLabelsIter;
+  StdLPersistent_HArray1OfPersistent::Iterator myAttribIter;
 };
 
 //=======================================================================
 //function : Read
 //purpose  : Read persistent data from a file
 //=======================================================================
-void StdLPersistent_PDF_Data::Read (StdObjMgt_ReadData& theReadData)
+void StdLPersistent_Data::Read (StdObjMgt_ReadData& theReadData)
 {
   theReadData >> myVersion >> myLabels >> myAttributes;
 }
@@ -87,12 +84,23 @@ void StdLPersistent_PDF_Data::Read (StdObjMgt_ReadData& theReadData)
 //function : Import
 //purpose  : Import transient data from the persistent data
 //=======================================================================
-Handle(TDF_Data) StdLPersistent_PDF_Data::Import() const
+Handle(TDF_Data) StdLPersistent_Data::Import() const
 {
   if (myLabels.IsNull() || myAttributes.IsNull())
     return NULL;
 
+  // Create tree of labels and add empty transient attributes to them
   Handle(TDF_Data) aData = new TDF_Data;
-  Parser (*this).FillLabel (aData->Root());
+  Parser (*myLabels->Array(), *myAttributes->Array()).FillLabel (aData->Root());
+
+  // Import transient attribuites from persistent data
+  StdLPersistent_HArray1OfPersistent::Iterator anAttribIter (*myAttributes->Array());
+  for (; anAttribIter.More(); anAttribIter.Next())
+  {
+    Handle(StdObjMgt_Persistent)& aPAttrib = anAttribIter.ChangeValue();
+    if (aPAttrib)
+      aPAttrib->ImportAttribute();
+  }
+
   return aData;
 }
similarity index 73%
rename from src/StdLPersistent/StdLPersistent_PDF_Data.hxx
rename to src/StdLPersistent/StdLPersistent_Data.hxx
index eb2e13a..441a677 100644 (file)
 // commercial license or contractual agreement.
 
 
-#ifndef _StdLPersistent_PDF_Data_HeaderFile
-#define _StdLPersistent_PDF_Data_HeaderFile
+#ifndef _StdLPersistent_Data_HeaderFile
+#define _StdLPersistent_Data_HeaderFile
 
 #include <StdObjMgt_Persistent.hxx>
-
-#include <StdLPersistent_PColStd_HArray1.hxx>
+#include <StdLPersistent_HArray1.hxx>
 
 class TDF_Data;
 
 
-class StdLPersistent_PDF_Data : public StdObjMgt_Persistent
+class StdLPersistent_Data : public StdObjMgt_Persistent
 {
 public:
   //! Read persistent data from a file.
@@ -35,9 +34,9 @@ private:
   class Parser;
 
 private:
-  Standard_Integer myVersion;
-  Handle(StdLPersistent_PColStd_HArray1OfInteger) myLabels;
-  Handle(StdLPersistent_PDF_HAttributeArray1) myAttributes;
+  Value     <Standard_Integer>                   myVersion;
+  Reference <StdLPersistent_HArray1::Integer>    myLabels;
+  Reference <StdLPersistent_HArray1::Persistent> myAttributes;
 };
 
 #endif
diff --git a/src/StdLPersistent/StdLPersistent_Dependency.cxx b/src/StdLPersistent/StdLPersistent_Dependency.cxx
new file mode 100644 (file)
index 0000000..6d61612
--- /dev/null
@@ -0,0 +1,51 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <StdLPersistent_Dependency.hxx>
+
+
+static void ImportName (const Handle(TDataStd_Expression)& theAttribute,
+                        const TCollection_ExtendedString&  theName)
+  { theAttribute->SetExpression (theName); }
+
+static void ImportName (const Handle(TDataStd_Relation)&  theAttribute,
+                        const TCollection_ExtendedString& theName)
+  { theAttribute->SetRelation (theName); }
+
+
+//=======================================================================
+//function : Import
+//purpose  : Import transient attribuite from the persistent data
+//=======================================================================
+template <class AttribClass>
+void StdLPersistent_Dependency::instance<AttribClass>::Import
+  (const Handle(AttribClass)& theAttribute) const
+{
+  if (myName)
+    ImportName (theAttribute, myName->Value()->String());
+
+  if (myVariables)
+  {
+    StdLPersistent_HArray1OfPersistent::Iterator anIter (*myVariables->Array());
+    for (; anIter.More(); anIter.Next())
+    {
+      const Handle(StdObjMgt_Persistent) aPersistent = anIter.Value();
+      if (aPersistent)
+        theAttribute->GetVariables().Append (aPersistent->GetAttribute());
+    }
+  }
+}
+
+
+template class StdLPersistent_Dependency::instance<TDataStd_Expression>;
+template class StdLPersistent_Dependency::instance<TDataStd_Relation>;
diff --git a/src/StdLPersistent/StdLPersistent_Dependency.hxx b/src/StdLPersistent/StdLPersistent_Dependency.hxx
new file mode 100644 (file)
index 0000000..4d7884a
--- /dev/null
@@ -0,0 +1,49 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#ifndef _StdLPersistent_Dependency_HeaderFile
+#define _StdLPersistent_Dependency_HeaderFile
+
+#include <StdObjMgt_Attribute.hxx>
+#include <StdLPersistent_HString.hxx>
+#include <StdLPersistent_HArray1.hxx>
+
+#include <TDataStd_Expression.hxx>
+#include <TDataStd_Relation.hxx>
+
+
+class StdLPersistent_Dependency
+{
+  template <class AttribClass>
+  class instance : public StdObjMgt_Attribute<AttribClass>
+  {
+  public:
+    //! Read persistent data from a file.
+    inline void Read (StdObjMgt_ReadData& theReadData)
+      { theReadData >> myName >> myVariables; }
+
+    //! Import transient attribuite from the persistent data.
+    void Import (const Handle(AttribClass)& theAttribute) const;
+
+  private:
+    StdObjMgt_ContentTypes::Reference<StdLPersistent_HString::Extended>   myName;
+    StdObjMgt_ContentTypes::Reference<StdLPersistent_HArray1::Persistent> myVariables;
+  };
+
+public:
+  typedef instance<TDataStd_Expression> Expression;
+  typedef instance<TDataStd_Relation>   Relation;
+};
+
+#endif
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include <StdLPersistent_PDocStd_Document.hxx>
-#include <StdLPersistent_PDF_Data.hxx>
-
+#include <StdLPersistent_Document.hxx>
+#include <StdLPersistent_Data.hxx>
 #include <StdObjMgt_ReadData.hxx>
 
 #include <TDocStd_Document.hxx>
 #include <TDocStd_Owner.hxx>
 
+
 //=======================================================================
 //function : Read
 //purpose  : Read persistent data from a file
 //=======================================================================
-void StdLPersistent_PDocStd_Document::Read (StdObjMgt_ReadData& theReadData)
+void StdLPersistent_Document::Read (StdObjMgt_ReadData& theReadData)
 {
   theReadData >> myData;
 }
@@ -32,13 +32,16 @@ void StdLPersistent_PDocStd_Document::Read (StdObjMgt_ReadData& theReadData)
 //function : Import
 //purpose  : Import transient document from the persistent data
 //=======================================================================
-void StdLPersistent_PDocStd_Document::Import (const Handle(CDM_Document)& theDocument) const
+void StdLPersistent_Document::ImportDocument
+  (const Handle(TDocStd_Document)& theDocument) const
 {
-  Handle(TDocStd_Document) aDocument = Handle(TDocStd_Document)::DownCast (theDocument);
-  if (aDocument.IsNull() || myData.IsNull())
+  if (theDocument.IsNull() || myData.IsNull())
     return;
 
   Handle(TDF_Data) aData = myData->Import();
-  aDocument->SetData (aData);
-  TDocStd_Owner::SetDocument (aData, aDocument);
+  if (aData.IsNull())
+    return;
+
+  theDocument->SetData (aData);
+  TDocStd_Owner::SetDocument (aData, theDocument);
 }
 // commercial license or contractual agreement.
 
 
-#ifndef _StdLPersistent_PDocStd_Document_HeaderFile
-#define _StdLPersistent_PDocStd_Document_HeaderFile
+#ifndef _StdLPersistent_Document_HeaderFile
+#define _StdLPersistent_Document_HeaderFile
 
 #include <StdObjMgt_Persistent.hxx>
 
-class CDM_Document;
-class StdLPersistent_PDF_Data;
+class TDocStd_Document;
+class StdLPersistent_Data;
 
 
-class StdLPersistent_PDocStd_Document : public StdObjMgt_Persistent
+class StdLPersistent_Document : public StdObjMgt_Persistent
 {
 public:
   //! Read persistent data from a file.
   Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
 
   //! Import transient document from the persistent data.
-  Standard_EXPORT void Import (const Handle(CDM_Document)& theDocument) const;
+  Standard_EXPORT virtual void ImportDocument
+    (const Handle(TDocStd_Document)& theDocument) const;
 
 private:
-  Handle(StdLPersistent_PDF_Data) myData;
+  Reference<StdLPersistent_Data> myData;
 };
 
 #endif
 // commercial license or contractual agreement.
 
 
-#ifndef _StdLPersistent_PDataStd_Name_HeaderFile
-#define _StdLPersistent_PDataStd_Name_HeaderFile
+#ifndef _StdLPersistent_Function_HeaderFile
+#define _StdLPersistent_Function_HeaderFile
 
-#include <StdObjMgt_Persistent.hxx>
+#include <StdObjMgt_Attribute.hxx>
+#include <StdLObject_GUID.hxx>
 
-class StdLPersistent_PCollection_HExtendedString;
+#include <TFunction_Function.hxx>
 
 
-class StdLPersistent_PDataStd_Name : public StdObjMgt_Persistent
+class StdLPersistent_Function : public StdObjMgt_Attribute<TFunction_Function>
 {
 public:
   //! Read persistent data from a file.
-  Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
+  inline void Read (StdObjMgt_ReadData& theReadData)
+    { theReadData >> myDriverGUID >> myFailure; }
 
   //! Import transient attribuite from the persistent data.
-  Standard_EXPORT virtual Handle(TDF_Attribute) ImportAttribute() const;
+  void Import (const Handle(TFunction_Function)& theAttribute) const
+  {
+    theAttribute->SetDriverGUID (myDriverGUID);
+    theAttribute->SetFailure    (myFailure);
+  }
 
 private:
-  Handle(StdLPersistent_PCollection_HExtendedString) myString;
+  Object<StdLObject_GUID> myDriverGUID;
+  Value<Standard_Integer> myFailure;
 };
 
 #endif
diff --git a/src/StdLPersistent/StdLPersistent_HArray1.cxx b/src/StdLPersistent/StdLPersistent_HArray1.cxx
new file mode 100644 (file)
index 0000000..ef0cb92
--- /dev/null
@@ -0,0 +1,55 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <StdLPersistent_HArray1.hxx>
+#include <StdObjMgt_ReadData.hxx>
+
+
+//=======================================================================
+//function : Read
+//purpose  : Read persistent data from a file
+//=======================================================================
+void StdLPersistent_HArray1::commonBase::Read (StdObjMgt_ReadData& theReadData)
+{
+  Value<Standard_Integer> aLowerBound, anUpperBound;
+  theReadData >> aLowerBound >> anUpperBound;
+  createArray (aLowerBound, anUpperBound);
+
+  theReadData.Driver().BeginReadObjectData();
+
+  Standard_Integer aSize;
+  theReadData.ReadValue (aSize);
+
+  for (Standard_Integer i = aLowerBound; i <= anUpperBound; i++)
+    readValue (theReadData, i);
+
+  theReadData.Driver().EndReadObjectData();
+}
+
+template <class ArrayClass, class ValueClass>
+void StdLPersistent_HArray1::instance<ArrayClass, ValueClass>::readValue (
+  StdObjMgt_ReadData& theReadData,
+  const Standard_Integer theIndex)
+{
+  ValueClass aValue;
+  theReadData >> aValue;
+  this->myArray->SetValue (theIndex, static_cast<typename ArrayClass::value_type> (aValue));
+}
+
+
+template class StdLPersistent_HArray1::instance<TColStd_HArray1OfInteger>;
+template class StdLPersistent_HArray1::instance<TColStd_HArray1OfReal>;
+template class StdLPersistent_HArray1::instance<TColStd_HArray1OfByte,
+  StdObjMgt_ContentTypes::Value<Standard_Character> >;
+template class StdLPersistent_HArray1::instance<StdLPersistent_HArray1OfPersistent,
+  StdObjMgt_ContentTypes::Reference<> >;
diff --git a/src/StdLPersistent/StdLPersistent_HArray1.hxx b/src/StdLPersistent/StdLPersistent_HArray1.hxx
new file mode 100644 (file)
index 0000000..c8c9bce
--- /dev/null
@@ -0,0 +1,83 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#ifndef _StdLPersistent_HArray1_HeaderFile
+#define _StdLPersistent_HArray1_HeaderFile
+
+#include <StdObjMgt_Persistent.hxx>
+#include <StdLPersistent_HArray1OfPersistent.hxx>
+#include <TColStd_HArray1OfInteger.hxx>
+#include <TColStd_HArray1OfReal.hxx>
+#include <TColStd_HArray1OfByte.hxx>
+
+class TCollection_HExtendedString;
+class TDF_Label;
+class TDF_Data;
+
+
+class StdLPersistent_HArray1 : protected StdObjMgt_ContentTypes
+{
+  class commonBase : public StdObjMgt_Persistent
+  {
+  public:
+    //! Read persistent data from a file.
+    Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
+
+  protected:
+    virtual void createArray (const Standard_Integer theLowerBound,
+                              const Standard_Integer theUpperBound) = 0;
+
+    virtual void readValue (StdObjMgt_ReadData& theReadData,
+                            const Standard_Integer theIndex) = 0;
+  };
+
+protected:
+  template <class ArrayClass>
+  class base : public commonBase
+  {
+  public:
+    typedef Handle(ArrayClass)              ArrayHandle;
+    typedef typename ArrayClass::value_type ValueType;
+    typedef typename ArrayClass::Iterator   Iterator;
+
+  public:
+    //! Get the array.
+    const Handle(ArrayClass)& Array() const  { return myArray; }
+
+  protected:
+    virtual void createArray (const Standard_Integer theLowerBound,
+                              const Standard_Integer theUpperBound)
+      { myArray = new ArrayClass (theLowerBound, theUpperBound); }
+
+  protected:
+    Handle(ArrayClass) myArray;
+  };
+
+private:
+  template <class ArrayClass, class ValueClass = Value<typename ArrayClass::value_type> >
+  class instance : public base<ArrayClass>
+  {
+  protected:
+    Standard_EXPORT virtual void readValue (StdObjMgt_ReadData& theReadData,
+                                            const Standard_Integer theIndex);
+  };
+
+public:
+  typedef instance<TColStd_HArray1OfInteger>                         Integer;
+  typedef instance<TColStd_HArray1OfReal>                            Real;
+  typedef instance<TColStd_HArray1OfByte, Value<Standard_Character> >Byte;
+  typedef instance<StdLPersistent_HArray1OfPersistent, Reference<> >        Persistent;
+};
+
+#endif
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
+#ifndef _StdLPersistent_HArray1OfPersistent_HeaderFile
+#define _StdLPersistent_HArray1OfPersistent_HeaderFile
 
-#ifndef _StdLPersistent_PCollection_HExtendedString_HeaderFile
-#define _StdLPersistent_PCollection_HExtendedString_HeaderFile
 
+#include <NCollection_DefineHArray1.hxx>
 #include <StdObjMgt_Persistent.hxx>
 
-class TCollection_HExtendedString;
+DEFINE_HARRAY1 (StdLPersistent_HArray1OfPersistent,
+                NCollection_Array1<Handle(StdObjMgt_Persistent)>)
 
-
-class StdLPersistent_PCollection_HExtendedString : public StdObjMgt_Persistent
-{
-public:
-  //! Read persistent data from a file.
-  Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
-
-  //! Get the value.
-  Handle(TCollection_HExtendedString) Value() const { return myValue; }
-
-private:
-  Handle(TCollection_HExtendedString) myValue;
-};
-
-#endif
+#endif // _StdLPersistent_HArray1OfPersistent_HeaderFile
diff --git a/src/StdLPersistent/StdLPersistent_HArray2.cxx b/src/StdLPersistent/StdLPersistent_HArray2.cxx
new file mode 100644 (file)
index 0000000..99135e4
--- /dev/null
@@ -0,0 +1,56 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <StdLPersistent_HArray2.hxx>
+#include <StdObjMgt_ReadData.hxx>
+
+#include <TColStd_HArray2OfInteger.hxx>
+#include <TColStd_HArray2OfReal.hxx>
+
+
+//=======================================================================
+//function : Read
+//purpose  : Read persistent data from a file
+//=======================================================================
+void StdLPersistent_HArray2::commonBase::Read (StdObjMgt_ReadData& theReadData)
+{
+  Value<Standard_Integer> aLowerRow, aLowerCol, anUpperRow, anUpperCol;
+  theReadData >> aLowerRow >> aLowerCol >> anUpperRow >> anUpperCol;
+  createArray (aLowerRow, aLowerCol, anUpperRow, anUpperCol);
+
+  theReadData.Driver().BeginReadObjectData();
+
+  Standard_Integer aSize;
+  theReadData.ReadValue (aSize);
+
+  for (Standard_Integer aRow = aLowerRow; aRow <= anUpperRow; aRow++)
+    for (Standard_Integer aCol = aLowerCol; aCol <= anUpperCol; aCol++)
+      readValue (theReadData, aRow, aCol);
+
+  theReadData.Driver().EndReadObjectData();
+}
+
+template <class ArrayClass>
+void StdLPersistent_HArray2::instance<ArrayClass>::readValue (
+  StdObjMgt_ReadData&    theReadData,
+  const Standard_Integer theRow,
+  const Standard_Integer theCol)
+{
+  typename ArrayClass::value_type aValue;
+  theReadData.ReadValue (aValue);
+  this->myArray->SetValue (theRow, theCol, aValue);
+}
+
+
+template class StdLPersistent_HArray2::instance<TColStd_HArray2OfInteger>;
+template class StdLPersistent_HArray2::instance<TColStd_HArray2OfReal>;
diff --git a/src/StdLPersistent/StdLPersistent_HArray2.hxx b/src/StdLPersistent/StdLPersistent_HArray2.hxx
new file mode 100644 (file)
index 0000000..045bcb5
--- /dev/null
@@ -0,0 +1,82 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#ifndef _StdLPersistent_HArray2_HeaderFile
+#define _StdLPersistent_HArray2_HeaderFile
+
+#include <StdObjMgt_Persistent.hxx>
+
+#include <TColStd_HArray2OfInteger.hxx>
+#include <TColStd_HArray2OfReal.hxx>
+
+
+class StdLPersistent_HArray2
+{
+  class commonBase : public StdObjMgt_Persistent
+  {
+  public:
+    //! Read persistent data from a file.
+    Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
+
+  protected:
+    virtual void createArray (
+      const Standard_Integer theLowerRow, const Standard_Integer theLowerCol,
+      const Standard_Integer theUpperRow, const Standard_Integer theUpperCol)
+        = 0;
+
+    virtual void readValue (StdObjMgt_ReadData&    theReadData,
+                            const Standard_Integer theRow,
+                            const Standard_Integer theCol) = 0;
+  };
+
+protected:
+  template <class ArrayClass>
+  class base : public commonBase
+  {
+  public:
+    typedef Handle(ArrayClass) ArrayHandle;
+
+  public:
+    //! Get the array.
+    const Handle(ArrayClass)& Array() const  { return myArray; }
+
+  protected:
+    virtual void createArray (
+      const Standard_Integer theLowerRow, const Standard_Integer theLowerCol,
+      const Standard_Integer theUpperRow, const Standard_Integer theUpperCol)
+    {
+      myArray = new ArrayClass (theLowerRow, theUpperRow,
+                                theLowerCol, theUpperCol);
+    }
+
+  protected:
+    Handle(ArrayClass) myArray;
+  };
+
+private:
+  template <class ArrayClass>
+  class instance : public base<ArrayClass>
+  {
+  protected:
+    Standard_EXPORT virtual void readValue (StdObjMgt_ReadData&    theReadData,
+                                            const Standard_Integer theRow,
+                                            const Standard_Integer theCol);
+  };
+
+public:
+  typedef instance<TColStd_HArray2OfInteger> Integer;
+  typedef instance<TColStd_HArray2OfReal>    Real;
+};
+
+#endif
diff --git a/src/StdLPersistent/StdLPersistent_HString.cxx b/src/StdLPersistent/StdLPersistent_HString.cxx
new file mode 100644 (file)
index 0000000..04000c4
--- /dev/null
@@ -0,0 +1,81 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <StdLPersistent_HString.hxx>
+#include <StdObjMgt_ReadData.hxx>
+#include <TDF_Label.hxx>
+#include <TDF_Tool.hxx>
+
+
+//=======================================================================
+//function : Read
+//purpose  : Read persistent data from a file
+//=======================================================================
+template <class StringClass, typename CharType>
+void StdLPersistent_HString::instance<StringClass, CharType>::Read
+  (StdObjMgt_ReadData& theReadData)
+{
+  theReadData.Driver().BeginReadObjectData();
+
+  Standard_Integer aSize;
+  theReadData.ReadValue (aSize);
+  myValue = new StringClass (aSize, 0);
+
+  for (Standard_Integer i = 1; i <= aSize; i++)
+  {
+    CharType aChar;
+    theReadData.ReadValue (aChar);
+    myValue->SetValue (i, aChar);
+  }
+
+  theReadData.Driver().EndReadObjectData();
+}
+
+//=======================================================================
+//function : Label
+//purpose  : Get/create a label defined by referenced string
+//=======================================================================
+template <class StringClass, typename CharType>
+TDF_Label StdLPersistent_HString::instance<StringClass, CharType>::Label
+  (const Handle(TDF_Data)& theDF) const
+{
+  TDF_Label aLabel;
+
+  if (!myValue.IsNull())
+    TDF_Tool::Label (theDF, myValue->String(), aLabel, Standard_True);
+
+  return aLabel;
+}
+
+//=======================================================================
+//function : AsciiString
+//purpose  : Get referenced ASCII string
+//=======================================================================
+Handle(TCollection_HAsciiString)
+  StdLPersistent_HString::Ascii::AsciiString() const
+    { return myValue; }
+
+//=======================================================================
+//function : ExtString
+//purpose  : Get referenced extended string
+//=======================================================================
+Handle(TCollection_HExtendedString)
+  StdLPersistent_HString::Extended::ExtString() const
+    { return myValue; }
+
+
+template class StdLPersistent_HString::instance
+  <TCollection_HAsciiString, Standard_Character>;
+
+template class StdLPersistent_HString::instance
+  <TCollection_HExtendedString, Standard_ExtCharacter>;
diff --git a/src/StdLPersistent/StdLPersistent_HString.hxx b/src/StdLPersistent/StdLPersistent_HString.hxx
new file mode 100644 (file)
index 0000000..a608d24
--- /dev/null
@@ -0,0 +1,62 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#ifndef _StdLPersistent_HString_HeaderFile
+#define _StdLPersistent_HString_HeaderFile
+
+#include <StdObjMgt_Persistent.hxx>
+
+#include <Standard_TypeDef.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <TCollection_HExtendedString.hxx>
+
+
+class StdLPersistent_HString
+{
+  template <class StringClass, typename CharType>
+  class instance : public StdObjMgt_Persistent
+  {
+  public:
+    //! Read persistent data from a file.
+    Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
+
+    //! Get/create a label defined by referenced string.
+    Standard_EXPORT virtual TDF_Label Label (const Handle(TDF_Data)& theDF) const;
+
+    //! Get the value.
+    const Handle(StringClass)& Value() const  { return myValue; }
+
+  protected:
+    Handle(StringClass) myValue;
+  };
+
+public:
+  class Ascii
+    : public instance<TCollection_HAsciiString, Standard_Character>
+  {
+  public:
+    //! Get referenced ASCII string.
+    Standard_EXPORT virtual Handle(TCollection_HAsciiString) AsciiString() const;
+  };
+
+  class Extended
+    : public instance<TCollection_HExtendedString, Standard_ExtCharacter>
+  {
+  public:
+    //! Get referenced extended string.
+    Standard_EXPORT virtual Handle(TCollection_HExtendedString) ExtString() const;
+  };
+};
+
+#endif
diff --git a/src/StdLPersistent/StdLPersistent_NamedData.cxx b/src/StdLPersistent/StdLPersistent_NamedData.cxx
new file mode 100644 (file)
index 0000000..01a68d1
--- /dev/null
@@ -0,0 +1,137 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <StdLPersistent_NamedData.hxx>
+
+#include <TCollection_HExtendedString.hxx>
+
+#include <TColStd_DataMapOfStringInteger.hxx>
+#include <TDataStd_DataMapOfStringReal.hxx>
+#include <TDataStd_DataMapOfStringString.hxx>
+#include <TDataStd_DataMapOfStringByte.hxx>
+#include <TDataStd_DataMapOfStringHArray1OfInteger.hxx>
+#include <TDataStd_DataMapOfStringHArray1OfReal.hxx>
+
+
+//=======================================================================
+//function : Import
+//purpose  : Import transient attribuite from the persistent data
+//=======================================================================
+void StdLPersistent_NamedData::Import
+  (const Handle(TDataStd_NamedData)& theAttribute) const
+{
+  if (myDimensions.IsNull())
+    return;
+
+  if (myInts)
+  {
+    TColStd_DataMapOfStringInteger aMap;
+    for (Standard_Integer i = lower(0); i <= upper(0); i++)
+    {
+      Standard_Integer aValue = 0;
+      aMap.Bind (myInts.Get (i, aValue), aValue);
+    }
+    theAttribute->ChangeIntegers (aMap);
+  }
+
+  if (myReals)
+  {
+    TDataStd_DataMapOfStringReal aMap;
+    for (Standard_Integer i = lower(1); i <= upper(1); i++)
+    {
+      Standard_Real aValue = 0.0;
+      aMap.Bind (myReals.Get (i, aValue), aValue);
+    }
+    theAttribute->ChangeReals (aMap);
+  }
+
+  if (myStrings)
+  {
+    TDataStd_DataMapOfStringString aMap;
+    for (Standard_Integer i = lower(2); i <= upper(2); i++)
+    {
+      Handle(StdObjMgt_Persistent) aValue;
+      aMap.Bind (myStrings.Get (i, aValue),
+                 aValue ? aValue->ExtString()->String()
+                        : TCollection_ExtendedString());
+    }
+    theAttribute->ChangeStrings (aMap);
+  }
+
+  if (myBytes)
+  {
+    TDataStd_DataMapOfStringByte aMap;
+    for (Standard_Integer i = lower(3); i <= upper(3); i++)
+    {
+      Standard_Byte aValue = 0;
+      aMap.Bind (myBytes.Get (i, aValue), aValue);
+    }
+    theAttribute->ChangeBytes (aMap);
+  }
+
+  if (myIntArrays)
+  {
+    TDataStd_DataMapOfStringHArray1OfInteger aMap;
+    for (Standard_Integer i = lower(4); i <= upper(4); i++)
+    {
+      Handle(StdObjMgt_Persistent)      aValue;
+      const TCollection_ExtendedString& aKey = myIntArrays.Get (i, aValue);
+
+      Handle(StdLPersistent_HArray1::Integer) aPArray =
+        Handle(StdLPersistent_HArray1::Integer)::DownCast (aValue);
+
+      Handle(TColStd_HArray1OfInteger) aTArray;
+      if (aPArray)
+        aTArray = aPArray->Array();
+
+      aMap.Bind (aKey, aTArray);
+    }
+    theAttribute->ChangeArraysOfIntegers (aMap);
+  }
+
+  if (myRealArrays)
+  {
+    TDataStd_DataMapOfStringHArray1OfReal aMap;
+    for (Standard_Integer i = lower(5); i <= upper(5); i++)
+    {
+      Handle(StdObjMgt_Persistent)      aValue;
+      const TCollection_ExtendedString& aKey = myRealArrays.Get (i, aValue);
+
+      Handle(StdLPersistent_HArray1::Real) aPArray =
+        Handle(StdLPersistent_HArray1::Real)::DownCast (aValue);
+
+      Handle(TColStd_HArray1OfReal) aTArray;
+      if (aPArray)
+        aTArray = aPArray->Array();
+
+      aMap.Bind (aKey, aTArray);
+    }
+    theAttribute->ChangeArraysOfReals (aMap);
+  }
+}
+
+Standard_Integer
+  StdLPersistent_NamedData::lower (Standard_Integer theIndex) const
+{
+  const Handle(TColStd_HArray2OfInteger)& aDimensions = myDimensions->Array();
+  return aDimensions->Value (aDimensions->LowerRow() + theIndex,
+                             aDimensions->LowerCol());
+}
+
+Standard_Integer
+  StdLPersistent_NamedData::upper (Standard_Integer theIndex) const
+{
+  const Handle(TColStd_HArray2OfInteger)& aDimensions = myDimensions->Array();
+  return aDimensions->Value (aDimensions->LowerRow() + theIndex,
+                             aDimensions->UpperCol());
+}
diff --git a/src/StdLPersistent/StdLPersistent_NamedData.hxx b/src/StdLPersistent/StdLPersistent_NamedData.hxx
new file mode 100644 (file)
index 0000000..56d40e2
--- /dev/null
@@ -0,0 +1,76 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#ifndef _StdLPersistent_NamedData_HeaderFile
+#define _StdLPersistent_NamedData_HeaderFile
+
+#include <StdObjMgt_Attribute.hxx>
+#include <StdLPersistent_HArray1.hxx>
+#include <StdLPersistent_HArray2.hxx>
+
+#include <TDataStd_NamedData.hxx>
+#include <TCollection_HExtendedString.hxx>
+
+class StdLPersistent_NamedData : public StdObjMgt_Attribute<TDataStd_NamedData>
+{
+  template <class HValuesArray>
+  class element
+  {
+  public:
+    inline void Read (StdObjMgt_ReadData& theReadData)
+      { theReadData >> myKeys >> myValues; }
+
+    inline operator bool() const
+      { return ! myKeys.IsNull(); }
+
+    template <class Value>
+    inline const TCollection_ExtendedString& Get
+      (Standard_Integer theIndex, Value& theValue) const
+    {
+      if (myValues)
+        theValue = myValues->Array()->Value(theIndex);
+      return myKeys->Array()->Value(theIndex)->ExtString()->String();
+    }
+
+  private:
+    Reference <StdLPersistent_HArray1::Persistent> myKeys;
+    Reference <HValuesArray>                       myValues;
+  };
+
+public:
+  //! Read persistent data from a file.
+  inline void Read (StdObjMgt_ReadData& theReadData)
+  {
+    theReadData >> myDimensions >>
+      myInts >> myReals >> myStrings >> myBytes >> myIntArrays >> myRealArrays;
+  }
+
+  //! Import transient attribuite from the persistent data.
+  void Import (const Handle(TDataStd_NamedData)& theAttribute) const;
+
+private:
+  inline Standard_Integer lower (Standard_Integer theIndex) const;
+  inline Standard_Integer upper (Standard_Integer theIndex) const;
+
+private:
+  Reference <StdLPersistent_HArray2::Integer>           myDimensions;
+  Object <element<StdLPersistent_HArray1::Integer>    > myInts;
+  Object <element<StdLPersistent_HArray1::Real>       > myReals;
+  Object <element<StdLPersistent_HArray1::Persistent> > myStrings;
+  Object <element<StdLPersistent_HArray1::Byte>       > myBytes;
+  Object <element<StdLPersistent_HArray1::Persistent> > myIntArrays;
+  Object <element<StdLPersistent_HArray1::Persistent> > myRealArrays;
+};
+
+#endif
diff --git a/src/StdLPersistent/StdLPersistent_PColStd_HArray1.hxx b/src/StdLPersistent/StdLPersistent_PColStd_HArray1.hxx
deleted file mode 100644 (file)
index f1e2c0c..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (c) 2015 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-
-#ifndef _StdLPersistent_PColStd_HArray1_HeaderFile
-#define _StdLPersistent_PColStd_HArray1_HeaderFile
-
-#include <StdLPersistent_PColStd_HArray1Base.hxx>
-
-#include <StdObjMgt_ReadData.hxx>
-
-#include <NCollection_Handle.hxx>
-#include <NCollection_Array1.hxx>
-
-#include <Standard_TypeDef.hxx>
-
-class StdObjMgt_Persistent;
-
-
-template <class Type>
-class StdLPersistent_PColStd_HArray1 : public StdLPersistent_PColStd_HArray1Base
-{
-public:
-  //! Get the value.
-  const NCollection_Array1<Type>& Array() const { return *myArray; }
-
-protected:
-  virtual void CreateArray (const Standard_Integer theLowerBound,
-                            const Standard_Integer theUpperBound)
-  {
-    myArray = new NCollection_Array1<Type> (theLowerBound, theUpperBound);
-  }
-
-  virtual void ReadValue (StdObjMgt_ReadData& theReadData,
-                          const Standard_Integer theIndex)
-  {
-    Type aValue;
-    theReadData >> aValue;
-    myArray->SetValue (theIndex, aValue);
-  }
-
-private:
-  NCollection_Handle<NCollection_Array1<Type>> myArray;
-};
-
-typedef StdLPersistent_PColStd_HArray1<Standard_Integer>
-        StdLPersistent_PColStd_HArray1OfInteger;
-
-typedef StdLPersistent_PColStd_HArray1<Handle(StdObjMgt_Persistent)>
-        StdLPersistent_PDF_HAttributeArray1;
-
-#endif
 // commercial license or contractual agreement.
 
 
-#ifndef _StdLPersistent_PDataStd_Name_HeaderFile
-#define _StdLPersistent_PDataStd_Name_HeaderFile
+#ifndef _StdLPersistent_Real_HeaderFile
+#define _StdLPersistent_Real_HeaderFile
 
-#include <StdObjMgt_Persistent.hxx>
+#include <StdObjMgt_Attribute.hxx>
 
-class StdLPersistent_PCollection_HExtendedString;
+#include <TDataStd_Real.hxx>
+#include <TDataStd_RealEnum.hxx>
 
 
-class StdLPersistent_PDataStd_Name : public StdObjMgt_Persistent
+class StdLPersistent_Real : public StdObjMgt_Attribute<TDataStd_Real>
 {
 public:
   //! Read persistent data from a file.
-  Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
+  inline void Read (StdObjMgt_ReadData& theReadData)
+    { theReadData >> myValue >> myDimension; }
 
   //! Import transient attribuite from the persistent data.
-  Standard_EXPORT virtual Handle(TDF_Attribute) ImportAttribute() const;
+  void Import (const Handle(TDataStd_Real)& theAttribute) const
+  {
+    theAttribute->Set (myValue);
+    theAttribute->SetDimension (myDimension);
+  }
 
 private:
-  Handle(StdLPersistent_PCollection_HExtendedString) myString;
+  Value<Standard_Real>    myValue;
+  Enum<TDataStd_RealEnum> myDimension;
 };
 
 #endif
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include <StdLPersistent_PDataStd_Name.hxx>
-#include <StdLPersistent_PCollection_HExtendedString.hxx>
+#include <StdLPersistent_TreeNode.hxx>
 
-#include <StdObjMgt_ReadData.hxx>
-
-#include <TCollection_HExtendedString.hxx>
-#include <TDataStd_Name.hxx>
 
 //=======================================================================
 //function : Read
 //purpose  : Read persistent data from a file
 //=======================================================================
-void StdLPersistent_PDataStd_Name::Read (StdObjMgt_ReadData& theReadData)
+void StdLPersistent_TreeNode::Read (StdObjMgt_ReadData& theReadData)
+{
+  myDynamicData = new dynamic;
+  theReadData >> myDynamicData->First >> myNext >> myDynamicData->TreeID;
+}
+
+//=======================================================================
+//function : CreateAttribute
+//purpose  : Create an empty transient attribuite
+//=======================================================================
+Handle(TDF_Attribute) StdLPersistent_TreeNode::CreateAttribute()
 {
-  theReadData >> myString;
+  Static::CreateAttribute();
+  myTransient->SetTreeID (myDynamicData->TreeID);
+  return myTransient;
 }
 
 //=======================================================================
 //function : ImportAttribute
 //purpose  : Import transient attribuite from the persistent data
 //=======================================================================
-Handle(TDF_Attribute) StdLPersistent_PDataStd_Name::ImportAttribute() const
+void StdLPersistent_TreeNode::ImportAttribute()
 {
-  if (myString.IsNull() || myString->Value().IsNull())
-    return NULL;
+  if (myDynamicData)
+  {
+    Handle(StdLPersistent_TreeNode) aChild = myDynamicData->First;
+    while (aChild)
+    {
+      if (aChild->myTransient)
+        myTransient->Append(aChild->myTransient);
+      StdLPersistent_TreeNode* aCurr = aChild.get();
+      aChild = aChild->myNext;
+      aCurr->myNext.Nullify(); // this reference is no longer needed
+    }
 
-  Handle(TDataStd_Name) aName = new TDataStd_Name;
-  aName->Set (myString->Value()->String());
-  return aName;
+    myDynamicData.Nullify();
+  }
 }
 // commercial license or contractual agreement.
 
 
-#ifndef _StdLPersistent_PDataStd_Name_HeaderFile
-#define _StdLPersistent_PDataStd_Name_HeaderFile
+#ifndef _StdLPersistent_TreeNode_HeaderFile
+#define _StdLPersistent_TreeNode_HeaderFile
 
-#include <StdObjMgt_Persistent.hxx>
+#include <StdObjMgt_Attribute.hxx>
+#include <StdLObject_GUID.hxx>
 
-class StdLPersistent_PCollection_HExtendedString;
+#include <TDataStd_TreeNode.hxx>
 
 
-class StdLPersistent_PDataStd_Name : public StdObjMgt_Persistent
+class StdLPersistent_TreeNode
+  : public StdObjMgt_Attribute<TDataStd_TreeNode>::Static
 {
 public:
   //! Read persistent data from a file.
   Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
 
+  //! Create an empty transient attribuite
+  Standard_EXPORT virtual Handle(TDF_Attribute) CreateAttribute();
+
   //! Import transient attribuite from the persistent data.
-  Standard_EXPORT virtual Handle(TDF_Attribute) ImportAttribute() const;
+  Standard_EXPORT virtual void ImportAttribute();
 
 private:
-  Handle(StdLPersistent_PCollection_HExtendedString) myString;
+  struct dynamic : public Standard_Transient
+  {
+    Reference <StdLPersistent_TreeNode> First;
+    Object    <StdLObject_GUID>         TreeID;
+  };
+
+  Handle(dynamic) myDynamicData;
+  Reference<StdLPersistent_TreeNode> myNext;
 };
 
 #endif
diff --git a/src/StdLPersistent/StdLPersistent_Value.cxx b/src/StdLPersistent/StdLPersistent_Value.cxx
new file mode 100644 (file)
index 0000000..130ec7a
--- /dev/null
@@ -0,0 +1,97 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <StdLPersistent_Value.hxx>
+
+#include <TCollection_HExtendedString.hxx>
+#include <Standard_GUID.hxx>
+
+
+//=======================================================================
+//function : ImportAttribute
+//purpose  : Import transient attribuite from the persistent data
+//=======================================================================
+template <class AttribClass>
+void StdLPersistent_Value::integer<AttribClass>::ImportAttribute()
+{
+  this->myTransient->Set (this->myData);
+}
+
+//=======================================================================
+//function : ImportAttribute
+//purpose  : Import transient attribuite from the persistent data
+//=======================================================================
+template <class AttribClass, class HStringClass>
+void StdLPersistent_Value::string<AttribClass, HStringClass>::ImportAttribute()
+{
+  Handle(HStringClass) anHString;
+  if (this->myData.Cast (anHString))
+  {
+    this->myTransient->Set (anHString->Value()->String());
+    this->myData.Nullify();
+  }
+}
+
+//=======================================================================
+//function : ImportAttribute
+//purpose  : Import transient attribuite from the persistent data
+//=======================================================================
+template<>
+void StdLPersistent_Value::string<TDF_Reference>::ImportAttribute()
+{
+  if (this->myData)
+  {
+    TDF_Label aLabel = myData->Label (this->myTransient->Label().Data());
+    if (!aLabel.IsNull())
+      this->myTransient->Set (aLabel);
+    this->myData.Nullify();
+  }
+}
+
+//=======================================================================
+//function : ImportAttribute
+//purpose  : Import transient attribuite from the persistent data
+//=======================================================================
+template<>
+void StdLPersistent_Value::string<TDataStd_UAttribute>::ImportAttribute()
+{}
+
+//=======================================================================
+//function : CreateAttribute
+//purpose  : Create an empty transient attribuite
+//=======================================================================
+Handle(TDF_Attribute) StdLPersistent_Value::UAttribute::CreateAttribute()
+{
+  string<TDataStd_UAttribute,StdLPersistent_HString::Extended>::CreateAttribute();
+
+  if (this->myData)
+  {
+    Handle(TCollection_HExtendedString) aString = this->myData->ExtString();
+    if (aString)
+      this->myTransient->SetID (Standard_GUID (aString->String().ToExtString()));
+    this->myData.Nullify();
+  }
+
+  return this->myTransient;
+  }
+
+
+template class StdLPersistent_Value::integer <TDataStd_Integer>;
+template class StdLPersistent_Value::integer <TDF_TagSource>;
+
+template class StdLPersistent_Value::string <TDF_Reference>;
+template class StdLPersistent_Value::string <TDataStd_UAttribute>;
+template class StdLPersistent_Value::string <TDataStd_Name>;
+template class StdLPersistent_Value::string <TDataStd_Comment>;
+template class StdLPersistent_Value::string <TDataStd_AsciiString,
+                                             StdLPersistent_HString::Ascii>;
diff --git a/src/StdLPersistent/StdLPersistent_Value.hxx b/src/StdLPersistent/StdLPersistent_Value.hxx
new file mode 100644 (file)
index 0000000..9bffe45
--- /dev/null
@@ -0,0 +1,67 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#ifndef _StdLPersistent_Value_HeaderFile
+#define _StdLPersistent_Value_HeaderFile
+
+#include <StdObjMgt_Attribute.hxx>
+#include <StdLPersistent_HString.hxx>
+
+#include <TDataStd_Integer.hxx>
+#include <TDF_TagSource.hxx>
+#include <TDF_Reference.hxx>
+#include <TDataStd_UAttribute.hxx>
+#include <TDataStd_Name.hxx>
+#include <TDataStd_Comment.hxx>
+#include <TDataStd_AsciiString.hxx>
+
+
+class StdLPersistent_Value
+{
+  template <class AttribClass>
+  class integer : public StdObjMgt_Attribute<AttribClass>::SingleInt
+  {
+  public:
+    //! Import transient attribuite from the persistent data.
+    Standard_EXPORT virtual void ImportAttribute();
+  };
+
+  template <class AttribClass,
+            class HStringClass = StdLPersistent_HString::Extended>
+  class string : public StdObjMgt_Attribute<AttribClass>::SingleRef
+  {
+  public:
+    //! Import transient attribuite from the persistent data.
+    Standard_EXPORT virtual void ImportAttribute();
+  };
+
+public:
+  typedef integer <TDataStd_Integer> Integer;
+  typedef integer <TDF_TagSource>    TagSource;
+
+  typedef string <TDF_Reference>                 Reference;
+  typedef string <TDataStd_Name>                 Name;
+  typedef string <TDataStd_Comment>              Comment;
+  typedef string <TDataStd_AsciiString,
+                  StdLPersistent_HString::Ascii> AsciiString;
+
+  class UAttribute : public string <TDataStd_UAttribute>
+  {
+  public:
+    //! Create an empty transient attribuite
+    Standard_EXPORT virtual Handle(TDF_Attribute) CreateAttribute();
+  };
+};
+
+#endif
 // commercial license or contractual agreement.
 
 
-#ifndef _StdLPersistent_PDataStd_Name_HeaderFile
-#define _StdLPersistent_PDataStd_Name_HeaderFile
+#ifndef _StdLPersistent_Variable_HeaderFile
+#define _StdLPersistent_Variable_HeaderFile
 
-#include <StdObjMgt_Persistent.hxx>
+#include <StdObjMgt_Attribute.hxx>
+#include <StdLPersistent_HString.hxx>
 
-class StdLPersistent_PCollection_HExtendedString;
+#include <TDataStd_Variable.hxx>
 
 
-class StdLPersistent_PDataStd_Name : public StdObjMgt_Persistent
+class StdLPersistent_Variable : public StdObjMgt_Attribute<TDataStd_Variable>
 {
 public:
   //! Read persistent data from a file.
-  Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
+  inline void Read (StdObjMgt_ReadData& theReadData)
+    { theReadData >> myIsConstant >> myUnit; }
 
   //! Import transient attribuite from the persistent data.
-  Standard_EXPORT virtual Handle(TDF_Attribute) ImportAttribute() const;
+  void Import (const Handle(TDataStd_Variable)& theAttribute) const
+  {
+    theAttribute->Constant (myIsConstant);
+    if (myUnit)
+      theAttribute->Unit (myUnit->Value()->String());
+  }
 
 private:
-  Handle(StdLPersistent_PCollection_HExtendedString) myString;
+  Value     <Standard_Boolean>              myIsConstant;
+  Reference <StdLPersistent_HString::Ascii> myUnit;
 };
 
 #endif
diff --git a/src/StdLPersistent/StdLPersistent_Void.hxx b/src/StdLPersistent/StdLPersistent_Void.hxx
new file mode 100644 (file)
index 0000000..5c8ad24
--- /dev/null
@@ -0,0 +1,45 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#ifndef _StdLPersistent_Void_HeaderFile
+#define _StdLPersistent_Void_HeaderFile
+
+#include <StdObjMgt_Attribute.hxx>
+
+#include <TDataStd_Directory.hxx>
+#include <TDataStd_Tick.hxx>
+#include <TDataStd_NoteBook.hxx>
+
+
+class StdLPersistent_Void
+{
+protected:
+  template <class AttribClass>
+  class instance : public StdObjMgt_Attribute<AttribClass>::Static
+  {
+  public:
+    //! Read persistent data from a file.
+    Standard_EXPORT virtual void Read (StdObjMgt_ReadData&) {}
+
+    //! Import transient attribuite from the persistent data
+    Standard_EXPORT virtual void ImportAttribute() {}
+  };
+
+public:
+  typedef instance<TDataStd_Directory> Directory;
+  typedef instance<TDataStd_Tick>      Tick;
+  typedef instance<TDataStd_NoteBook>  NoteBook;
+};
+
+#endif
 // commercial license or contractual agreement.
 
 
-#ifndef _StdLPersistent_PDataStd_Name_HeaderFile
-#define _StdLPersistent_PDataStd_Name_HeaderFile
+#ifndef _StdLPersistent_XLink_HeaderFile
+#define _StdLPersistent_XLink_HeaderFile
 
-#include <StdObjMgt_Persistent.hxx>
+#include <StdObjMgt_Attribute.hxx>
+#include <StdLPersistent_HString.hxx>
 
-class StdLPersistent_PCollection_HExtendedString;
+#include <TDocStd_XLink.hxx>
 
 
-class StdLPersistent_PDataStd_Name : public StdObjMgt_Persistent
+class StdLPersistent_XLink : public StdObjMgt_Attribute<TDocStd_XLink>
 {
 public:
   //! Read persistent data from a file.
-  Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
+  inline void Read (StdObjMgt_ReadData& theReadData)
+    { theReadData >> myDocEntry >> myLabEntry; }
 
   //! Import transient attribuite from the persistent data.
-  Standard_EXPORT virtual Handle(TDF_Attribute) ImportAttribute() const;
+  void Import (const Handle(TDocStd_XLink)& theAttribute) const
+  {
+    if (myDocEntry)
+      theAttribute->DocumentEntry (myDocEntry->Value()->String());
+
+    if (myLabEntry)
+      theAttribute->LabelEntry    (myLabEntry->Value()->String());
+  }
 
 private:
-  Handle(StdLPersistent_PCollection_HExtendedString) myString;
+  Reference<StdLPersistent_HString::Ascii> myDocEntry;
+  Reference<StdLPersistent_HString::Ascii> myLabEntry;
 };
 
 #endif
index 9ac838a..c07fc4b 100644 (file)
@@ -1,6 +1,9 @@
+StdObjMgt_Attribute.hxx
+StdObjMgt_ContentTypes.hxx
 StdObjMgt_MapOfInstantiators.cxx
 StdObjMgt_MapOfInstantiators.hxx
 StdObjMgt_Persistent.cxx
 StdObjMgt_Persistent.hxx
 StdObjMgt_ReadData.cxx
 StdObjMgt_ReadData.hxx
+StdObjMgt_SharedObject.hxx
diff --git a/src/StdObjMgt/StdObjMgt_Attribute.hxx b/src/StdObjMgt/StdObjMgt_Attribute.hxx
new file mode 100644 (file)
index 0000000..897606d
--- /dev/null
@@ -0,0 +1,91 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _StdObjMgt_Attribute_HeaderFile
+#define _StdObjMgt_Attribute_HeaderFile
+
+#include <StdObjMgt_Persistent.hxx>
+#include <StdObjMgt_ReadData.hxx>
+
+
+//! Root class for a temporary persistent object corresponding to an attribute.
+template <class Transient>
+class StdObjMgt_Attribute : public    Standard_Transient,
+                            protected StdObjMgt_ContentTypes
+{
+  class base : public StdObjMgt_Persistent
+  {
+  public:
+    //! Create an empty transient attribuite
+    Standard_EXPORT virtual Handle(TDF_Attribute) CreateAttribute()
+      { return myTransient = new Transient; }
+
+    //! Get transient attribuite for the persistent data
+    Standard_EXPORT virtual Handle(TDF_Attribute) GetAttribute() const
+    { return Handle(TDF_Attribute)(myTransient); }
+
+  protected:
+    Handle(Transient) myTransient;
+  };
+
+public:
+  class Static : public base {};
+
+  template <class DataType>
+  class Simple : public Static
+  {
+  public:
+    //! Read persistent data from a file.
+    Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData)
+      { theReadData >> myData; }
+
+  protected:
+    DataType myData;
+  };
+
+  struct SingleInt : Simple <Value<Standard_Integer> > {};
+  struct SingleRef : Simple <Reference<> > {};
+
+private:
+  template <class Persistent>
+  class container : public base
+  {
+  public:
+    //! Read persistent data from a file.
+    Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData)
+    {
+      myPersistent = new Persistent;
+      myPersistent->Read (theReadData);
+    }
+
+    //! Import transient attribuite from the persistent data
+    Standard_EXPORT virtual void ImportAttribute()
+    {
+      if (myPersistent && this->myTransient)
+      {
+        myPersistent->Import (this->myTransient);
+        myPersistent.Nullify();
+      }
+    }
+
+  private:
+    Handle(Persistent) myPersistent;
+  };
+
+public:
+  template <class Persistent>
+  static Handle(StdObjMgt_Persistent) Instantiate()
+    { return new container<Persistent>; }
+};
+
+#endif // _StdObjMgt_Attribute_HeaderFile
diff --git a/src/StdObjMgt/StdObjMgt_ContentTypes.hxx b/src/StdObjMgt/StdObjMgt_ContentTypes.hxx
new file mode 100644 (file)
index 0000000..5455fe0
--- /dev/null
@@ -0,0 +1,102 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _StdObjMgt_ContentTypes_HeaderFile
+#define _StdObjMgt_ContentTypes_HeaderFile
+
+
+#include <StdObjMgt_ReadData.hxx>
+
+class StdObjMgt_Persistent;
+
+
+//! Root class for an object containing other obects.
+class StdObjMgt_ContentTypes
+{
+  template <typename Type>
+  class holder
+  {
+  public:
+    //! Return the value.
+    operator Type() const { return myValue; }
+
+  protected:
+    Type myValue;
+  };
+
+  template <typename Type>
+  struct enum_ : holder<Type>
+  {
+    //! Read the value from a file.
+    void Read (StdObjMgt_ReadData& theReadData)
+      { theReadData.ReadEnum (this->myValue); }
+  };
+
+  template <typename Type>
+  struct value : holder<Type>
+  {
+    //! Read the value from a file.
+    void Read (StdObjMgt_ReadData& theReadData)
+      { theReadData.ReadValue (this->myValue); }
+  };
+
+  template <class Class>
+  struct object : Class
+  {
+    //! Read object data from a file.
+    void Read (StdObjMgt_ReadData& theReadData)
+      { theReadData.ReadObject ((Class&)*this); }
+  };
+
+  template <class Persistent>
+  struct referenceT : Handle(Persistent)
+  {
+    //! Read object data from a file.
+    void Read (StdObjMgt_ReadData& theReadData)
+      { theReadData.ReadReference (*this); }
+  };
+
+  struct reference : Handle(StdObjMgt_Persistent)
+  {
+    //! Read object data from a file.
+    void Read (StdObjMgt_ReadData& theReadData)
+      { Handle(StdObjMgt_Persistent)::operator= (theReadData.ReadReference()); }
+
+    //! Cast the reference to a target type.
+    template <class Persistent>
+    bool Cast (Handle(Persistent)& theTarget) const
+    {
+      theTarget = Handle(Persistent)::DownCast(*this);
+      return ! theTarget.IsNull();
+    }
+  };
+
+public:
+  template <class Type>
+  struct Enum      : StdObjMgt_ReadData::Content <enum_<Type> > {};
+
+  template <class Type>
+  struct Value     : StdObjMgt_ReadData::Content <value<Type> > {};
+
+  template <class Class>
+  struct Object    : StdObjMgt_ReadData::Content <object<Class> > {};
+
+  template <class Persistent = StdObjMgt_Persistent>
+  struct Reference : StdObjMgt_ReadData::Content <referenceT<Persistent> > {};
+};
+
+template<>
+struct StdObjMgt_ContentTypes::Reference<StdObjMgt_Persistent>
+    : StdObjMgt_ReadData::Content <reference> {};
+
+#endif // _StdObjMgt_ContentTypes_HeaderFile
index 791acdf..87142c0 100644 (file)
@@ -25,21 +25,16 @@ class StdObjMgt_MapOfInstantiators
                                TCollection_AsciiString>
 {
 public:
-  template <class Type>
+  template <class Persistent>
   void Bind (const TCollection_AsciiString& theTypeName)
   {
     NCollection_DataMap<TCollection_AsciiString,
                         StdObjMgt_Persistent::Instantiator,
                         TCollection_AsciiString>
-      ::Bind (theTypeName, &Instantiate<Type>);
+      ::Bind (theTypeName, Persistent::template Instantiate<Persistent>);
   }
 
   DEFINE_STANDARD_ALLOC
-
-private:
-  template <class Type>
-  static Handle(StdObjMgt_Persistent) Instantiate()
-  { return new Type; }
 };
 
 #endif // _StdObjMgt_MapOfInstantiators_HeaderFile
index ad1b42e..66901f6 100644 (file)
 
 #include <StdObjMgt_Persistent.hxx>
 
+
+//=======================================================================
+//function : ImportDocument
+//purpose  : Import transient document from the persistent data
+//           (to be overriden by document class;
+//           does nothing by default for other classes).
+//=======================================================================
+void StdObjMgt_Persistent::ImportDocument
+  (const Handle(TDocStd_Document)&) const {}
+
+//=======================================================================
+//function : CreateAttribute
+//purpose  : Create an empty transient attribuite
+//           (to be overriden by attribute classes;
+//           does nothing and returns a null handle by default for other classes)
+//=======================================================================
+Handle(TDF_Attribute) StdObjMgt_Persistent::CreateAttribute()
+  { return Handle(TDF_Attribute)(); }
+
+//=======================================================================
+//function : GetAttribute
+//purpose  : Get transient attribuite for the persistent data
+//           (to be overriden by attribute classes;
+//           returns a null handle by default for non-attribute classes)
+//=======================================================================
+Handle(TDF_Attribute) StdObjMgt_Persistent::GetAttribute() const
+  { return Handle(TDF_Attribute)(); }
+
 //=======================================================================
 //function : ImportAttribute
 //purpose  : Import transient attribuite from the persistent data
-//!          (to be overriden by attribute classes;
-//!          returns a null handle by default for non-attribute classes)
+//           (to be overriden by attribute classes;
+//           does nothing by default for non-attribute classes)
+//=======================================================================
+void StdObjMgt_Persistent::ImportAttribute() {}
+
+//=======================================================================
+//function : AsciiString
+//purpose  : Get referenced ASCII string
+//           (to be overriden by ASCII string class;
+//           returns a null handle by default for other classes)
+//=======================================================================
+Handle(TCollection_HAsciiString) StdObjMgt_Persistent::AsciiString() const
+  { return Handle(TCollection_HAsciiString)(); }
+
+//=======================================================================
+//function : ExtString
+//purpose  : Get referenced extended string
+//           (to be overriden by extended string class;
+//           returns a null handle by default for other classes)
+//=======================================================================
+Handle(TCollection_HExtendedString) StdObjMgt_Persistent::ExtString() const
+  { return Handle(TCollection_HExtendedString)(); }
+
+//=======================================================================
+//function : Label
+//purpose  : Get a label expressed by referenced extended string
+//           (to be overriden by extended string class;
+//           returns a null label by default for other classes)
 //=======================================================================
-Handle(TDF_Attribute) StdObjMgt_Persistent::ImportAttribute() const
-{
-  return Handle(TDF_Attribute)();
-}
+TDF_Label StdObjMgt_Persistent::Label (const Handle(TDF_Data)&) const
+  { return TDF_Label(); }
index 87f06e5..5c7f68f 100644 (file)
 #include <Standard.hxx>
 #include <Standard_Handle.hxx>
 #include <Standard_Transient.hxx>
+#include <StdObjMgt_ContentTypes.hxx>
+
+#include <TDF_Label.hxx>
 
 class StdObjMgt_ReadData;
+class TDocStd_Document;
 class TDF_Attribute;
+class TDF_Data;
+class TCollection_HAsciiString;
+class TCollection_HExtendedString;
 
 
-//! Root class for a temporary object that reads data from a file and then
-//! creates transient object using the data.
-class StdObjMgt_Persistent : public Standard_Transient
+//! Root class for a temporary persistent object that reads data from a file
+//! and then creates transient object using the data.
+class StdObjMgt_Persistent : public    Standard_Transient,
+                             protected StdObjMgt_ContentTypes
 {
 public:
-  //! Create a derived class instance.
+  //! Derived class instance create function.
   typedef Handle(StdObjMgt_Persistent) (*Instantiator)();
 
+  //! Create a derived class instance.
+  template <class Persistent>
+  static Handle(StdObjMgt_Persistent) Instantiate()
+    { return new Persistent; }
+
   //! Read persistent data from a file.
   Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData) = 0;
 
-  //! Import transient attribuite from the persistent data
+  //! Import transient document from the persistent data
+  //! (to be overriden by document class;
+  //! does nothing by default for other classes).
+  Standard_EXPORT virtual void ImportDocument
+    (const Handle(TDocStd_Document)& theDocument) const;
+
+  //! Create an empty transient attribuite
+  //! (to be overriden by attribute classes;
+  //! does nothing and returns a null handle by default for other classes).
+  Standard_EXPORT virtual Handle(TDF_Attribute) CreateAttribute();
+
+  //! Get transient attribuite for the persistent data
   //! (to be overriden by attribute classes;
   //! returns a null handle by default for non-attribute classes).
-  Standard_EXPORT virtual Handle(TDF_Attribute) ImportAttribute() const;
+  Standard_EXPORT virtual Handle(TDF_Attribute) GetAttribute() const;
+
+  //! Import transient attribuite from the persistent data
+  //! (to be overriden by attribute classes;
+  //! does nothing by default for non-attribute classes).
+  Standard_EXPORT virtual void ImportAttribute();
+
+  //! Get referenced ASCII string
+  //! (to be overriden by ASCII string class;
+  //! returns a null handle by default for other classes).
+  Standard_EXPORT virtual Handle(TCollection_HAsciiString) AsciiString() const;
+
+  //! Get referenced extended string
+  //! (to be overriden by extended string class;
+  //! returns a null handle by default for other classes).
+  Standard_EXPORT virtual Handle(TCollection_HExtendedString) ExtString() const;
+
+  //! Get a label expressed by referenced extended string
+  //! (to be overriden by extended string class;
+  //! returns a null label by default for other classes).
+  Standard_EXPORT virtual TDF_Label Label (const Handle(TDF_Data)& theDF) const;
 };
 
 #endif // _StdObjMgt_Persistent_HeaderFile
index c663600..99472cb 100644 (file)
 // commercial license or contractual agreement.
 
 #include <StdObjMgt_ReadData.hxx>
+#include <StdObjMgt_Persistent.hxx>
 
 
-StdObjMgt_ReadData::StdObjMgt_ReadData (Storage_BaseDriver&    theDriver,
-                                        const Standard_Integer theNumberOfObjects)
-  : myDriver (&theDriver)
-  , myPersistentObjects (1, theNumberOfObjects) {}
+StdObjMgt_ReadData::StdObjMgt_ReadData
+  (Storage_BaseDriver& theDriver, const Standard_Integer theNumberOfObjects)
+    : myDriver (&theDriver)
+    , myPersistentObjects (1, theNumberOfObjects) {}
 
-void StdObjMgt_ReadData::ReadReference (Handle(StdObjMgt_Persistent)& theTarget)
+void StdObjMgt_ReadData::ReadPersistentObject (const Standard_Integer theRef)
+{
+  Handle(StdObjMgt_Persistent) aPersistent = myPersistentObjects (theRef);
+  if (aPersistent)
+  {
+    Standard_Integer aRef, aType;
+    myDriver->ReadPersistentObjectHeader (aRef, aType);
+    myDriver->BeginReadPersistentObjectData();
+    aPersistent->Read (*this);
+    myDriver->EndReadPersistentObjectData();
+  }
+}
+
+Handle(StdObjMgt_Persistent) StdObjMgt_ReadData::ReadReference()
 {
   Standard_Integer aRef;
   myDriver->GetReference (aRef);
-
-  if (aRef)
-    theTarget = Object (aRef);
-  else
-    theTarget.Nullify();
+  return aRef ? PersistentObject (aRef) : NULL;
 }
index 09b2ee8..b952ba0 100644 (file)
 #define _StdObjMgt_ReadData_HeaderFile
 
 #include <Standard.hxx>
-#include <StdObjMgt_Persistent.hxx>
-#include <NCollection_Array1.hxx>
 #include <Storage_BaseDriver.hxx>
+#include <NCollection_Array1.hxx>
 
+class StdObjMgt_Persistent;
 
 //! Auxiliary data used to read persistent objects from a file.
 class StdObjMgt_ReadData
 {
 public:
-  Standard_EXPORT StdObjMgt_ReadData (Storage_BaseDriver&    theDriver,
-                                      const Standard_Integer theNumberOfObjects);
-
-  void CreateObject (const Standard_Integer             theRef,
-                     StdObjMgt_Persistent::Instantiator theInstantiator)
-    { myPersistentObjects (theRef) = theInstantiator(); }
-
-  Handle(StdObjMgt_Persistent) Object (const Standard_Integer theRef) const
-    { return myPersistentObjects (theRef); }
+  Standard_EXPORT StdObjMgt_ReadData
+    (Storage_BaseDriver& theDriver, const Standard_Integer theNumberOfObjects);
 
   Storage_BaseDriver& Driver() const
     { return *myDriver; }
 
-  Standard_EXPORT void ReadReference (Handle(StdObjMgt_Persistent)& theTarget);
-  
+  template <class Instantiator>
+  void CreatePersistentObject
+    (const Standard_Integer theRef, Instantiator theInstantiator)
+      { myPersistentObjects (theRef) = theInstantiator(); }
+
+  Standard_EXPORT void ReadPersistentObject
+    (const Standard_Integer theRef);
+
+  Handle(StdObjMgt_Persistent) PersistentObject
+    (const Standard_Integer theRef) const
+      { return myPersistentObjects (theRef); }
+
+  Standard_EXPORT Handle(StdObjMgt_Persistent) ReadReference();
+
+  template <class Persistent>
+  void ReadReference (Handle(Persistent)& theTarget)
+  {
+    theTarget = Handle(Persistent)::DownCast (ReadReference());
+  }
+
+  template <class Object>
+  void ReadObject (Object& theObject)
+  {
+    myDriver->BeginReadObjectData();
+    theObject.Read (*this);
+    myDriver->EndReadObjectData();
+  }
+
   template <class Type>
-  StdObjMgt_ReadData& operator >> (Type& aValue)
+  void ReadValue (Type& theValue)
   {
-    *myDriver >> aValue;
-    return *this;
+    *myDriver >> theValue;
   }
 
   template <class Type>
-  StdObjMgt_ReadData& operator >> (Handle(Type)& theTarget)
+  void ReadEnum (Type& theEnum)
+  {
+    Standard_Integer aValue;
+    *myDriver >> aValue;
+    theEnum = static_cast<Type> (aValue);
+  }
+
+  template <class Base> struct Content : Base {};
+
+  template <class Base>
+  StdObjMgt_ReadData& operator >> (Content<Base>& theContent)
   {
-    Handle(StdObjMgt_Persistent) aTarget = theTarget;
-    ReadReference (aTarget);
-    theTarget = dynamic_cast<Type*> (aTarget.get());
+    theContent.Read (*this);
     return *this;
   }
 
diff --git a/src/StdObjMgt/StdObjMgt_SharedObject.hxx b/src/StdObjMgt/StdObjMgt_SharedObject.hxx
new file mode 100644 (file)
index 0000000..d2b8998
--- /dev/null
@@ -0,0 +1,113 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#ifndef _StdObjMgt_SharedObject_HeaderFile
+#define _StdObjMgt_SharedObject_HeaderFile
+
+#include <StdObjMgt_Persistent.hxx>
+
+
+class StdObjMgt_SharedObject
+{
+public:
+  class PersistentBase : public    Standard_Transient,
+                         protected StdObjMgt_ContentTypes {};
+
+  template <class Transient>
+  class AbstractPersistentBase : public PersistentBase
+  {
+  public:
+    virtual Handle(Transient) Import() const = 0;
+  };
+
+  template <class Transient, class Base = StdObjMgt_Persistent>
+  class SharedBase : public Base
+  {
+  public:
+    //! Import transient object from the persistent data.
+    inline const Handle(Transient)& Import()  { return myTransient; }
+
+  protected:
+    Handle(Transient) myTransient;
+  };
+
+  template <class Base,
+            class Transient,
+            class Persistent = AbstractPersistentBase<Transient> >
+  class DelayedBase : public Base
+  {
+  public:
+    typedef Transient  TransientBase;
+    typedef Persistent PersistentBase;
+
+    //! Import transient object from the persistent data.
+    Standard_EXPORT virtual Handle(Transient) Import()
+      { return myTransient; }
+
+  protected:
+    Handle(Transient) myTransient;
+  };
+
+  template <class Base,
+            class PersistentData,
+            class Transient = typename Base::TransientBase>
+  class IgnoreData : public Base
+  {
+  public:
+    //! Read persistent data from a file.
+    Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData)
+      { PersistentData().Read (theReadData); }
+
+    //! Import transient object from the persistent data.
+    Standard_EXPORT virtual Handle(Transient) Import()
+      { return NULL; }
+  };
+
+private:
+  template <class Base>
+  class delayedSubBase : public Base
+  {
+  public:
+    //! Import transient object from the persistent data.
+    Standard_EXPORT virtual Handle(typename Base::TransientBase) Import()
+    {
+      if (Base::myTransient.IsNull() && !myPersistent.IsNull())
+      {
+        Base::myTransient = myPersistent->Import();
+        myPersistent.Nullify();
+      }
+
+      return Base::myTransient;
+    }
+
+  protected:
+    Handle(typename Base::PersistentBase) myPersistent;
+  };
+
+public:
+  template <class Base, class Persistent = typename Base::PersistentBase>
+  class Delayed : public delayedSubBase<Base>
+  {
+  public:
+    //! Read persistent data from a file.
+    Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData)
+    {
+      Handle(Persistent) aPersistent = new Persistent;
+      aPersistent->Read (theReadData);
+      this->myPersistent = aPersistent;
+    }
+  };
+};
+
+#endif
diff --git a/src/StdObject/FILES b/src/StdObject/FILES
new file mode 100644 (file)
index 0000000..3fe5d97
--- /dev/null
@@ -0,0 +1,5 @@
+StdObject_gp.hxx
+StdObject_Location.cxx
+StdObject_Location.hxx
+StdObject_Shape.cxx
+StdObject_Shape.hxx
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include <StdLPersistent_PColStd_HArray1Base.hxx>
+#include <StdObject_Location.hxx>
+#include <StdPersistent_TopLoc.hxx>
 
-#include <StdObjMgt_ReadData.hxx>
 
 //=======================================================================
-//function : Read
-//purpose  : Read persistent data from a file
+//function : Import
+//purpose  : Import transient object from the persistent data
 //=======================================================================
-void StdLPersistent_PColStd_HArray1Base::Read (StdObjMgt_ReadData& theReadData)
+TopLoc_Location StdObject_Location::Import() const
 {
-  Standard_Integer aLowerBound, anUpperBound;
-  theReadData >> aLowerBound >> anUpperBound;
-  CreateArray (aLowerBound, anUpperBound);
-
-  theReadData.Driver().BeginReadObjectData();
-
-  Standard_Integer aSize;
-  theReadData >> aSize;
-
-  for (Standard_Integer i = aLowerBound; i <= anUpperBound; i++)
-    ReadValue (theReadData, i);
-
-  theReadData.Driver().EndReadObjectData();
+  Handle(StdPersistent_TopLoc::ItemLocation) anItemLocation;
+  if (myData.Cast (anItemLocation))
+    return anItemLocation->Import();
+  else
+    return TopLoc_Location();
 }
 // commercial license or contractual agreement.
 
 
-#ifndef _StdLPersistent_PDataStd_Integer_HeaderFile
-#define _StdLPersistent_PDataStd_Integer_HeaderFile
+#ifndef _StdObject_Location_HeaderFile
+#define _StdObject_Location_HeaderFile
 
-#include <StdObjMgt_Persistent.hxx>
+#include <StdObjMgt_ContentTypes.hxx>
 
+#include <TopLoc_Location.hxx>
 
-class StdLPersistent_PDataStd_Integer : public StdObjMgt_Persistent
+
+class StdObject_Location : private StdObjMgt_ContentTypes
 {
 public:
   //! Read persistent data from a file.
-  Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
+  inline void Read (StdObjMgt_ReadData& theReadData)
+    { theReadData >> myData; }
 
-  //! Import transient attribuite from the persistent data.
-  Standard_EXPORT virtual Handle(TDF_Attribute) ImportAttribute() const;
+  //! Import transient object from the persistent data.
+  TopLoc_Location Import() const;
 
 private:
-  Standard_Integer myValue;
+  Reference<> myData;
 };
 
 #endif
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include <StdLPersistent_PCollection_HExtendedString.hxx>
-
+#include <StdObject_Shape.hxx>
 #include <StdObjMgt_ReadData.hxx>
 
-#include <TCollection_HExtendedString.hxx>
 
 //=======================================================================
-//function : Read
-//purpose  : Read persistent data from a file
+//function : Import
+//purpose  : Import transient object from the persistent data
 //=======================================================================
-void StdLPersistent_PCollection_HExtendedString::Read (StdObjMgt_ReadData& theReadData)
+TopoDS_Shape StdObject_Shape::Import() const
 {
-  theReadData.Driver().BeginReadObjectData();
+  TopoDS_Shape aShape;
 
-  Standard_Integer aSize;
-  theReadData >> aSize;
-  myValue = new TCollection_HExtendedString (aSize, 0);
+  if (myTShape)
+    aShape.TShape (myTShape->Import());
 
-  for (Standard_Integer i = 1; i <= aSize; i++)
-  {
-    Standard_ExtCharacter aChar;
-    theReadData >> aChar;
-    myValue->SetValue (i, aChar);
-  }
+  aShape.Location (myLocation.Import());
+  aShape.Orientation (myOrient);
 
-  theReadData.Driver().EndReadObjectData();
+  return aShape;
 }
 // commercial license or contractual agreement.
 
 
-#ifndef _StdLPersistent_PCollection_HExtendedString_HeaderFile
-#define _StdLPersistent_PCollection_HExtendedString_HeaderFile
+#ifndef _StdObject_Shape_HeaderFile
+#define _StdObject_Shape_HeaderFile
 
-#include <StdObjMgt_Persistent.hxx>
+#include <StdObjMgt_ContentTypes.hxx>
+#include <StdObject_Location.hxx>
+#include <StdPersistent_TopoDS.hxx>
 
-class TCollection_HExtendedString;
+#include <TopAbs_Orientation.hxx>
+#include <TopoDS_Shape.hxx>
 
 
-class StdLPersistent_PCollection_HExtendedString : public StdObjMgt_Persistent
+class StdObject_Shape : private StdObjMgt_ContentTypes
 {
 public:
   //! Read persistent data from a file.
-  Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
+  inline void Read (StdObjMgt_ReadData& theReadData)
+    { theReadData >> myTShape >> myLocation >> myOrient; }
 
-  //! Get the value.
-  Handle(TCollection_HExtendedString) Value() const { return myValue; }
+  //! Import transient object from the persistent data.
+  Standard_EXPORT TopoDS_Shape Import() const;
 
 private:
-  Handle(TCollection_HExtendedString) myValue;
+  Reference <StdPersistent_TopoDS::TShape> myTShape;
+  Object    <StdObject_Location>           myLocation;
+  Enum      <TopAbs_Orientation>           myOrient;
 };
 
 #endif
diff --git a/src/StdObject/StdObject_gp.hxx b/src/StdObject/StdObject_gp.hxx
new file mode 100644 (file)
index 0000000..2d5c272
--- /dev/null
@@ -0,0 +1,414 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#ifndef _StdObject_gp_HeaderFile
+#define _StdObject_gp_HeaderFile
+
+#include <StdObjMgt_ContentTypes.hxx>
+
+class StdObject_gp : private StdObjMgt_ContentTypes
+{
+  template <class Data>
+  struct object : Data
+    { Standard_EXPORT void Read (StdObjMgt_ReadData& theReadData); };
+
+public:
+  template <class Data>
+  struct Object : StdObjMgt_ContentTypes::Object <object<Data> > {};
+
+  template <class Data>
+  static Object<Data>& Ref (Data& theData)
+    { return static_cast<Object<Data>&> (theData); }
+};
+
+// read vectors
+
+#include <gp_Pnt2d.hxx>
+#include <gp_Vec2d.hxx>
+#include <gp_Dir2d.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Vec.hxx>
+#include <gp_Dir.hxx>
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_XY& theXY)
+{
+  Standard_Real aX, aY;
+  theReadData.ReadValue(aX);
+  theReadData.ReadValue(aY);
+  theXY.SetCoord(aX, aY);
+  return theReadData;
+}
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Pnt2d& thePnt)
+{
+  Standard_Real aX, aY;
+  theReadData.ReadValue(aX);
+  theReadData.ReadValue(aY);
+  thePnt.SetCoord(aX, aY);
+  return theReadData;
+}
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Vec2d& theVec)
+{
+  Standard_Real aX, aY;
+  theReadData.ReadValue(aX);
+  theReadData.ReadValue(aY);
+  theVec.SetCoord(aX, aY);
+  return theReadData;
+}
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Dir2d& theDir)
+{
+  Standard_Real aX, aY;
+  theReadData.ReadValue(aX);
+  theReadData.ReadValue(aY);
+  theDir.SetCoord(aX, aY);
+  return theReadData;
+}
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_XYZ& theXYZ)
+{
+  Standard_Real aX, aY, aZ;
+  theReadData.ReadValue(aX);
+  theReadData.ReadValue(aY);
+  theReadData.ReadValue(aZ);
+  theXYZ.SetCoord(aX, aY, aZ);
+  return theReadData;
+}
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Pnt& thePnt)
+{
+  Standard_Real aX, aY, aZ;
+  theReadData.ReadValue(aX);
+  theReadData.ReadValue(aY);
+  theReadData.ReadValue(aZ);
+  thePnt.SetCoord(aX, aY, aZ);
+  return theReadData;
+}
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Vec& theVec)
+{
+  Standard_Real aX, aY, aZ;
+  theReadData.ReadValue(aX);
+  theReadData.ReadValue(aY);
+  theReadData.ReadValue(aZ);
+  theVec.SetCoord(aX, aY, aZ);
+  return theReadData;
+}
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Dir& theDir)
+{
+  Standard_Real aX, aY, aZ;
+  theReadData.ReadValue(aX);
+  theReadData.ReadValue(aY);
+  theReadData.ReadValue(aZ);
+  theDir.SetCoord(aX, aY, aZ);
+  return theReadData;
+}
+
+// read axis placements
+
+#include <gp_Ax2d.hxx>
+#include <gp_Ax22d.hxx>
+#include <gp_Ax1.hxx>
+#include <gp_Ax2.hxx>
+#include <gp_Ax3.hxx>
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Ax2d& theAx)
+{
+  gp_Pnt2d aLoc;
+  gp_Dir2d aDir;
+  theReadData >> aLoc >> aDir;
+  theAx = gp_Ax2d (aLoc, aDir);
+  return theReadData;
+}
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Ax22d& theAx)
+{
+  gp_Pnt2d aLoc;
+  gp_Dir2d aYDir, aXDir;
+  theReadData >> aLoc >> aYDir >> aXDir;
+  theAx = gp_Ax22d (aLoc, aXDir, aYDir);
+  return theReadData;
+}
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Ax1& theAx)
+{
+  gp_XYZ aLoc;
+  gp_Dir aDir;
+  theReadData >> aLoc >> aDir;
+  theAx = gp_Ax1 (aLoc, aDir);
+  return theReadData;
+}
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Ax2& theAx)
+{
+  gp_Ax1 anAx;
+  gp_Dir aYDir, aXDir;
+  theReadData >> anAx >> aYDir >> aXDir;
+  theAx = gp_Ax2 (anAx.Location(), anAx.Direction(), aXDir);
+  return theReadData;
+}
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Ax3& theAx)
+{
+  gp_Ax1 anAx;
+  gp_Dir aYDir, aXDir;
+  theReadData >> anAx >> aYDir >> aXDir;
+  theAx = gp_Ax3 (anAx.Location(), anAx.Direction(), aXDir);
+  if (aYDir * theAx.YDirection() < 0.)
+    theAx.YReverse();
+  return theReadData;
+}
+
+// read curves
+
+#include <gp_Lin2d.hxx>
+#include <gp_Circ2d.hxx>
+#include <gp_Elips2d.hxx>
+#include <gp_Hypr2d.hxx>
+#include <gp_Parab2d.hxx>
+#include <gp_Lin.hxx>
+#include <gp_Circ.hxx>
+#include <gp_Elips.hxx>
+#include <gp_Hypr.hxx>
+#include <gp_Parab.hxx>
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Lin2d& theLin)
+{
+  gp_Ax2d anAx;
+  theReadData >> anAx;
+  theLin.SetPosition(anAx);
+  return theReadData;
+}
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Circ2d& theCirc)
+{
+  gp_Ax22d anAx;
+  Standard_Real aRadius;
+  theReadData >> anAx;
+  theReadData.ReadValue(aRadius);
+  theCirc.SetAxis(anAx);
+  theCirc.SetRadius (aRadius);
+  return theReadData;
+}
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Elips2d& theElips)
+{
+  gp_Ax22d anAx;
+  Standard_Real aMajorRadius, aMinorRadius;
+  theReadData >> anAx;
+  theReadData.ReadValue(aMajorRadius);
+  theReadData.ReadValue(aMinorRadius);
+  theElips.SetAxis(anAx);
+  theElips.SetMajorRadius(aMajorRadius);
+  theElips.SetMinorRadius(aMinorRadius);
+  return theReadData;
+}
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Hypr2d& theHypr)
+{
+  gp_Ax22d anAx;
+  Standard_Real aMajorRadius, aMinorRadius;
+  theReadData >> anAx;
+  theReadData.ReadValue(aMajorRadius);
+  theReadData.ReadValue(aMinorRadius);
+  theHypr.SetAxis(anAx);
+  theHypr.SetMajorRadius(aMajorRadius);
+  theHypr.SetMinorRadius(aMinorRadius);
+  return theReadData;
+}
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Parab2d& theParab)
+{
+  gp_Ax22d anAx;
+  Standard_Real aFocalLength;
+  theReadData >> anAx;
+  theReadData.ReadValue(aFocalLength);
+  theParab.SetAxis(anAx);
+  theParab.SetFocal(aFocalLength);
+  return theReadData;
+}
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Lin& theLin)
+{
+  gp_Ax1 anAx;
+  theReadData >> anAx;
+  theLin.SetPosition(anAx);
+  return theReadData;
+}
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Circ& theCirc)
+{
+  gp_Ax2 anAx;
+  Standard_Real aRadius;
+  theReadData >> anAx;
+  theReadData.ReadValue(aRadius);
+  theCirc.SetPosition(anAx);
+  theCirc.SetRadius (aRadius);
+  return theReadData;
+}
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Elips& theElips)
+{
+  gp_Ax2 anAx;
+  Standard_Real aMajorRadius, aMinorRadius;
+  theReadData >> anAx;
+  theReadData.ReadValue(aMajorRadius);
+  theReadData.ReadValue(aMinorRadius);
+  theElips.SetPosition(anAx);
+  theElips.SetMajorRadius(aMajorRadius);
+  theElips.SetMinorRadius(aMinorRadius);
+  return theReadData;
+}
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Hypr& theHypr)
+{
+  gp_Ax2 anAx;
+  Standard_Real aMajorRadius, aMinorRadius;
+  theReadData >> anAx;
+  theReadData.ReadValue(aMajorRadius);
+  theReadData.ReadValue(aMinorRadius);
+  theHypr.SetPosition(anAx);
+  theHypr.SetMajorRadius(aMajorRadius);
+  theHypr.SetMinorRadius(aMinorRadius);
+  return theReadData;
+}
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Parab& theParab)
+{
+  gp_Ax2 anAx;
+  Standard_Real aFocalLength;
+  theReadData >> anAx;
+  theReadData.ReadValue(aFocalLength);
+  theParab.SetPosition(anAx);
+  theParab.SetFocal(aFocalLength);
+  return theReadData;
+}
+
+// read surfaces
+
+#include <gp_Cone.hxx>
+#include <gp_Cylinder.hxx>
+#include <gp_Sphere.hxx>
+#include <gp_Torus.hxx>
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Cone& theCone)
+{
+  gp_Ax3 anAx;
+  Standard_Real aRadius, aSemiAngle;
+  theReadData >> anAx;
+  theReadData.ReadValue(aRadius);
+  theReadData.ReadValue(aSemiAngle);
+  theCone.SetPosition(anAx);
+  theCone.SetRadius(aRadius);
+  theCone.SetSemiAngle(aSemiAngle);
+  return theReadData;
+}
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Cylinder& theCyl)
+{
+  gp_Ax3 anAx;
+  Standard_Real aRadius;
+  theReadData >> anAx;
+  theReadData.ReadValue(aRadius);
+  theCyl.SetPosition(anAx);
+  theCyl.SetRadius(aRadius);
+  return theReadData;
+}
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Sphere& theSph)
+{
+  gp_Ax3 anAx;
+  Standard_Real aRadius;
+  theReadData >> anAx;
+  theReadData.ReadValue(aRadius);
+  theSph.SetPosition(anAx);
+  theSph.SetRadius(aRadius);
+  return theReadData;
+}
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Torus& theTorus)
+{
+  gp_Ax3 anAx;
+  Standard_Real aMajorRadius, aMinorRadius;
+  theReadData >> anAx;
+  theReadData.ReadValue(aMajorRadius);
+  theReadData.ReadValue(aMinorRadius);
+  theTorus.SetPosition(anAx);
+  theTorus.SetMajorRadius(aMajorRadius);
+  theTorus.SetMinorRadius(aMinorRadius);
+  return theReadData;
+}
+
+// read transformations
+
+#include <gp_Mat2d.hxx>
+#include <gp_Mat.hxx>
+#include <gp_Trsf2d.hxx>
+#include <gp_Trsf.hxx>
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Mat2d& theMat)
+{
+  gp_XY aRow1, aRow2;
+  theReadData >> aRow1 >> aRow2;
+  theMat.SetRows(aRow1, aRow2);
+  return theReadData;
+}
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Mat& theMat)
+{
+  gp_XYZ aRow1, aRow2, aRow3;
+  theReadData >> aRow1 >> aRow2 >> aRow3;
+  theMat.SetRows(aRow1, aRow2, aRow3);
+  return theReadData;
+}
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Trsf2d& theTrsf)
+{
+  Standard_Real aScale;
+  gp_TrsfForm aForm;
+  gp_Mat2d aMat;
+  gp_XY aLoc;
+  theReadData.ReadValue(aScale);
+  theReadData.ReadEnum(aForm);
+  theReadData >> aMat >> aLoc;
+  theTrsf.SetValues(aScale * aMat(1, 1), aScale * aMat(1, 2), aLoc.X(),
+                    aScale * aMat(2, 1), aScale * aMat(2, 2), aLoc.Y());
+  return theReadData;
+}
+
+inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Trsf& theTrsf)
+{
+  Standard_Real aScale;
+  gp_TrsfForm aForm;
+  gp_Mat aMat;
+  gp_XYZ aLoc;
+  theReadData.ReadValue(aScale);
+  theReadData.ReadEnum(aForm);
+  theReadData >> aMat >> aLoc;
+  theTrsf.SetValues(aScale * aMat(1, 1), aScale * aMat(1, 2), aScale * aMat(1, 3), aLoc.X(),
+                    aScale * aMat(2, 1), aScale * aMat(2, 2), aScale * aMat(2, 3), aLoc.Y(),
+                    aScale * aMat(3, 1), aScale * aMat(3, 2), aScale * aMat(3, 3), aLoc.Z());
+  return theReadData;
+}
+
+template<class T>
+inline void StdObject_gp::object<T>::Read (StdObjMgt_ReadData& theReadData)
+{
+  theReadData >> (*this);
+}
+
+
+#endif
index e60a9fa..5a716b7 100644 (file)
@@ -1,3 +1,18 @@
-FILES
 StdPersistent.cxx
 StdPersistent.hxx
+StdPersistent_DataXtd.cxx
+StdPersistent_DataXtd.hxx
+StdPersistent_DataXtd_Constraint.cxx
+StdPersistent_DataXtd_Constraint.hxx
+StdPersistent_DataXtd_PatternStd.cxx
+StdPersistent_DataXtd_PatternStd.hxx
+StdPersistent_HArray1OfShape1.hxx
+StdPersistent_HArray1.cxx
+StdPersistent_HArray1.hxx
+StdPersistent_Naming.cxx
+StdPersistent_Naming.hxx
+StdPersistent_PPrsStd.cxx
+StdPersistent_PPrsStd.hxx
+StdPersistent_TopLoc.cxx
+StdPersistent_TopLoc.hxx
+StdPersistent_TopoDS.hxx
index 783a957..94cd3c5 100644 (file)
 #include <StdPersistent.hxx>
 #include <StdObjMgt_MapOfInstantiators.hxx>
 
+#include <StdPersistent_TopLoc.hxx>
+#include <StdPersistent_TopoDS.hxx>
+#include <StdPersistent_Naming.hxx>
+#include <StdPersistent_HArray1.hxx>
+#include <StdLPersistent_HArray1.hxx>
+#include <StdPersistent_DataXtd.hxx>
+#include <StdPersistent_DataXtd_Constraint.hxx>
+#include <StdPersistent_DataXtd_PatternStd.hxx>
+#include <StdPersistent_PPrsStd.hxx>
+
+
 //=======================================================================
 //function : BindTypes
 //purpose  : Register types
 //=======================================================================
-void StdPersistent::BindTypes (StdObjMgt_MapOfInstantiators& /*theMap*/)
+void StdPersistent::BindTypes (StdObjMgt_MapOfInstantiators& theMap)
 {
+  // Non-attribute data
+  theMap.Bind <StdPersistent_TopLoc::Datum3D>      ("PTopLoc_Datum3D");
+  theMap.Bind <StdPersistent_TopLoc::ItemLocation> ("PTopLoc_ItemLocation");
+  theMap.Bind <StdPersistent_TopoDS::TShape>       ("PTopoDS_TShape1");
+  theMap.Bind <StdPersistent_HArray1::Shape1>      ("PTopoDS_HArray1OfShape1");
+  theMap.Bind <StdPersistent_Naming::Name>         ("PNaming_Name");
+  theMap.Bind <StdPersistent_Naming::Name_1>       ("PNaming_Name_1");
+  theMap.Bind <StdPersistent_Naming::Name_2>       ("PNaming_Name_2");
+
+  theMap.Bind <StdLPersistent_HArray1::Persistent>
+    ("PNaming_HArray1OfNamedShape");
+
+  // Attributes
+  theMap.Bind <StdPersistent_Naming::NamedShape>   ("PNaming_NamedShape");
+  theMap.Bind <StdPersistent_Naming::Naming>       ("PNaming_Naming");
+  theMap.Bind <StdPersistent_Naming::Naming_1>     ("PNaming_Naming_1");
+  theMap.Bind <StdPersistent_Naming::Naming_2>     ("PNaming_Naming_2");
+
+  theMap.Bind <StdPersistent_DataXtd::Shape>       ("PDataXtd_Shape");
+  theMap.Bind <StdPersistent_DataXtd::Point>       ("PDataXtd_Point");
+  theMap.Bind <StdPersistent_DataXtd::Axis>        ("PDataXtd_Axis");
+  theMap.Bind <StdPersistent_DataXtd::Plane>       ("PDataXtd_Plane");
+  theMap.Bind <StdPersistent_DataXtd::Placement>   ("PDataXtd_Placement");
+  theMap.Bind <StdPersistent_DataXtd::Geometry>    ("PDataXtd_Geometry");
+  theMap.Bind <StdPersistent_DataXtd::Position>    ("PDataXtd_Position");
+  theMap.Bind <StdPersistent_DataXtd_Constraint>   ("PDataXtd_Constraint");
+  theMap.Bind <StdPersistent_DataXtd_PatternStd>   ("PDataXtd_PatternStd");
+
+  theMap.Bind <StdPersistent_PPrsStd::AISPresentation>
+    ("PPrsStd_AISPresentation");
+
+  theMap.Bind <StdPersistent_PPrsStd::AISPresentation_1>
+    ("PPrsStd_AISPresentation_1");
 }
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include <StdLPersistent_PDataStd_Integer.hxx>
+#include <StdPersistent_DataXtd.hxx>
 
-#include <StdObjMgt_ReadData.hxx>
-
-#include <TDataStd_Integer.hxx>
 
 //=======================================================================
-//function : Read
-//purpose  : Read persistent data from a file
+//function : ImportAttribute
+//purpose  : Import transient attribuite from the persistent data
 //=======================================================================
-void StdLPersistent_PDataStd_Integer::Read (StdObjMgt_ReadData& theReadData)
-{
-  theReadData >> myValue;
-}
+void StdPersistent_DataXtd::Geometry::ImportAttribute()
+  { myTransient->SetType (myData); }
 
 //=======================================================================
 //function : ImportAttribute
 //purpose  : Import transient attribuite from the persistent data
 //=======================================================================
-Handle(TDF_Attribute) StdLPersistent_PDataStd_Integer::ImportAttribute() const
-{
-  Handle(TDataStd_Integer) aValue = new TDataStd_Integer;
-  aValue->Set (myValue);
-  return aValue;
-}
+void StdPersistent_DataXtd::Position::ImportAttribute()
+  { myTransient->SetPosition (myData); }
diff --git a/src/StdPersistent/StdPersistent_DataXtd.hxx b/src/StdPersistent/StdPersistent_DataXtd.hxx
new file mode 100644 (file)
index 0000000..376d064
--- /dev/null
@@ -0,0 +1,65 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#ifndef _StdPersistent_DataXtd_HeaderFile
+#define _StdPersistent_DataXtd_HeaderFile
+
+#include <StdObjMgt_ContentTypes.hxx>
+#include <StdObjMgt_Attribute.hxx>
+#include <StdLPersistent_Void.hxx>
+#include <StdObject_gp.hxx>
+
+#include <TDataXtd_Shape.hxx>
+#include <TDataXtd_Point.hxx>
+#include <TDataXtd_Axis.hxx>
+#include <TDataXtd_Plane.hxx>
+#include <TDataXtd_Placement.hxx>
+#include <TDataXtd_Geometry.hxx>
+#include <TDataXtd_Position.hxx>
+
+
+class StdPersistent_DataXtd : private StdObjMgt_ContentTypes
+{
+  class _void : private StdLPersistent_Void
+  {
+  public:
+    template <class AttribClass>
+    struct Instance : instance<AttribClass> {};
+  };
+
+public:
+  typedef _void::Instance<TDataXtd_Shape>     Shape;
+  typedef _void::Instance<TDataXtd_Point>     Point;
+  typedef _void::Instance<TDataXtd_Axis>      Axis;
+  typedef _void::Instance<TDataXtd_Plane>     Plane;
+  typedef _void::Instance<TDataXtd_Placement> Placement;
+
+  class Geometry : public StdObjMgt_Attribute<TDataXtd_Geometry>::
+                            Simple <Enum<TDataXtd_GeometryEnum> >
+  {
+  public:
+    //! Import transient attribuite from the persistent data.
+    Standard_EXPORT virtual void ImportAttribute();
+  };
+
+  class Position : public StdObjMgt_Attribute<TDataXtd_Position>::
+                            Simple <StdObject_gp::Object<gp_Pnt> >
+  {
+  public:
+    //! Import transient attribuite from the persistent data.
+    Standard_EXPORT virtual void ImportAttribute();
+  };
+};
+
+#endif
diff --git a/src/StdPersistent/StdPersistent_DataXtd_Constraint.cxx b/src/StdPersistent/StdPersistent_DataXtd_Constraint.cxx
new file mode 100644 (file)
index 0000000..e5437ed
--- /dev/null
@@ -0,0 +1,58 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <StdPersistent_DataXtd_Constraint.hxx>
+
+#include <TNaming_NamedShape.hxx>
+#include <TDataStd_Real.hxx>
+
+
+//=======================================================================
+//function : Import
+//purpose  : Import transient attribuite from the persistent data
+//=======================================================================
+void StdPersistent_DataXtd_Constraint::Import
+  (const Handle(TDataXtd_Constraint)& theAttribute) const
+{
+  theAttribute->SetType  (myType);
+  theAttribute->Reversed (myIsReversed);
+  theAttribute->Inverted (myIsInverted);
+  theAttribute->Verified (myIsVerified);
+
+  if (myGeometries)
+  {
+    Handle(StdLPersistent_HArray1OfPersistent) aGeometries = myGeometries->Array();
+    for (Standard_Integer i = 1; i <= aGeometries->Length(); i++)
+    {
+      Handle(StdObjMgt_Persistent) aPGeometry = aGeometries->Value(i);
+      if (aPGeometry)
+      {
+        Handle(TDF_Attribute) aTGeometry = aPGeometry->GetAttribute();
+        theAttribute->SetGeometry
+          (i, Handle(TNaming_NamedShape)::DownCast (aTGeometry));
+      }
+    }
+  }
+
+  if (myValue)
+  {
+    Handle(TDF_Attribute) aValue = myValue->GetAttribute();
+    theAttribute->SetValue (Handle(TDataStd_Real)::DownCast (aValue));
+  }
+
+  if (myPlane)
+  {
+    Handle(TDF_Attribute) aPlane = myPlane->GetAttribute();
+    theAttribute->SetPlane (Handle(TNaming_NamedShape)::DownCast (aPlane));
+  }
+}
diff --git a/src/StdPersistent/StdPersistent_DataXtd_Constraint.hxx b/src/StdPersistent/StdPersistent_DataXtd_Constraint.hxx
new file mode 100644 (file)
index 0000000..8302ff3
--- /dev/null
@@ -0,0 +1,49 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#ifndef _StdPersistent_DataXtd_Constraint_HeaderFile
+#define _StdPersistent_DataXtd_Constraint_HeaderFile
+
+#include <StdObjMgt_Attribute.hxx>
+#include <StdLPersistent_HArray1.hxx>
+
+#include <TDataXtd_Constraint.hxx>
+#include <TDataXtd_ConstraintEnum.hxx>
+
+
+class StdPersistent_DataXtd_Constraint
+  : public StdObjMgt_Attribute<TDataXtd_Constraint>
+{
+public:
+  //! Read persistent data from a file.
+  inline void Read (StdObjMgt_ReadData& theReadData)
+  {
+    theReadData >> myType >> myGeometries >> myValue
+                >> myIsReversed >> myIsInverted >> myIsVerified >> myPlane;
+  }
+
+  //! Import transient attribuite from the persistent data.
+  void Import (const Handle(TDataXtd_Constraint)& theAttribute) const;
+
+private:
+  Enum<TDataXtd_ConstraintEnum> myType;
+  Reference<StdLPersistent_HArray1::Persistent> myGeometries;
+  Reference<>                   myValue;
+  Value<Standard_Boolean>       myIsReversed;
+  Value<Standard_Boolean>       myIsInverted;
+  Value<Standard_Boolean>       myIsVerified;
+  Reference<>                   myPlane;
+};
+
+#endif
diff --git a/src/StdPersistent/StdPersistent_DataXtd_PatternStd.cxx b/src/StdPersistent/StdPersistent_DataXtd_PatternStd.cxx
new file mode 100644 (file)
index 0000000..4a556f2
--- /dev/null
@@ -0,0 +1,56 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <StdPersistent_DataXtd_PatternStd.hxx>
+
+#include <TNaming_NamedShape.hxx>
+#include <TDataStd_Real.hxx>
+#include <TDataStd_Integer.hxx>
+
+
+//=======================================================================
+//function : Import
+//purpose  : Import transient attribuite from the persistent data
+//=======================================================================
+void StdPersistent_DataXtd_PatternStd::Import
+  (const Handle(TDataXtd_PatternStd)& theAttribute) const
+{
+  if (mySignature < 5)
+  {
+    theAttribute->Axis1 (
+      Handle(TNaming_NamedShape)::DownCast (myAxis1->GetAttribute()));
+
+    theAttribute->Value1 (
+      Handle(TDataStd_Real)::DownCast (myValue1->GetAttribute()));
+
+    theAttribute->NbInstances1 (
+      Handle(TDataStd_Integer)::DownCast (myNb1->GetAttribute()));
+
+    if (mySignature > 2)
+    {
+      theAttribute->Axis2 (
+        Handle(TNaming_NamedShape)::DownCast (myAxis2->GetAttribute()));
+
+      theAttribute->Value2 (
+        Handle(TDataStd_Real)::DownCast (myValue2->GetAttribute()));
+
+      theAttribute->NbInstances2 (
+        Handle(TDataStd_Integer)::DownCast (myNb2->GetAttribute()));
+    }
+  }
+  else
+  {
+    theAttribute->Mirror (
+      Handle(TNaming_NamedShape)::DownCast (myMirror->GetAttribute()));
+  }
+}
diff --git a/src/StdPersistent/StdPersistent_DataXtd_PatternStd.hxx b/src/StdPersistent/StdPersistent_DataXtd_PatternStd.hxx
new file mode 100644 (file)
index 0000000..f0a8893
--- /dev/null
@@ -0,0 +1,50 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#ifndef _StdPersistent_DataXtd_PatternStd_HeaderFile
+#define _StdPersistent_DataXtd_PatternStd_HeaderFile
+
+#include <StdObjMgt_Attribute.hxx>
+
+#include <TDataXtd_PatternStd.hxx>
+
+
+class StdPersistent_DataXtd_PatternStd
+  : public StdObjMgt_Attribute<TDataXtd_PatternStd>
+{
+public:
+  //! Read persistent data from a file.
+  inline void Read (StdObjMgt_ReadData& theReadData)
+  {
+    theReadData >> mySignature >> myAxis1Reversed >> myAxis2Reversed >>
+      myAxis1 >> myAxis2 >> myValue1 >> myValue2 >> myNb1 >> myNb2 >> myMirror;
+  }
+
+  //! Import transient attribuite from the persistent data.
+  void Import (const Handle(TDataXtd_PatternStd)& theAttribute) const;
+
+private:
+  Value<Standard_Integer> mySignature;
+  Value<Standard_Boolean> myAxis1Reversed;
+  Value<Standard_Boolean> myAxis2Reversed;
+  Reference<>             myAxis1;
+  Reference<>             myAxis2;
+  Reference<>             myValue1;
+  Reference<>             myValue2;
+  Reference<>             myNb1;
+  Reference<>             myNb2;
+  Reference<>             myMirror;
+};
+
+#endif
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
+#include <StdPersistent_HArray1.hxx>
+#include <StdObjMgt_ReadData.hxx>
 
-#ifndef _StdLPersistent_PDataStd_Integer_HeaderFile
-#define _StdLPersistent_PDataStd_Integer_HeaderFile
 
-#include <StdObjMgt_Persistent.hxx>
-
-
-class StdLPersistent_PDataStd_Integer : public StdObjMgt_Persistent
+void StdPersistent_HArray1::Shape1::readValue (StdObjMgt_ReadData& theReadData,
+                                               const Standard_Integer theIndex)
 {
-public:
-  //! Read persistent data from a file.
-  Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
-
-  //! Import transient attribuite from the persistent data.
-  Standard_EXPORT virtual Handle(TDF_Attribute) ImportAttribute() const;
-
-private:
-  Standard_Integer myValue;
-};
-
-#endif
+  theReadData.ReadObject (myArray->ChangeValue (theIndex));
+}
 // commercial license or contractual agreement.
 
 
-#ifndef _StdLPersistent_PDataStd_Integer_HeaderFile
-#define _StdLPersistent_PDataStd_Integer_HeaderFile
+#ifndef _StdPersistent_HArray1_HeaderFile
+#define _StdPersistent_HArray1_HeaderFile
 
-#include <StdObjMgt_Persistent.hxx>
+#include <StdLPersistent_HArray1.hxx>
+#include <StdPersistent_HArray1OfShape1.hxx>
 
 
-class StdLPersistent_PDataStd_Integer : public StdObjMgt_Persistent
+class StdPersistent_HArray1 : private StdLPersistent_HArray1
 {
 public:
-  //! Read persistent data from a file.
-  Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
-
-  //! Import transient attribuite from the persistent data.
-  Standard_EXPORT virtual Handle(TDF_Attribute) ImportAttribute() const;
-
-private:
-  Standard_Integer myValue;
+  class Shape1 : public StdLPersistent_HArray1::base<StdPersistent_HArray1OfShape1>
+  {
+    virtual void readValue (StdObjMgt_ReadData& theReadData,
+                            const Standard_Integer theIndex);
+  };
 };
 
 #endif
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
+#ifndef _StdPersistent_HArray1OfShape1_HeaderFile
+#define _StdPersistent_HArray1OfShape1_HeaderFile
 
-#ifndef _StdLPersistent_PDataStd_Integer_HeaderFile
-#define _StdLPersistent_PDataStd_Integer_HeaderFile
 
-#include <StdObjMgt_Persistent.hxx>
+#include <NCollection_DefineHArray1.hxx>
+#include <StdObject_Shape.hxx>
 
+DEFINE_HARRAY1 (StdPersistent_HArray1OfShape1, NCollection_Array1<StdObject_Shape>)
 
-class StdLPersistent_PDataStd_Integer : public StdObjMgt_Persistent
-{
-public:
-  //! Read persistent data from a file.
-  Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
-
-  //! Import transient attribuite from the persistent data.
-  Standard_EXPORT virtual Handle(TDF_Attribute) ImportAttribute() const;
-
-private:
-  Standard_Integer myValue;
-};
-
-#endif
+#endif // _StdPersistent_HArray1OfShape1_HeaderFile
diff --git a/src/StdPersistent/StdPersistent_Naming.cxx b/src/StdPersistent/StdPersistent_Naming.cxx
new file mode 100644 (file)
index 0000000..d239a83
--- /dev/null
@@ -0,0 +1,178 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <StdPersistent_Naming.hxx>
+#include <StdObjMgt_ReadData.hxx>
+
+#include <TNaming_Name.hxx>
+#include <TNaming_Builder.hxx>
+#include <TNaming_Iterator.hxx>
+
+
+//=======================================================================
+//function : Import
+//purpose  : Import transient attribuite from the persistent data
+//=======================================================================
+void StdPersistent_Naming::NamedShape::Import
+  (const Handle(TNaming_NamedShape)& theAttribute) const
+{
+  theAttribute->SetVersion (myVersion);
+
+  if (myOldShapes.IsNull() || myNewShapes.IsNull())
+    return;
+
+  TNaming_Builder aBuilder (theAttribute->Label());
+
+  StdPersistent_HArray1OfShape1::Iterator aOldShapesIter (*myOldShapes->Array());
+  StdPersistent_HArray1OfShape1::Iterator aNewShapesIter (*myNewShapes->Array());
+  for (; aNewShapesIter.More(); aOldShapesIter.Next(), aNewShapesIter.Next())
+  {
+    TopoDS_Shape aOldShape = aOldShapesIter.Value().Import();
+    TopoDS_Shape aNewShape = aNewShapesIter.Value().Import();
+
+    switch (myShapeStatus)
+    {
+    case 0: aBuilder.Generated (aNewShape);            break; // PRIMITIVE
+    case 1: aBuilder.Generated (aOldShape, aNewShape); break; // GENERATED
+    case 2: aBuilder.Modify    (aOldShape, aNewShape); break; // MODIFY
+    case 3: aBuilder.Delete    (aOldShape);            break; // DELETE
+    case 4: aBuilder.Select    (aNewShape, aOldShape); break; // SELECTED
+    case 5: aBuilder.Modify    (aOldShape, aNewShape); break; // REPLACE
+    }
+  }
+}
+
+//=======================================================================
+//function : Read
+//purpose  : Read persistent data from a file
+//=======================================================================
+void StdPersistent_Naming::Name::Read (StdObjMgt_ReadData& theReadData)
+{
+  theReadData >> myType >> myShapeType >> myArgs >> myStop >> myIndex;
+}
+
+//=======================================================================
+//function : Import
+//purpose  : Import transient object from the persistent data
+//=======================================================================
+void StdPersistent_Naming::Name::Import
+  (TNaming_Name& theName, const Handle(TDF_Data)&) const
+{
+  theName.Type      (myType);
+  theName.ShapeType (myShapeType);
+
+  if (myArgs)
+  {
+    StdLPersistent_HArray1OfPersistent::Iterator anIter (*myArgs->Array());
+    for (; anIter.More(); anIter.Next())
+    {
+      Handle(StdObjMgt_Persistent) aPersistent = anIter.Value();
+      if (aPersistent)
+      {
+        Handle(TDF_Attribute) anArg = aPersistent->GetAttribute();
+        theName.Append (Handle(TNaming_NamedShape)::DownCast (anArg));
+      }
+    }
+  }
+
+  if (myStop)
+  {
+    Handle(TDF_Attribute) aStop = myStop->GetAttribute();
+    theName.StopNamedShape (Handle(TNaming_NamedShape)::DownCast (aStop));
+  }
+
+  theName.Index (myIndex);
+}
+
+//=======================================================================
+//function : Read
+//purpose  : Read persistent data from a file
+//=======================================================================
+void StdPersistent_Naming::Name_1::Read (StdObjMgt_ReadData& theReadData)
+{
+  Name::Read (theReadData);
+  theReadData >> myContextLabel;
+}
+
+//=======================================================================
+//function : Import
+//purpose  : Import transient object from the persistent data
+//=======================================================================
+void StdPersistent_Naming::Name_1::Import
+  (TNaming_Name& theName, const Handle(TDF_Data)& theDF) const
+{
+  Name::Import (theName, theDF);
+  if (myContextLabel)
+    theName.ContextLabel (myContextLabel->Label (theDF));
+}
+
+//=======================================================================
+//function : Read
+//purpose  : Read persistent data from a file
+//=======================================================================
+void StdPersistent_Naming::Name_2::Read (StdObjMgt_ReadData& theReadData)
+{
+  Name_1::Read (theReadData);
+  theReadData >> myOrientation;
+}
+
+//=======================================================================
+//function : Import
+//purpose  : Import transient object from the persistent data
+//=======================================================================
+void StdPersistent_Naming::Name_2::Import
+  (TNaming_Name& theName, const Handle(TDF_Data)& theDF) const
+{
+  Name_1::Import (theName, theDF);
+  theName.Orientation (myOrientation);
+}
+
+//=======================================================================
+//function : ImportAttribute
+//purpose  : Import transient attribuite from the persistent data
+//=======================================================================
+void StdPersistent_Naming::Naming::ImportAttribute()
+{
+  Handle(Name) aName;
+  if (myData.Cast (aName))
+  {
+    aName->Import (myTransient->ChangeName(), myTransient->Label().Data());
+    myData.Nullify();
+  }
+}
+
+//=======================================================================
+//function : ImportAttribute
+//purpose  : Import transient attribuite from the persistent data
+//=======================================================================
+void StdPersistent_Naming::Naming_1::ImportAttribute()
+{
+  Naming::ImportAttribute();
+
+  Handle(TNaming_NamedShape) aNamedShape;
+  if (myTransient->Label().FindAttribute (TNaming_NamedShape::GetID(), aNamedShape)
+   && aNamedShape->Evolution() == TNaming_SELECTED)
+  {
+    for (TNaming_Iterator anIter (aNamedShape); anIter.More(); anIter.Next())
+    {
+      const TopoDS_Shape& aOldShape = anIter.OldShape();
+      const TopoDS_Shape& aNewShape = anIter.NewShape();
+
+      if (!aOldShape.IsNull() && aOldShape.ShapeType() == TopAbs_VERTEX
+            && !aNewShape.IsNull() && aNewShape.ShapeType() != TopAbs_VERTEX)
+      {
+        myTransient->ChangeName().Orientation (aOldShape.Orientation());
+      }
+    }
+  }
+}
diff --git a/src/StdPersistent/StdPersistent_Naming.hxx b/src/StdPersistent/StdPersistent_Naming.hxx
new file mode 100644 (file)
index 0000000..90c2cfe
--- /dev/null
@@ -0,0 +1,118 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#ifndef _StdPersistent_Naming_HeaderFile
+#define _StdPersistent_Naming_HeaderFile
+
+#include <StdObjMgt_Attribute.hxx>
+#include <StdObjMgt_Persistent.hxx>
+#include <StdPersistent_HArray1.hxx>
+#include <StdLPersistent_HArray1.hxx>
+#include <StdLPersistent_HString.hxx>
+
+#include <TopAbs_ShapeEnum.hxx>
+#include <TopAbs_Orientation.hxx>
+
+#include <TNaming_NameType.hxx>
+
+#include <TNaming_NamedShape.hxx>
+#include <TNaming_Naming.hxx>
+
+class TNaming_Name;
+
+
+class StdPersistent_Naming
+{
+public:
+  class NamedShape : public StdObjMgt_Attribute<TNaming_NamedShape>
+  {
+  public:
+    //! Read persistent data from a file.
+    inline void Read (StdObjMgt_ReadData& theReadData)
+    { theReadData >> myOldShapes >> myNewShapes >> myShapeStatus >> myVersion; }
+
+    //! Import transient attribuite from the persistent data.
+    void Import (const Handle(TNaming_NamedShape)& theAttribute) const;
+
+  private:
+    Reference <StdPersistent_HArray1::Shape1> myOldShapes;
+    Reference <StdPersistent_HArray1::Shape1> myNewShapes;
+    Value     <Standard_Integer>              myShapeStatus;
+    Value     <Standard_Integer>              myVersion;
+  };
+
+  class Name : public StdObjMgt_Persistent
+  {
+  public:
+    //! Read persistent data from a file.
+    Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
+
+    //! Import transient object from the persistent data.
+    Standard_EXPORT virtual void Import
+      (TNaming_Name& theName, const Handle(TDF_Data)& theDF) const;
+
+  private:
+    Enum      <TNaming_NameType>                   myType;
+    Enum      <TopAbs_ShapeEnum>                   myShapeType;
+    Reference <StdLPersistent_HArray1::Persistent> myArgs;
+    Reference<>                                    myStop;
+    Value     <Standard_Integer>                   myIndex;
+  };
+
+  class Name_1 : public Name
+  {
+  public:
+    //! Read persistent data from a file.
+    Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
+
+    //! Import transient object from the persistent data.
+    Standard_EXPORT virtual void Import
+      (TNaming_Name& theName, const Handle(TDF_Data)& theDF) const;
+
+  private:
+    Reference<StdLPersistent_HString::Ascii> myContextLabel;
+  };
+
+  class Name_2 : public Name_1
+  {
+  public:
+    //! Read persistent data from a file.
+    Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
+
+    //! Import transient object from the persistent data.
+    Standard_EXPORT virtual void Import
+      (TNaming_Name& theName, const Handle(TDF_Data)& theDF) const;
+
+  private:
+    Enum<TopAbs_Orientation> myOrientation;
+  };
+
+  class Naming : public StdObjMgt_Attribute<TNaming_Naming>::SingleRef
+  {
+  public:
+    //! Import transient attribuite from the persistent data.
+    Standard_EXPORT virtual void ImportAttribute();
+  };
+
+  class Naming_1 : public Naming
+  {
+  public:
+    //! Import transient attribuite from the persistent data.
+    Standard_EXPORT virtual void ImportAttribute();
+  };
+
+  typedef Naming Naming_2;
+};
+
+#endif
diff --git a/src/StdPersistent/StdPersistent_PPrsStd.cxx b/src/StdPersistent/StdPersistent_PPrsStd.cxx
new file mode 100644 (file)
index 0000000..986eabd
--- /dev/null
@@ -0,0 +1,62 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <StdPersistent_PPrsStd.hxx>
+
+
+//=======================================================================
+//function : Import
+//purpose  : Import transient attribuite from the persistent data
+//=======================================================================
+void StdPersistent_PPrsStd::AISPresentation::Import
+  (const Handle(TDataXtd_Presentation)& theAttribute) const
+{
+  theAttribute->SetDisplayed (myIsDisplayed);
+
+  Handle(TCollection_HExtendedString) aDriverGUID = myDriverGUID->ExtString();
+  if (aDriverGUID)
+    theAttribute->SetDriverGUID (
+      Standard_GUID (aDriverGUID->String().ToExtString()));
+
+  if (myColor != -1)
+    theAttribute->SetColor
+      (static_cast<Quantity_NameOfColor> ((Standard_Integer)myColor));
+  else
+    theAttribute->UnsetColor();
+
+  if (myMaterial != -1)
+    theAttribute->SetMaterialIndex (myMaterial);
+  else
+    theAttribute->UnsetMaterial();
+  if (myTransparency != -1.)
+    theAttribute->SetTransparency (myTransparency);
+  else
+    theAttribute->UnsetTransparency();
+  if (myWidth != -1.)
+    theAttribute->SetWidth (myWidth);
+  else
+    theAttribute->UnsetWidth();
+}
+
+//=======================================================================
+//function : Import
+//purpose  : Import transient attribuite from the persistent data
+//=======================================================================
+void StdPersistent_PPrsStd::AISPresentation_1::Import
+  (const Handle(TDataXtd_Presentation)& theAttribute) const
+{
+  AISPresentation::Import (theAttribute);
+  theAttribute->SetMode (myMode);
+}
diff --git a/src/StdPersistent/StdPersistent_PPrsStd.hxx b/src/StdPersistent/StdPersistent_PPrsStd.hxx
new file mode 100644 (file)
index 0000000..b288732
--- /dev/null
@@ -0,0 +1,66 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#ifndef _StdPersistent_PPrsStd_PatternStd_HeaderFile
+#define _StdPersistent_PPrsStd_PatternStd_HeaderFile
+
+#include <StdObjMgt_Attribute.hxx>
+#include <StdLPersistent_HString.hxx>
+
+#include <TDataXtd_Presentation.hxx>
+
+class StdPersistent_PPrsStd
+{
+public:
+  class AISPresentation : public StdObjMgt_Attribute<TDataXtd_Presentation>
+  {
+  public:
+    //! Read persistent data from a file.
+    inline void Read (StdObjMgt_ReadData& theReadData)
+    {
+      theReadData >> myIsDisplayed >> myDriverGUID
+        >> myTransparency >> myColor >> myMaterial >> myWidth;
+    }
+
+    //! Import transient attribuite from the persistent data.
+    void Import (const Handle(TDataXtd_Presentation)& theAttribute) const;
+
+  private:
+    Value<Standard_Boolean> myIsDisplayed;
+    Reference<>             myDriverGUID;
+    Value<Standard_Real>    myTransparency;
+    Value<Standard_Integer> myColor;
+    Value<Standard_Integer> myMaterial;
+    Value<Standard_Real>    myWidth;
+  };
+
+  class AISPresentation_1 : public AISPresentation
+  {
+  public:
+    //! Read persistent data from a file.
+    inline void Read (StdObjMgt_ReadData& theReadData)
+    {
+      AISPresentation::Read (theReadData);
+      theReadData >> myMode;
+    }
+
+    //! Import transient attribuite from the persistent data.
+    void Import (const Handle(TDataXtd_Presentation)& theAttribute) const;
+
+  private:
+    Value<Standard_Integer> myMode;
+  };
+};
+
+#endif
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include <StdLPersistent_PDocStd_Document.hxx>
-#include <StdLPersistent_PDF_Data.hxx>
-
+#include <StdPersistent_TopLoc.hxx>
 #include <StdObjMgt_ReadData.hxx>
+#include <StdObject_gp.hxx>
+
+#include <gp_Trsf.hxx>
 
-#include <TDocStd_Document.hxx>
-#include <TDocStd_Owner.hxx>
 
 //=======================================================================
 //function : Read
 //purpose  : Read persistent data from a file
 //=======================================================================
-void StdLPersistent_PDocStd_Document::Read (StdObjMgt_ReadData& theReadData)
+void StdPersistent_TopLoc::Datum3D::Read (StdObjMgt_ReadData& theReadData)
 {
-  theReadData >> myData;
+  StdObject_gp::Object<gp_Trsf> aTrsf;
+  theReadData >> aTrsf;
+  myTransient = new TopLoc_Datum3D (aTrsf);
 }
 
 //=======================================================================
-//function : Import
-//purpose  : Import transient document from the persistent data
+//function : Read
+//purpose  : Read persistent data from a file
 //=======================================================================
-void StdLPersistent_PDocStd_Document::Import (const Handle(CDM_Document)& theDocument) const
+void StdPersistent_TopLoc::ItemLocation::Read (StdObjMgt_ReadData& theReadData)
 {
-  Handle(TDocStd_Document) aDocument = Handle(TDocStd_Document)::DownCast (theDocument);
-  if (aDocument.IsNull() || myData.IsNull())
-    return;
+  theReadData >> myDatum >> myPower >> myNext;
+}
 
-  Handle(TDF_Data) aData = myData->Import();
-  aDocument->SetData (aData);
-  TDocStd_Owner::SetDocument (aData, aDocument);
+//=======================================================================
+//function : Import
+//purpose  : Import transient object from the persistent data
+//=======================================================================
+TopLoc_Location StdPersistent_TopLoc::ItemLocation::Import() const
+{
+  TopLoc_Location aNext = myNext.Import();
+  if (myDatum)
+    return aNext * TopLoc_Location (myDatum->Import()).Powered (myPower);
+  else
+    return aNext;
 }
diff --git a/src/StdPersistent/StdPersistent_TopLoc.hxx b/src/StdPersistent/StdPersistent_TopLoc.hxx
new file mode 100644 (file)
index 0000000..891921f
--- /dev/null
@@ -0,0 +1,52 @@
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#ifndef _StdPersistent_TopLoc_HeaderFile
+#define _StdPersistent_TopLoc_HeaderFile
+
+#include <StdObjMgt_SharedObject.hxx>
+#include <StdObjMgt_Persistent.hxx>
+#include <StdObject_Location.hxx>
+
+#include <TopLoc_Datum3D.hxx>
+#include <TopLoc_Location.hxx>
+
+
+class StdPersistent_TopLoc
+{
+public:
+  class Datum3D : public StdObjMgt_SharedObject::SharedBase<TopLoc_Datum3D>
+  {
+  public:
+    //! Read persistent data from a file.
+    void Read (StdObjMgt_ReadData& theReadData);
+  };
+
+  class ItemLocation : public StdObjMgt_Persistent
+  {
+  public:
+    //! Read persistent data from a file.
+    Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
+
+    //! Import transient object from the persistent data.
+    Standard_EXPORT TopLoc_Location Import() const;
+
+  private:
+    Reference<Datum3D>         myDatum;
+    Value<Standard_Integer>    myPower;
+    Object<StdObject_Location> myNext;
+  };
+};
+
+#endif
 // commercial license or contractual agreement.
 
 
-#ifndef _StdLPersistent_PColStd_HArray1Base_HeaderFile
-#define _StdLPersistent_PColStd_HArray1Base_HeaderFile
+#ifndef _StdPersistent_TopoDS_HeaderFile
+#define _StdPersistent_TopoDS_HeaderFile
 
-#include <StdObjMgt_Persistent.hxx>
+#include <StdObjMgt_SharedObject.hxx>
+#include <StdObjMgt_ReadData.hxx>
 
+#include <TopoDS_TShape.hxx>
 
-class StdLPersistent_PColStd_HArray1Base : public StdObjMgt_Persistent
-{
-public:
-  //! Read persistent data from a file.
-  Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
 
+class StdPersistent_TopoDS : protected StdObjMgt_SharedObject
+{
 protected:
-  virtual void CreateArray (const Standard_Integer theLowerBound,
-                            const Standard_Integer theUpperBound) = 0;
+  class pTShape : public PersistentBase
+  {
+  public:
+    inline void Read (StdObjMgt_ReadData& theReadData)
+      { theReadData >> myShapes >> myFlags; }
 
-  virtual void ReadValue (StdObjMgt_ReadData& theReadData,
-                          const Standard_Integer theIndex) = 0;
+  protected:
+    Reference<>             myShapes;
+    Value<Standard_Integer> myFlags;
+  };
+
+public:
+  typedef IgnoreData<StdObjMgt_Persistent, pTShape, TopoDS_TShape> TShape;
 };
 
 #endif
diff --git a/src/TKShape/CMakeLists.txt b/src/TKShape/CMakeLists.txt
deleted file mode 100644 (file)
index 51ec161..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-project(TKShape)
-
-OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKShape/EXTERNLIB b/src/TKShape/EXTERNLIB
deleted file mode 100644 (file)
index 6d653e1..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-TKernel
-TKG2d
-TKMath
-TKCDF
diff --git a/src/TKShape/FILES b/src/TKShape/FILES
deleted file mode 100644 (file)
index c999897..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-PACKAGES
-EXTERNLIB
diff --git a/src/TKShape/PACKAGES b/src/TKShape/PACKAGES
deleted file mode 100644 (file)
index 78502df..0000000
+++ /dev/null
@@ -1 +0,0 @@
-ShapePersistent
index 4ff518a..605da78 100644 (file)
@@ -1,9 +1,9 @@
-TKCDF
 TKernel
+TKCDF
 TKCAF
-TKShape
 TKLCAF
-TKStdL
-TKG3d
+TKBRep
 TKMath
 TKG2d
+TKG3d
+TKStdL
index c6bcead..1fbe61e 100644 (file)
@@ -1,2 +1,4 @@
 StdDrivers
+StdObject
 StdPersistent
+ShapePersistent
index fad7652..cd1b434 100644 (file)
@@ -1,4 +1,3 @@
-TKCDF
 TKernel
-TKShape
+TKCDF
 TKLCAF
index 893f136..6d5a70e 100644 (file)
@@ -1,3 +1,4 @@
 StdLDrivers
+StdLObject
 StdLPersistent
 StdObjMgt
diff --git a/tests/bugs/caf/buc60756_std b/tests/bugs/caf/buc60756_std
new file mode 100644 (file)
index 0000000..3091dc3
--- /dev/null
@@ -0,0 +1,17 @@
+puts "==========="
+puts "BUC60756"
+puts "BUC60761"
+puts "BUC60762"
+puts "BUC60764"
+puts "==========="
+
+Open [locate_data_file BUC60756_Doc.std] D
+
+######################################################################
+catch {file delete ${imagedir}/Doc2.cbf}
+
+Format D BinOcaf
+SaveAs D ${imagedir}/Doc2.cbf
+Close D
+Open ${imagedir}/Doc2.cbf D 
+
diff --git a/tests/bugs/caf/buc60867_std b/tests/bugs/caf/buc60867_std
new file mode 100644 (file)
index 0000000..7fc9a65
--- /dev/null
@@ -0,0 +1,12 @@
+puts "==========="
+puts "BUC60867"
+puts "==========="
+
+pload QAcommands
+
+set ResultError [ BUC60867 [locate_data_file BUC60756_Doc.std] ]
+
+if { [regexp "0" $ResultError] != 1 } {
+    puts "Error : 1"
+}
+
diff --git a/tests/bugs/caf/bug1454_std b/tests/bugs/caf/bug1454_std
new file mode 100644 (file)
index 0000000..8464ff1
--- /dev/null
@@ -0,0 +1,34 @@
+
+puts "===== OCC1454 ====="
+#######################################################################################
+# Improve performance of TDF_Label::FindChild
+#######################################################################################
+
+puts "Info: Open the document with 80000 sublabels of the label 0:2"
+dchrono h reset
+dchrono h start
+Open [locate_data_file OCC1726.std] D
+dchrono h stop
+set TimeList [dchrono h show]
+
+regexp {Elapsed time: [-0-9.+eE]+ Hours ([-0-9.+eE]+) Minutes ([-0-9.+eE]+) Seconds} $TimeList full ElapsedTime_min ElapsedTime_sec
+regexp {CPU user time: ([-0-9.+eE]+) seconds} $TimeList full CPUusertime
+regexp {CPU system time: ([-0-9.+eE]+) seconds} $TimeList full CPUsystemtime
+
+puts "ElapsedTime = ${ElapsedTime_min} min ${ElapsedTime_sec} sec CPUusertime = ${CPUusertime} CPUsystemtime = ${CPUsystemtime}"
+
+if { ${ElapsedTime_sec} > 20.0 || ${ElapsedTime_min} != 0 } {
+  puts "Elapsed time is more then 20.0 seconds - Faulty"
+  puts "Faulty OCC1454"
+} elseif { ${CPUusertime} > 12 } {
+    puts "CPUusertime is more then 12 seconds - Faulty"
+    puts "Faulty OCC1454"
+} elseif { ${CPUsystemtime} > 0.6 } { 
+    puts "CPUsystemtime is more then 0.6 seconds"
+    puts "Faulty OCC1454"
+} else {
+    puts "Elapsed time is less then 20 seconds - OK"
+    puts "CPU user time is less then 12 seconds - OK"
+    puts "CPU system time is less then 0.6 seconds - OK"
+    puts "OK for OCC1454"
+}
diff --git a/tests/bugs/caf/bug1726_std b/tests/bugs/caf/bug1726_std
new file mode 100644 (file)
index 0000000..828829c
--- /dev/null
@@ -0,0 +1,26 @@
+puts "================"
+puts "OCC1726"
+puts "================"
+puts ""
+#######################################################################################
+# TDF_LabelNode::~TDF_LabelNode causes stack overflow
+#######################################################################################
+
+puts "Info: Open the document with 80000 sublabels of the label 0:2"
+chrono h reset; chrono h start
+Open [locate_data_file OCC1726.std] D
+chrono h stop; chrono h show
+
+set IsGood 1
+puts "Info: Close the document"
+chrono h reset; chrono h start
+if [catch {Close D} result] {
+   set IsGood 0
+}
+chrono h stop; chrono h show
+
+if { ${IsGood} == 0} {
+  puts "Faulty OCC1726"
+} else {
+  puts "OK OCC1726"
+}
diff --git a/tests/bugs/caf/bug22788_1_std b/tests/bugs/caf/bug22788_1_std
new file mode 100644 (file)
index 0000000..9bbfbfd
--- /dev/null
@@ -0,0 +1,41 @@
+puts "============"
+puts "OCC22788"
+puts "============"
+puts ""
+#######################################################################
+# 
+#######################################################################
+
+pload QAcommands
+
+set BugNumber OCC22788
+
+NewDocument D MDTV-Standard
+
+set aFile OCC22788.std
+
+Open [locate_data_file ${aFile}] D
+
+Close D
+
+return
+
+set log [OCC159 D]
+
+set list [split ${log}]
+set ll [llength ${list}]
+
+if { ${ll} < 13 } {
+    puts "OCC159: Error"
+} else {
+    set DocRefCount1 [lindex ${list} 2]
+    set DocOwner1    [lindex ${list} 5]
+    set DocOwner2    [lindex ${list} 8]
+    set DocRefCount2 [lindex ${list} 11]
+    set deltaRefCount [expr ${DocRefCount1} - ${DocRefCount2}]
+    if { ${DocOwner2} == "NULL" && ${deltaRefCount} >= 1 } then {
+       puts "OCC159: OK"
+    } else {
+       puts "OCC159: Error"
+    }
+}
diff --git a/tests/bugs/caf/bug22788_2_std b/tests/bugs/caf/bug22788_2_std
new file mode 100644 (file)
index 0000000..da36cfd
--- /dev/null
@@ -0,0 +1,32 @@
+puts "================"
+puts "OCC22788"
+puts "================"
+puts ""
+#######################################################################################
+# Exception during closing of document due to corrupted memory.
+######################################################################################
+
+set BugNumber OCC22788
+
+set aFile [locate_data_file OCC22788.std]
+
+Open ${aFile} D
+
+GetShape D 0:2 result
+smallview
+fit
+
+set catch_status 0
+if { [catch {Close D} catch_result] } {
+  set catch_status 1
+}
+
+if { ${catch_status} != 0 } {
+   puts "Faulty ${BugNumber}"
+} else {
+   puts "OK ${BugNumber}"
+}
+
+checkprops result -s 220000
+checkshape result
+set 2dviewer 0
index 3fd43f6..65245b3 100755 (executable)
@@ -8,7 +8,7 @@ puts ""
 
 # test to check compatibility of old std format
 
-Open [locate_data_file bug23766_ttt1_old.cbf] D
+Open [locate_data_file bug23766_ttt1_old.std] D
 
 GetShape D 0:1:2:1:2 E1
 set info1 [whatis E1]
diff --git a/tests/bugs/caf/bug5023_std b/tests/bugs/caf/bug5023_std
new file mode 100644 (file)
index 0000000..4f255ad
--- /dev/null
@@ -0,0 +1,39 @@
+puts "================"
+puts "OCC5023"
+puts "================"
+puts ""
+######################################################
+# Performance regression in opening OCAF file
+######################################################
+
+set aFile [locate_data_file OCC5023.std]
+
+puts "Info: Restore the document"
+
+if [info exists DD] {
+    catch {Close DD}; unset DD
+}
+
+dchrono h reset
+dchrono h start
+
+Open ${aFile} DD
+dchrono h stop
+set list [dchrono h show]
+Close DD
+
+regexp {CPU user time: +([-0-9.+eE]+)} $list full CPU_user_time
+
+set Good_CPU_user_time 2.
+
+set CPU_user_time_percent [expr (${CPU_user_time} - ${Good_CPU_user_time}) / ${Good_CPU_user_time} * 100.]
+set percent_max 0.1
+
+puts "CPU_user_time = ${CPU_user_time}"
+puts "Good_CPU_user_time = ${Good_CPU_user_time}"
+puts "CPU_user_time_percent = ${CPU_user_time_percent}"
+
+if {${CPU_user_time_percent} > ${percent_max}} {
+    puts "Faulty OCC5023 : CPU user time is wrong"
+}
+
diff --git a/tests/bugs/modalg_5/bug24849_1_std b/tests/bugs/modalg_5/bug24849_1_std
new file mode 100644 (file)
index 0000000..d80d339
--- /dev/null
@@ -0,0 +1,21 @@
+puts "================"
+puts "CR24849"
+puts "================"
+puts ""
+###############################################
+## Crash on Pipe creation
+###############################################
+
+pload DCAF
+
+Open [locate_data_file bug24849_Study1_GEOM.sgd] D
+
+GetShape D 0:1:465:1:1:2 f
+GetShape D 0:1:283:1:1:2 w
+explode w e
+wire ww w_1
+
+pipe result ww f 2
+
+checknbshapes result -vertex 4 -edge 8 -wire 7 -face 7 -shell 2 -solid 2 -compsolid 0 -compound 1 -shape 31
+set 2dviewer 1
diff --git a/tests/bugs/modalg_5/bug24849_2_std b/tests/bugs/modalg_5/bug24849_2_std
new file mode 100644 (file)
index 0000000..4f25d48
--- /dev/null
@@ -0,0 +1,21 @@
+puts "================"
+puts "CR24849"
+puts "================"
+puts ""
+###############################################
+## Crash on Pipe creation
+###############################################
+
+pload DCAF
+
+Open [locate_data_file bug24849_Study1_GEOM.sgd] D
+
+GetShape D 0:1:465:1:1:2 f
+GetShape D 0:1:283:1:1:2 w
+explode w e
+wire ww w_2
+
+pipe result ww f 2
+
+checknbshapes result -vertex 4 -edge 8 -wire 7 -face 7 -shell 2 -solid 2 -compsolid 0 -compound 1 -shape 31
+set 2dviewer 1
diff --git a/tests/bugs/modalg_5/bug25969_std b/tests/bugs/modalg_5/bug25969_std
new file mode 100644 (file)
index 0000000..a672786
--- /dev/null
@@ -0,0 +1,37 @@
+puts "================"
+puts "CR25969"
+puts "================"
+puts ""
+###############################################
+## Wrong result obtained by 2d classifier algorithm.
+###############################################
+
+pload DCAF
+
+Open [locate_data_file bug25969_pal22851.sgd] D
+
+GetShape D 0:1:15:1:1:2 b1
+GetShape D 0:1:29:1:1:2 b2
+explode b1
+explode b2
+bop b1_2 b2_1
+bopcut r
+
+explode r f
+copy r_4 f
+pcurve f
+point p 12.658283198213592 21.045164979270297 
+set cls1 [b2dclassifx f p]
+if { [regexp {OUT} $cls1] } {
+    puts "Error : Wrong result of 2d classifier algorithm"
+} else {
+    puts "OK : Good result of 2d classifier algorithm"
+}
+
+smallview
+fit
+set only_screen_axo 1
diff --git a/tests/bugs/moddata_3/bug23733_std b/tests/bugs/moddata_3/bug23733_std
new file mode 100644 (file)
index 0000000..e80fd46
--- /dev/null
@@ -0,0 +1,40 @@
+puts "================"
+puts "CR23733"
+puts "================"
+puts ""
+###############################################
+## PCurve for edge on face creation failure
+###############################################
+
+pload DCAF TOPTEST
+
+Open [locate_data_file bug_glue_edges_GEOM.sgd] D
+
+GetShape D 0:1:9686:1:1:2 s1
+GetShape D 0:1:9449:1:1:2 s2
+explode s1 e
+explode s2 f
+
+#should create pcurve
+bhaspc s1_100 s2_2 do
+#should report OK
+set info1 [bhaspc s1_100 s2_2]
+if { [regexp {No} ${info1}] == 1 } {
+    puts "Faulty: No 2D curves detected"
+}
+
+#should create pcurve
+bhaspc s1_40 s2_54 do
+#should report OK
+set info2 [bhaspc s1_40 s2_54]
+if { [regexp {No} ${info2}] == 1 } {
+    puts "Faulty: No 2D curves detected"
+}
+
+#should create pcurve
+bhaspc s1_22 s2_123 do
+#should report OK
+set info3 [bhaspc s1_22 s2_123]
+if { [regexp {No} ${info3}] == 1 } {
+    puts "Faulty: No 2D curves detected"
+}