1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-09 18:50:54 +03:00

0027241: Create a complete test case to verify reading of all attribute types from MDTV-Standard document

Added test case that works in one of two modes:
1) create synthetic document (in old version of OCCT) containing all possible attributes.
2) open the document and compare all attributes with expected values.

Fixed reading of TDataStd_NamedData, TDataXtd_PatternStd, and PColStd_HArray2OfReal.
Point and curve representations are created even from NULL geometry handles.
The code is simplified by abandoning usage of templates from StdObjMgt_ContentTypes class for persistent data elements.

Fixed SetAsciiString Draw command failed when the target label contained NamedData attribute.
This commit is contained in:
myn 2016-03-11 22:08:01 +03:00 committed by abv
parent 944d808cd0
commit 45d8465ea2
82 changed files with 1524 additions and 1333 deletions
adm
src
DDataStd
ShapePersistent
StdLDrivers
StdLObject
StdLPersistent
StdObjMgt
StdObject
StdPersistent
TKStdL
tests

@ -244,7 +244,6 @@ n CDM
n FWOSDriver n FWOSDriver
n PCDM n PCDM
n StdLDrivers n StdLDrivers
n StdLObject
n StdLPersistent n StdLPersistent
n StdObjMgt n StdObjMgt
n StdDrivers n StdDrivers

@ -2856,7 +2856,7 @@ static Standard_Integer DDataStd_SetAsciiString (Draw_Interpretor& di,
DDF::AddLabel(DF, arg[2], aLabel); DDF::AddLabel(DF, arg[2], aLabel);
TCollection_AsciiString aString(arg[3]); TCollection_AsciiString aString(arg[3]);
Handle(TDataStd_AsciiString) anAtt; Handle(TDataStd_AsciiString) anAtt;
if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) if(!aLabel.FindAttribute(TDataStd_AsciiString::GetID(), anAtt))
anAtt = TDataStd_AsciiString::Set(aLabel, aString); anAtt = TDataStd_AsciiString::Set(aLabel, aString);
if(anAtt.IsNull()) { if(anAtt.IsNull()) {
di << "AsciiString attribute is not found or not set" << "\n"; di << "AsciiString attribute is not found or not set" << "\n";

@ -11,9 +11,7 @@ ShapePersistent_Geom_Surface.hxx
ShapePersistent_Geom2d.hxx ShapePersistent_Geom2d.hxx
ShapePersistent_Geom2d_Curve.cxx ShapePersistent_Geom2d_Curve.cxx
ShapePersistent_Geom2d_Curve.hxx ShapePersistent_Geom2d_Curve.hxx
ShapePersistent_HArray1.cxx
ShapePersistent_HArray1.hxx ShapePersistent_HArray1.hxx
ShapePersistent_HArray2.cxx
ShapePersistent_HArray2.hxx ShapePersistent_HArray2.hxx
ShapePersistent_HSequence.cxx ShapePersistent_HSequence.cxx
ShapePersistent_HSequence.hxx ShapePersistent_HSequence.hxx

@ -15,6 +15,7 @@
#include <StdObjMgt_MapOfInstantiators.hxx> #include <StdObjMgt_MapOfInstantiators.hxx>
#include <StdLPersistent_HArray1.hxx> #include <StdLPersistent_HArray1.hxx>
#include <StdLPersistent_HArray2.hxx>
#include <StdPersistent_TopoDS.hxx> #include <StdPersistent_TopoDS.hxx>
#include <ShapePersistent_TopoDS.hxx> #include <ShapePersistent_TopoDS.hxx>
#include <ShapePersistent_HArray1.hxx> #include <ShapePersistent_HArray1.hxx>
@ -36,16 +37,32 @@
void ShapePersistent::BindTypes (StdObjMgt_MapOfInstantiators& theMap) void ShapePersistent::BindTypes (StdObjMgt_MapOfInstantiators& theMap)
{ {
theMap.Bind <StdLPersistent_HArray1::Persistent> ("PTopoDS_HArray1OfHShape"); theMap.Bind <StdLPersistent_HArray1::Persistent> ("PTopoDS_HArray1OfHShape");
theMap.Bind <StdLPersistent_HArray1::Persistent> ("PColPGeom_HArray1OfCurve");
theMap.Bind <StdLPersistent_HArray1::Persistent> ("PColPGeom_HArray1OfBoundedCurve");
theMap.Bind <StdLPersistent_HArray1::Persistent> ("PColPGeom_HArray1OfBezierCurve");
theMap.Bind <StdLPersistent_HArray1::Persistent> ("PColPGeom_HArray1OfBSplineCurve");
theMap.Bind <StdLPersistent_HArray1::Persistent> ("PColPGeom_HArray1OfSurface");
theMap.Bind <StdLPersistent_HArray1::Persistent> ("PColPGeom_HArray1OfBoundedSurface");
theMap.Bind <StdLPersistent_HArray2::Persistent> ("PColPGeom_HArray2OfSurface");
theMap.Bind <StdLPersistent_HArray2::Persistent> ("PColPGeom_HArray2OfBoundedSurface");
theMap.Bind <StdLPersistent_HArray2::Persistent> ("PColPGeom_HArray2OfBezierSurface");
theMap.Bind <StdLPersistent_HArray2::Persistent> ("PColPGeom_HArray2OfBSplineSurface");
theMap.Bind <StdLPersistent_HArray1::Persistent> ("PColPGeom2d_HArray1OfCurve");
theMap.Bind <StdLPersistent_HArray1::Persistent> ("PColPGeom2d_HArray1OfBoundedCurve");
theMap.Bind <StdLPersistent_HArray1::Persistent> ("PColPGeom2d_HArray1OfBezierCurve");
theMap.Bind <StdLPersistent_HArray1::Persistent> ("PColPGeom2d_HArray1OfBSplineCurve");
theMap.Bind <ShapePersistent_TopoDS::Shape> ("PTopoDS_HShape"); theMap.Bind <StdLPersistent_HArray2::Real> ("PColStd_HArray2OfReal");
theMap.Bind <ShapePersistent_TopoDS::Shape> ("PTopoDS_Vertex");
theMap.Bind <ShapePersistent_TopoDS::Shape> ("PTopoDS_Edge"); theMap.Bind <ShapePersistent_TopoDS::HShape> ("PTopoDS_HShape");
theMap.Bind <ShapePersistent_TopoDS::Shape> ("PTopoDS_Wire"); theMap.Bind <ShapePersistent_TopoDS::HShape> ("PTopoDS_Vertex");
theMap.Bind <ShapePersistent_TopoDS::Shape> ("PTopoDS_Face"); theMap.Bind <ShapePersistent_TopoDS::HShape> ("PTopoDS_Edge");
theMap.Bind <ShapePersistent_TopoDS::Shape> ("PTopoDS_Shell"); theMap.Bind <ShapePersistent_TopoDS::HShape> ("PTopoDS_Wire");
theMap.Bind <ShapePersistent_TopoDS::Shape> ("PTopoDS_Solid"); theMap.Bind <ShapePersistent_TopoDS::HShape> ("PTopoDS_Face");
theMap.Bind <ShapePersistent_TopoDS::Shape> ("PTopoDS_CompSolid"); theMap.Bind <ShapePersistent_TopoDS::HShape> ("PTopoDS_Shell");
theMap.Bind <ShapePersistent_TopoDS::Shape> ("PTopoDS_Compound"); theMap.Bind <ShapePersistent_TopoDS::HShape> ("PTopoDS_Solid");
theMap.Bind <ShapePersistent_TopoDS::HShape> ("PTopoDS_CompSolid");
theMap.Bind <ShapePersistent_TopoDS::HShape> ("PTopoDS_Compound");
theMap.Bind <StdPersistent_TopoDS::TShape> ("PTopoDS_TShape"); theMap.Bind <StdPersistent_TopoDS::TShape> ("PTopoDS_TShape");

@ -74,11 +74,12 @@ void ShapePersistent_BRep::PointOnCurve::Read
Handle(BRep_PointRepresentation) Handle(BRep_PointRepresentation)
ShapePersistent_BRep::PointOnCurve::import() const ShapePersistent_BRep::PointOnCurve::import() const
{ {
if (myCurve.IsNull()) Handle(Geom_Curve) aCurve;
return NULL; if (myCurve)
aCurve = myCurve->Import();
return new BRep_PointOnCurve return new BRep_PointOnCurve
(myParameter, myCurve->Import(), myLocation.Import()); (myParameter, aCurve, myLocation.Import());
} }
void ShapePersistent_BRep::PointsOnSurface::Read void ShapePersistent_BRep::PointsOnSurface::Read
@ -98,11 +99,16 @@ void ShapePersistent_BRep::PointOnCurveOnSurface::Read
Handle(BRep_PointRepresentation) Handle(BRep_PointRepresentation)
ShapePersistent_BRep::PointOnCurveOnSurface::import() const ShapePersistent_BRep::PointOnCurveOnSurface::import() const
{ {
if (mySurface.IsNull() || myPCurve.IsNull()) Handle(Geom2d_Curve) aPCurve;
return NULL; if (myPCurve)
aPCurve = myPCurve->Import();
Handle(Geom_Surface) aSurface;
if (mySurface)
aSurface = mySurface->Import();
return new BRep_PointOnCurveOnSurface return new BRep_PointOnCurveOnSurface
(myParameter, myPCurve->Import(), mySurface->Import(), myLocation.Import()); (myParameter, aPCurve, aSurface, myLocation.Import());
} }
void ShapePersistent_BRep::PointOnSurface::Read void ShapePersistent_BRep::PointOnSurface::Read
@ -115,11 +121,12 @@ void ShapePersistent_BRep::PointOnSurface::Read
Handle(BRep_PointRepresentation) Handle(BRep_PointRepresentation)
ShapePersistent_BRep::PointOnSurface::import() const ShapePersistent_BRep::PointOnSurface::import() const
{ {
if (mySurface.IsNull()) Handle(Geom_Surface) aSurface;
return NULL; if (mySurface)
aSurface = mySurface->Import();
return new BRep_PointOnSurface return new BRep_PointOnSurface
(myParameter, myParameter2, mySurface->Import(), myLocation.Import()); (myParameter, myParameter2, aSurface, myLocation.Import());
} }
//======================================================================= //=======================================================================
@ -164,12 +171,12 @@ void ShapePersistent_BRep::Curve3D::Read
Handle(BRep_CurveRepresentation) Handle(BRep_CurveRepresentation)
ShapePersistent_BRep::Curve3D::import() const ShapePersistent_BRep::Curve3D::import() const
{ {
Handle(Geom_Curve) aCurve; Handle(Geom_Curve) aCurve3D;
if (myCurve3D) if (myCurve3D)
aCurve = myCurve3D->Import(); aCurve3D = myCurve3D->Import();
Handle(BRep_Curve3D) aRepresentation = Handle(BRep_Curve3D) aRepresentation =
new BRep_Curve3D (aCurve, myLocation.Import()); new BRep_Curve3D (aCurve3D, myLocation.Import());
aRepresentation->SetRange (myFirst, myLast); aRepresentation->SetRange (myFirst, myLast);
return aRepresentation; return aRepresentation;
@ -185,18 +192,21 @@ void ShapePersistent_BRep::CurveOnSurface::Read
Handle(BRep_CurveRepresentation) Handle(BRep_CurveRepresentation)
ShapePersistent_BRep::CurveOnSurface::import() const ShapePersistent_BRep::CurveOnSurface::import() const
{ {
if (myPCurve.IsNull() || mySurface.IsNull()) Handle(Geom2d_Curve) aPCurve;
return NULL; if (myPCurve)
aPCurve = myPCurve->Import();
Handle(BRep_CurveOnSurface) aCurve = Handle(Geom_Surface) aSurface;
new BRep_CurveOnSurface (myPCurve->Import(), if (mySurface)
mySurface->Import(), aSurface = mySurface->Import();
myLocation.Import());
aCurve->SetUVPoints (myUV1, myUV2); Handle(BRep_CurveOnSurface) aRepresentation =
aCurve->SetRange (myFirst, myLast); new BRep_CurveOnSurface (aPCurve, aSurface, myLocation.Import());
return aCurve; aRepresentation->SetUVPoints (myUV1, myUV2);
aRepresentation->SetRange (myFirst, myLast);
return aRepresentation;
} }
void ShapePersistent_BRep::CurveOnClosedSurface::Read void ShapePersistent_BRep::CurveOnClosedSurface::Read
@ -209,21 +219,29 @@ void ShapePersistent_BRep::CurveOnClosedSurface::Read
Handle(BRep_CurveRepresentation) Handle(BRep_CurveRepresentation)
ShapePersistent_BRep::CurveOnClosedSurface::import() const ShapePersistent_BRep::CurveOnClosedSurface::import() const
{ {
if (myPCurve.IsNull() || mySurface.IsNull() || myPCurve2.IsNull()) Handle(Geom2d_Curve) aPCurve;
return NULL; if (myPCurve)
aPCurve = myPCurve->Import();
Handle(BRep_CurveOnClosedSurface) aCurve = Handle(Geom2d_Curve) aPCurve2;
new BRep_CurveOnClosedSurface (myPCurve->Import(), if (myPCurve2)
myPCurve2->Import(), aPCurve2 = myPCurve2->Import();
mySurface->Import(),
myLocation.Import(),
myContinuity);
aCurve->SetUVPoints (myUV1 , myUV2 ); Handle(Geom_Surface) aSurface;
aCurve->SetUVPoints2 (myUV21 , myUV22); if (mySurface)
aCurve->SetRange (myFirst, myLast); aSurface = mySurface->Import();
return aCurve; GeomAbs_Shape aContinuity = static_cast<GeomAbs_Shape> (myContinuity);
Handle(BRep_CurveOnClosedSurface) aRepresentation =
new BRep_CurveOnClosedSurface
(aPCurve, aPCurve2, aSurface, myLocation.Import(), aContinuity);
aRepresentation->SetUVPoints (myUV1 , myUV2 );
aRepresentation->SetUVPoints2 (myUV21 , myUV22);
aRepresentation->SetRange (myFirst, myLast);
return aRepresentation;
} }
void ShapePersistent_BRep::Polygon3D::Read void ShapePersistent_BRep::Polygon3D::Read
@ -236,10 +254,11 @@ void ShapePersistent_BRep::Polygon3D::Read
Handle(BRep_CurveRepresentation) Handle(BRep_CurveRepresentation)
ShapePersistent_BRep::Polygon3D::import() const ShapePersistent_BRep::Polygon3D::import() const
{ {
if (myPolygon3D.IsNull()) Handle(Poly_Polygon3D) aPolygon3D;
return NULL; if (myPolygon3D)
aPolygon3D = myPolygon3D->Import();
return new BRep_Polygon3D (myPolygon3D->Import(), myLocation.Import()); return new BRep_Polygon3D (aPolygon3D, myLocation.Import());
} }
void ShapePersistent_BRep::PolygonOnTriangulation::Read void ShapePersistent_BRep::PolygonOnTriangulation::Read
@ -252,12 +271,16 @@ void ShapePersistent_BRep::PolygonOnTriangulation::Read
Handle(BRep_CurveRepresentation) Handle(BRep_CurveRepresentation)
ShapePersistent_BRep::PolygonOnTriangulation::import() const ShapePersistent_BRep::PolygonOnTriangulation::import() const
{ {
if (myPolygon.IsNull() || myTriangulation.IsNull()) Handle(Poly_PolygonOnTriangulation) aPolygon;
return NULL; if (myPolygon)
aPolygon = myPolygon->Import();
return new BRep_PolygonOnTriangulation (myPolygon->Import(), Handle(Poly_Triangulation) aTriangulation;
myTriangulation->Import(), if (myTriangulation)
myLocation.Import()); aTriangulation = myTriangulation->Import();
return new BRep_PolygonOnTriangulation
(aPolygon, aTriangulation, myLocation.Import());
} }
void ShapePersistent_BRep::PolygonOnClosedTriangulation::Read void ShapePersistent_BRep::PolygonOnClosedTriangulation::Read
@ -270,13 +293,20 @@ void ShapePersistent_BRep::PolygonOnClosedTriangulation::Read
Handle(BRep_CurveRepresentation) Handle(BRep_CurveRepresentation)
ShapePersistent_BRep::PolygonOnClosedTriangulation::import() const ShapePersistent_BRep::PolygonOnClosedTriangulation::import() const
{ {
if (myPolygon.IsNull() || myTriangulation.IsNull() || myPolygon2.IsNull()) Handle(Poly_PolygonOnTriangulation) aPolygon;
return NULL; if (myPolygon)
aPolygon = myPolygon->Import();
return new BRep_PolygonOnClosedTriangulation (myPolygon->Import(), Handle(Poly_PolygonOnTriangulation) aPolygon2;
myPolygon2->Import(), if (myPolygon2)
myTriangulation->Import(), aPolygon2 = myPolygon2->Import();
myLocation.Import());
Handle(Poly_Triangulation) aTriangulation;
if (myTriangulation)
aTriangulation = myTriangulation->Import();
return new BRep_PolygonOnClosedTriangulation
(aPolygon, aPolygon2, aTriangulation, myLocation.Import());
} }
void ShapePersistent_BRep::PolygonOnSurface::Read void ShapePersistent_BRep::PolygonOnSurface::Read
@ -289,12 +319,15 @@ void ShapePersistent_BRep::PolygonOnSurface::Read
Handle(BRep_CurveRepresentation) Handle(BRep_CurveRepresentation)
ShapePersistent_BRep::PolygonOnSurface::import() const ShapePersistent_BRep::PolygonOnSurface::import() const
{ {
if (myPolygon2D.IsNull() || mySurface.IsNull()) Handle(Poly_Polygon2D) aPolygon2D;
return NULL; if (myPolygon2D)
aPolygon2D = myPolygon2D->Import();
return new BRep_PolygonOnSurface (myPolygon2D->Import(), Handle(Geom_Surface) aSurface;
mySurface->Import(), if (mySurface)
myLocation.Import()); aSurface = mySurface->Import();
return new BRep_PolygonOnSurface (aPolygon2D, aSurface, myLocation.Import());
} }
void ShapePersistent_BRep::PolygonOnClosedSurface::Read void ShapePersistent_BRep::PolygonOnClosedSurface::Read
@ -307,13 +340,20 @@ void ShapePersistent_BRep::PolygonOnClosedSurface::Read
Handle(BRep_CurveRepresentation) Handle(BRep_CurveRepresentation)
ShapePersistent_BRep::PolygonOnClosedSurface::import() const ShapePersistent_BRep::PolygonOnClosedSurface::import() const
{ {
if (myPolygon2D.IsNull() || mySurface.IsNull() || myPolygon2.IsNull()) Handle(Poly_Polygon2D) aPolygon2D;
return NULL; if (myPolygon2D)
aPolygon2D = myPolygon2D->Import();
return new BRep_PolygonOnClosedSurface (myPolygon2D->Import(), Handle(Poly_Polygon2D) aPolygon2;
myPolygon2->Import(), if (myPolygon2)
mySurface->Import(), aPolygon2 = myPolygon2->Import();
myLocation.Import());
Handle(Geom_Surface) aSurface;
if (mySurface)
aSurface = mySurface->Import();
return new BRep_PolygonOnClosedSurface
(aPolygon2D, aPolygon2, aSurface, myLocation.Import());
} }
void ShapePersistent_BRep::CurveOn2Surfaces::Read void ShapePersistent_BRep::CurveOn2Surfaces::Read
@ -326,14 +366,18 @@ void ShapePersistent_BRep::CurveOn2Surfaces::Read
Handle(BRep_CurveRepresentation) Handle(BRep_CurveRepresentation)
ShapePersistent_BRep::CurveOn2Surfaces::import() const ShapePersistent_BRep::CurveOn2Surfaces::import() const
{ {
if (mySurface.IsNull() || mySurface2.IsNull()) Handle(Geom_Surface) aSurface;
return NULL; if (mySurface)
aSurface = mySurface->Import();
return new BRep_CurveOn2Surfaces (mySurface->Import(), Handle(Geom_Surface) aSurface2;
mySurface2->Import(), if (mySurface2)
myLocation.Import(), aSurface2 = mySurface2->Import();
myLocation2.Import(),
myContinuity); GeomAbs_Shape aContinuity = static_cast<GeomAbs_Shape> (myContinuity);
return new BRep_CurveOn2Surfaces
(aSurface, aSurface2, myLocation.Import(), myLocation2.Import(), aContinuity);
} }
//======================================================================= //=======================================================================

@ -20,14 +20,13 @@
#include <ShapePersistent_Geom2d.hxx> #include <ShapePersistent_Geom2d.hxx>
#include <ShapePersistent_Poly.hxx> #include <ShapePersistent_Poly.hxx>
#include <StdObject_Location.hxx> #include <StdObject_Location.hxx>
#include <StdObject_gp.hxx> #include <StdObject_gp_Vectors.hxx>
#include <BRep_ListOfPointRepresentation.hxx> #include <BRep_ListOfPointRepresentation.hxx>
#include <BRep_ListOfCurveRepresentation.hxx> #include <BRep_ListOfCurveRepresentation.hxx>
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx> #include <gp_Pnt2d.hxx>
#include <GeomAbs_Shape.hxx>
class BRep_PointRepresentation; class BRep_PointRepresentation;
class BRep_CurveRepresentation; class BRep_CurveRepresentation;
@ -50,11 +49,11 @@ public:
virtual Handle(BRep_PointRepresentation) import() const; virtual Handle(BRep_PointRepresentation) import() const;
protected: protected:
Object <StdObject_Location> myLocation; StdObject_Location myLocation;
Value <Standard_Real> myParameter; Standard_Real myParameter;
private: private:
Reference<PointRepresentation> myNext; Handle(PointRepresentation) myNext;
}; };
class PointOnCurve : public PointRepresentation class PointOnCurve : public PointRepresentation
@ -64,7 +63,7 @@ public:
virtual Handle(BRep_PointRepresentation) import() const; virtual Handle(BRep_PointRepresentation) import() const;
private: private:
Reference<ShapePersistent_Geom::Curve> myCurve; Handle(ShapePersistent_Geom::Curve) myCurve;
}; };
class PointsOnSurface : public PointRepresentation class PointsOnSurface : public PointRepresentation
@ -73,7 +72,7 @@ public:
virtual void Read (StdObjMgt_ReadData& theReadData); virtual void Read (StdObjMgt_ReadData& theReadData);
protected: protected:
Reference<ShapePersistent_Geom::Surface> mySurface; Handle(ShapePersistent_Geom::Surface) mySurface;
}; };
class PointOnCurveOnSurface : public PointsOnSurface class PointOnCurveOnSurface : public PointsOnSurface
@ -83,7 +82,7 @@ public:
virtual Handle(BRep_PointRepresentation) import() const; virtual Handle(BRep_PointRepresentation) import() const;
private: private:
Reference<ShapePersistent_Geom2d::Curve> myPCurve; Handle(ShapePersistent_Geom2d::Curve) myPCurve;
}; };
class PointOnSurface : public PointsOnSurface class PointOnSurface : public PointsOnSurface
@ -93,7 +92,7 @@ public:
virtual Handle(BRep_PointRepresentation) import() const; virtual Handle(BRep_PointRepresentation) import() const;
private: private:
Value<Standard_Real> myParameter2; Standard_Real myParameter2;
}; };
class CurveRepresentation : public StdObjMgt_Persistent class CurveRepresentation : public StdObjMgt_Persistent
@ -110,10 +109,10 @@ public:
virtual Handle(BRep_CurveRepresentation) import() const; virtual Handle(BRep_CurveRepresentation) import() const;
protected: protected:
Object<StdObject_Location> myLocation; StdObject_Location myLocation;
private: private:
Reference<CurveRepresentation> myNext; Handle(CurveRepresentation) myNext;
}; };
class GCurve : public CurveRepresentation class GCurve : public CurveRepresentation
@ -122,8 +121,8 @@ public:
virtual void Read (StdObjMgt_ReadData& theReadData); virtual void Read (StdObjMgt_ReadData& theReadData);
protected: protected:
Value<Standard_Real> myFirst; Standard_Real myFirst;
Value<Standard_Real> myLast; Standard_Real myLast;
}; };
class Curve3D : public GCurve class Curve3D : public GCurve
@ -133,7 +132,7 @@ public:
virtual Handle(BRep_CurveRepresentation) import() const; virtual Handle(BRep_CurveRepresentation) import() const;
private: private:
Reference<ShapePersistent_Geom::Curve> myCurve3D; Handle(ShapePersistent_Geom::Curve) myCurve3D;
}; };
class CurveOnSurface : public GCurve class CurveOnSurface : public GCurve
@ -143,10 +142,10 @@ public:
virtual Handle(BRep_CurveRepresentation) import() const; virtual Handle(BRep_CurveRepresentation) import() const;
protected: protected:
Reference<ShapePersistent_Geom2d::Curve> myPCurve; Handle(ShapePersistent_Geom2d::Curve) myPCurve;
Reference<ShapePersistent_Geom::Surface> mySurface; Handle(ShapePersistent_Geom::Surface) mySurface;
StdObject_gp::Object<gp_Pnt2d> myUV1; gp_Pnt2d myUV1;
StdObject_gp::Object<gp_Pnt2d> myUV2; gp_Pnt2d myUV2;
}; };
class CurveOnClosedSurface : public CurveOnSurface class CurveOnClosedSurface : public CurveOnSurface
@ -156,10 +155,10 @@ public:
virtual Handle(BRep_CurveRepresentation) import() const; virtual Handle(BRep_CurveRepresentation) import() const;
private: private:
Reference<ShapePersistent_Geom2d::Curve> myPCurve2; Handle(ShapePersistent_Geom2d::Curve) myPCurve2;
Enum<GeomAbs_Shape> myContinuity; Standard_Integer myContinuity;
StdObject_gp::Object<gp_Pnt2d> myUV21; gp_Pnt2d myUV21;
StdObject_gp::Object<gp_Pnt2d> myUV22; gp_Pnt2d myUV22;
}; };
class Polygon3D : public CurveRepresentation class Polygon3D : public CurveRepresentation
@ -169,7 +168,7 @@ public:
virtual Handle(BRep_CurveRepresentation) import() const; virtual Handle(BRep_CurveRepresentation) import() const;
private: private:
Reference<ShapePersistent_Poly::Polygon3D> myPolygon3D; Handle(ShapePersistent_Poly::Polygon3D) myPolygon3D;
}; };
class PolygonOnTriangulation : public CurveRepresentation class PolygonOnTriangulation : public CurveRepresentation
@ -179,8 +178,8 @@ public:
virtual Handle(BRep_CurveRepresentation) import() const; virtual Handle(BRep_CurveRepresentation) import() const;
protected: protected:
Reference<ShapePersistent_Poly::PolygonOnTriangulation> myPolygon; Handle(ShapePersistent_Poly::PolygonOnTriangulation) myPolygon;
Reference<ShapePersistent_Poly::Triangulation> myTriangulation; Handle(ShapePersistent_Poly::Triangulation) myTriangulation;
}; };
class PolygonOnClosedTriangulation : public PolygonOnTriangulation class PolygonOnClosedTriangulation : public PolygonOnTriangulation
@ -190,7 +189,7 @@ public:
virtual Handle(BRep_CurveRepresentation) import() const; virtual Handle(BRep_CurveRepresentation) import() const;
private: private:
Reference<ShapePersistent_Poly::PolygonOnTriangulation> myPolygon2; Handle(ShapePersistent_Poly::PolygonOnTriangulation) myPolygon2;
}; };
class PolygonOnSurface : public CurveRepresentation class PolygonOnSurface : public CurveRepresentation
@ -200,8 +199,8 @@ public:
virtual Handle(BRep_CurveRepresentation) import() const; virtual Handle(BRep_CurveRepresentation) import() const;
protected: protected:
Reference<ShapePersistent_Poly::Polygon2D> myPolygon2D; Handle(ShapePersistent_Poly::Polygon2D) myPolygon2D;
Reference<ShapePersistent_Geom::Surface> mySurface; Handle(ShapePersistent_Geom::Surface) mySurface;
}; };
class PolygonOnClosedSurface : public PolygonOnSurface class PolygonOnClosedSurface : public PolygonOnSurface
@ -211,7 +210,7 @@ public:
virtual Handle(BRep_CurveRepresentation) import() const; virtual Handle(BRep_CurveRepresentation) import() const;
private: private:
Reference<ShapePersistent_Poly::Polygon2D> myPolygon2; Handle(ShapePersistent_Poly::Polygon2D) myPolygon2;
}; };
class CurveOn2Surfaces : public CurveRepresentation class CurveOn2Surfaces : public CurveRepresentation
@ -221,10 +220,10 @@ public:
virtual Handle(BRep_CurveRepresentation) import() const; virtual Handle(BRep_CurveRepresentation) import() const;
private: private:
Reference <ShapePersistent_Geom::Surface> mySurface; Handle(ShapePersistent_Geom::Surface) mySurface;
Reference <ShapePersistent_Geom::Surface> mySurface2; Handle(ShapePersistent_Geom::Surface) mySurface2;
Object <StdObject_Location> myLocation2; StdObject_Location myLocation2;
Enum <GeomAbs_Shape> myContinuity; Standard_Integer myContinuity;
}; };
private: private:
@ -241,9 +240,9 @@ private:
virtual Handle(TopoDS_TShape) createTShape() const; virtual Handle(TopoDS_TShape) createTShape() const;
private: private:
Value<Standard_Real> myTolerance; Standard_Real myTolerance;
StdObject_gp::Object<gp_Pnt> myPnt; gp_Pnt myPnt;
Reference<PointRepresentation> myPoints; Handle(PointRepresentation) myPoints;
}; };
class pTEdge : public pTBase class pTEdge : public pTBase
@ -259,9 +258,9 @@ private:
virtual Handle(TopoDS_TShape) createTShape() const; virtual Handle(TopoDS_TShape) createTShape() const;
private: private:
Value <Standard_Real> myTolerance; Standard_Real myTolerance;
Value <Standard_Integer> myFlags; Standard_Integer myFlags;
Reference <CurveRepresentation> myCurves; Handle(CurveRepresentation) myCurves;
}; };
class pTFace : public pTBase class pTFace : public pTBase
@ -278,11 +277,11 @@ private:
virtual Handle(TopoDS_TShape) createTShape() const; virtual Handle(TopoDS_TShape) createTShape() const;
private: private:
Reference <ShapePersistent_Geom::Surface> mySurface; Handle(ShapePersistent_Geom::Surface) mySurface;
Reference <ShapePersistent_Poly::Triangulation> myTriangulation; Handle(ShapePersistent_Poly::Triangulation) myTriangulation;
Object <StdObject_Location> myLocation; StdObject_Location myLocation;
Value <Standard_Real> myTolerance; Standard_Real myTolerance;
Value <Standard_Boolean> myNaturalRestriction; Standard_Boolean myNaturalRestriction;
}; };
public: public:

@ -12,6 +12,8 @@
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <ShapePersistent_Geom.hxx> #include <ShapePersistent_Geom.hxx>
#include <StdObject_gp_Axes.hxx>
#include <StdObject_gp_Vectors.hxx>
//======================================================================= //=======================================================================
@ -29,8 +31,8 @@ void ShapePersistent_Geom::instance<ShapePersistent_Geom::AxisPlacement,
Geom_Axis2Placement> Geom_Axis2Placement>
::Read (StdObjMgt_ReadData& theReadData) ::Read (StdObjMgt_ReadData& theReadData)
{ {
StdObject_gp::Object<gp_Ax1> anAxis; gp_Ax1 anAxis;
StdObject_gp::Object<gp_Dir> anXDirection; gp_Dir anXDirection;
theReadData >> anAxis >> anXDirection; theReadData >> anAxis >> anXDirection;

@ -16,7 +16,12 @@
#define _ShapePersistent_Geom_HeaderFile #define _ShapePersistent_Geom_HeaderFile
#include <StdObjMgt_SharedObject.hxx> #include <StdObjMgt_SharedObject.hxx>
#include <StdObject_gp.hxx>
#include <StdObject_gp_Vectors.hxx>
#include <StdObject_gp_Axes.hxx>
#include <StdObject_gp_Curves.hxx>
#include <StdObject_gp_Surfaces.hxx>
#include <StdObject_gp_Trsfs.hxx>
#include <Geom_CartesianPoint.hxx> #include <Geom_CartesianPoint.hxx>
#include <Geom_Direction.hxx> #include <Geom_Direction.hxx>
@ -52,7 +57,16 @@ protected:
}; };
template <class Base, class GpData> template <class Base, class GpData>
struct subBase_gp : subBase <Base, StdObject_gp::Object<GpData> > {}; struct subBase_gp : public Base
{
public:
//! Read persistent data from a file.
Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData)
{
GpData aData;
theReadData >> aData;
}
};
template <class Base> template <class Base>
struct subBase_empty : Base {}; struct subBase_empty : Base {};
@ -64,7 +78,7 @@ protected:
//! Read persistent data from a file. //! Read persistent data from a file.
Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData) Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData)
{ {
StdObject_gp::Object<Data> aData; Data aData;
theReadData >> aData; theReadData >> aData;
this->myTransient = new Target (aData); this->myTransient = new Target (aData);
} }

@ -46,9 +46,9 @@ class ShapePersistent_Geom2d_Curve : protected ShapePersistent_Geom2d
virtual Handle(Geom2d_Curve) Import() const; virtual Handle(Geom2d_Curve) Import() const;
private: private:
Value <Standard_Boolean> myRational; Standard_Boolean myRational;
Reference <ShapePersistent_HArray1::Pnt2d> myPoles; Handle(ShapePersistent_HArray1::Pnt2d) myPoles;
Reference <StdLPersistent_HArray1::Real> myWeights; Handle(StdLPersistent_HArray1::Real) myWeights;
}; };
class pBSpline : public pBounded class pBSpline : public pBounded
@ -63,13 +63,13 @@ class ShapePersistent_Geom2d_Curve : protected ShapePersistent_Geom2d
virtual Handle(Geom2d_Curve) Import() const; virtual Handle(Geom2d_Curve) Import() const;
private: private:
Value <Standard_Boolean> myRational; Standard_Boolean myRational;
Value <Standard_Boolean> myPeriodic; Standard_Boolean myPeriodic;
Value <Standard_Integer> mySpineDegree; Standard_Integer mySpineDegree;
Reference <ShapePersistent_HArray1::Pnt2d> myPoles; Handle(ShapePersistent_HArray1::Pnt2d) myPoles;
Reference <StdLPersistent_HArray1::Real> myWeights; Handle(StdLPersistent_HArray1::Real) myWeights;
Reference <StdLPersistent_HArray1::Real> myKnots; Handle(StdLPersistent_HArray1::Real) myKnots;
Reference <StdLPersistent_HArray1::Integer> myMultiplicities; Handle(StdLPersistent_HArray1::Integer) myMultiplicities;
}; };
class pTrimmed : public pBounded class pTrimmed : public pBounded
@ -81,9 +81,9 @@ class ShapePersistent_Geom2d_Curve : protected ShapePersistent_Geom2d
virtual Handle(Geom2d_Curve) Import() const; virtual Handle(Geom2d_Curve) Import() const;
private: private:
Reference<Curve> myBasisCurve; Handle(Curve) myBasisCurve;
Value<Standard_Real> myFirstU; Standard_Real myFirstU;
Value<Standard_Real> myLastU; Standard_Real myLastU;
}; };
class pOffset : public pBase class pOffset : public pBase
@ -95,8 +95,8 @@ class ShapePersistent_Geom2d_Curve : protected ShapePersistent_Geom2d
virtual Handle(Geom2d_Curve) Import() const; virtual Handle(Geom2d_Curve) Import() const;
private: private:
Reference<Curve> myBasisCurve; Handle(Curve) myBasisCurve;
Value<Standard_Real> myOffsetValue; Standard_Real myOffsetValue;
}; };
public: public:

@ -48,9 +48,9 @@ class ShapePersistent_Geom_Curve : private ShapePersistent_Geom
virtual Handle(Geom_Curve) Import() const; virtual Handle(Geom_Curve) Import() const;
private: private:
Value <Standard_Boolean> myRational; Standard_Boolean myRational;
Reference <ShapePersistent_HArray1::Pnt> myPoles; Handle(ShapePersistent_HArray1::Pnt) myPoles;
Reference <StdLPersistent_HArray1::Real> myWeights; Handle(StdLPersistent_HArray1::Real) myWeights;
}; };
class pBSpline : public pBounded class pBSpline : public pBounded
@ -65,13 +65,13 @@ class ShapePersistent_Geom_Curve : private ShapePersistent_Geom
virtual Handle(Geom_Curve) Import() const; virtual Handle(Geom_Curve) Import() const;
private: private:
Value <Standard_Boolean> myRational; Standard_Boolean myRational;
Value <Standard_Boolean> myPeriodic; Standard_Boolean myPeriodic;
Value <Standard_Integer> mySpineDegree; Standard_Integer mySpineDegree;
Reference <ShapePersistent_HArray1::Pnt> myPoles; Handle(ShapePersistent_HArray1::Pnt) myPoles;
Reference <StdLPersistent_HArray1::Real> myWeights; Handle(StdLPersistent_HArray1::Real) myWeights;
Reference <StdLPersistent_HArray1::Real> myKnots; Handle(StdLPersistent_HArray1::Real) myKnots;
Reference <StdLPersistent_HArray1::Integer> myMultiplicities; Handle(StdLPersistent_HArray1::Integer) myMultiplicities;
}; };
class pTrimmed : public pBounded class pTrimmed : public pBounded
@ -83,9 +83,9 @@ class ShapePersistent_Geom_Curve : private ShapePersistent_Geom
virtual Handle(Geom_Curve) Import() const; virtual Handle(Geom_Curve) Import() const;
private: private:
Reference<Curve> myBasisCurve; Handle(Curve) myBasisCurve;
Value<Standard_Real> myFirstU; Standard_Real myFirstU;
Value<Standard_Real> myLastU; Standard_Real myLastU;
}; };
class pOffset : public pBase class pOffset : public pBase
@ -97,9 +97,9 @@ class ShapePersistent_Geom_Curve : private ShapePersistent_Geom
virtual Handle(Geom_Curve) Import() const; virtual Handle(Geom_Curve) Import() const;
private: private:
Reference<Curve> myBasisCurve; Handle(Curve) myBasisCurve;
StdObject_gp::Object<gp_Dir> myOffsetDirection; gp_Dir myOffsetDirection;
Value<Standard_Real> myOffsetValue; Standard_Real myOffsetValue;
}; };
public: public:

@ -40,15 +40,15 @@ class ShapePersistent_Geom_Surface : private ShapePersistent_Geom
{ {
typedef Surface::PersistentBase pBase; typedef Surface::PersistentBase pBase;
class pSweptData : protected StdObjMgt_ContentTypes class pSweptData
{ {
public: public:
inline void Read (StdObjMgt_ReadData& theReadData) inline void Read (StdObjMgt_ReadData& theReadData)
{ theReadData >> myBasisCurve >> myDirection; } { theReadData >> myBasisCurve >> myDirection; }
protected: protected:
Reference <Curve> myBasisCurve; Handle(Curve) myBasisCurve;
StdObject_gp::Object <gp_Dir> myDirection; gp_Dir myDirection;
}; };
struct pSwept : pBase, pSweptData {}; struct pSwept : pBase, pSweptData {};
@ -71,7 +71,7 @@ class ShapePersistent_Geom_Surface : private ShapePersistent_Geom
virtual Handle(Geom_Surface) Import() const; virtual Handle(Geom_Surface) Import() const;
private: private:
StdObject_gp::Object<gp_Pnt> myLocation; gp_Pnt myLocation;
}; };
typedef pBase pBounded; typedef pBase pBounded;
@ -85,10 +85,10 @@ class ShapePersistent_Geom_Surface : private ShapePersistent_Geom
virtual Handle(Geom_Surface) Import() const; virtual Handle(Geom_Surface) Import() const;
private: private:
Value <Standard_Boolean> myURational; Standard_Boolean myURational;
Value <Standard_Boolean> myVRational; Standard_Boolean myVRational;
Reference <ShapePersistent_HArray2::Pnt> myPoles; Handle(ShapePersistent_HArray2::Pnt) myPoles;
Reference <StdLPersistent_HArray2::Real> myWeights; Handle(StdLPersistent_HArray2::Real) myWeights;
}; };
class pBSpline : public pBounded class pBSpline : public pBounded
@ -108,18 +108,18 @@ class ShapePersistent_Geom_Surface : private ShapePersistent_Geom
virtual Handle(Geom_Surface) Import() const; virtual Handle(Geom_Surface) Import() const;
private: private:
Value <Standard_Boolean> myURational; Standard_Boolean myURational;
Value <Standard_Boolean> myVRational; Standard_Boolean myVRational;
Value <Standard_Boolean> myUPeriodic; Standard_Boolean myUPeriodic;
Value <Standard_Boolean> myVPeriodic; Standard_Boolean myVPeriodic;
Value <Standard_Integer> myUSpineDegree; Standard_Integer myUSpineDegree;
Value <Standard_Integer> myVSpineDegree; Standard_Integer myVSpineDegree;
Reference <ShapePersistent_HArray2::Pnt> myPoles; Handle(ShapePersistent_HArray2::Pnt) myPoles;
Reference <StdLPersistent_HArray2::Real> myWeights; Handle(StdLPersistent_HArray2::Real) myWeights;
Reference <StdLPersistent_HArray1::Real> myUKnots; Handle(StdLPersistent_HArray1::Real) myUKnots;
Reference <StdLPersistent_HArray1::Real> myVKnots; Handle(StdLPersistent_HArray1::Real) myVKnots;
Reference <StdLPersistent_HArray1::Integer> myUMultiplicities; Handle(StdLPersistent_HArray1::Integer) myUMultiplicities;
Reference <StdLPersistent_HArray1::Integer> myVMultiplicities; Handle(StdLPersistent_HArray1::Integer) myVMultiplicities;
}; };
class pRectangularTrimmed : public pBounded class pRectangularTrimmed : public pBounded
@ -134,11 +134,11 @@ class ShapePersistent_Geom_Surface : private ShapePersistent_Geom
virtual Handle(Geom_Surface) Import() const; virtual Handle(Geom_Surface) Import() const;
private: private:
Reference<Surface> myBasisSurface; Handle(Surface) myBasisSurface;
Value<Standard_Real> myFirstU; Standard_Real myFirstU;
Value<Standard_Real> myLastU; Standard_Real myLastU;
Value<Standard_Real> myFirstV; Standard_Real myFirstV;
Value<Standard_Real> myLastV; Standard_Real myLastV;
}; };
class pOffset : public pBase class pOffset : public pBase
@ -150,8 +150,8 @@ class ShapePersistent_Geom_Surface : private ShapePersistent_Geom
virtual Handle(Geom_Surface) Import() const; virtual Handle(Geom_Surface) Import() const;
private: private:
Reference<Surface> myBasisSurface; Handle(Surface) myBasisSurface;
Value<Standard_Real> myOffsetValue; Standard_Real myOffsetValue;
}; };
public: public:

@ -1,45 +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.
#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>;

@ -16,6 +16,8 @@
#define _ShapePersistent_HArray1_HeaderFile #define _ShapePersistent_HArray1_HeaderFile
#include <StdLPersistent_HArray1.hxx> #include <StdLPersistent_HArray1.hxx>
#include <StdObject_gp_Vectors.hxx>
#include <StdObject_gp_Curves.hxx>
#include <TColgp_HArray1OfXYZ.hxx> #include <TColgp_HArray1OfXYZ.hxx>
#include <TColgp_HArray1OfPnt.hxx> #include <TColgp_HArray1OfPnt.hxx>
@ -32,13 +34,6 @@
class ShapePersistent_HArray1 : private StdLPersistent_HArray1 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: public:
typedef instance<TColgp_HArray1OfXYZ> XYZ; typedef instance<TColgp_HArray1OfXYZ> XYZ;
typedef instance<TColgp_HArray1OfPnt> Pnt; typedef instance<TColgp_HArray1OfPnt> Pnt;
@ -53,4 +48,13 @@ public:
typedef instance<Poly_HArray1OfTriangle> Triangle; typedef instance<Poly_HArray1OfTriangle> Triangle;
}; };
inline StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData& theReadData, Poly_Triangle& theTriangle)
{
Standard_Integer N1, N2, N3;
theReadData >> N1 >> N2 >> N3;
theTriangle.Set (N1, N2, N3);
return theReadData;
}
#endif #endif

@ -1,38 +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.
#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>;

@ -16,6 +16,8 @@
#define _ShapePersistent_HArray2_HeaderFile #define _ShapePersistent_HArray2_HeaderFile
#include <StdLPersistent_HArray2.hxx> #include <StdLPersistent_HArray2.hxx>
#include <StdObject_gp_Vectors.hxx>
#include <StdObject_gp_Curves.hxx>
#include <TColgp_HArray2OfXYZ.hxx> #include <TColgp_HArray2OfXYZ.hxx>
#include <TColgp_HArray2OfPnt.hxx> #include <TColgp_HArray2OfPnt.hxx>
@ -31,14 +33,6 @@
class ShapePersistent_HArray2 : private StdLPersistent_HArray2 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: public:
typedef instance<TColgp_HArray2OfXYZ> XYZ; typedef instance<TColgp_HArray2OfXYZ> XYZ;
typedef instance<TColgp_HArray2OfPnt> Pnt; typedef instance<TColgp_HArray2OfPnt> Pnt;

@ -16,7 +16,7 @@
#define _ShapePersistent_HSequence_HeaderFile #define _ShapePersistent_HSequence_HeaderFile
#include <StdObjMgt_Persistent.hxx> #include <StdObjMgt_Persistent.hxx>
#include <StdObject_gp.hxx> #include <StdObject_gp_Vectors.hxx>
#include <TColgp_HSequenceOfXYZ.hxx> #include <TColgp_HSequenceOfXYZ.hxx>
#include <TColgp_HSequenceOfPnt.hxx> #include <TColgp_HSequenceOfPnt.hxx>
@ -41,9 +41,9 @@ class ShapePersistent_HSequence
const ItemType& Item() const { return myItem; } const ItemType& Item() const { return myItem; }
private: private:
Reference<node> myPreviuos; Handle(node) myPreviuos;
Reference<node> myNext; Handle(node) myNext;
StdObject_gp::Object<ItemType> myItem; ItemType myItem;
}; };
template <class SequenceClass> template <class SequenceClass>
@ -60,9 +60,9 @@ class ShapePersistent_HSequence
Standard_EXPORT Handle(SequenceClass) Import() const; Standard_EXPORT Handle(SequenceClass) Import() const;
private: private:
Reference<Node> myFirst; Handle(Node) myFirst;
Reference<Node> myLast; Handle(Node) myLast;
Value<Standard_Integer> mySize; Standard_Integer mySize;
}; };
public: public:

@ -28,7 +28,7 @@ class Poly_Triangulation;
class ShapePersistent_Poly : private StdObjMgt_SharedObject class ShapePersistent_Poly : private StdObjMgt_SharedObject
{ {
class pPolygon2D : public PersistentBase class pPolygon2D : public Standard_Transient
{ {
public: public:
inline void Read (StdObjMgt_ReadData& theReadData) inline void Read (StdObjMgt_ReadData& theReadData)
@ -37,11 +37,11 @@ class ShapePersistent_Poly : private StdObjMgt_SharedObject
Handle(Poly_Polygon2D) Import() const; Handle(Poly_Polygon2D) Import() const;
private: private:
Value <Standard_Real> myDeflection; Standard_Real myDeflection;
Reference <ShapePersistent_HArray1::Pnt2d> myNodes; Handle(ShapePersistent_HArray1::Pnt2d) myNodes;
}; };
class pPolygon3D : public PersistentBase class pPolygon3D : public Standard_Transient
{ {
public: public:
inline void Read (StdObjMgt_ReadData& theReadData) inline void Read (StdObjMgt_ReadData& theReadData)
@ -50,12 +50,12 @@ class ShapePersistent_Poly : private StdObjMgt_SharedObject
Handle(Poly_Polygon3D) Import() const; Handle(Poly_Polygon3D) Import() const;
private: private:
Value <Standard_Real> myDeflection; Standard_Real myDeflection;
Reference <ShapePersistent_HArray1::Pnt> myNodes; Handle(ShapePersistent_HArray1::Pnt) myNodes;
Reference <StdLPersistent_HArray1::Real> myParameters; Handle(StdLPersistent_HArray1::Real) myParameters;
}; };
class pPolygonOnTriangulation : public PersistentBase class pPolygonOnTriangulation : public Standard_Transient
{ {
public: public:
inline void Read (StdObjMgt_ReadData& theReadData) inline void Read (StdObjMgt_ReadData& theReadData)
@ -64,12 +64,12 @@ class ShapePersistent_Poly : private StdObjMgt_SharedObject
Handle(Poly_PolygonOnTriangulation) Import() const; Handle(Poly_PolygonOnTriangulation) Import() const;
private: private:
Value <Standard_Real> myDeflection; Standard_Real myDeflection;
Reference <StdLPersistent_HArray1::Integer> myNodes; Handle(StdLPersistent_HArray1::Integer) myNodes;
Reference <StdLPersistent_HArray1::Real> myParameters; Handle(StdLPersistent_HArray1::Real) myParameters;
}; };
class pTriangulation : public PersistentBase class pTriangulation : public Standard_Transient
{ {
public: public:
inline void Read (StdObjMgt_ReadData& theReadData) inline void Read (StdObjMgt_ReadData& theReadData)
@ -78,10 +78,10 @@ class ShapePersistent_Poly : private StdObjMgt_SharedObject
Handle(Poly_Triangulation) Import() const; Handle(Poly_Triangulation) Import() const;
private: private:
Value <Standard_Real> myDeflection; Standard_Real myDeflection;
Reference <ShapePersistent_HArray1::Pnt> myNodes; Handle(ShapePersistent_HArray1::Pnt) myNodes;
Reference <ShapePersistent_HArray1::Pnt2d> myUVNodes; Handle(ShapePersistent_HArray1::Pnt2d) myUVNodes;
Reference <ShapePersistent_HArray1::Triangle> myTriangles; Handle(ShapePersistent_HArray1::Triangle) myTriangles;
}; };
template <class Persistent, class Transient> template <class Persistent, class Transient>

@ -31,10 +31,10 @@ enum
//function : Read //function : Read
//purpose : Read persistent data from a file //purpose : Read persistent data from a file
//======================================================================= //=======================================================================
void ShapePersistent_TopoDS::Shape::Read (StdObjMgt_ReadData& theReadData) void ShapePersistent_TopoDS::HShape::Read (StdObjMgt_ReadData& theReadData)
{ {
theReadData >> myEntry; theReadData >> myEntry;
myShape.Read (theReadData); StdObject_Shape::read (theReadData);
} }
void ShapePersistent_TopoDS::pTBase::setFlags void ShapePersistent_TopoDS::pTBase::setFlags
@ -52,8 +52,8 @@ void ShapePersistent_TopoDS::pTBase::setFlags
static inline void AddShape static inline void AddShape
(TopoDS_Shape& theParent, const Handle(StdObjMgt_Persistent)& theRef) (TopoDS_Shape& theParent, const Handle(StdObjMgt_Persistent)& theRef)
{ {
Handle(ShapePersistent_TopoDS::Shape) aShape = Handle(ShapePersistent_TopoDS::HShape) aShape =
Handle(ShapePersistent_TopoDS::Shape)::DownCast (theRef); Handle(ShapePersistent_TopoDS::HShape)::DownCast (theRef);
if (aShape) if (aShape)
BRep_Builder().Add (theParent, aShape->Import()); BRep_Builder().Add (theParent, aShape->Import());
@ -69,8 +69,8 @@ template <class ShapesArray>
void ShapePersistent_TopoDS::pTBase::addShapesT void ShapePersistent_TopoDS::pTBase::addShapesT
(TopoDS_Shape& theParent) const (TopoDS_Shape& theParent) const
{ {
Handle(ShapesArray) aShapes; Handle(ShapesArray) aShapes = Handle(ShapesArray)::DownCast (myShapes);
if (myShapes.Cast (aShapes)) if (aShapes)
{ {
typename ShapesArray::Iterator anIter (*aShapes->Array()); typename ShapesArray::Iterator anIter (*aShapes->Array());
for (; anIter.More(); anIter.Next()) for (; anIter.More(); anIter.Next())

@ -30,18 +30,14 @@
class ShapePersistent_TopoDS : public StdPersistent_TopoDS class ShapePersistent_TopoDS : public StdPersistent_TopoDS
{ {
public: public:
class Shape : public StdObjMgt_Persistent class HShape : public StdObjMgt_Persistent, public StdObject_Shape
{ {
public: public:
//! Read persistent data from a file. //! Read persistent data from a file.
Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData); Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
//! Import transient object from the persistent data.
TopoDS_Shape Import() const { return myShape.Import(); }
private: private:
Reference<> myEntry; Handle(StdObjMgt_Persistent) myEntry;
StdObject_Shape myShape;
}; };
protected: protected:

@ -50,24 +50,22 @@ Handle(CDM_Document) StdLDrivers_DocumentRetrievalDriver::CreateDocument()
//function : Read //function : Read
//purpose : Retrieve the content of a file into a new document //purpose : Retrieve the content of a file into a new document
//======================================================================= //=======================================================================
void StdLDrivers_DocumentRetrievalDriver::Read ( void StdLDrivers_DocumentRetrievalDriver::Read (const TCollection_ExtendedString& theFileName,
const TCollection_ExtendedString& theFileName,
const Handle(CDM_Document)& theNewDocument, const Handle(CDM_Document)& theNewDocument,
const Handle(CDM_Application)&) const Handle(CDM_Application)&)
{ {
// Read header data and persistent document // Read header data and persistent document
Storage_HeaderData aHeaderData; Storage_HeaderData aHeaderData;
Handle(StdObjMgt_Persistent) aPDocument = read (theFileName, aHeaderData); Handle(StdObjMgt_Persistent) aPDocument = read (theFileName, aHeaderData);
if (aPDocument.IsNull())
return;
// Import transient document from the persistent one // Import transient document from the persistent one
if (!aPDocument.IsNull()) aPDocument->ImportDocument (
{ Handle(TDocStd_Document)::DownCast (theNewDocument));
aPDocument->ImportDocument (
Handle(TDocStd_Document)::DownCast (theNewDocument));
// Copy comments from the header data // Copy comments from the header data
theNewDocument->SetComments (aHeaderData.Comments()); theNewDocument->SetComments (aHeaderData.Comments());
}
} }
//======================================================================= //=======================================================================
@ -91,20 +89,20 @@ Handle(StdObjMgt_Persistent) StdLDrivers_DocumentRetrievalDriver::read (
NCollection_Handle<Storage_BaseDriver> aFileDriver (aFileDriverPtr); NCollection_Handle<Storage_BaseDriver> aFileDriver (aFileDriverPtr);
// Try to open the file // Try to open the file
try try
{ {
OCC_CATCH_SIGNALS OCC_CATCH_SIGNALS
PCDM_ReadWriter::Open (*aFileDriver, theFileName, Storage_VSRead); PCDM_ReadWriter::Open (*aFileDriver, theFileName, Storage_VSRead);
myReaderStatus = PCDM_RS_OK; myReaderStatus = PCDM_RS_OK;
} }
catch (Standard_Failure) catch (Standard_Failure)
{ {
myReaderStatus = PCDM_RS_OpenError; myReaderStatus = PCDM_RS_OpenError;
Standard_SStream aMsg; Standard_SStream aMsg;
aMsg << Standard_Failure::Caught() << endl; aMsg << Standard_Failure::Caught() << endl;
Standard_Failure::Raise (aMsg); Standard_Failure::Raise (aMsg);
} }
// Read header section // Read header section
if (!theHeaderData.Read (*aFileDriver)) if (!theHeaderData.Read (*aFileDriver))

@ -28,8 +28,7 @@ public:
Standard_EXPORT virtual Handle(CDM_Document) CreateDocument() Standard_OVERRIDE; Standard_EXPORT virtual Handle(CDM_Document) CreateDocument() Standard_OVERRIDE;
//! Retrieve the content of a file into a new document. //! Retrieve the content of a file into a new document.
Standard_EXPORT virtual void Read ( Standard_EXPORT virtual void Read (const TCollection_ExtendedString& theFileName,
const TCollection_ExtendedString& theFileName,
const Handle(CDM_Document)& theNewDocument, const Handle(CDM_Document)& theNewDocument,
const Handle(CDM_Application)& theApplication) Standard_OVERRIDE; const Handle(CDM_Application)& theApplication) Standard_OVERRIDE;

@ -1,2 +0,0 @@
StdLObject_GUID.cxx
StdLObject_GUID.hxx

@ -1,33 +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.
#include <StdLObject_GUID.hxx>
//=======================================================================
//function : Read
//purpose : Read persistent data from a file
//=======================================================================
void StdLObject_GUID::Read (StdObjMgt_ReadData& theReadData)
{
Value<Standard_Integer> a32b;
Value<Standard_ExtCharacter> a16b[3];
Value<Standard_Character> a8b [6];
theReadData >> a32b >> a16b[0] >> a16b[1] >> a16b[2];
theReadData >> a8b[0] >> a8b[1] >> a8b[2] >> a8b[3] >> a8b[4] >> a8b[5];
*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]);
}

@ -1,29 +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 _StdLObject_GUID_HeaderFile
#define _StdLObject_GUID_HeaderFile
#include <StdObjMgt_Attribute.hxx>
#include <Standard_GUID.hxx>
class StdLObject_GUID : public Standard_GUID, private StdObjMgt_ContentTypes
{
public:
void Read (StdObjMgt_ReadData& theReadData);
};
#endif

@ -9,7 +9,6 @@ StdLPersistent_Dependency.hxx
StdLPersistent_Document.cxx StdLPersistent_Document.cxx
StdLPersistent_Document.hxx StdLPersistent_Document.hxx
StdLPersistent_Function.hxx StdLPersistent_Function.hxx
StdLPersistent_HArray1OfPersistent.hxx
StdLPersistent_HArray1.cxx StdLPersistent_HArray1.cxx
StdLPersistent_HArray1.hxx StdLPersistent_HArray1.hxx
StdLPersistent_HArray2.cxx StdLPersistent_HArray2.cxx

@ -66,17 +66,17 @@ private:
//function : Read //function : Read
//purpose : Read persistent data from a file //purpose : Read persistent data from a file
//======================================================================= //=======================================================================
template <class Persistent> template <class Base>
void StdLPersistent_Collection::booleanArrayBase<Persistent>::Read void StdLPersistent_Collection::booleanArrayBase<Base>::Read
(StdObjMgt_ReadData& theReadData) (StdObjMgt_ReadData& theReadData)
{ {
StdLPersistent_Collection::booleanArrayBase<Persistent>::SingleRef::Read (theReadData); Base::Read (theReadData);
theReadData >> myLower >> myUpper; theReadData >> myLower >> myUpper;
} }
template <class Persistent> template <class Base>
template <class ArrayHandle, class Converter> template <class ArrayHandle, class Converter>
void StdLPersistent_Collection::booleanArrayBase<Persistent>::import void StdLPersistent_Collection::booleanArrayBase<Base>::import
(const ArrayHandle& theArray, Converter theConverter) const (const ArrayHandle& theArray, Converter theConverter) const
{ {
Handle(TColStd_HArray1OfByte) aByteArray = Handle(TColStd_HArray1OfByte) aByteArray =
@ -89,17 +89,17 @@ void StdLPersistent_Collection::booleanArrayBase<Persistent>::import
this->myTransient->SetInternalArray (aByteArray); this->myTransient->SetInternalArray (aByteArray);
} }
template <class Persistent> template <class Base>
template <class ArrayHandle, class Converter> template <class ArrayHandle, class Converter>
void StdLPersistent_Collection::directArrayBase<Persistent>::import void StdLPersistent_Collection::directArrayBase<Base>::import
(const ArrayHandle& theArray, Converter) const (const ArrayHandle& theArray, Converter) const
{ {
this->myTransient->ChangeArray (theArray); this->myTransient->ChangeArray (theArray);
} }
template <class Persistent> template <class Base>
template <class ArrayHandle, class Converter> template <class ArrayHandle, class Converter>
void StdLPersistent_Collection::arrayBase<Persistent>::import void StdLPersistent_Collection::arrayBase<Base>::import
(const ArrayHandle& theArray, Converter theConverter) const (const ArrayHandle& theArray, Converter theConverter) const
{ {
this->myTransient->Init (theArray->Lower(), theArray->Upper()); this->myTransient->Init (theArray->Lower(), theArray->Upper());
@ -107,18 +107,18 @@ void StdLPersistent_Collection::arrayBase<Persistent>::import
this->myTransient->SetValue (i, theConverter (theArray->Value(i))); this->myTransient->SetValue (i, theConverter (theArray->Value(i)));
} }
template <class Persistent> template <class Base>
template <class ArrayHandle, class Converter> template <class ArrayHandle, class Converter>
void StdLPersistent_Collection::listBase<Persistent>::import void StdLPersistent_Collection::listBase<Base>::import
(const ArrayHandle& theArray, Converter theConverter) const (const ArrayHandle& theArray, Converter theConverter) const
{ {
for (Standard_Integer i = theArray->Lower(); i <= theArray->Upper(); i++) for (Standard_Integer i = theArray->Lower(); i <= theArray->Upper(); i++)
this->myTransient->Append (theConverter (theArray->Value(i))); this->myTransient->Append (theConverter (theArray->Value(i)));
} }
template <class Persistent> template <class Base>
template <class ArrayHandle, class Converter> template <class ArrayHandle, class Converter>
void StdLPersistent_Collection::mapBase<Persistent>::import void StdLPersistent_Collection::mapBase<Base>::import
(const ArrayHandle& theArray, Converter theConverter) const (const ArrayHandle& theArray, Converter theConverter) const
{ {
Handle(TColStd_HPackedMapOfInteger) anHMap = new TColStd_HPackedMapOfInteger; Handle(TColStd_HPackedMapOfInteger) anHMap = new TColStd_HPackedMapOfInteger;
@ -138,8 +138,8 @@ template <template<class> class BaseT,
void StdLPersistent_Collection:: void StdLPersistent_Collection::
instance<BaseT, HArrayClass, AttribClass, Converter>::ImportAttribute() instance<BaseT, HArrayClass, AttribClass, Converter>::ImportAttribute()
{ {
Handle(HArrayClass) anHArray; Handle(HArrayClass) anHArray = Handle(HArrayClass)::DownCast (this->myData);
if (this->myData.Cast (anHArray)) if (anHArray)
{ {
typename HArrayClass::ArrayHandle anArray = anHArray->Array(); typename HArrayClass::ArrayHandle anArray = anHArray->Array();
if (anArray) if (anArray)

@ -32,7 +32,7 @@
#include <TDataStd_IntPackedMap.hxx> #include <TDataStd_IntPackedMap.hxx>
class StdLPersistent_Collection : private StdObjMgt_ContentTypes class StdLPersistent_Collection
{ {
// Converters // Converters
struct noConversion; struct noConversion;
@ -54,8 +54,8 @@ class StdLPersistent_Collection : private StdObjMgt_ContentTypes
const; const;
protected: protected:
Value<Standard_Integer> myLower; Standard_Integer myLower;
Value<Standard_Integer> myUpper; Standard_Integer myUpper;
}; };
template <class Base> template <class Base>
@ -118,7 +118,7 @@ class StdLPersistent_Collection : private StdObjMgt_ContentTypes
Standard_EXPORT virtual void ImportAttribute(); Standard_EXPORT virtual void ImportAttribute();
private: private:
Value<Standard_Boolean> myDelta; Standard_Boolean myDelta;
}; };

@ -23,7 +23,7 @@ class StdLPersistent_Data::Parser
{ {
public: public:
//! Start parsing a persistent data. //! Start parsing a persistent data.
Parser (const TColStd_HArray1OfInteger& theLabels, Parser (const TColStd_HArray1OfInteger& theLabels,
const StdLPersistent_HArray1OfPersistent& theAttributes) const StdLPersistent_HArray1OfPersistent& theAttributes)
: myLabelsIter (theLabels) : myLabelsIter (theLabels)
, myAttribIter (theAttributes) {} , myAttribIter (theAttributes) {}
@ -67,7 +67,7 @@ public:
} }
private: private:
TColStd_HArray1OfInteger ::Iterator myLabelsIter; TColStd_HArray1OfInteger ::Iterator myLabelsIter;
StdLPersistent_HArray1OfPersistent::Iterator myAttribIter; StdLPersistent_HArray1OfPersistent::Iterator myAttribIter;
}; };

@ -34,9 +34,9 @@ private:
class Parser; class Parser;
private: private:
Value <Standard_Integer> myVersion; Standard_Integer myVersion;
Reference <StdLPersistent_HArray1::Integer> myLabels; Handle(StdLPersistent_HArray1::Integer) myLabels;
Reference <StdLPersistent_HArray1::Persistent> myAttributes; Handle(StdLPersistent_HArray1::Persistent) myAttributes;
}; };
#endif #endif

@ -37,8 +37,8 @@ class StdLPersistent_Dependency
void Import (const Handle(AttribClass)& theAttribute) const; void Import (const Handle(AttribClass)& theAttribute) const;
private: private:
StdObjMgt_ContentTypes::Reference<StdLPersistent_HString::Extended> myName; Handle(StdLPersistent_HString::Extended) myName;
StdObjMgt_ContentTypes::Reference<StdLPersistent_HArray1::Persistent> myVariables; Handle(StdLPersistent_HArray1::Persistent) myVariables;
}; };
public: public:

@ -32,7 +32,7 @@ public:
(const Handle(TDocStd_Document)& theDocument) const; (const Handle(TDocStd_Document)& theDocument) const;
private: private:
Reference<StdLPersistent_Data> myData; Handle(StdLPersistent_Data) myData;
}; };
#endif #endif

@ -16,9 +16,9 @@
#define _StdLPersistent_Function_HeaderFile #define _StdLPersistent_Function_HeaderFile
#include <StdObjMgt_Attribute.hxx> #include <StdObjMgt_Attribute.hxx>
#include <StdLObject_GUID.hxx>
#include <TFunction_Function.hxx> #include <TFunction_Function.hxx>
#include <Standard_GUID.hxx>
class StdLPersistent_Function : public StdObjMgt_Attribute<TFunction_Function> class StdLPersistent_Function : public StdObjMgt_Attribute<TFunction_Function>
@ -36,8 +36,8 @@ public:
} }
private: private:
Object<StdLObject_GUID> myDriverGUID; Standard_GUID myDriverGUID;
Value<Standard_Integer> myFailure; Standard_Integer myFailure;
}; };
#endif #endif

@ -12,44 +12,23 @@
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <StdLPersistent_HArray1.hxx> #include <StdLPersistent_HArray1.hxx>
#include <StdObjMgt_ReadData.hxx>
//======================================================================= //=======================================================================
//function : Read //function : Read
//purpose : Read persistent data from a file //purpose : Read persistent data from a file
//======================================================================= //=======================================================================
void StdLPersistent_HArray1::commonBase::Read (StdObjMgt_ReadData& theReadData) void StdLPersistent_HArray1::base::Read (StdObjMgt_ReadData& theReadData)
{ {
Value<Standard_Integer> aLowerBound, anUpperBound; Standard_Integer aLowerBound, anUpperBound;
theReadData >> aLowerBound >> anUpperBound; theReadData >> aLowerBound >> anUpperBound;
createArray (aLowerBound, anUpperBound); createArray (aLowerBound, anUpperBound);
theReadData.Driver().BeginReadObjectData(); StdObjMgt_ReadData::Object anObjectData (theReadData);
Standard_Integer aSize; Standard_Integer aSize;
theReadData.ReadValue (aSize); anObjectData >> aSize;
for (Standard_Integer i = aLowerBound; i <= anUpperBound; i++) for (Standard_Integer i = aLowerBound; i <= anUpperBound; i++)
readValue (theReadData, i); readValue (anObjectData, 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<> >;

@ -16,7 +16,10 @@
#define _StdLPersistent_HArray1_HeaderFile #define _StdLPersistent_HArray1_HeaderFile
#include <StdObjMgt_Persistent.hxx> #include <StdObjMgt_Persistent.hxx>
#include <StdLPersistent_HArray1OfPersistent.hxx> #include <StdObjMgt_ReadData.hxx>
#include <NCollection_DefineHArray1.hxx>
#include <TColStd_HArray1OfInteger.hxx> #include <TColStd_HArray1OfInteger.hxx>
#include <TColStd_HArray1OfReal.hxx> #include <TColStd_HArray1OfReal.hxx>
#include <TColStd_HArray1OfByte.hxx> #include <TColStd_HArray1OfByte.hxx>
@ -26,9 +29,13 @@ class TDF_Label;
class TDF_Data; class TDF_Data;
class StdLPersistent_HArray1 : protected StdObjMgt_ContentTypes DEFINE_HARRAY1 (StdLPersistent_HArray1OfPersistent,
NCollection_Array1<Handle(StdObjMgt_Persistent)>)
class StdLPersistent_HArray1
{ {
class commonBase : public StdObjMgt_Persistent class base : public StdObjMgt_Persistent
{ {
public: public:
//! Read persistent data from a file. //! Read persistent data from a file.
@ -44,7 +51,7 @@ class StdLPersistent_HArray1 : protected StdObjMgt_ContentTypes
protected: protected:
template <class ArrayClass> template <class ArrayClass>
class base : public commonBase class instance : public base
{ {
public: public:
typedef Handle(ArrayClass) ArrayHandle; typedef Handle(ArrayClass) ArrayHandle;
@ -60,24 +67,23 @@ protected:
const Standard_Integer theUpperBound) const Standard_Integer theUpperBound)
{ myArray = new ArrayClass (theLowerBound, theUpperBound); } { myArray = new ArrayClass (theLowerBound, theUpperBound); }
virtual void readValue (StdObjMgt_ReadData& theReadData,
const Standard_Integer theIndex)
{ theReadData >> myArray->ChangeValue (theIndex); }
protected: protected:
Handle(ArrayClass) myArray; 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: public:
typedef instance<TColStd_HArray1OfInteger> Integer; typedef instance<TColStd_HArray1OfInteger> Integer;
typedef instance<TColStd_HArray1OfReal> Real; typedef instance<TColStd_HArray1OfReal> Real;
typedef instance<TColStd_HArray1OfByte, Value<Standard_Character> >Byte; typedef instance<TColStd_HArray1OfByte> Byte;
typedef instance<StdLPersistent_HArray1OfPersistent, Reference<> > Persistent; typedef instance<StdLPersistent_HArray1OfPersistent> Persistent;
}; };
inline StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData& theReadData, Standard_Byte& theByte)
{ return theReadData >> reinterpret_cast<Standard_Character&> (theByte); }
#endif #endif

@ -1,24 +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_HArray1OfPersistent_HeaderFile
#define _StdLPersistent_HArray1OfPersistent_HeaderFile
#include <NCollection_DefineHArray1.hxx>
#include <StdObjMgt_Persistent.hxx>
DEFINE_HARRAY1 (StdLPersistent_HArray1OfPersistent,
NCollection_Array1<Handle(StdObjMgt_Persistent)>)
#endif // _StdLPersistent_HArray1OfPersistent_HeaderFile

@ -12,7 +12,6 @@
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <StdLPersistent_HArray2.hxx> #include <StdLPersistent_HArray2.hxx>
#include <StdObjMgt_ReadData.hxx>
#include <TColStd_HArray2OfInteger.hxx> #include <TColStd_HArray2OfInteger.hxx>
#include <TColStd_HArray2OfReal.hxx> #include <TColStd_HArray2OfReal.hxx>
@ -22,35 +21,18 @@
//function : Read //function : Read
//purpose : Read persistent data from a file //purpose : Read persistent data from a file
//======================================================================= //=======================================================================
void StdLPersistent_HArray2::commonBase::Read (StdObjMgt_ReadData& theReadData) void StdLPersistent_HArray2::base::Read (StdObjMgt_ReadData& theReadData)
{ {
Value<Standard_Integer> aLowerRow, aLowerCol, anUpperRow, anUpperCol; Standard_Integer aLowerRow, aLowerCol, anUpperRow, anUpperCol;
theReadData >> aLowerRow >> aLowerCol >> anUpperRow >> anUpperCol; theReadData >> aLowerRow >> aLowerCol >> anUpperRow >> anUpperCol;
createArray (aLowerRow, aLowerCol, anUpperRow, anUpperCol); createArray (aLowerRow, aLowerCol, anUpperRow, anUpperCol);
theReadData.Driver().BeginReadObjectData(); StdObjMgt_ReadData::Object anObjectData (theReadData);
Standard_Integer aSize; Standard_Integer aSize;
theReadData.ReadValue (aSize); anObjectData >> aSize;
for (Standard_Integer aRow = aLowerRow; aRow <= anUpperRow; aRow++) for (Standard_Integer aRow = aLowerRow; aRow <= anUpperRow; aRow++)
for (Standard_Integer aCol = aLowerCol; aCol <= anUpperCol; aCol++) for (Standard_Integer aCol = aLowerCol; aCol <= anUpperCol; aCol++)
readValue (theReadData, aRow, aCol); readValue (anObjectData, 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>;

@ -16,14 +16,21 @@
#define _StdLPersistent_HArray2_HeaderFile #define _StdLPersistent_HArray2_HeaderFile
#include <StdObjMgt_Persistent.hxx> #include <StdObjMgt_Persistent.hxx>
#include <StdObjMgt_ReadData.hxx>
#include <NCollection_DefineHArray2.hxx>
#include <TColStd_HArray2OfInteger.hxx> #include <TColStd_HArray2OfInteger.hxx>
#include <TColStd_HArray2OfReal.hxx> #include <TColStd_HArray2OfReal.hxx>
DEFINE_HARRAY2 (StdLPersistent_HArray2OfPersistent,
NCollection_Array2<Handle(StdObjMgt_Persistent)>)
class StdLPersistent_HArray2 class StdLPersistent_HArray2
{ {
class commonBase : public StdObjMgt_Persistent class base : public StdObjMgt_Persistent
{ {
public: public:
//! Read persistent data from a file. //! Read persistent data from a file.
@ -42,7 +49,7 @@ class StdLPersistent_HArray2
protected: protected:
template <class ArrayClass> template <class ArrayClass>
class base : public commonBase class instance : public base
{ {
public: public:
typedef Handle(ArrayClass) ArrayHandle; typedef Handle(ArrayClass) ArrayHandle;
@ -60,23 +67,19 @@ protected:
theLowerCol, theUpperCol); theLowerCol, theUpperCol);
} }
virtual void readValue (StdObjMgt_ReadData& theReadData,
const Standard_Integer theRow,
const Standard_Integer theCol)
{ theReadData >> myArray->ChangeValue (theRow, theCol); }
protected: protected:
Handle(ArrayClass) myArray; 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: public:
typedef instance<TColStd_HArray2OfInteger> Integer; typedef instance<TColStd_HArray2OfInteger> Integer;
typedef instance<TColStd_HArray2OfReal> Real; typedef instance<TColStd_HArray2OfReal> Real;
typedef instance<StdLPersistent_HArray2OfPersistent> Persistent;
}; };
#endif #endif

@ -25,20 +25,18 @@ template <class StringClass, typename CharType>
void StdLPersistent_HString::instance<StringClass, CharType>::Read void StdLPersistent_HString::instance<StringClass, CharType>::Read
(StdObjMgt_ReadData& theReadData) (StdObjMgt_ReadData& theReadData)
{ {
theReadData.Driver().BeginReadObjectData(); StdObjMgt_ReadData::Object anObjectData (theReadData);
Standard_Integer aSize; Standard_Integer aSize;
theReadData.ReadValue (aSize); anObjectData >> aSize;
myValue = new StringClass (aSize, 0); myValue = new StringClass (aSize, 0);
for (Standard_Integer i = 1; i <= aSize; i++) for (Standard_Integer i = 1; i <= aSize; i++)
{ {
CharType aChar; CharType aChar;
theReadData.ReadValue (aChar); anObjectData >> aChar;
myValue->SetValue (i, aChar); myValue->SetValue (i, aChar);
} }
theReadData.Driver().EndReadObjectData();
} }
//======================================================================= //=======================================================================

@ -13,8 +13,6 @@
#include <StdLPersistent_NamedData.hxx> #include <StdLPersistent_NamedData.hxx>
#include <TCollection_HExtendedString.hxx>
#include <TColStd_DataMapOfStringInteger.hxx> #include <TColStd_DataMapOfStringInteger.hxx>
#include <TDataStd_DataMapOfStringReal.hxx> #include <TDataStd_DataMapOfStringReal.hxx>
#include <TDataStd_DataMapOfStringString.hxx> #include <TDataStd_DataMapOfStringString.hxx>
@ -23,6 +21,24 @@
#include <TDataStd_DataMapOfStringHArray1OfReal.hxx> #include <TDataStd_DataMapOfStringHArray1OfReal.hxx>
static const TCollection_ExtendedString&
String (Handle(StdObjMgt_Persistent) theValue)
{
if (theValue)
return theValue->ExtString()->String();
static TCollection_ExtendedString anEmptyString;
return anEmptyString;
}
template <class HArray>
static typename HArray::ArrayHandle
Array (Handle(StdObjMgt_Persistent) theValue)
{
Handle(HArray) anArray = Handle(HArray)::DownCast (theValue);
return anArray ? anArray->Array() : NULL;
}
//======================================================================= //=======================================================================
//function : Import //function : Import
//purpose : Import transient attribuite from the persistent data //purpose : Import transient attribuite from the persistent data
@ -37,10 +53,8 @@ void StdLPersistent_NamedData::Import
{ {
TColStd_DataMapOfStringInteger aMap; TColStd_DataMapOfStringInteger aMap;
for (Standard_Integer i = lower(0); i <= upper(0); i++) for (Standard_Integer i = lower(0); i <= upper(0); i++)
{ aMap.Bind (myInts.Key(i), myInts.Value(i));
Standard_Integer aValue = 0;
aMap.Bind (myInts.Get (i, aValue), aValue);
}
theAttribute->ChangeIntegers (aMap); theAttribute->ChangeIntegers (aMap);
} }
@ -48,10 +62,8 @@ void StdLPersistent_NamedData::Import
{ {
TDataStd_DataMapOfStringReal aMap; TDataStd_DataMapOfStringReal aMap;
for (Standard_Integer i = lower(1); i <= upper(1); i++) for (Standard_Integer i = lower(1); i <= upper(1); i++)
{ aMap.Bind (myReals.Key(i), myReals.Value(i));
Standard_Real aValue = 0.0;
aMap.Bind (myReals.Get (i, aValue), aValue);
}
theAttribute->ChangeReals (aMap); theAttribute->ChangeReals (aMap);
} }
@ -59,12 +71,8 @@ void StdLPersistent_NamedData::Import
{ {
TDataStd_DataMapOfStringString aMap; TDataStd_DataMapOfStringString aMap;
for (Standard_Integer i = lower(2); i <= upper(2); i++) for (Standard_Integer i = lower(2); i <= upper(2); i++)
{ aMap.Bind (myStrings.Key(i), String (myStrings.Value(i)));
Handle(StdObjMgt_Persistent) aValue;
aMap.Bind (myStrings.Get (i, aValue),
aValue ? aValue->ExtString()->String()
: TCollection_ExtendedString());
}
theAttribute->ChangeStrings (aMap); theAttribute->ChangeStrings (aMap);
} }
@ -72,10 +80,8 @@ void StdLPersistent_NamedData::Import
{ {
TDataStd_DataMapOfStringByte aMap; TDataStd_DataMapOfStringByte aMap;
for (Standard_Integer i = lower(3); i <= upper(3); i++) for (Standard_Integer i = lower(3); i <= upper(3); i++)
{ aMap.Bind (myBytes.Key(i), myBytes.Value(i));
Standard_Byte aValue = 0;
aMap.Bind (myBytes.Get (i, aValue), aValue);
}
theAttribute->ChangeBytes (aMap); theAttribute->ChangeBytes (aMap);
} }
@ -83,19 +89,9 @@ void StdLPersistent_NamedData::Import
{ {
TDataStd_DataMapOfStringHArray1OfInteger aMap; TDataStd_DataMapOfStringHArray1OfInteger aMap;
for (Standard_Integer i = lower(4); i <= upper(4); i++) for (Standard_Integer i = lower(4); i <= upper(4); i++)
{ aMap.Bind (myIntArrays.Key(i),
Handle(StdObjMgt_Persistent) aValue; Array<StdLPersistent_HArray1::Integer> (myIntArrays.Value(i)));
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); theAttribute->ChangeArraysOfIntegers (aMap);
} }
@ -103,19 +99,9 @@ void StdLPersistent_NamedData::Import
{ {
TDataStd_DataMapOfStringHArray1OfReal aMap; TDataStd_DataMapOfStringHArray1OfReal aMap;
for (Standard_Integer i = lower(5); i <= upper(5); i++) for (Standard_Integer i = lower(5); i <= upper(5); i++)
{ aMap.Bind (myRealArrays.Key(i),
Handle(StdObjMgt_Persistent) aValue; Array<StdLPersistent_HArray1::Real> (myRealArrays.Value(i)));
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); theAttribute->ChangeArraysOfReals (aMap);
} }
} }

@ -25,35 +25,39 @@
class StdLPersistent_NamedData : public StdObjMgt_Attribute<TDataStd_NamedData> class StdLPersistent_NamedData : public StdObjMgt_Attribute<TDataStd_NamedData>
{ {
template <class HValuesArray> template <class HValuesArray>
class element class pMapData
{ {
public: public:
typedef typename HValuesArray::ValueType ValueType;
inline void Read (StdObjMgt_ReadData& theReadData) inline void Read (StdObjMgt_ReadData& theReadData)
{ theReadData >> myKeys >> myValues; } { theReadData >> myKeys >> myValues; }
inline operator bool() const inline operator bool() const
{ return ! myKeys.IsNull(); } { return !myKeys.IsNull(); }
template <class Value> const TCollection_ExtendedString& Key (Standard_Integer theIndex) const
inline const TCollection_ExtendedString& Get { return myKeys->Array()->Value(theIndex)->ExtString()->String(); }
(Standard_Integer theIndex, Value& theValue) const
{ ValueType Value (Standard_Integer theIndex) const
if (myValues) { return myValues ? myValues->Array()->Value(theIndex) : 0; }
theValue = myValues->Array()->Value(theIndex);
return myKeys->Array()->Value(theIndex)->ExtString()->String();
}
private: private:
Reference <StdLPersistent_HArray1::Persistent> myKeys; Handle(StdLPersistent_HArray1::Persistent) myKeys;
Reference <HValuesArray> myValues; Handle(HValuesArray) myValues;
}; };
public: public:
//! Read persistent data from a file. //! Read persistent data from a file.
inline void Read (StdObjMgt_ReadData& theReadData) inline void Read (StdObjMgt_ReadData& theReadData)
{ {
theReadData >> myDimensions >> theReadData >> myDimensions;
myInts >> myReals >> myStrings >> myBytes >> myIntArrays >> myRealArrays; myInts .Read (theReadData);
myReals .Read (theReadData);
myStrings .Read (theReadData);
myBytes .Read (theReadData);
myIntArrays .Read (theReadData);
myRealArrays.Read (theReadData);
} }
//! Import transient attribuite from the persistent data. //! Import transient attribuite from the persistent data.
@ -64,13 +68,13 @@ private:
inline Standard_Integer upper (Standard_Integer theIndex) const; inline Standard_Integer upper (Standard_Integer theIndex) const;
private: private:
Reference <StdLPersistent_HArray2::Integer> myDimensions; Handle(StdLPersistent_HArray2::Integer) myDimensions;
Object <element<StdLPersistent_HArray1::Integer> > myInts; pMapData<StdLPersistent_HArray1::Integer> myInts;
Object <element<StdLPersistent_HArray1::Real> > myReals; pMapData<StdLPersistent_HArray1::Real> myReals;
Object <element<StdLPersistent_HArray1::Persistent> > myStrings; pMapData<StdLPersistent_HArray1::Persistent> myStrings;
Object <element<StdLPersistent_HArray1::Byte> > myBytes; pMapData<StdLPersistent_HArray1::Byte> myBytes;
Object <element<StdLPersistent_HArray1::Persistent> > myIntArrays; pMapData<StdLPersistent_HArray1::Persistent> myIntArrays;
Object <element<StdLPersistent_HArray1::Persistent> > myRealArrays; pMapData<StdLPersistent_HArray1::Persistent> myRealArrays;
}; };
#endif #endif

@ -18,7 +18,6 @@
#include <StdObjMgt_Attribute.hxx> #include <StdObjMgt_Attribute.hxx>
#include <TDataStd_Real.hxx> #include <TDataStd_Real.hxx>
#include <TDataStd_RealEnum.hxx>
class StdLPersistent_Real : public StdObjMgt_Attribute<TDataStd_Real> class StdLPersistent_Real : public StdObjMgt_Attribute<TDataStd_Real>
@ -31,13 +30,13 @@ public:
//! Import transient attribuite from the persistent data. //! Import transient attribuite from the persistent data.
void Import (const Handle(TDataStd_Real)& theAttribute) const void Import (const Handle(TDataStd_Real)& theAttribute) const
{ {
theAttribute->Set (myValue); theAttribute->Set (myValue);
theAttribute->SetDimension (myDimension); theAttribute->SetDimension (static_cast<TDataStd_RealEnum> (myDimension));
} }
private: private:
Value<Standard_Real> myValue; Standard_Real myValue;
Enum<TDataStd_RealEnum> myDimension; Standard_Integer myDimension;
}; };
#endif #endif

@ -16,9 +16,9 @@
#define _StdLPersistent_TreeNode_HeaderFile #define _StdLPersistent_TreeNode_HeaderFile
#include <StdObjMgt_Attribute.hxx> #include <StdObjMgt_Attribute.hxx>
#include <StdLObject_GUID.hxx>
#include <TDataStd_TreeNode.hxx> #include <TDataStd_TreeNode.hxx>
#include <Standard_GUID.hxx>
class StdLPersistent_TreeNode class StdLPersistent_TreeNode
@ -37,12 +37,12 @@ public:
private: private:
struct dynamic : public Standard_Transient struct dynamic : public Standard_Transient
{ {
Reference <StdLPersistent_TreeNode> First; Handle(StdLPersistent_TreeNode) First;
Object <StdLObject_GUID> TreeID; Standard_GUID TreeID;
}; };
Handle(dynamic) myDynamicData; Handle(dynamic) myDynamicData;
Reference<StdLPersistent_TreeNode> myNext; Handle(StdLPersistent_TreeNode) myNext;
}; };
#endif #endif

@ -34,8 +34,9 @@ void StdLPersistent_Value::integer<AttribClass>::ImportAttribute()
template <class AttribClass, class HStringClass> template <class AttribClass, class HStringClass>
void StdLPersistent_Value::string<AttribClass, HStringClass>::ImportAttribute() void StdLPersistent_Value::string<AttribClass, HStringClass>::ImportAttribute()
{ {
Handle(HStringClass) anHString; Handle(HStringClass) anHString =
if (this->myData.Cast (anHString)) Handle(HStringClass)::DownCast (this->myData);
if (anHString)
{ {
this->myTransient->Set (anHString->Value()->String()); this->myTransient->Set (anHString->Value()->String());
this->myData.Nullify(); this->myData.Nullify();
@ -83,7 +84,7 @@ Handle(TDF_Attribute) StdLPersistent_Value::UAttribute::CreateAttribute()
} }
return this->myTransient; return this->myTransient;
} }
template class StdLPersistent_Value::integer <TDataStd_Integer>; template class StdLPersistent_Value::integer <TDataStd_Integer>;

@ -37,8 +37,8 @@ public:
} }
private: private:
Value <Standard_Boolean> myIsConstant; Standard_Boolean myIsConstant;
Reference <StdLPersistent_HString::Ascii> myUnit; Handle(StdLPersistent_HString::Ascii) myUnit;
}; };
#endif #endif

@ -39,8 +39,8 @@ public:
} }
private: private:
Reference<StdLPersistent_HString::Ascii> myDocEntry; Handle(StdLPersistent_HString::Ascii) myDocEntry;
Reference<StdLPersistent_HString::Ascii> myLabEntry; Handle(StdLPersistent_HString::Ascii) myLabEntry;
}; };
#endif #endif

@ -1,5 +1,4 @@
StdObjMgt_Attribute.hxx StdObjMgt_Attribute.hxx
StdObjMgt_ContentTypes.hxx
StdObjMgt_MapOfInstantiators.cxx StdObjMgt_MapOfInstantiators.cxx
StdObjMgt_MapOfInstantiators.hxx StdObjMgt_MapOfInstantiators.hxx
StdObjMgt_Persistent.cxx StdObjMgt_Persistent.cxx

@ -20,8 +20,7 @@
//! Root class for a temporary persistent object corresponding to an attribute. //! Root class for a temporary persistent object corresponding to an attribute.
template <class Transient> template <class Transient>
class StdObjMgt_Attribute : public Standard_Transient, class StdObjMgt_Attribute : public Standard_Transient
protected StdObjMgt_ContentTypes
{ {
class base : public StdObjMgt_Persistent class base : public StdObjMgt_Persistent
{ {
@ -53,8 +52,8 @@ public:
DataType myData; DataType myData;
}; };
struct SingleInt : Simple <Value<Standard_Integer> > {}; struct SingleInt : Simple<Standard_Integer> {};
struct SingleRef : Simple <Reference<> > {}; struct SingleRef : Simple<Handle(StdObjMgt_Persistent)> {};
private: private:
template <class Persistent> template <class Persistent>

@ -1,102 +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 _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

@ -18,7 +18,6 @@
#include <Standard.hxx> #include <Standard.hxx>
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <Standard_Transient.hxx> #include <Standard_Transient.hxx>
#include <StdObjMgt_ContentTypes.hxx>
#include <TDF_Label.hxx> #include <TDF_Label.hxx>
@ -32,8 +31,7 @@ class TCollection_HExtendedString;
//! Root class for a temporary persistent object that reads data from a file //! Root class for a temporary persistent object that reads data from a file
//! and then creates transient object using the data. //! and then creates transient object using the data.
class StdObjMgt_Persistent : public Standard_Transient, class StdObjMgt_Persistent : public Standard_Transient
protected StdObjMgt_ContentTypes
{ {
public: public:
//! Derived class instance create function. //! Derived class instance create function.

@ -14,6 +14,8 @@
#include <StdObjMgt_ReadData.hxx> #include <StdObjMgt_ReadData.hxx>
#include <StdObjMgt_Persistent.hxx> #include <StdObjMgt_Persistent.hxx>
#include <Standard_GUID.hxx>
StdObjMgt_ReadData::StdObjMgt_ReadData StdObjMgt_ReadData::StdObjMgt_ReadData
(Storage_BaseDriver& theDriver, const Standard_Integer theNumberOfObjects) (Storage_BaseDriver& theDriver, const Standard_Integer theNumberOfObjects)
@ -39,3 +41,23 @@ Handle(StdObjMgt_Persistent) StdObjMgt_ReadData::ReadReference()
myDriver->GetReference (aRef); myDriver->GetReference (aRef);
return aRef ? PersistentObject (aRef) : NULL; return aRef ? PersistentObject (aRef) : NULL;
} }
//=======================================================================
//function : operator >>
//purpose : Read persistent data from a file
//=======================================================================
StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData::Object theReadData, Standard_GUID& theGUID)
{
Standard_Integer a32b;
Standard_ExtCharacter a16b[3];
Standard_Character a8b [6];
theReadData >> a32b >> a16b[0] >> a16b[1] >> a16b[2];
theReadData >> a8b[0] >> a8b[1] >> a8b[2] >> a8b[3] >> a8b[4] >> a8b[5];
theGUID = Standard_GUID (a32b, a16b[0], a16b[1], a16b[2],
a8b[0], a8b[1], a8b[2], a8b[3], a8b[4], a8b[5]);
return theReadData;
}

@ -19,17 +19,18 @@
#include <NCollection_Array1.hxx> #include <NCollection_Array1.hxx>
class StdObjMgt_Persistent; class StdObjMgt_Persistent;
class Standard_GUID;
//! Auxiliary data used to read persistent objects from a file. //! Auxiliary data used to read persistent objects from a file.
class StdObjMgt_ReadData class StdObjMgt_ReadData
{ {
public: public:
class Object;
Standard_EXPORT StdObjMgt_ReadData Standard_EXPORT StdObjMgt_ReadData
(Storage_BaseDriver& theDriver, const Standard_Integer theNumberOfObjects); (Storage_BaseDriver& theDriver, const Standard_Integer theNumberOfObjects);
Storage_BaseDriver& Driver() const
{ return *myDriver; }
template <class Instantiator> template <class Instantiator>
void CreatePersistentObject void CreatePersistentObject
(const Standard_Integer theRef, Instantiator theInstantiator) (const Standard_Integer theRef, Instantiator theInstantiator)
@ -45,45 +46,69 @@ public:
Standard_EXPORT Handle(StdObjMgt_Persistent) ReadReference(); Standard_EXPORT Handle(StdObjMgt_Persistent) ReadReference();
template <class Persistent> template <class Persistent>
void ReadReference (Handle(Persistent)& theTarget) StdObjMgt_ReadData& operator >> (Handle(Persistent)& theTarget)
{ {
theTarget = Handle(Persistent)::DownCast (ReadReference()); theTarget = Handle(Persistent)::DownCast (ReadReference());
}
template <class Object>
void ReadObject (Object& theObject)
{
myDriver->BeginReadObjectData();
theObject.Read (*this);
myDriver->EndReadObjectData();
}
template <class Type>
void ReadValue (Type& theValue)
{
*myDriver >> theValue;
}
template <class Type>
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)
{
theContent.Read (*this);
return *this; return *this;
} }
StdObjMgt_ReadData& operator >> (Handle(StdObjMgt_Persistent)& theTarget)
{
theTarget = ReadReference();
return *this;
}
template <class Type>
StdObjMgt_ReadData& ReadValue (Type& theValue)
{
*myDriver >> theValue;
return *this;
}
StdObjMgt_ReadData& operator >> (Standard_Character& theValue)
{ return ReadValue (theValue); }
StdObjMgt_ReadData& operator >> (Standard_ExtCharacter& theValue)
{ return ReadValue (theValue); }
StdObjMgt_ReadData& operator >> (Standard_Integer& theValue)
{ return ReadValue (theValue); }
StdObjMgt_ReadData& operator >> (Standard_Boolean& theValue)
{ return ReadValue (theValue); }
StdObjMgt_ReadData& operator >> (Standard_Real& theValue)
{ return ReadValue (theValue); }
StdObjMgt_ReadData& operator >> (Standard_ShortReal& theValue)
{ return ReadValue (theValue); }
private: private:
Storage_BaseDriver* myDriver; Storage_BaseDriver* myDriver;
NCollection_Array1<Handle(StdObjMgt_Persistent)> myPersistentObjects; NCollection_Array1<Handle(StdObjMgt_Persistent)> myPersistentObjects;
}; };
class StdObjMgt_ReadData::Object
{
public:
Object (StdObjMgt_ReadData& theData) : myReadData (&theData)
{ myReadData->myDriver->BeginReadObjectData(); }
~Object()
{ myReadData->myDriver->EndReadObjectData(); }
operator StdObjMgt_ReadData&()
{ return *myReadData; }
template <class Data>
StdObjMgt_ReadData& operator >> (Data& theData)
{ return *myReadData >> theData; }
private:
StdObjMgt_ReadData* myReadData;
};
Standard_EXPORT StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData::Object theReadData, Standard_GUID& theGUID);
#endif // _StdObjMgt_ReadData_HeaderFile #endif // _StdObjMgt_ReadData_HeaderFile

@ -21,11 +21,8 @@
class StdObjMgt_SharedObject class StdObjMgt_SharedObject
{ {
public: public:
class PersistentBase : public Standard_Transient,
protected StdObjMgt_ContentTypes {};
template <class Transient> template <class Transient>
class AbstractPersistentBase : public PersistentBase class AbstractPersistentBase : public Standard_Transient
{ {
public: public:
virtual Handle(Transient) Import() const = 0; virtual Handle(Transient) Import() const = 0;

@ -1,4 +1,8 @@
StdObject_gp.hxx StdObject_gp_Axes.hxx
StdObject_gp_Curves.hxx
StdObject_gp_Surfaces.hxx
StdObject_gp_Trsfs.hxx
StdObject_gp_Vectors.hxx
StdObject_Location.cxx StdObject_Location.cxx
StdObject_Location.hxx StdObject_Location.hxx
StdObject_Shape.cxx StdObject_Shape.cxx

@ -21,9 +21,7 @@
//======================================================================= //=======================================================================
TopLoc_Location StdObject_Location::Import() const TopLoc_Location StdObject_Location::Import() const
{ {
Handle(StdPersistent_TopLoc::ItemLocation) anItemLocation; Handle(StdPersistent_TopLoc::ItemLocation) anItemLocation =
if (myData.Cast (anItemLocation)) Handle(StdPersistent_TopLoc::ItemLocation)::DownCast (myData);
return anItemLocation->Import(); return anItemLocation ? anItemLocation->Import() : TopLoc_Location();
else
return TopLoc_Location();
} }

@ -15,23 +15,29 @@
#ifndef _StdObject_Location_HeaderFile #ifndef _StdObject_Location_HeaderFile
#define _StdObject_Location_HeaderFile #define _StdObject_Location_HeaderFile
#include <StdObjMgt_ContentTypes.hxx> #include <StdObjMgt_ReadData.hxx>
#include <TopLoc_Location.hxx> #include <TopLoc_Location.hxx>
class StdObject_Location : private StdObjMgt_ContentTypes class StdObject_Location
{ {
public: public:
//! Read persistent data from a file.
inline void Read (StdObjMgt_ReadData& theReadData)
{ theReadData >> myData; }
//! Import transient object from the persistent data. //! Import transient object from the persistent data.
TopLoc_Location Import() const; TopLoc_Location Import() const;
private: private:
Reference<> myData; Handle(StdObjMgt_Persistent) myData;
friend StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData::Object, StdObject_Location&);
}; };
//! Read persistent data from a file.
inline StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData::Object theReadData, StdObject_Location& theLocation)
{
return theReadData >> theLocation.myData;
}
#endif #endif

@ -27,7 +27,7 @@ TopoDS_Shape StdObject_Shape::Import() const
aShape.TShape (myTShape->Import()); aShape.TShape (myTShape->Import());
aShape.Location (myLocation.Import()); aShape.Location (myLocation.Import());
aShape.Orientation (myOrient); aShape.Orientation (static_cast<TopAbs_Orientation> (myOrient));
return aShape; return aShape;
} }

@ -15,28 +15,39 @@
#ifndef _StdObject_Shape_HeaderFile #ifndef _StdObject_Shape_HeaderFile
#define _StdObject_Shape_HeaderFile #define _StdObject_Shape_HeaderFile
#include <StdObjMgt_ContentTypes.hxx> #include <StdObjMgt_ReadData.hxx>
#include <StdObject_Location.hxx> #include <StdObject_Location.hxx>
#include <StdPersistent_TopoDS.hxx> #include <StdPersistent_TopoDS.hxx>
#include <TopAbs_Orientation.hxx>
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
class StdObject_Shape : private StdObjMgt_ContentTypes class StdObject_Shape
{ {
public: public:
//! Read persistent data from a file.
inline void Read (StdObjMgt_ReadData& theReadData)
{ theReadData >> myTShape >> myLocation >> myOrient; }
//! Import transient object from the persistent data. //! Import transient object from the persistent data.
Standard_EXPORT TopoDS_Shape Import() const; Standard_EXPORT TopoDS_Shape Import() const;
protected:
//! Read persistent data from a file.
inline void read (StdObjMgt_ReadData& theReadData)
{ theReadData >> myTShape >> myLocation >> myOrient; }
private: private:
Reference <StdPersistent_TopoDS::TShape> myTShape; Handle(StdPersistent_TopoDS::TShape) myTShape;
Object <StdObject_Location> myLocation; StdObject_Location myLocation;
Enum <TopAbs_Orientation> myOrient; Standard_Integer myOrient;
friend StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData::Object, StdObject_Shape&);
}; };
//! Read persistent data from a file.
inline StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData::Object theReadData, StdObject_Shape& theShape)
{
theShape.read (theReadData);
return theReadData;
}
#endif #endif

@ -1,414 +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 _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

@ -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.
#ifndef _StdObject_gp_Axes_HeaderFile
#define _StdObject_gp_Axes_HeaderFile
#include <StdObject_gp_Vectors.hxx>
#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::Object 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::Object 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::Object 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::Object 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::Object 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;
}
#endif

@ -0,0 +1,168 @@
// 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_Curves_HeaderFile
#define _StdObject_gp_Curves_HeaderFile
#include <StdObject_gp_Axes.hxx>
#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::Object theReadData, gp_Lin2d& theLin)
{
gp_Ax2d anAx;
theReadData >> anAx;
theLin.SetPosition (anAx);
return theReadData;
}
inline StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData::Object theReadData, gp_Circ2d& theCirc)
{
gp_Ax22d anAx;
Standard_Real aRadius;
theReadData >> anAx >> aRadius;
theCirc.SetAxis (anAx);
theCirc.SetRadius (aRadius);
return theReadData;
}
inline StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData::Object theReadData, gp_Elips2d& theElips)
{
gp_Ax22d anAx;
Standard_Real aMajorRadius, aMinorRadius;
theReadData >> anAx >> aMajorRadius >> aMinorRadius;
theElips.SetAxis (anAx);
theElips.SetMajorRadius (aMajorRadius);
theElips.SetMinorRadius (aMinorRadius);
return theReadData;
}
inline StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData::Object theReadData, gp_Hypr2d& theHypr)
{
gp_Ax22d anAx;
Standard_Real aMajorRadius, aMinorRadius;
theReadData >> anAx >> aMajorRadius >> aMinorRadius;
theHypr.SetAxis (anAx);
theHypr.SetMajorRadius (aMajorRadius);
theHypr.SetMinorRadius (aMinorRadius);
return theReadData;
}
inline StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData::Object theReadData, gp_Parab2d& theParab)
{
gp_Ax22d anAx;
Standard_Real aFocalLength;
theReadData >> anAx >> aFocalLength;
theParab.SetAxis (anAx);
theParab.SetFocal (aFocalLength);
return theReadData;
}
inline StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData::Object theReadData, gp_Lin& theLin)
{
gp_Ax1 anAx;
theReadData >> anAx;
theLin.SetPosition (anAx);
return theReadData;
}
inline StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData::Object theReadData, gp_Circ& theCirc)
{
gp_Ax2 anAx;
Standard_Real aRadius;
theReadData >> anAx >> aRadius;
theCirc.SetPosition (anAx);
theCirc.SetRadius (aRadius);
return theReadData;
}
inline StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData::Object theReadData, gp_Elips& theElips)
{
gp_Ax2 anAx;
Standard_Real aMajorRadius, aMinorRadius;
theReadData >> anAx >> aMajorRadius >> aMinorRadius;
theElips.SetPosition (anAx);
theElips.SetMajorRadius (aMajorRadius);
theElips.SetMinorRadius (aMinorRadius);
return theReadData;
}
inline StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData::Object theReadData, gp_Hypr& theHypr)
{
gp_Ax2 anAx;
Standard_Real aMajorRadius, aMinorRadius;
theReadData >> anAx >> aMajorRadius >> aMinorRadius;
theHypr.SetPosition (anAx);
theHypr.SetMajorRadius (aMajorRadius);
theHypr.SetMinorRadius (aMinorRadius);
return theReadData;
}
inline StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData::Object theReadData, gp_Parab& theParab)
{
gp_Ax2 anAx;
Standard_Real aFocalLength;
theReadData >> anAx >> aFocalLength;
theParab.SetPosition (anAx);
theParab.SetFocal (aFocalLength);
return theReadData;
}
#endif

@ -0,0 +1,86 @@
// 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_Surfaces_HeaderFile
#define _StdObject_gp_Surfaces_HeaderFile
#include <StdObject_gp_Axes.hxx>
#include <gp_Cone.hxx>
#include <gp_Cylinder.hxx>
#include <gp_Sphere.hxx>
#include <gp_Torus.hxx>
inline StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData::Object theReadData, gp_Cone& theCone)
{
gp_Ax3 anAx;
Standard_Real aRadius, aSemiAngle;
theReadData >> anAx >> aRadius >> aSemiAngle;
theCone.SetPosition (anAx);
theCone.SetRadius (aRadius);
theCone.SetSemiAngle (aSemiAngle);
return theReadData;
}
inline StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData::Object theReadData, gp_Cylinder& theCyl)
{
gp_Ax3 anAx;
Standard_Real aRadius;
theReadData >> anAx >> aRadius;
theCyl.SetPosition (anAx);
theCyl.SetRadius (aRadius);
return theReadData;
}
inline StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData::Object theReadData, gp_Sphere& theSph)
{
gp_Ax3 anAx;
Standard_Real aRadius;
theReadData >> anAx >> aRadius;
theSph.SetPosition (anAx);
theSph.SetRadius (aRadius);
return theReadData;
}
inline StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData::Object theReadData, gp_Torus& theTorus)
{
gp_Ax3 anAx;
Standard_Real aMajorRadius, aMinorRadius;
theReadData >> anAx >> aMajorRadius >> aMinorRadius;
theTorus.SetPosition (anAx);
theTorus.SetMajorRadius (aMajorRadius);
theTorus.SetMinorRadius (aMinorRadius);
return theReadData;
}
#endif

@ -0,0 +1,80 @@
// 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_Trsfs_HeaderFile
#define _StdObject_gp_Trsfs_HeaderFile
#include <StdObject_gp_Vectors.hxx>
#include <gp_Mat2d.hxx>
#include <gp_Mat.hxx>
#include <gp_Trsf2d.hxx>
#include <gp_Trsf.hxx>
inline StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData::Object theReadData, gp_Mat2d& theMat)
{
gp_XY aRow1, aRow2;
theReadData >> aRow1 >> aRow2;
theMat.SetRows (aRow1, aRow2);
return theReadData;
}
inline StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData::Object 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::Object theReadData, gp_Trsf2d& theTrsf)
{
Standard_Real aScale;
Standard_Integer aForm;
gp_Mat2d aMat;
gp_XY aLoc;
theReadData >> aScale >> aForm >> 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::Object theReadData, gp_Trsf& theTrsf)
{
Standard_Real aScale;
Standard_Integer aForm;
gp_Mat aMat;
gp_XYZ aLoc;
theReadData >> aScale >> aForm >> 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;
}
#endif

@ -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 _StdObject_gp_Vectors_HeaderFile
#define _StdObject_gp_Vectors_HeaderFile
#include <StdObjMgt_ReadData.hxx>
#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::Object theReadData, gp_XY& theXY)
{
Standard_Real aX, aY;
theReadData >> aX >> aY;
theXY.SetCoord (aX, aY);
return theReadData;
}
inline StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData::Object theReadData, gp_Pnt2d& thePnt)
{
Standard_Real aX, aY;
theReadData >> aX >> aY;
thePnt.SetCoord (aX, aY);
return theReadData;
}
inline StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData::Object theReadData, gp_Vec2d& theVec)
{
Standard_Real aX, aY;
theReadData >> aX >> aY;
theVec.SetCoord (aX, aY);
return theReadData;
}
inline StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData::Object theReadData, gp_Dir2d& theDir)
{
Standard_Real aX, aY;
theReadData >> aX >> aY;
theDir.SetCoord (aX, aY);
return theReadData;
}
inline StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData::Object theReadData, gp_XYZ& theXYZ)
{
Standard_Real aX, aY, aZ;
theReadData >> aX >> aY >> aZ;
theXYZ.SetCoord (aX, aY, aZ);
return theReadData;
}
inline StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData::Object theReadData, gp_Pnt& thePnt)
{
Standard_Real aX, aY, aZ;
theReadData >> aX >> aY >> aZ;
thePnt.SetCoord (aX, aY, aZ);
return theReadData;
}
inline StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData::Object theReadData, gp_Vec& theVec)
{
Standard_Real aX, aY, aZ;
theReadData >> aX >> aY >> aZ;
theVec.SetCoord (aX, aY, aZ);
return theReadData;
}
inline StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData::Object theReadData, gp_Dir& theDir)
{
Standard_Real aX, aY, aZ;
theReadData >> aX >> aY >> aZ;
theDir.SetCoord (aX, aY, aZ);
return theReadData;
}
#endif

@ -6,8 +6,6 @@ StdPersistent_DataXtd_Constraint.cxx
StdPersistent_DataXtd_Constraint.hxx StdPersistent_DataXtd_Constraint.hxx
StdPersistent_DataXtd_PatternStd.cxx StdPersistent_DataXtd_PatternStd.cxx
StdPersistent_DataXtd_PatternStd.hxx StdPersistent_DataXtd_PatternStd.hxx
StdPersistent_HArray1OfShape1.hxx
StdPersistent_HArray1.cxx
StdPersistent_HArray1.hxx StdPersistent_HArray1.hxx
StdPersistent_Naming.cxx StdPersistent_Naming.cxx
StdPersistent_Naming.hxx StdPersistent_Naming.hxx

@ -19,7 +19,7 @@
//purpose : Import transient attribuite from the persistent data //purpose : Import transient attribuite from the persistent data
//======================================================================= //=======================================================================
void StdPersistent_DataXtd::Geometry::ImportAttribute() void StdPersistent_DataXtd::Geometry::ImportAttribute()
{ myTransient->SetType (myData); } { myTransient->SetType (static_cast<TDataXtd_GeometryEnum> (myData)); }
//======================================================================= //=======================================================================
//function : ImportAttribute //function : ImportAttribute

@ -15,10 +15,9 @@
#ifndef _StdPersistent_DataXtd_HeaderFile #ifndef _StdPersistent_DataXtd_HeaderFile
#define _StdPersistent_DataXtd_HeaderFile #define _StdPersistent_DataXtd_HeaderFile
#include <StdObjMgt_ContentTypes.hxx>
#include <StdObjMgt_Attribute.hxx> #include <StdObjMgt_Attribute.hxx>
#include <StdLPersistent_Void.hxx> #include <StdLPersistent_Void.hxx>
#include <StdObject_gp.hxx> #include <StdObject_gp_Vectors.hxx>
#include <TDataXtd_Shape.hxx> #include <TDataXtd_Shape.hxx>
#include <TDataXtd_Point.hxx> #include <TDataXtd_Point.hxx>
@ -29,7 +28,7 @@
#include <TDataXtd_Position.hxx> #include <TDataXtd_Position.hxx>
class StdPersistent_DataXtd : private StdObjMgt_ContentTypes class StdPersistent_DataXtd
{ {
class _void : private StdLPersistent_Void class _void : private StdLPersistent_Void
{ {
@ -45,16 +44,14 @@ public:
typedef _void::Instance<TDataXtd_Plane> Plane; typedef _void::Instance<TDataXtd_Plane> Plane;
typedef _void::Instance<TDataXtd_Placement> Placement; typedef _void::Instance<TDataXtd_Placement> Placement;
class Geometry : public StdObjMgt_Attribute<TDataXtd_Geometry>:: class Geometry : public StdObjMgt_Attribute<TDataXtd_Geometry>::SingleInt
Simple <Enum<TDataXtd_GeometryEnum> >
{ {
public: public:
//! Import transient attribuite from the persistent data. //! Import transient attribuite from the persistent data.
Standard_EXPORT virtual void ImportAttribute(); Standard_EXPORT virtual void ImportAttribute();
}; };
class Position : public StdObjMgt_Attribute<TDataXtd_Position>:: class Position : public StdObjMgt_Attribute<TDataXtd_Position>::Simple<gp_Pnt>
Simple <StdObject_gp::Object<gp_Pnt> >
{ {
public: public:
//! Import transient attribuite from the persistent data. //! Import transient attribuite from the persistent data.

@ -24,7 +24,7 @@
void StdPersistent_DataXtd_Constraint::Import void StdPersistent_DataXtd_Constraint::Import
(const Handle(TDataXtd_Constraint)& theAttribute) const (const Handle(TDataXtd_Constraint)& theAttribute) const
{ {
theAttribute->SetType (myType); theAttribute->SetType (static_cast<TDataXtd_ConstraintEnum> (myType));
theAttribute->Reversed (myIsReversed); theAttribute->Reversed (myIsReversed);
theAttribute->Inverted (myIsInverted); theAttribute->Inverted (myIsInverted);
theAttribute->Verified (myIsVerified); theAttribute->Verified (myIsVerified);

@ -19,7 +19,6 @@
#include <StdLPersistent_HArray1.hxx> #include <StdLPersistent_HArray1.hxx>
#include <TDataXtd_Constraint.hxx> #include <TDataXtd_Constraint.hxx>
#include <TDataXtd_ConstraintEnum.hxx>
class StdPersistent_DataXtd_Constraint class StdPersistent_DataXtd_Constraint
@ -37,13 +36,13 @@ public:
void Import (const Handle(TDataXtd_Constraint)& theAttribute) const; void Import (const Handle(TDataXtd_Constraint)& theAttribute) const;
private: private:
Enum<TDataXtd_ConstraintEnum> myType; Standard_Integer myType;
Reference<StdLPersistent_HArray1::Persistent> myGeometries; Handle(StdLPersistent_HArray1::Persistent) myGeometries;
Reference<> myValue; Handle(StdObjMgt_Persistent) myValue;
Value<Standard_Boolean> myIsReversed; Standard_Boolean myIsReversed;
Value<Standard_Boolean> myIsInverted; Standard_Boolean myIsInverted;
Value<Standard_Boolean> myIsVerified; Standard_Boolean myIsVerified;
Reference<> myPlane; Handle(StdObjMgt_Persistent) myPlane;
}; };
#endif #endif

@ -25,6 +25,10 @@
void StdPersistent_DataXtd_PatternStd::Import void StdPersistent_DataXtd_PatternStd::Import
(const Handle(TDataXtd_PatternStd)& theAttribute) const (const Handle(TDataXtd_PatternStd)& theAttribute) const
{ {
theAttribute->Signature (mySignature);
theAttribute->Axis1Reversed (myAxis1Reversed);
theAttribute->Axis2Reversed (myAxis2Reversed);
if (mySignature < 5) if (mySignature < 5)
{ {
theAttribute->Axis1 ( theAttribute->Axis1 (

@ -35,16 +35,16 @@ public:
void Import (const Handle(TDataXtd_PatternStd)& theAttribute) const; void Import (const Handle(TDataXtd_PatternStd)& theAttribute) const;
private: private:
Value<Standard_Integer> mySignature; Standard_Integer mySignature;
Value<Standard_Boolean> myAxis1Reversed; Standard_Boolean myAxis1Reversed;
Value<Standard_Boolean> myAxis2Reversed; Standard_Boolean myAxis2Reversed;
Reference<> myAxis1; Handle(StdObjMgt_Persistent) myAxis1;
Reference<> myAxis2; Handle(StdObjMgt_Persistent) myAxis2;
Reference<> myValue1; Handle(StdObjMgt_Persistent) myValue1;
Reference<> myValue2; Handle(StdObjMgt_Persistent) myValue2;
Reference<> myNb1; Handle(StdObjMgt_Persistent) myNb1;
Reference<> myNb2; Handle(StdObjMgt_Persistent) myNb2;
Reference<> myMirror; Handle(StdObjMgt_Persistent) myMirror;
}; };
#endif #endif

@ -1,22 +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.
#include <StdPersistent_HArray1.hxx>
#include <StdObjMgt_ReadData.hxx>
void StdPersistent_HArray1::Shape1::readValue (StdObjMgt_ReadData& theReadData,
const Standard_Integer theIndex)
{
theReadData.ReadObject (myArray->ChangeValue (theIndex));
}

@ -16,17 +16,19 @@
#define _StdPersistent_HArray1_HeaderFile #define _StdPersistent_HArray1_HeaderFile
#include <StdLPersistent_HArray1.hxx> #include <StdLPersistent_HArray1.hxx>
#include <StdPersistent_HArray1OfShape1.hxx> #include <StdObject_Shape.hxx>
#include <NCollection_DefineHArray1.hxx>
DEFINE_HARRAY1 (StdPersistent_HArray1OfShape1,
NCollection_Array1<StdObject_Shape>)
class StdPersistent_HArray1 : private StdLPersistent_HArray1 class StdPersistent_HArray1 : private StdLPersistent_HArray1
{ {
public: public:
class Shape1 : public StdLPersistent_HArray1::base<StdPersistent_HArray1OfShape1> typedef instance<StdPersistent_HArray1OfShape1> Shape1;
{
virtual void readValue (StdObjMgt_ReadData& theReadData,
const Standard_Integer theIndex);
};
}; };
#endif #endif

@ -1,23 +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 _StdPersistent_HArray1OfShape1_HeaderFile
#define _StdPersistent_HArray1OfShape1_HeaderFile
#include <NCollection_DefineHArray1.hxx>
#include <StdObject_Shape.hxx>
DEFINE_HARRAY1 (StdPersistent_HArray1OfShape1, NCollection_Array1<StdObject_Shape>)
#endif // _StdPersistent_HArray1OfShape1_HeaderFile

@ -68,8 +68,8 @@ void StdPersistent_Naming::Name::Read (StdObjMgt_ReadData& theReadData)
void StdPersistent_Naming::Name::Import void StdPersistent_Naming::Name::Import
(TNaming_Name& theName, const Handle(TDF_Data)&) const (TNaming_Name& theName, const Handle(TDF_Data)&) const
{ {
theName.Type (myType); theName.Type (static_cast<TNaming_NameType> (myType));
theName.ShapeType (myShapeType); theName.ShapeType (static_cast<TopAbs_ShapeEnum> (myShapeType));
if (myArgs) if (myArgs)
{ {
@ -134,7 +134,7 @@ void StdPersistent_Naming::Name_2::Import
(TNaming_Name& theName, const Handle(TDF_Data)& theDF) const (TNaming_Name& theName, const Handle(TDF_Data)& theDF) const
{ {
Name_1::Import (theName, theDF); Name_1::Import (theName, theDF);
theName.Orientation (myOrientation); theName.Orientation (static_cast<TopAbs_Orientation> (myOrientation));
} }
//======================================================================= //=======================================================================
@ -143,8 +143,8 @@ void StdPersistent_Naming::Name_2::Import
//======================================================================= //=======================================================================
void StdPersistent_Naming::Naming::ImportAttribute() void StdPersistent_Naming::Naming::ImportAttribute()
{ {
Handle(Name) aName; Handle(Name) aName = Handle(Name)::DownCast (myData);
if (myData.Cast (aName)) if (aName)
{ {
aName->Import (myTransient->ChangeName(), myTransient->Label().Data()); aName->Import (myTransient->ChangeName(), myTransient->Label().Data());
myData.Nullify(); myData.Nullify();

@ -21,11 +21,6 @@
#include <StdLPersistent_HArray1.hxx> #include <StdLPersistent_HArray1.hxx>
#include <StdLPersistent_HString.hxx> #include <StdLPersistent_HString.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopAbs_Orientation.hxx>
#include <TNaming_NameType.hxx>
#include <TNaming_NamedShape.hxx> #include <TNaming_NamedShape.hxx>
#include <TNaming_Naming.hxx> #include <TNaming_Naming.hxx>
@ -46,10 +41,10 @@ public:
void Import (const Handle(TNaming_NamedShape)& theAttribute) const; void Import (const Handle(TNaming_NamedShape)& theAttribute) const;
private: private:
Reference <StdPersistent_HArray1::Shape1> myOldShapes; Handle(StdPersistent_HArray1::Shape1) myOldShapes;
Reference <StdPersistent_HArray1::Shape1> myNewShapes; Handle(StdPersistent_HArray1::Shape1) myNewShapes;
Value <Standard_Integer> myShapeStatus; Standard_Integer myShapeStatus;
Value <Standard_Integer> myVersion; Standard_Integer myVersion;
}; };
class Name : public StdObjMgt_Persistent class Name : public StdObjMgt_Persistent
@ -63,11 +58,11 @@ public:
(TNaming_Name& theName, const Handle(TDF_Data)& theDF) const; (TNaming_Name& theName, const Handle(TDF_Data)& theDF) const;
private: private:
Enum <TNaming_NameType> myType; Standard_Integer myType;
Enum <TopAbs_ShapeEnum> myShapeType; Standard_Integer myShapeType;
Reference <StdLPersistent_HArray1::Persistent> myArgs; Handle(StdLPersistent_HArray1::Persistent) myArgs;
Reference<> myStop; Handle(StdObjMgt_Persistent) myStop;
Value <Standard_Integer> myIndex; Standard_Integer myIndex;
}; };
class Name_1 : public Name class Name_1 : public Name
@ -81,7 +76,7 @@ public:
(TNaming_Name& theName, const Handle(TDF_Data)& theDF) const; (TNaming_Name& theName, const Handle(TDF_Data)& theDF) const;
private: private:
Reference<StdLPersistent_HString::Ascii> myContextLabel; Handle(StdLPersistent_HString::Ascii) myContextLabel;
}; };
class Name_2 : public Name_1 class Name_2 : public Name_1
@ -95,7 +90,7 @@ public:
(TNaming_Name& theName, const Handle(TDF_Data)& theDF) const; (TNaming_Name& theName, const Handle(TDF_Data)& theDF) const;
private: private:
Enum<TopAbs_Orientation> myOrientation; Standard_Integer myOrientation;
}; };
class Naming : public StdObjMgt_Attribute<TNaming_Naming>::SingleRef class Naming : public StdObjMgt_Attribute<TNaming_Naming>::SingleRef

@ -37,12 +37,12 @@ public:
void Import (const Handle(TDataXtd_Presentation)& theAttribute) const; void Import (const Handle(TDataXtd_Presentation)& theAttribute) const;
private: private:
Value<Standard_Boolean> myIsDisplayed; Standard_Boolean myIsDisplayed;
Reference<> myDriverGUID; Handle(StdObjMgt_Persistent) myDriverGUID;
Value<Standard_Real> myTransparency; Standard_Real myTransparency;
Value<Standard_Integer> myColor; Standard_Integer myColor;
Value<Standard_Integer> myMaterial; Standard_Integer myMaterial;
Value<Standard_Real> myWidth; Standard_Real myWidth;
}; };
class AISPresentation_1 : public AISPresentation class AISPresentation_1 : public AISPresentation
@ -59,7 +59,7 @@ public:
void Import (const Handle(TDataXtd_Presentation)& theAttribute) const; void Import (const Handle(TDataXtd_Presentation)& theAttribute) const;
private: private:
Value<Standard_Integer> myMode; Standard_Integer myMode;
}; };
}; };

@ -13,9 +13,7 @@
#include <StdPersistent_TopLoc.hxx> #include <StdPersistent_TopLoc.hxx>
#include <StdObjMgt_ReadData.hxx> #include <StdObjMgt_ReadData.hxx>
#include <StdObject_gp.hxx> #include <StdObject_gp_Trsfs.hxx>
#include <gp_Trsf.hxx>
//======================================================================= //=======================================================================
@ -24,7 +22,7 @@
//======================================================================= //=======================================================================
void StdPersistent_TopLoc::Datum3D::Read (StdObjMgt_ReadData& theReadData) void StdPersistent_TopLoc::Datum3D::Read (StdObjMgt_ReadData& theReadData)
{ {
StdObject_gp::Object<gp_Trsf> aTrsf; gp_Trsf aTrsf;
theReadData >> aTrsf; theReadData >> aTrsf;
myTransient = new TopLoc_Datum3D (aTrsf); myTransient = new TopLoc_Datum3D (aTrsf);
} }

@ -43,9 +43,9 @@ public:
Standard_EXPORT TopLoc_Location Import() const; Standard_EXPORT TopLoc_Location Import() const;
private: private:
Reference<Datum3D> myDatum; Handle(Datum3D) myDatum;
Value<Standard_Integer> myPower; Standard_Integer myPower;
Object<StdObject_Location> myNext; StdObject_Location myNext;
}; };
}; };

@ -24,15 +24,15 @@
class StdPersistent_TopoDS : protected StdObjMgt_SharedObject class StdPersistent_TopoDS : protected StdObjMgt_SharedObject
{ {
protected: protected:
class pTShape : public PersistentBase class pTShape : public Standard_Transient
{ {
public: public:
inline void Read (StdObjMgt_ReadData& theReadData) inline void Read (StdObjMgt_ReadData& theReadData)
{ theReadData >> myShapes >> myFlags; } { theReadData >> myShapes >> myFlags; }
protected: protected:
Reference<> myShapes; Handle(StdObjMgt_Persistent) myShapes;
Value<Standard_Integer> myFlags; Standard_Integer myFlags;
}; };
public: public:

@ -1,4 +1,3 @@
StdLDrivers StdLDrivers
StdLObject
StdLPersistent StdLPersistent
StdObjMgt StdObjMgt

333
tests/caf/bugs/D2 Normal file

@ -0,0 +1,333 @@
puts "==========="
puts "0027241: Create a complete test case to verify reading of all attribute types from MDTV-Standard document"
puts "==========="
puts ""
# Set Create_Doc to 1 to generate the document (using OCCT 6.9.1 or earlier)
set Create_Doc 0
set test_file_name bug27241_ocaf_all_attributes.std
set test_name "OCC26961"
set test_int 123
set test_real 123.456e-7
set test_int_arr {10 20}
set test_real_arr {1.1 3.14 5.4e18}
set test_extstr_arr {"sample string 1" "string 2"}
set test_bool_arr {0 1}
set test_ref_arr {"0:1:2:3:2" "0:1:2:3:1"}
set test_byte_arr {15 25}
set test_map {1 5 2 10}
set test_map_sorted {1 2 5 10}
set test_named_ints {i1 1 i2 2}
set test_named_reals {r1 1.1 r2 2.2}
set test_named_strings {s1 string1 s2 string2}
set test_named_bytes {b1 65 b2 66}
set test_ref "0:1:1"
set test_guid "00000000-0000-0000-2222-000000000000"
set test_comment "Sample document containing various attributes"
set test_string "Sample string"
set test_expr "2*pi*r"
set test_var1 "0:1:2:3:2"
set test_var2 "0:1:2:3:1"
set test_point "111 222 333"
set test_axisPos "10 10 30"
set test_axisDir "11 22 33"
set test_plane "15 25 35"
set test_boxXYZ "10 20 30"
set test_boxDX 100
set test_boxDY 200
set test_boxDZ 300
set test_geom_t "cir"
set test_failure 1
set test_driver "G"
set test_driver_id "2a96b604-ec8b-11d0-bee7-080009dc3333"
set test_transp 0.5
set test_color 11
set test_material 22
set test_positionX 100
set test_positionY 200
set test_positionZ 300
proc checkarray {name array expected} {
set exp_len [llength $expected]
if {$exp_len != [llength $array]} {puts "Error: invalid $name"; return}
for {set i 0} {$i < $exp_len} {incr i} {
if {[lindex $array $i] != [lindex $expected $i]} {puts "Error: invalid $name"}
}
}
pload TOPTEST
catch {Close D}
# Normal test execution
if !$Create_Doc {
# Load document
Open [locate_data_file $test_file_name] D
# Simple values
if [catch {GetInteger D 0:1:1 i}] {puts "Error: Integer not found"
} elseif {[dval i] != $test_int} {puts "Error: invalid Integer"}
if [catch {GetReal D 0:1:1 r}] {puts "Error: Real not found"
} elseif {[dval r] != $test_real} {puts "Error: invalid Real"}
if [catch {set name [GetName D 0:1:1]}] {puts "Error: Name not found"
} elseif {$name != $test_name} {puts "Error: invalid Name"}
if [catch {set comment [GetComment D 0:1:1]}] {puts "Error: Comment not found"
} elseif {$comment != $test_comment} {puts "Error: invalid Comment"}
if [catch {set string [GetAsciiString D 0:1:1]}] {puts "Error: AsciiString not found"}
# TagSource
if [catch {NewTag D 0:1:2}] {puts "Error: TagSource not found"}
# Reference
if [catch {set ref [GetReference D 0:1:3]}] {puts "Error: Reference not found"
} elseif {[string compare $ref $test_ref] != 0} {puts "Error: invalid Reference"}
# Directory
if [catch {AddDirectory D 0:1:2:1}] {puts "Error: Directory not found"}
# UAttribute
if [catch {set guid [GetUAttribute D 0:1:2:2 $test_guid]}] {puts "Error: no label for UAttribute"
} elseif {$guid == "No UAttribute Attribute on label"} {puts "Error: $guid"
} elseif {$guid != $test_guid} {puts "Error: invalid UAttribute"}
# Variable
if [regexp "no such attribute" [GetVariable D $test_var2 is_const units]] {puts "Error: Variable not found"
} elseif {$is_const != 0 || $units != "mm"} {puts "Error: invalid Variable"}
# Relation
if [catch {set rel_dump [DumpRelation D 0:1:2:3]}] {puts "Error: Relation not found"
} elseif ![regexp "$test_expr.*$test_var1 $test_var2" $rel_dump] {
puts "Error: invalid Relation"}
# TreeNode
if [catch {set root_node [RootNode D 0:1:2:4]}] {puts "Error: TreeNode not found"
} elseif {$root_node != "0:1:2:4"} {puts "Error: invalid TreeNode"}
# Arrays
if [catch {set iarr [GetIntArray D 0:1:1]}] {puts "Error: IntegerArray not found"
} else { checkarray "IntegerArray" $iarr $test_int_arr }
if [catch {set rarr [GetRealArray D 0:1:1]}] {puts "Error: RealArray not found"
} else { checkarray "RealArray" $rarr $test_real_arr }
if [catch {set esarr [GetExtStringArray D 0:1:1]}] {puts "Error: ExtStringArray not found"
} else { checkarray "ExtStringArray" $esarr [join $test_extstr_arr " "]}
if [catch {set boolarr [GetBooleanArray D 0:1:1]}] {puts "Error: BooleanArray not found"
} else { checkarray "BooleanArray" $boolarr $test_bool_arr }
if [catch {set refarr [GetRefArray D 0:1:1]}] {puts "Error: ReferenceArray not found"
} else { checkarray "ReferenceArray" $refarr $test_ref_arr }
if [catch {set bytearr [GetByteArray D 0:1:1]}] {puts "Error: ByteArray not found"
} else { checkarray "ByteArray" $bytearr $test_byte_arr }
# Lists
if [catch {set ilst [GetIntegerList D 0:1:1]}] {puts "Error: IntegerList not found"
} else { checkarray "IntegerList" $ilst $test_int_arr }
if [catch {set rlst [GetRealList D 0:1:1]}] {puts "Error: RealList not found"
} else { checkarray "RealList" $rlst $test_real_arr }
if [catch {set eslst [GetExtStringList D 0:1:1]}] {puts "Error: ExtStringList not found"
} else { checkarray "ExtStringList" $eslst [join $test_extstr_arr " "]}
if [catch {set blst [GetBooleanList D 0:1:1]}] {puts "Error: BooleanList not found"
} else { checkarray "BooleanList" $blst $test_bool_arr }
if [catch {set reflst [GetReferenceList D 0:1:1]}] {puts "Error: ReferenceList not found"
} else { checkarray "ReferenceList" $reflst $test_ref_arr }
# IntPackedMap
if [catch {set map [GetIntPackedMap D 0:1:1]}] {puts "Error: IntPackedMap not found"
} else { checkarray "IntPackedMap" $map $test_map_sorted }
# NamedData
if [catch {GetNDIntegers D 0:1:4}] {puts "Error: NamedData not found"}
if [catch {GetNDReals D 0:1:4}] {puts "Error: NamedData not found"}
if [catch {GetNDStrings D 0:1:4}] {puts "Error: NamedData not found"}
if [catch {GetNDBytes D 0:1:4}] {puts "Error: NamedData not found"}
if [catch {GetNDIntArrays D 0:1:4}] {puts "Error: NamedData not found"}
if [catch {GetNDRealArrays D 0:1:4}] {puts "Error: NamedData not found"}
# NamedShape
eval box Box $test_boxXYZ $test_boxDX $test_boxDY $test_boxDZ
if [catch {GetShape D 0:1:6 b}] {puts "Error: NamedShape not found"
} elseif {[bounding b] != [bounding Box]} {puts "Error: invalid NamedShape"
} else {
checkshape b
checkprops b -l [expr $test_boxDX * 8 + $test_boxDY * 8 + $test_boxDZ * 8]
checkprops b -s [expr $test_boxDX * $test_boxDY * 2 + $test_boxDY * $test_boxDZ * 2 + $test_boxDX * $test_boxDZ * 2]
checkprops b -v [expr $test_boxDX * $test_boxDY * $test_boxDZ]
}
# Point, Axis, Plane
if [catch {GetPoint D 0:1:5:1 pnt}] {puts "Error: Point not found"}
if [catch {GetAxis D 0:1:5:2 axs}] {puts "Error: Axis not found"}
if [catch {GetPlane D 0:1:5:3 pln}] {puts "Error: Plane not found"}
# Geometry
if [catch {set geom_t [GetGeometryType D 0:1:6]}] {puts "Error: Geometry not found"
} elseif {$geom_t != $test_geom_t} { puts "Error: invalid Geometry" }
# Constraint
if [catch {set constraint [GetConstraint D 0:1:1]}] {puts "Error: Constraint not found"
} elseif {$constraint != "0:1:1 COINCIDENT G_1 (0:1:6) "} { puts "Error: invalid Constraint" }
# PatternStd
if [catch {set pattern [DumpPattern D 0:1:1]}] {puts "Error: PatternStd not found"
} elseif {$pattern != "0:1:1 signature = 5 Mirror (0:1:6)"} { puts "Error: invalid PatternStd" }
# Function
if [catch {GetFunction D 0:1:1 fguid failure}] {puts "Error: Function not found"
} elseif {$fguid != $test_guid || $failure != $test_failure} { puts "Error: invalid Function" }
# AISPresentation
AISInitViewer D
if [catch {set driver [AISDriver D 0:1:1]}] {puts "Error: AISPresentation not found"
} elseif [catch {set transp [AISTransparency D 0:1:1]}] {puts "Error: AISPresentation not found"
} elseif [catch {set color [AISColor D 0:1:1]}] {puts "Error: AISPresentation not found"
} elseif [catch {set material [AISMaterial D 0:1:1]}] {puts "Error: AISPresentation not found"
} elseif {$driver != $test_driver_id} { puts "Error: invalid AISPresentation"
} elseif {[lindex [split $transp "\n"] 1] != $test_transp} { puts "Error: invalid AISPresentation"
} elseif {[lindex [split $color "\n"] 1] != $test_color} { puts "Error: invalid AISPresentation"
} elseif {[lindex [split $material "\n"] 1] != $test_material} { puts "Error: invalid AISPresentation" }
# Position
if [catch {GetPosition D 0:1:1 posX posY posZ}] {puts "Error: Position not found"
} elseif {$posX != $test_positionX} { puts "Error: invalid Position"
} elseif {$posY != $test_positionY} { puts "Error: invalid Position"
} elseif {$posZ != $test_positionZ} { puts "Error: invalid Position" }
} else {
# Creation of the document to be used in normal execution.
# Note! This will work only on OCCT versions older than 7.0,
# as since 7.0 there is no more storage driver for old persistence.
puts "Creating document"
NewDocument D MDTV-Standard
# Simple values
SetInteger D 0:1:1 $test_int
SetReal D 0:1:1 $test_real
SetName D 0:1:1 $test_name
SetComment D 0:1:1 $test_comment
SetAsciiString D 0:1:1 $test_string
# TagSource
SetTagger D 0:1:2
# Reference
SetReference D 0:1:3 $test_ref
# Directory
NewDirectory D 0:1:2:1
# UAttribute
SetUAttribute D 0:1:2:2 $test_guid
# Variable
SetVariable D $test_var2 0 mm
SetVariable D $test_var1 1 ""
# Relation
SetRelation D 0:1:2:3 "2*pi*r" $test_var1 $test_var2
# TreeNode
SetNode D 0:1:2:4
# Arrays
eval SetIntArray D 0:1:1 1 1 2 $test_int_arr
eval SetRealArray D 0:1:1 1 1 3 $test_real_arr
eval SetExtStringArray D 0:1:1 1 1 2 $test_extstr_arr
eval SetBooleanArray D 0:1:1 1 1 2 $test_bool_arr
eval SetRefArray D 0:1:1 1 2 $test_ref_arr
eval SetByteArray D 0:1:1 1 1 2 $test_byte_arr
# Lists
eval SetIntegerList D 0:1:1 $test_int_arr
eval SetRealList D 0:1:1 $test_real_arr
eval SetExtStringList D 0:1:1 $test_extstr_arr
eval SetBooleanList D 0:1:1 $test_bool_arr
eval SetReferenceList D 0:1:1 $test_ref_arr
# IntPackedMap
eval SetIntPackedMap D 0:1:1 1 $test_map
# NamedData
eval SetNDataIntegers D 0:1:4 2 $test_named_ints
eval SetNDataReals D 0:1:4 2 $test_named_reals
eval SetNDataStrings D 0:1:4 2 $test_named_strings
eval SetNDataBytes D 0:1:4 2 $test_named_bytes
eval SetNDataIntArrays D 0:1:4 ia 2 $test_int_arr
eval SetNDataRealArrays D 0:1:4 ra 3 $test_real_arr
# NamedShape
eval box Box $test_boxXYZ $test_boxDX $test_boxDY $test_boxDZ
SetShape D 0:1:6 Box
# Point
eval point Point $test_point
SetPoint D 0:1:5:1 Point
# Axis
eval line Axis $test_axisPos $test_axisDir
SetAxis D 0:1:5:2 Axis
# Plane
eval plane Plane $test_plane
SetPlane D 0:1:5:3 Plane
# Geometry
SetGeometry D 0:1:6 $test_geom_t
# Constraint
SetConstraint D 0:1:1 equal 0:1:6
# PatternStd
SetPattern D 0:1:1 5 0:1:6
# Function
SetFunction D 0:1:1 $test_guid $test_failure
# AISPresentation
AISInitViewer D
AISSet D 0:1:1 $test_driver
AISTransparency D 0:1:1 $test_transp
AISColor D 0:1:1 $test_color
AISMaterial D 0:1:1 $test_material
# Position
SetPosition D 0:1:1 $test_positionX $test_positionY $test_positionZ
SaveAs D $imagedir/ocaf_all_attributes.std
puts "Document saved to $imagedir/$test_file_name"
}

@ -1,5 +1,6 @@
SKIPPED /Tcl Exception: .*[fF]ile .* could not be found/ data file is missing SKIPPED /Tcl Exception: .*[fF]ile .* could not be found/ data file is missing
IGNORE /Tcl Exception: [*][*] Exception [*][*]/ duplicate report on exception on Tcl level IGNORE /Tcl Exception: [*][*] Exception [*][*]/ duplicate report on exception on Tcl level
IGNORE /Relative error of mass computation :/ diagnostic message of *props* commands
FAILED /\b[Ee]xception\b/ exception FAILED /\b[Ee]xception\b/ exception
FAILED /\b[Ee][Rr][Rr][Oo][Rr]\b/ error FAILED /\b[Ee][Rr][Rr][Oo][Rr]\b/ error
FAILED /Process killed by CPU limit/ Killed by CPU limit FAILED /Process killed by CPU limit/ Killed by CPU limit