From: szv Date: Tue, 20 Sep 2016 10:31:26 +0000 (+0300) Subject: Transfer packages cleaned X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=a71d5ed3917dcc5c50741d7880389c8cc07ed8bc;p=occt-copy.git Transfer packages cleaned --- diff --git a/src/BRepToIGES/BRepToIGES_BREntity.cxx b/src/BRepToIGES/BRepToIGES_BREntity.cxx index bc53a4690d..56d9d01317 100644 --- a/src/BRepToIGES/BRepToIGES_BREntity.cxx +++ b/src/BRepToIGES/BRepToIGES_BREntity.cxx @@ -42,11 +42,9 @@ #include #include #include -#include -#include +//szv_c1:#include #include -//#include char Name[100]; //======================================================================= @@ -236,8 +234,9 @@ void BRepToIGES_BREntity::AddFail (const Handle(Standard_Transient)& start, const Standard_CString amess) { - Handle(Transfer_TransientMapper) Mapper = new Transfer_TransientMapper(start); - TheMap->AddFail(Mapper, amess); + /*szv_c1:Handle(Transfer_TransientMapper) Mapper = new Transfer_TransientMapper(start); + TheMap->AddFail(Mapper, amess);*/ + TheMap->AddFail(start, amess); } @@ -250,8 +249,9 @@ void BRepToIGES_BREntity::AddWarning (const Handle(Standard_Transient)& start, const Standard_CString amess) { - Handle(Transfer_TransientMapper) Mapper = new Transfer_TransientMapper(start); - TheMap->AddWarning(Mapper, amess); + /*szv_c1:Handle(Transfer_TransientMapper) Mapper = new Transfer_TransientMapper(start); + TheMap->AddWarning(Mapper, amess);*/ + TheMap->AddWarning(start, amess); } @@ -312,8 +312,9 @@ void BRepToIGES_BREntity::SetShapeResult Standard_Boolean BRepToIGES_BREntity::HasShapeResult (const Handle(Standard_Transient)& start) const { - Handle(Transfer_TransientMapper) Mapper = new Transfer_TransientMapper(start); - DeclareAndCast(Transfer_SimpleBinderOfTransient, binder, TheMap->Find(Mapper)); + /*szv_c1:Handle(Transfer_TransientMapper) Mapper = new Transfer_TransientMapper(start); + DeclareAndCast(Transfer_SimpleBinderOfTransient, binder, TheMap->Find(Mapper));*/ + DeclareAndCast(Transfer_SimpleBinderOfTransient, binder, TheMap->Find(start)); if (binder.IsNull()) return Standard_False; return binder->HasResult(); } @@ -329,8 +330,9 @@ Handle(Standard_Transient) BRepToIGES_BREntity::GetShapeResult { Handle(Standard_Transient) res; - Handle(Transfer_TransientMapper) Mapper = new Transfer_TransientMapper(start); - DeclareAndCast(Transfer_SimpleBinderOfTransient, binder, TheMap->Find(Mapper)); + /*szv_c1:Handle(Transfer_TransientMapper) Mapper = new Transfer_TransientMapper(start); + DeclareAndCast(Transfer_SimpleBinderOfTransient, binder, TheMap->Find(Mapper));*/ + DeclareAndCast(Transfer_SimpleBinderOfTransient, binder, TheMap->Find(start)); if (binder.IsNull()) return res; if (binder->HasResult()) res = binder->Result(); @@ -347,9 +349,10 @@ void BRepToIGES_BREntity::SetShapeResult ( const Handle(Standard_Transient)& start, const Handle(Standard_Transient)& result) { - Handle(Transfer_TransientMapper) Mapper = new Transfer_TransientMapper(start); Handle(Transfer_SimpleBinderOfTransient) binder = new Transfer_SimpleBinderOfTransient; - TheMap->Bind(Mapper,binder); + /*szv_c1:Handle(Transfer_TransientMapper) Mapper = new Transfer_TransientMapper(start); + TheMap->Bind(Mapper,binder);*/ + TheMap->Bind(start,binder); binder->SetResult(result); } diff --git a/src/BRepToIGESBRep/BRepToIGESBRep_Entity.cxx b/src/BRepToIGESBRep/BRepToIGESBRep_Entity.cxx index c95525f2e5..ee1f382a18 100644 --- a/src/BRepToIGESBRep/BRepToIGESBRep_Entity.cxx +++ b/src/BRepToIGESBRep/BRepToIGESBRep_Entity.cxx @@ -102,15 +102,8 @@ #include #include #include -#include -#include -#include #include -//#include -//#include -//#include -//#include //======================================================================= //function : BRepToIGESBRep_Entity //purpose : diff --git a/src/IGESCAFControl/IGESCAFControl_Writer.cxx b/src/IGESCAFControl/IGESCAFControl_Writer.cxx index 65aa2b97c0..ad3f723625 100644 --- a/src/IGESCAFControl/IGESCAFControl_Writer.cxx +++ b/src/IGESCAFControl/IGESCAFControl_Writer.cxx @@ -330,13 +330,12 @@ void IGESCAFControl_Writer::MakeColors (const TopoDS_Shape &S, Handle(Transfer_Binder) bnd = FP->Find ( mapper ); if ( ! bnd.IsNull() ) { Handle(Transfer_TransientListBinder) TransientListBinder = - //Handle(Transfer_TransientListBinder)::DownCast( bnd->Next(Standard_True) ); Handle(Transfer_TransientListBinder)::DownCast( bnd ); Standard_Integer i=0, nb=0; if (! TransientListBinder.IsNull() ) { - nb = TransientListBinder->NbTransients(); + nb = TransientListBinder->Result().Length(); for (i=1; i<=nb; i++) { - Handle(Standard_Transient) t = TransientListBinder->Transient(i); + const Handle(Standard_Transient) &t = TransientListBinder->Result().Value(i); ent = Handle(IGESData_IGESEntity)::DownCast(t); if (!ent.IsNull()) { @@ -350,15 +349,6 @@ void IGESCAFControl_Writer::MakeColors (const TopoDS_Shape &S, } } } - /* // alternative: consider recursive mapping S -> compound -> entities - else { - TopoDS_Shape comp = TransferBRep::ShapeResult(bnd); - if ( ! comp.IsNull() && comp.ShapeType() < S.ShapeType() ) - for ( TopoDS_Iterator it(comp); it.More(); it.Next() ) { - MakeColors ( it.Value(), settings, colors, Map, style ); - } - } - */ } } } diff --git a/src/IGESControl/IGESControl_ActorWrite.cxx b/src/IGESControl/IGESControl_ActorWrite.cxx index 4708b0614a..b918c5c257 100644 --- a/src/IGESControl/IGESControl_ActorWrite.cxx +++ b/src/IGESControl/IGESControl_ActorWrite.cxx @@ -27,88 +27,82 @@ #include #include #include -#include -#include +//szv_c1:#include #include #include #include IMPLEMENT_STANDARD_RTTIEXT(IGESControl_ActorWrite,Transfer_ActorOfFinderProcess) -IGESControl_ActorWrite::IGESControl_ActorWrite () { ModeTrans() = 0; } - -Standard_Boolean IGESControl_ActorWrite::Recognize - (const Handle(Transfer_Finder)& start) +Standard_Boolean IGESControl_ActorWrite::Recognize (const Handle(Standard_Transient)& start) { DeclareAndCast(TransferBRep_ShapeMapper,shmap,start); if (!shmap.IsNull()) return Standard_True; - DeclareAndCast(Transfer_TransientMapper,gemap,start); + /*szv_c1:DeclareAndCast(Transfer_TransientMapper,gemap,start); if (!gemap.IsNull()) { Handle(Standard_Transient) geom = gemap->Value(); DeclareAndCast(Geom_Curve,Curve,geom); - DeclareAndCast(Geom_Surface,Surf,geom); + DeclareAndCast(Geom_Surface,Surf,geom);*/ + DeclareAndCast(Geom_Curve,Curve,start); + DeclareAndCast(Geom_Surface,Surf,start); if (!Curve.IsNull() || !Surf.IsNull()) return Standard_True; - } + //szv_c1:} return Standard_False; } -Handle(Transfer_Binder) IGESControl_ActorWrite::Transfer - (const Handle(Transfer_Finder)& start, - const Handle(Transfer_FinderProcess)& FP) +Handle(Transfer_Binder) IGESControl_ActorWrite::Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_ProcessForFinder)& TP) { XSAlgo::AlgoContainer()->PrepareForTransfer(); - DeclareAndCast(IGESData_IGESModel,modl,FP->Model()); - if (modl.IsNull()) return NullResult(); - if (themodetrans < 0 || themodetrans > 1) return NullResult(); + DeclareAndCast(IGESData_IGESModel,modl,TP->Model()); + if (modl.IsNull()) return NULL; + if (themodetrans < 0 || themodetrans > 1) return NULL; Handle(Standard_Transient) ent; DeclareAndCast(TransferBRep_ShapeMapper,shmap,start); if (!shmap.IsNull()) { - TopoDS_Shape shape = shmap->Value(); - if (shape.IsNull()) return NullResult(); -// modified by NIZHNY-EAP Tue Aug 29 11:16:54 2000 ___BEGIN___ + TopoDS_Shape shape = shmap->Shape(); + if (shape.IsNull()) return NULL; Handle(Standard_Transient) info; Standard_Real Tol = Interface_Static::RVal("write.precision.val"); Standard_Real maxTol = Interface_Static::RVal("read.maxprecision.val"); shape = XSAlgo::AlgoContainer()->ProcessShape( shape, Tol, maxTol, "write.iges.resource.name", "write.iges.sequence", info, - FP->GetProgress() ); -// modified by NIZHNY-EAP Tue Aug 29 11:17:01 2000 ___END___ + TP->GetProgress() ); + + Handle(Transfer_FinderProcess) FP = Handle(Transfer_FinderProcess)::DownCast(TP); BRepToIGES_BREntity BR0; BR0.SetModel(modl); BR0.SetTransferProcess(FP); BRepToIGESBRep_Entity BR1; BR1.SetModel(modl); BR1.SetTransferProcess(FP); if (themodetrans == 0) ent = BR0.TransferShape(shape); if (themodetrans == 1) ent = BR1.TransferShape(shape); -// modified by NIZHNY-EAP Tue Aug 29 11:37:18 2000 ___BEGIN___ XSAlgo::AlgoContainer()->MergeTransferInfo(FP, info); -// modified by NIZHNY-EAP Tue Aug 29 11:37:25 2000 ___END___ - if (!ent.IsNull()) return TransientResult(ent); + if (!ent.IsNull()) return new Transfer_SimpleBinderOfTransient(ent); } - DeclareAndCast(Transfer_TransientMapper,gemap,start); + /*szv_c1:DeclareAndCast(Transfer_TransientMapper,gemap,start); if (!gemap.IsNull()) { Handle(Standard_Transient) geom = gemap->Value(); DeclareAndCast(Geom_Curve,Curve,geom); - DeclareAndCast(Geom_Surface,Surf,geom); + DeclareAndCast(Geom_Surface,Surf,geom);*/ + DeclareAndCast(Geom_Curve,Curve,start); + DeclareAndCast(Geom_Surface,Surf,start); // On reconnait : Curve et Surface de Geom // quid de Point; Geom2d ? -// GeomToIGES_GeomPoint GP; GeomToIGES_GeomCurve GC; GC.SetModel(modl); GeomToIGES_GeomSurface GS; GS.SetModel(modl); if (!Curve.IsNull()) - ent = GC.TransferCurve(Curve,Curve->FirstParameter(),Curve->LastParameter()) -; + ent = GC.TransferCurve(Curve,Curve->FirstParameter(),Curve->LastParameter()); else if (!Surf.IsNull()) { Standard_Real U1,U2,V1,V2; Surf->Bounds(U1,U2,V1,V2); ent = GS.TransferSurface(Surf,U1,U2,V1,V2); } - if (!ent.IsNull()) return TransientResult(ent); - } + if (!ent.IsNull()) return new Transfer_SimpleBinderOfTransient(ent); + //szv_c1:} - return NullResult(); + return NULL; } diff --git a/src/IGESControl/IGESControl_ActorWrite.hxx b/src/IGESControl/IGESControl_ActorWrite.hxx index cabe728247..10b8b4faa6 100644 --- a/src/IGESControl/IGESControl_ActorWrite.hxx +++ b/src/IGESControl/IGESControl_ActorWrite.hxx @@ -17,15 +17,7 @@ #ifndef _IGESControl_ActorWrite_HeaderFile #define _IGESControl_ActorWrite_HeaderFile -#include -#include - #include -#include -class Transfer_Finder; -class Transfer_Binder; -class Transfer_FinderProcess; - class IGESControl_ActorWrite; DEFINE_STANDARD_HANDLE(IGESControl_ActorWrite, Transfer_ActorOfFinderProcess) @@ -33,42 +25,20 @@ DEFINE_STANDARD_HANDLE(IGESControl_ActorWrite, Transfer_ActorOfFinderProcess) //! Actor to write Shape to IGES class IGESControl_ActorWrite : public Transfer_ActorOfFinderProcess { - -public: - + public: - Standard_EXPORT IGESControl_ActorWrite(); + IGESControl_ActorWrite() {} //! Recognizes a ShapeMapper - Standard_EXPORT virtual Standard_Boolean Recognize (const Handle(Transfer_Finder)& start) Standard_OVERRIDE; + Standard_EXPORT virtual Standard_Boolean Recognize (const Handle(Standard_Transient)& start) Standard_OVERRIDE; //! Transfers Shape to IGES Entities //! //! ModeTrans may be : 0 -> groups of Faces //! or 1 -> BRep - Standard_EXPORT virtual Handle(Transfer_Binder) Transfer (const Handle(Transfer_Finder)& start, const Handle(Transfer_FinderProcess)& FP) Standard_OVERRIDE; - - - + Standard_EXPORT virtual Handle(Transfer_Binder) Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_ProcessForFinder)& FP) Standard_OVERRIDE; DEFINE_STANDARD_RTTIEXT(IGESControl_ActorWrite,Transfer_ActorOfFinderProcess) - -protected: - - - - -private: - - - - }; - - - - - - #endif // _IGESControl_ActorWrite_HeaderFile diff --git a/src/IGESControl/IGESControl_Controller.cxx b/src/IGESControl/IGESControl_Controller.cxx index e9a04f2360..190334441f 100644 --- a/src/IGESControl/IGESControl_Controller.cxx +++ b/src/IGESControl/IGESControl_Controller.cxx @@ -333,22 +333,6 @@ Handle(Transfer_ActorOfTransientProcess) IGESControl_Controller::ActorRead (cons return myAdaptorRead; } -// #### TRANSFERT (ECRITURE SHAPE) #### -// modetrans : 0 <5.1 (groupe de faces), 1 BREP-5.1 - -//======================================================================= -//function : TransferWriteShape -//purpose : -//======================================================================= - -IFSelect_ReturnStatus IGESControl_Controller::TransferWriteShape (const TopoDS_Shape& shape, - const Handle(Transfer_FinderProcess)& FP, - const Handle(Interface_InterfaceModel)& model, - const Standard_Integer modetrans) const -{ - return XSControl_Controller::TransferWriteShape (shape,FP,model,modetrans); -} - //======================================================================= //function : Init //purpose : diff --git a/src/IGESControl/IGESControl_Controller.hxx b/src/IGESControl/IGESControl_Controller.hxx index 7a8472906f..9c2924d5c6 100644 --- a/src/IGESControl/IGESControl_Controller.hxx +++ b/src/IGESControl/IGESControl_Controller.hxx @@ -24,8 +24,6 @@ #include #include #include -class Interface_InterfaceModel; -class Transfer_ActorOfTransientProcess; class TopoDS_Shape; class Transfer_FinderProcess; class XSControl_WorkSession; @@ -37,9 +35,7 @@ DEFINE_STANDARD_HANDLE(IGESControl_Controller, XSControl_Controller) //! Controller for IGES-5.1 class IGESControl_Controller : public XSControl_Controller { - -public: - + public: //! Initializes the use of IGES Norm (the first time) and returns //! a Controller for IGES-5.1 @@ -55,15 +51,6 @@ public: //! Unit, tolerances Standard_EXPORT Handle(Transfer_ActorOfTransientProcess) ActorRead (const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE; - //! Takes one Shape and transfers it to the InterfaceModel - //! (already created by NewModel for instance) - //! is to be interpreted by each kind of XstepAdaptor - //! Returns a status : 0 OK 1 No result 2 Fail -1 bad modeshape - //! -2 bad model (requires an IGESModel) - //! modeshape : 0 groupe of face (version < 5.1) - //! 1 BREP-version 5.1 of IGES - Standard_EXPORT virtual IFSelect_ReturnStatus TransferWriteShape (const TopoDS_Shape& shape, const Handle(Transfer_FinderProcess)& FP, const Handle(Interface_InterfaceModel)& model, const Standard_Integer modetrans = 0) const Standard_OVERRIDE; - //! Standard Initialisation. It creates a Controller for IGES and //! records it to various names, available to select it later //! Returns True when done, False if could not be done @@ -72,28 +59,11 @@ public: Standard_EXPORT virtual void Customise (Handle(XSControl_WorkSession)& WS) Standard_OVERRIDE; - - - DEFINE_STANDARD_RTTIEXT(IGESControl_Controller,XSControl_Controller) -protected: - - - - -private: - + private: Standard_Boolean themode; - - }; - - - - - - #endif // _IGESControl_Controller_HeaderFile diff --git a/src/IGESControl/IGESControl_Reader.cxx b/src/IGESControl/IGESControl_Reader.cxx index cc2237b94e..35e134940c 100644 --- a/src/IGESControl/IGESControl_Reader.cxx +++ b/src/IGESControl/IGESControl_Reader.cxx @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include @@ -52,7 +51,6 @@ #include // S3767 dce 18/01/1999 -//Transfer_Iterator.hxx> // add of stdio.h for NT compilation //======================================================================= //function : IGESControl_Reader @@ -149,7 +147,6 @@ void IGESControl_Reader::PrintTransferInfo if (! model.IsNull()) { nbEntities = model->NbEntities(); nbRoots = TP->NbRoots(); - //nbResults = TP->NbMapped(); Transfer_IteratorOfProcessForTransient iterTrans = TP->RootResult(Standard_True); Handle(Dico_DictionaryOfInteger) dicoCountResult = new Dico_DictionaryOfInteger; Handle(Dico_DictionaryOfInteger) dicoCountMapping = new Dico_DictionaryOfInteger; @@ -169,7 +166,7 @@ void IGESControl_Reader::PrintTransferInfo else if ( mode == IFSelect_Mapping ) { char mess[300]; const Handle(Transfer_Binder) aBinder = iterTrans.Value(); - DeclareAndCast(IGESData_IGESEntity,igesEnt,iterTrans.Starting()); + DeclareAndCast(IGESData_IGESEntity,igesEnt,iterTrans.SourceObject()); sprintf(mess,"%d\t%d\t%s\t%s", igesEnt->TypeNumber(), igesEnt->FormNumber(), "%d", aBinder->ResultTypeName()); diff --git a/src/IGESControl/IGESControl_Reader.hxx b/src/IGESControl/IGESControl_Reader.hxx index 8914615936..8e53561b74 100644 --- a/src/IGESControl/IGESControl_Reader.hxx +++ b/src/IGESControl/IGESControl_Reader.hxx @@ -45,9 +45,6 @@ class IGESData_IGESModel; //! To check a loading file use method Check: //! reader.Check(failsonly); where failsonly is equal to Standard_True or //! Standard_False; -//! To print the results of load: -//! reader.PrintCheckLoad(failsonly,mode) where mode is equal to the value of -//! enumeration IFSelect_PrintCount //! To transfer entities from a model the following methods can be used: //! for the whole model //! reader.TransferRoots(onlyvisible); where onlyvisible is equal to diff --git a/src/IGESToBRep/IGESToBRep.hxx b/src/IGESToBRep/IGESToBRep.hxx index 15e464bc57..d67733b469 100644 --- a/src/IGESToBRep/IGESToBRep.hxx +++ b/src/IGESToBRep/IGESToBRep.hxx @@ -18,7 +18,6 @@ #define _IGESToBRep_HeaderFile #include -#include #include #include @@ -29,28 +28,16 @@ class IGESData_IGESEntity; class TopoDS_Shape; class TopoDS_Edge; class TopoDS_Face; -class IGESToBRep_CurveAndSurface; -class IGESToBRep_BasicSurface; -class IGESToBRep_BasicCurve; -class IGESToBRep_TopoSurface; -class IGESToBRep_TopoCurve; class IGESToBRep_BRepEntity; -class IGESToBRep_IGESBoundary; -class IGESToBRep_Reader; -class IGESToBRep_Actor; class IGESToBRep_AlgoContainer; -class IGESToBRep_ToolContainer; //! Provides tools in order to transfer IGES entities //! to CAS.CADE. class IGESToBRep { -public: + public: - DEFINE_STANDARD_ALLOC - - //! Creates and initializes default AlgoContainer. Standard_EXPORT static void Init(); @@ -104,39 +91,6 @@ public: Standard_EXPORT static Standard_Integer IGESCurveToSequenceOfIGESCurve (const Handle(IGESData_IGESEntity)& curve, Handle(TColStd_HSequenceOfTransient)& sequence); Standard_EXPORT static Standard_Boolean TransferPCurve (const TopoDS_Edge& fromedge, const TopoDS_Edge& toedge, const TopoDS_Face& face); - - - - -protected: - - - - - -private: - - - - -friend class IGESToBRep_CurveAndSurface; -friend class IGESToBRep_BasicSurface; -friend class IGESToBRep_BasicCurve; -friend class IGESToBRep_TopoSurface; -friend class IGESToBRep_TopoCurve; -friend class IGESToBRep_BRepEntity; -friend class IGESToBRep_IGESBoundary; -friend class IGESToBRep_Reader; -friend class IGESToBRep_Actor; -friend class IGESToBRep_AlgoContainer; -friend class IGESToBRep_ToolContainer; - }; - - - - - - #endif // _IGESToBRep_HeaderFile diff --git a/src/IGESToBRep/IGESToBRep_Actor.cxx b/src/IGESToBRep/IGESToBRep_Actor.cxx index 8e791ca840..3677afe5b8 100644 --- a/src/IGESToBRep/IGESToBRep_Actor.cxx +++ b/src/IGESToBRep/IGESToBRep_Actor.cxx @@ -27,8 +27,6 @@ #include #include #include -#include -#include #include #include #include @@ -39,50 +37,23 @@ IMPLEMENT_STANDARD_RTTIEXT(IGESToBRep_Actor,Transfer_ActorOfTransientProcess) -//======================================================================= -//function : IGESToBRep_Actor -//purpose : -//======================================================================= -IGESToBRep_Actor::IGESToBRep_Actor () -{ thecontinuity = 0; theeps = 0.0001; } - - //======================================================================= //function : SetModel //purpose : //======================================================================= + void IGESToBRep_Actor::SetModel (const Handle(Interface_InterfaceModel)& model) { themodel = model; theeps = Handle(IGESData_IGESModel)::DownCast(themodel)->GlobalSection().Resolution(); } - -//======================================================================= -//function : SetContinuity -//purpose : -//======================================================================= -void IGESToBRep_Actor::SetContinuity (const Standard_Integer continuity) -{ - thecontinuity = continuity; -} - - -//======================================================================= -//function : GetContinuity -//purpose : -//======================================================================= -Standard_Integer IGESToBRep_Actor::GetContinuity () const -{ - return thecontinuity; -} - //======================================================================= //function : Recognize //purpose : //======================================================================= -Standard_Boolean IGESToBRep_Actor::Recognize -(const Handle(Standard_Transient)& start) + +Standard_Boolean IGESToBRep_Actor::Recognize (const Handle(Standard_Transient)& start) { DeclareAndCast(IGESData_IGESModel,mymodel,themodel); DeclareAndCast(IGESData_IGESEntity,ent,start); @@ -100,12 +71,13 @@ Standard_Boolean IGESToBRep_Actor::Recognize // Cas restants : non reconnus return Standard_False; } + //======================================================================= //function : EncodeRegul //purpose : INTERNAL to encode regularity on edges //======================================================================= -static Standard_Boolean EncodeRegul (const TopoDS_Shape& sh) +static Standard_Boolean EncodeRegul (const TopoDS_Shape& sh) { Standard_Real tolang = Interface_Static::RVal("read.encoderegularity.angle"); if (sh.IsNull()) return Standard_True; @@ -119,14 +91,14 @@ static Standard_Boolean EncodeRegul (const TopoDS_Shape& sh) } return Standard_True; } + //======================================================================= //function : TrimTolerances //purpose : Trims tolerances of the shape according to static parameters // //======================================================================= -static void TrimTolerances (const TopoDS_Shape& shape, - const Standard_Real tol) +static void TrimTolerances (const TopoDS_Shape& shape, const Standard_Real tol) { if( Interface_Static::IVal("read.maxprecision.mode")==1) { ShapeFix_ShapeTolerance SFST; @@ -134,24 +106,24 @@ static void TrimTolerances (const TopoDS_Shape& shape, } } - - //======================================================================= -//function : Transfer +//function : Transferring //purpose : //======================================================================= -Handle(Transfer_Binder) IGESToBRep_Actor::Transfer -(const Handle(Standard_Transient)& start, const Handle(Transfer_TransientProcess)& TP) + +Handle(Transfer_Binder) IGESToBRep_Actor::Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_ProcessForTransient)& PT) { DeclareAndCast(IGESData_IGESModel,mymodel,themodel); DeclareAndCast(IGESData_IGESEntity,ent,start); - if (mymodel.IsNull() || ent.IsNull()) return NullResult(); + if (mymodel.IsNull() || ent.IsNull()) return NULL; Standard_Integer anum = mymodel->Number(start); if (Interface_Static::IVal("read.iges.faulty.entities") == 0 && mymodel->IsErrorEntity(anum)) - return NullResult(); + return NULL; TopoDS_Shape shape; + Handle(Transfer_TransientProcess) TP = Handle(Transfer_TransientProcess)::DownCast(PT); + // appeler le transfert seulement si type OK Standard_Integer typnum = ent->TypeNumber(); Standard_Integer fornum = ent->FormNumber(); @@ -174,7 +146,6 @@ Handle(Transfer_Binder) IGESToBRep_Actor::Transfer eps = mymodel->GlobalSection().Resolution(); else eps = Interface_Static::RVal("read.precision.val"); //:10 ABV 11 Nov 97 -//:10 eps = BRepAPI::Precision(); Ival = Interface_Static::IVal("read.iges.bspline.approxd1.mode"); CAS.SetModeApprox ( (Ival > 0) ); Ival = Interface_Static::IVal("read.surfacecurve.mode"); @@ -183,7 +154,6 @@ Handle(Transfer_Binder) IGESToBRep_Actor::Transfer if (eps > 1.E-08) { CAS.SetEpsGeom(eps); theeps = eps*CAS.GetUnitFactor(); -// Interface_Static::SetRVal("lastpreci",theeps); } Standard_Integer nbTPitems = TP->NbMapped(); { @@ -212,16 +182,11 @@ Handle(Transfer_Binder) IGESToBRep_Actor::Transfer if (SBE.ShapeType(shape,Standard_True) != TopAbs_SHAPE) { if (!shape.IsNull()) { EncodeRegul (shape); - //#74 rln 03.03.99 S4135 TrimTolerances (shape, UsedTolerance()); - // Shapes().Append(shape); } } + Handle(TransferBRep_ShapeBinder) binder; if (!shape.IsNull()) binder = new TransferBRep_ShapeBinder(shape); return binder; } - - - Standard_Real IGESToBRep_Actor::UsedTolerance () const - { return theeps; } diff --git a/src/IGESToBRep/IGESToBRep_Actor.hxx b/src/IGESToBRep/IGESToBRep_Actor.hxx index d2c4d6d5dd..57c57c3438 100644 --- a/src/IGESToBRep/IGESToBRep_Actor.hxx +++ b/src/IGESToBRep/IGESToBRep_Actor.hxx @@ -17,18 +17,7 @@ #ifndef _IGESToBRep_Actor_HeaderFile #define _IGESToBRep_Actor_HeaderFile -#include -#include - -#include -#include #include -#include -class Interface_InterfaceModel; -class Standard_Transient; -class Transfer_Binder; -class Transfer_TransientProcess; - class IGESToBRep_Actor; DEFINE_STANDARD_HANDLE(IGESToBRep_Actor, Transfer_ActorOfTransientProcess) @@ -40,54 +29,34 @@ DEFINE_STANDARD_HANDLE(IGESToBRep_Actor, Transfer_ActorOfTransientProcess) //! then returns the Binder which contains the Result class IGESToBRep_Actor : public Transfer_ActorOfTransientProcess { + public: -public: - + IGESToBRep_Actor() : thecontinuity (0), theeps (0.0001) {} - Standard_EXPORT IGESToBRep_Actor(); + Standard_EXPORT virtual Standard_Boolean Recognize (const Handle(Standard_Transient)& start) Standard_OVERRIDE; + + Standard_EXPORT virtual Handle(Transfer_Binder) Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_ProcessForTransient)& TP) Standard_OVERRIDE; Standard_EXPORT void SetModel (const Handle(Interface_InterfaceModel)& model); //! ---Purpose By default continuity = 0 //! if continuity = 1 : try C1 //! if continuity = 2 : try C2 - Standard_EXPORT void SetContinuity (const Standard_Integer continuity = 0); - - //! Return "thecontinuity" - Standard_EXPORT Standard_Integer GetContinuity() const; + void SetContinuity (const Standard_Integer continuity = 0) { thecontinuity = continuity; } - Standard_EXPORT virtual Standard_Boolean Recognize (const Handle(Standard_Transient)& start) Standard_OVERRIDE; - - Standard_EXPORT virtual Handle(Transfer_Binder) Transfer (const Handle(Standard_Transient)& start, const Handle(Transfer_TransientProcess)& TP) Standard_OVERRIDE; + Standard_Integer GetContinuity() const { return thecontinuity; } //! Returns the tolerance which was actually used, either from //! the file or from statics - Standard_EXPORT Standard_Real UsedTolerance() const; - - - + Standard_Real UsedTolerance() const { return theeps; } DEFINE_STANDARD_RTTIEXT(IGESToBRep_Actor,Transfer_ActorOfTransientProcess) -protected: - - - - -private: - + private: Handle(Interface_InterfaceModel) themodel; Standard_Integer thecontinuity; Standard_Real theeps; - - }; - - - - - - #endif // _IGESToBRep_Actor_HeaderFile diff --git a/src/IGESToBRep/IGESToBRep_CurveAndSurface.cxx b/src/IGESToBRep/IGESToBRep_CurveAndSurface.cxx index 28d115c52d..9c5a985688 100644 --- a/src/IGESToBRep/IGESToBRep_CurveAndSurface.cxx +++ b/src/IGESToBRep/IGESToBRep_CurveAndSurface.cxx @@ -605,11 +605,8 @@ void IGESToBRep_CurveAndSurface::SetShapeResult Standard_Integer IGESToBRep_CurveAndSurface::NbShapeResult (const Handle(IGESData_IGESEntity)& start) const { - Standard_Integer nbres = 0; DeclareAndCast(TransferBRep_ShapeListBinder,binder,myTP->Find(start)); - if (binder.IsNull()) return nbres; - nbres = binder->NbShapes(); - return nbres; + return (binder.IsNull()? 0 : binder->Result().Length()); } @@ -621,14 +618,9 @@ Standard_Integer IGESToBRep_CurveAndSurface::NbShapeResult TopoDS_Shape IGESToBRep_CurveAndSurface::GetShapeResult (const Handle(IGESData_IGESEntity)& start, const Standard_Integer num) const { - TopoDS_Shape res; - DeclareAndCast(TransferBRep_ShapeListBinder,binder,myTP->Find(start)); - if (binder.IsNull()) return res; - - if (num <= binder->NbShapes()) - res = binder->Shape(num); - return res; + if (binder.IsNull()) return TopoDS_Shape(); + return (num >= 1 && num <= binder->Result().Length())? binder->Result().Value(num) : TopoDS_Shape(); } diff --git a/src/IGESToBRep/IGESToBRep_Reader.cxx b/src/IGESToBRep/IGESToBRep_Reader.cxx index 755669c568..d696544b7a 100644 --- a/src/IGESToBRep/IGESToBRep_Reader.cxx +++ b/src/IGESToBRep/IGESToBRep_Reader.cxx @@ -52,7 +52,6 @@ #include #include #include -#include #include #include #include @@ -377,15 +376,12 @@ void IGESToBRep_Reader::TransferRoots (const Standard_Boolean onlyvisible) theShapes.Clear(); Standard_Integer level = theProc->TraceLevel(); - theProc->SetErrorHandle(Standard_True); theProc->SetRootManagement(Standard_True); -// PrepareTransfer(); -> protocol, actor theActor->SetModel(theModel); Standard_Integer continuity = Interface_Static::IVal("read.iges.bspline.continuity"); theActor->SetContinuity (continuity); theProc->SetModel (theModel); theProc->SetActor (theActor); - Transfer_TransferOutput TP (theProc,theModel); const Handle(Interface_Protocol) aProtocol = protocol; // to avoid ambiguity Interface_ShareFlags SH (theModel, aProtocol); @@ -428,7 +424,10 @@ void IGESToBRep_Reader::TransferRoots (const Standard_Boolean onlyvisible) theDone = Standard_True; try { OCC_CATCH_SIGNALS - TP.Transfer(ent); + // Check if the entity belongs to the model + if (theModel->Number(ent) == 0) + continue; + theProc->Transfer (ent); shape = TransferBRep::ShapeResult (theProc,ent); } catch(Standard_Failure) { diff --git a/src/Interface/FILES b/src/Interface/FILES index ca32e3abdb..8b06bd2a9e 100755 --- a/src/Interface/FILES +++ b/src/Interface/FILES @@ -103,7 +103,6 @@ Interface_STAT.hxx Interface_Static.cxx Interface_Static.hxx Interface_Statics.hxx -Interface_StaticSatisfies.hxx Interface_StaticStandards.cxx Interface_Translates.hxx Interface_TypedValue.cxx diff --git a/src/Interface/Interface_Static.cxx b/src/Interface/Interface_Static.cxx index 0c21f8dc56..c3640c9cb5 100644 --- a/src/Interface/Interface_Static.cxx +++ b/src/Interface/Interface_Static.cxx @@ -31,27 +31,12 @@ static char defmess[31]; // Fonctions Satisfies offertes en standard ... -//svv #2 -//static Standard_Boolean StaticPath(const Handle(TCollection_HAsciiString)& val) -//{ -// OSD_Path apath; -// return apath.IsValid (TCollection_AsciiString(val->ToCString())); -//} - - - Interface_Static::Interface_Static - (const Standard_CString family, const Standard_CString name, - const Interface_ParamType type, const Standard_CString init) - : Interface_TypedValue (name,type,init) , - thefamily (family) , - theupdate (Standard_True) { } - - Interface_Static::Interface_Static +Interface_Static::Interface_Static (const Standard_CString family, const Standard_CString name, const Handle(Interface_Static)& other) - : Interface_TypedValue (name, other->Type(), "") , - thefamily (family) , - theupdate (Standard_True) +: Interface_TypedValue (name, other->Type(), ""), + thefamily (family) , + theupdate (Standard_True) { switch (Type()) { case Interface_ParamInteger : { @@ -71,9 +56,8 @@ static char defmess[31]; Standard_Boolean match; Standard_Integer e0,e1,i; other->EnumDef (e0,e1,match); StartEnum (e0,match); -// if (e1 >= e0) theenums = new TColStd_HArray1OfAsciiString(e0,e1); for (i = e0; i <= e1; i ++) - AddEnum (other->EnumVal(i)); + AddEnum (other->EnumVal(i)); } break; case Interface_ParamIdent : @@ -95,46 +79,8 @@ void Interface_Static::PrintStatic (const Handle(Message_Messenger)& S) const if (!thewild.IsNull()) S<<" -- Attached to wild-card : "<Name()< #include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include #include +#include +#include class Dico_DictionaryOfInteger; class TCollection_HAsciiString; -class Standard_Transient; class Interface_InterfaceError; class Message_Messenger; - class Interface_Static; DEFINE_STANDARD_HANDLE(Interface_Static, Interface_TypedValue) @@ -67,9 +58,7 @@ DEFINE_STANDARD_HANDLE(Interface_Static, Interface_TypedValue) //! dictionary class Interface_Static : public Interface_TypedValue { - -public: - + public: //! Creates and records a Static, with a family and a name //! family can report to a name of ressource or to a system or @@ -82,7 +71,11 @@ public: //! //! init gives an initial value. If it is not given, the Static //! begin as "not set", its value is empty - Standard_EXPORT Interface_Static(const Standard_CString family, const Standard_CString name, const Interface_ParamType type = Interface_ParamText, const Standard_CString init = ""); + Interface_Static(const Standard_CString family, const Standard_CString name, const Interface_ParamType type = Interface_ParamText, const Standard_CString init = "") + : Interface_TypedValue (name,type,init), + thefamily (family) , + theupdate (Standard_True) + {} //! Creates a new Static with same definition as another one //! (value is copied, except for Entity : it remains null) @@ -101,22 +94,22 @@ public: //! Returns the family. It can be : a resource name for applis, //! an internal name between : $e (environment variables), //! $l (other, purely local) - Standard_EXPORT Standard_CString Family() const; - + Standard_CString Family() const { return thefamily.ToCString(); } + //! Sets a "wild-card" static : its value will be considered //! if is not properly set. (reset by set a null one) - Standard_EXPORT void SetWild (const Handle(Interface_Static)& wildcard); - + void SetWild (const Handle(Interface_Static)& wildcard) { thewild = wildcard; } + //! Returns the wildcard static, which can be (is most often) null - Standard_EXPORT Handle(Interface_Static) Wild() const; - + const Handle(Interface_Static) & Wild() const { return thewild; } + //! Records a Static has "uptodate", i.e. its value has been taken //! into account by a reinitialisation procedure //! This flag is reset at each successful SetValue - Standard_EXPORT void SetUptodate(); - + void SetUptodate() { theupdate = Standard_True; } + //! Returns the status "uptodate" - Standard_EXPORT Standard_Boolean UpdatedStatus() const; + Standard_Boolean UpdatedStatus() const { return theupdate; } //! Declares a new Static (by calling its constructor) //! If this name is already taken, does nothing and returns False @@ -258,18 +251,9 @@ public: //! must be defined around it Standard_EXPORT static void Standards(); - - - DEFINE_STANDARD_RTTIEXT(Interface_Static,Interface_TypedValue) -protected: - - - - -private: - + private: TCollection_AsciiString thefamily; TCollection_AsciiString thename; @@ -285,20 +269,10 @@ private: TCollection_AsciiString theunidef; Handle(TColStd_HArray1OfAsciiString) theenums; Handle(Dico_DictionaryOfInteger) theeadds; - Interface_StaticSatisfies thesatisf; - TCollection_AsciiString thesatisn; Standard_Boolean theupdate; Standard_Integer theival; Handle(TCollection_HAsciiString) thehval; Handle(Standard_Transient) theoval; - - }; - - - - - - #endif // _Interface_Static_HeaderFile diff --git a/src/Interface/Interface_StaticSatisfies.hxx b/src/Interface/Interface_StaticSatisfies.hxx deleted file mode 100644 index 5423943c5b..0000000000 --- a/src/Interface/Interface_StaticSatisfies.hxx +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) 1999-2014 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 _Interface_StaticSatisfies_HeaderFile -#define _Interface_StaticSatisfies_HeaderFile - -#include - -typedef Standard_Boolean (*Interface_StaticSatisfies) (const Handle(TCollection_HAsciiString)& val); - -#endif diff --git a/src/Interface/Interface_StaticStandards.cxx b/src/Interface/Interface_StaticStandards.cxx index 3229e183c9..6ead732265 100644 --- a/src/Interface/Interface_StaticStandards.cxx +++ b/src/Interface/Interface_StaticStandards.cxx @@ -81,14 +81,8 @@ void Interface_Static::Standards () Interface_Static::Init("XSTEP" ,"write.surfacecurve.mode", '&',"ematch 0"); Interface_Static::Init("XSTEP" ,"write.surfacecurve.mode", '&',"eval Off"); Interface_Static::Init("XSTEP" ,"write.surfacecurve.mode", '&',"eval On"); -// Interface_Static::Init("XSTEP" ,"write.surfacecurve.mode", '&',"eval NoAnalytic"); Interface_Static::SetIVal ("write.surfacecurve.mode",1); -// lastpreci : pour recuperer la derniere valeur codee (cf XSControl) -// (0 pour dire : pas codee) -//:S4136 Interface_Static::Init("std" ,"lastpreci", 'r',"0."); - - // **** MESSAGERIE DE BASE **** // Chargement "manuel" au cas ou les fichiers, env, etc sont KO diff --git a/src/STEPCAFControl/STEPCAFControl_ActorWrite.cxx b/src/STEPCAFControl/STEPCAFControl_ActorWrite.cxx index 3cc5205d0a..32e7e4a0bc 100644 --- a/src/STEPCAFControl/STEPCAFControl_ActorWrite.cxx +++ b/src/STEPCAFControl/STEPCAFControl_ActorWrite.cxx @@ -14,41 +14,11 @@ // commercial license or contractual agreement. -#include #include #include IMPLEMENT_STANDARD_RTTIEXT(STEPCAFControl_ActorWrite,STEPControl_ActorWrite) -//======================================================================= -//function : STEPCAFControl_ActorWrite -//purpose : -//======================================================================= -STEPCAFControl_ActorWrite::STEPCAFControl_ActorWrite () : myStdMode(Standard_True) -{ -} - -//======================================================================= -//function : ClearMap -//purpose : -//======================================================================= - -void STEPCAFControl_ActorWrite::SetStdMode (const Standard_Boolean stdmode) -{ - myStdMode = stdmode; - if ( myStdMode ) ClearMap(); -} - -//======================================================================= -//function : ClearMap -//purpose : -//======================================================================= - -void STEPCAFControl_ActorWrite::ClearMap () -{ - myMap.Clear(); -} - //======================================================================= //function : RegisterAssembly //purpose : @@ -69,4 +39,3 @@ Standard_Boolean STEPCAFControl_ActorWrite::IsAssembly (TopoDS_Shape &S) const if ( myStdMode ) return STEPControl_ActorWrite::IsAssembly ( S ); return myMap.Contains ( S ); } - diff --git a/src/STEPCAFControl/STEPCAFControl_ActorWrite.hxx b/src/STEPCAFControl/STEPCAFControl_ActorWrite.hxx index c86837eb79..6269fe2e16 100644 --- a/src/STEPCAFControl/STEPCAFControl_ActorWrite.hxx +++ b/src/STEPCAFControl/STEPCAFControl_ActorWrite.hxx @@ -19,7 +19,6 @@ #include #include -#include #include #include class TopoDS_Shape; @@ -32,12 +31,10 @@ DEFINE_STANDARD_HANDLE(STEPCAFControl_ActorWrite, STEPControl_ActorWrite) //! whether shape is assembly (based on information from DECAF) class STEPCAFControl_ActorWrite : public STEPControl_ActorWrite { + public: -public: + STEPCAFControl_ActorWrite() : myStdMode(Standard_True) {} - - Standard_EXPORT STEPCAFControl_ActorWrite(); - //! Check whether shape S is assembly //! Returns True if shape is registered in assemblies map Standard_EXPORT virtual Standard_Boolean IsAssembly (TopoDS_Shape& S) const Standard_OVERRIDE; @@ -45,38 +42,25 @@ public: //! Set standard mode of work //! In standard mode Actor (default) behaves exactly as its //! ancestor, also map is cleared - Standard_EXPORT void SetStdMode (const Standard_Boolean stdmode = Standard_True); + void SetStdMode (const Standard_Boolean stdmode = Standard_True) + { + myStdMode = stdmode; + if ( myStdMode ) myMap.Clear(); + } //! Clears map of shapes registered as assemblies - Standard_EXPORT void ClearMap(); + void ClearMap() { myMap.Clear(); } //! Registers shape to be written as assembly //! The shape should be TopoDS_Compound (else does nothing) Standard_EXPORT void RegisterAssembly (const TopoDS_Shape& S); - - - DEFINE_STANDARD_RTTIEXT(STEPCAFControl_ActorWrite,STEPControl_ActorWrite) -protected: - - - - -private: - + private: Standard_Boolean myStdMode; TopTools_MapOfShape myMap; - - }; - - - - - - #endif // _STEPCAFControl_ActorWrite_HeaderFile diff --git a/src/STEPCAFControl/STEPCAFControl_Reader.cxx b/src/STEPCAFControl/STEPCAFControl_Reader.cxx index ab04efc4db..990c519970 100644 --- a/src/STEPCAFControl/STEPCAFControl_Reader.cxx +++ b/src/STEPCAFControl/STEPCAFControl_Reader.cxx @@ -1778,7 +1778,7 @@ void readAnnotation(const Handle(XSControl_TransferReader)& theTR, Handle(TCollection_HAsciiString) aPresentName; TopoDS_Compound aResAnnotation; Handle(Transfer_TransientProcess) aTP = theTR->TransientProcess(); - const Interface_Graph& aGraph = aTP->Graph(); + const Interface_Graph& aGraph = aTP->HGraph()->Graph(); // find the proper DraughtingModelItemAssociation Interface_EntityIterator subs = aGraph.Sharings(theGDT); Handle(StepAP242_DraughtingModelItemAssociation) aDMIA; @@ -1921,7 +1921,7 @@ void readAnnotation(const Handle(XSControl_TransferReader)& theTR, anAnnotationShape = STEPConstruct::FindShape (aTP,aCurveItem); if( anAnnotationShape.IsNull()) { - Handle(Transfer_Binder) binder = theTR->Actor()->Transfer(aCurveItem, aTP); + Handle(Transfer_Binder) binder = theTR->Actor()->Transferring(aCurveItem, aTP); if ( ! binder.IsNull() && binder->HasResult() ) { anAnnotationShape = TransferBRep::ShapeResult ( aTP, binder ); } @@ -2043,7 +2043,7 @@ void readConnectionPoints(const Handle(XSControl_TransferReader)& theTR, const Handle(XCAFDimTolObjects_DimensionObject)& theDimObject) { Handle(Transfer_TransientProcess) aTP = theTR->TransientProcess(); - const Interface_Graph& aGraph = aTP->Graph(); + const Interface_Graph& aGraph = aTP->HGraph()->Graph(); //calculate units Standard_Real aFact = 1; @@ -2213,7 +2213,7 @@ static Standard_Boolean setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat, Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool( theDoc->Main() ); const Handle(XSControl_TransferReader) &aTR = theWS->TransferReader(); const Handle(Transfer_TransientProcess) &aTP = aTR->TransientProcess(); - const Interface_Graph& aGraph = aTP->Graph(); + const Interface_Graph& aGraph = aTP->HGraph()->Graph(); Handle(XCAFDoc_Datum) aDat; TDF_Label aShL; Standard_Boolean aRefShapeIsFound = Standard_False; @@ -2446,7 +2446,7 @@ static Standard_Boolean readDatumsAP242(const Handle(Standard_Transient)& theEnt Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool( theDoc->Main() ); const Handle(XSControl_TransferReader) &aTR = theWS->TransferReader(); const Handle(Transfer_TransientProcess) &aTP = aTR->TransientProcess(); - const Interface_Graph& aGraph = aTP->Graph(); + const Interface_Graph& aGraph = aTP->HGraph()->Graph(); Interface_EntityIterator anIter = aGraph.Shareds(theEnt); for(anIter.Start(); anIter.More(); anIter.Next()) { @@ -2593,7 +2593,7 @@ static void collectShapeAspect(const Handle(StepRepr_ShapeAspect)& theSA, { Handle(XSControl_TransferReader) aTR = theWS->TransferReader(); Handle(Transfer_TransientProcess) aTP = aTR->TransientProcess(); - const Interface_Graph& aGraph = aTP->Graph(); + const Interface_Graph& aGraph = aTP->HGraph()->Graph(); // Retrieve Shape_Aspect, connected to Representation_Item from Derived_Shape_Aspect if (theSA->IsKind(STANDARD_TYPE(StepRepr_DerivedShapeAspect))) { Interface_EntityIterator anIter = aGraph.Sharings(theSA); @@ -2665,7 +2665,7 @@ static TDF_Label createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt, Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool( theDoc->Main() ); const Handle(XSControl_TransferReader) &aTR = theWS->TransferReader(); const Handle(Transfer_TransientProcess) &aTP = aTR->TransientProcess(); - const Interface_Graph& aGraph = aTP->Graph(); + const Interface_Graph& aGraph = aTP->HGraph()->Graph(); Standard_Boolean isAllAround = Standard_False; Standard_Boolean isAllOver = Standard_False; @@ -3055,7 +3055,7 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt, Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool( theDoc->Main() ); const Handle(XSControl_TransferReader) &aTR = theWS->TransferReader(); const Handle(Transfer_TransientProcess) &aTP = aTR->TransientProcess(); - const Interface_Graph& aGraph = aTP->Graph(); + const Interface_Graph& aGraph = aTP->HGraph()->Graph(); Handle(XCAFDimTolObjects_DimensionObject) aDimObj; if(!theEnt->IsKind(STANDARD_TYPE(StepShape_DimensionalSize)) && !theEnt->IsKind(STANDARD_TYPE(StepShape_DimensionalLocation))) @@ -3551,7 +3551,7 @@ static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt, Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool( theDoc->Main() ); const Handle(XSControl_TransferReader) &aTR = theWS->TransferReader(); const Handle(Transfer_TransientProcess) &aTP = aTR->TransientProcess(); - const Interface_Graph& aGraph = aTP->Graph(); + const Interface_Graph& aGraph = aTP->HGraph()->Graph(); Handle(XCAFDoc_GeomTolerance) aGTol; if(!theTolL.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGTol)) { @@ -3788,7 +3788,7 @@ Standard_Boolean STEPCAFControl_Reader::ReadMaterials(const Handle(XSControl_Wor Handle(XCAFDoc_MaterialTool) MatTool = XCAFDoc_DocumentTool::MaterialTool( Doc->Main() ); if(MatTool.IsNull()) return Standard_False; - const Interface_Graph& graph = TP->Graph(); + const Interface_Graph& graph = TP->HGraph()->Graph(); for(Standard_Integer i=1; i<=SeqPDS->Length(); i++) { Handle(StepRepr_ProductDefinitionShape) PDS = Handle(StepRepr_ProductDefinitionShape)::DownCast(SeqPDS->Value(i)); diff --git a/src/STEPCAFControl/STEPCAFControl_Writer.cxx b/src/STEPCAFControl/STEPCAFControl_Writer.cxx index 20c44fe5bc..75198b1edd 100644 --- a/src/STEPCAFControl/STEPCAFControl_Writer.cxx +++ b/src/STEPCAFControl/STEPCAFControl_Writer.cxx @@ -879,7 +879,6 @@ static Standard_Integer FindEntities (const Handle(Transfer_FinderProcess) &FP, if ( bnd.IsNull() ) return 0; Handle(Transfer_TransientListBinder) TransientListBinder = - //Handle(Transfer_TransientListBinder)::DownCast( bnd->Next(Standard_True) ); Handle(Transfer_TransientListBinder)::DownCast( bnd ); Standard_Integer nres=0; if ( TransientListBinder.IsNull() && S.ShapeType() == TopAbs_COMPOUND) @@ -893,9 +892,9 @@ static Standard_Integer FindEntities (const Handle(Transfer_FinderProcess) &FP, } else { - const Standard_Integer nb = TransientListBinder->NbTransients(); + const Standard_Integer nb = TransientListBinder->Result().Length(); for (Standard_Integer i=1; i<=nb; i++) { - Handle(Standard_Transient) t = TransientListBinder->Transient(i); + const Handle(Standard_Transient) &t = TransientListBinder->Result().Value(i); item = Handle(StepRepr_RepresentationItem)::DownCast(t); if ( item.IsNull() ) continue; nres++; diff --git a/src/STEPConstruct/STEPConstruct_Styles.cxx b/src/STEPConstruct/STEPConstruct_Styles.cxx index ad131f96c0..ea26dd8729 100644 --- a/src/STEPConstruct/STEPConstruct_Styles.cxx +++ b/src/STEPConstruct/STEPConstruct_Styles.cxx @@ -74,8 +74,6 @@ #include #include #include -#include -#include #include //======================================================================= diff --git a/src/STEPConstruct/STEPConstruct_ValidationProps.cxx b/src/STEPConstruct/STEPConstruct_ValidationProps.cxx index 6df3c0ab4e..8872dbcf77 100644 --- a/src/STEPConstruct/STEPConstruct_ValidationProps.cxx +++ b/src/STEPConstruct/STEPConstruct_ValidationProps.cxx @@ -63,8 +63,6 @@ #include #include #include -#include -#include #include //======================================================================= @@ -95,20 +93,6 @@ Standard_Boolean STEPConstruct_ValidationProps::Init (const Handle(XSControl_Wor return SetWS ( WS ); } -//======================================================================= -//function : TransientResult CORRECTED -//purpose : -//======================================================================= - -static Handle(Transfer_SimpleBinderOfTransient) TransientResult (const Handle(Standard_Transient)& res) -{ - Handle(Transfer_SimpleBinderOfTransient) binder; - if (res.IsNull()) return binder; - binder = new Transfer_SimpleBinderOfTransient; - binder->SetResult (res); - return binder; -} - //======================================================================= //function : FindTarget //purpose : @@ -291,7 +275,7 @@ Standard_Boolean STEPConstruct_ValidationProps::FindTarget (const TopoDS_Shape & SDR->Init ( RD, SR ); // record SHAPE_ASPECT in the map - binder->AddResult ( TransientResult ( aspect ) ); + binder->AddResult ( Transfer_SimpleBinderOfTransient::TransientResult ( aspect ) ); // add SDR and all the data into model Model()->AddWithRefs ( SDR ); diff --git a/src/STEPControl/STEPControl_ActorRead.cxx b/src/STEPControl/STEPControl_ActorRead.cxx index f056451192..f78a843356 100644 --- a/src/STEPControl/STEPControl_ActorRead.cxx +++ b/src/STEPControl/STEPControl_ActorRead.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -194,20 +195,12 @@ namespace { Standard_Boolean NM_DETECTED = Standard_False; } -// ============================================================================ -// Method : STEPControl_ActorRead::STEPControl_ActorRead () -// Purpose : Empty constructor -// ============================================================================ - -STEPControl_ActorRead::STEPControl_ActorRead() {} - // ============================================================================ // Method : STEPControl_ActorRead::Recognize // Purpose : tells if an entity is valid for transfer by this Actor // ============================================================================ -Standard_Boolean STEPControl_ActorRead::Recognize - (const Handle(Standard_Transient)& start) +Standard_Boolean STEPControl_ActorRead::Recognize (const Handle(Standard_Transient)& start) { if (start.IsNull()) return Standard_False; @@ -264,16 +257,13 @@ Standard_Boolean STEPControl_ActorRead::Recognize return Standard_False; } - // ============================================================================ -// Method : STEPControl_ActorRead::Transfer +// Method : Transferring // Purpose : recursive method that acces to the root entities and start the // mapping // ============================================================================ -Handle(Transfer_Binder) STEPControl_ActorRead::Transfer -(const Handle(Standard_Transient)& start, - const Handle(Transfer_TransientProcess)& TP) +Handle(Transfer_Binder) STEPControl_ActorRead::Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_ProcessForTransient)& TP) { // [BEGIN] Get version of preprocessor (to detect I-Deas case) (ssv; 23.11.2010) Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast ( TP->Model() ); @@ -297,7 +287,7 @@ Handle(Transfer_Binder) STEPControl_ActorRead::Transfer } } // [END] Get version of preprocessor (to detect I-Deas case) (ssv; 23.11.2010) - return TransferShape (start,TP); + return TransferShape (start,Handle(Transfer_TransientProcess)::DownCast(TP)); } @@ -320,7 +310,7 @@ static Handle(StepRepr_Representation) FindContext (const Handle(Standard_Transi const Standard_Integer level=10 ) { Handle(StepRepr_Representation) rep; - const Interface_Graph& graph = TP->Graph(); + const Interface_Graph& graph = TP->HGraph()->Graph(); Interface_EntityIterator subs = graph.Sharings(start); for (subs.Start(); subs.More() && rep.IsNull(); subs.Next()) { rep = Handle(StepRepr_Representation)::DownCast(subs.Value()); @@ -362,7 +352,7 @@ static void getListSDR(const Handle(StepRepr_ShapeAspect)& sa, Handle(TColStd_HSequenceOfTransient)& listSDR, const Handle(Transfer_TransientProcess)& TP) { - const Interface_Graph& graph = TP->Graph(); + const Interface_Graph& graph = TP->HGraph()->Graph(); // check whether this ShapeAspect is used in G&DT, and if yes, ignore it if(sa->IsKind(STANDARD_TYPE(StepDimTol_DatumFeature))) return; @@ -407,7 +397,7 @@ static void getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS, Standard_Integer nbSDR0 = listSDR->Length(); // Iterate by entities referring PDS - const Interface_Graph& graph = TP->Graph(); + const Interface_Graph& graph = TP->HGraph()->Graph(); Handle(StepShape_ShapeDefinitionRepresentation) NeedSDR; Interface_EntityIterator subs4 = graph.Sharings(PDS); for (subs4.Start(); subs4.More(); subs4.Next()) { @@ -480,7 +470,7 @@ static void getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS, Handle(TColStd_HSequenceOfTransient) listSDR = new TColStd_HSequenceOfTransient; Handle(TColStd_HSequenceOfTransient) listNAUO = new TColStd_HSequenceOfTransient; Handle(TColStd_HSequenceOfTransient) listSDRAspect = new TColStd_HSequenceOfTransient; - const Interface_Graph& graph = TP->Graph(); + const Interface_Graph& graph = TP->HGraph()->Graph(); Interface_EntityIterator subs3 = graph.Sharings(PD); for (subs3.Start(); subs3.More() ; subs3.Next()) { // PDS is used to find shape definitions attached to this product @@ -661,7 +651,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han { Handle(TransferBRep_ShapeBinder) shbinder; Handle(StepBasic_ProductDefinition) PD; - const Interface_Graph& graph = TP->Graph(); + const Interface_Graph& graph = TP->HGraph()->Graph(); gp_Trsf Trsf; Standard_Boolean iatrsf=Standard_False, SRRReversed=Standard_False, IsDepend=Standard_False; Handle(StepRepr_ShapeRepresentationRelationship) SRR; @@ -683,7 +673,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han Handle(StepRepr_Representation) rep = ( SRRReversed ? RR->Rep2() : RR->Rep1() ); iatrsf = ComputeSRRWT ( RR, TP, Trsf ); // find real ProductDefinition used rep - Interface_EntityIterator subs3 = TP->Graph().Sharings(rep); + Interface_EntityIterator subs3 = TP->HGraph()->Graph().Sharings(rep); for (subs3.Start(); subs3.More(); subs3.Next()) { if ( subs3.Value()->IsKind(STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation))) { DeclareAndCast(StepShape_ShapeDefinitionRepresentation,SDR,subs3.Value()); @@ -1017,7 +1007,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han Handle(StepShape_ShapeRepresentation) anitem = Handle(StepShape_ShapeRepresentation)::DownCast(anitemt); Handle(Transfer_Binder) binder; Standard_Boolean isBound = Standard_False; - if (!TP->IsBound(anitem)) binder = TransferEntity(anitem,TP,isBound);//TP->Transferring(anitem); + if (!TP->IsBound(anitem)) binder = TransferEntity(anitem,TP,isBound); else binder = TP->Find(anitem); TopoDS_Shape theResult = TransferBRep::ShapeResult (binder); if (!theResult.IsNull()) { @@ -1058,7 +1048,7 @@ static Standard_Boolean IsNeedRepresentation(const Handle(StepRepr_ShapeAspect)& { Standard_Boolean IsSDRaspect=Standard_True; Handle(StepRepr_ProductDefinitionShape) PDSA = sa->OfShape(); - const Interface_Graph& graph = TP->Graph(); + const Interface_Graph& graph = TP->HGraph()->Graph(); Interface_EntityIterator subs7 = graph.Sharings(PDSA); for (subs7.Start(); ! PDSA.IsNull() && subs7.More(); subs7.Next()) { Handle(StepShape_ShapeDefinitionRepresentation) sdrA = @@ -1096,7 +1086,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::OldWay(const Handle(Stan const Handle(Transfer_TransientProcess)& TP) { Handle(Message_Messenger) sout = TP->Messenger(); - const Interface_Graph& graph = TP->Graph(); + const Interface_Graph& graph = TP->HGraph()->Graph(); Handle(TransferBRep_ShapeBinder) shbinder; DeclareAndCast(StepShape_ShapeDefinitionRepresentation,sdr,start); Handle(StepRepr_Representation) rep = sdr->UsedRepresentation(); @@ -1119,7 +1109,6 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::OldWay(const Handle(Stan #endif Handle(Transfer_Binder) binder = TP->Find(rep); if (binder.IsNull()) binder = TP->Transferring(rep); -//:j2 if (!binder.IsNull()) return binder; // SDR designant des CDSR (lien implicite, via la UsedRepr) @@ -1429,7 +1418,7 @@ Handle(Transfer_Binder) STEPControl_ActorRead::TransferShape(const Handle(Standa const Handle(Transfer_TransientProcess)& TP, const Standard_Boolean isManifold) { - if (start.IsNull()) return NullResult(); + if (start.IsNull()) return NULL; XSAlgo::AlgoContainer()->PrepareForTransfer(); // myContext.SetModel ( Handle(StepData_StepModel)::DownCast ( TP->Model() ) ); // for asking IsAP203? diff --git a/src/STEPControl/STEPControl_ActorRead.hxx b/src/STEPControl/STEPControl_ActorRead.hxx index 1ea04b9049..2ac717cccf 100644 --- a/src/STEPControl/STEPControl_ActorRead.hxx +++ b/src/STEPControl/STEPControl_ActorRead.hxx @@ -20,16 +20,11 @@ #include #include -#include -#include #include -#include -#include #include #include +#include class StepRepr_Representation; -class Standard_Transient; -class Transfer_Binder; class Transfer_TransientProcess; class StepGeom_Axis2Placement3d; class gp_Trsf; @@ -57,15 +52,13 @@ DEFINE_STANDARD_HANDLE(STEPControl_ActorRead, Transfer_ActorOfTransientProcess) //! then returns the Binder which contains the Result class STEPControl_ActorRead : public Transfer_ActorOfTransientProcess { - -public: - + public: - Standard_EXPORT STEPControl_ActorRead(); + Standard_EXPORT STEPControl_ActorRead() {} Standard_EXPORT virtual Standard_Boolean Recognize (const Handle(Standard_Transient)& start) Standard_OVERRIDE; - Standard_EXPORT virtual Handle(Transfer_Binder) Transfer (const Handle(Standard_Transient)& start, const Handle(Transfer_TransientProcess)& TP) Standard_OVERRIDE; + Standard_EXPORT virtual Handle(Transfer_Binder) Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_ProcessForTransient)& TP) Standard_OVERRIDE; Standard_EXPORT Handle(Transfer_Binder) TransferShape (const Handle(Standard_Transient)& start, const Handle(Transfer_TransientProcess)& TP, const Standard_Boolean isManifold = Standard_True); @@ -86,13 +79,9 @@ public: //! REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION Standard_EXPORT Standard_Boolean ComputeSRRWT (const Handle(StepRepr_RepresentationRelationship)& SRR, const Handle(Transfer_TransientProcess)& TP, gp_Trsf& Trsf); - - - DEFINE_STANDARD_RTTIEXT(STEPControl_ActorRead,Transfer_ActorOfTransientProcess) -protected: - + protected: //! Transfers product definition entity Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity (const Handle(StepBasic_ProductDefinition)& PD, const Handle(Transfer_TransientProcess)& TP); @@ -121,10 +110,7 @@ protected: //! Tranlates file by old way when CDSR are roots . Acts only if "read.step.product_mode" is equal Off. Standard_EXPORT Handle(TransferBRep_ShapeBinder) OldWay (const Handle(Standard_Transient)& start, const Handle(Transfer_TransientProcess)& TP); - - -private: - + private: Standard_EXPORT TopoDS_Shell closeIDEASShell (const TopoDS_Shell& shell, const TopTools_ListOfShape& closingShells); @@ -134,14 +120,6 @@ private: Standard_Real myPrecision; Standard_Real myMaxTol; Handle(StepRepr_Representation) mySRContext; - - }; - - - - - - #endif // _STEPControl_ActorRead_HeaderFile diff --git a/src/STEPControl/STEPControl_ActorWrite.cxx b/src/STEPControl/STEPControl_ActorWrite.cxx index 268c968ff8..b288335eb8 100644 --- a/src/STEPControl/STEPControl_ActorWrite.cxx +++ b/src/STEPControl/STEPControl_ActorWrite.cxx @@ -222,17 +222,6 @@ static Standard_Boolean IsManifoldShape(const TopoDS_Shape& theShape) { return aResult; } -//======================================================================= -//function : STEPControl_ActorWrite -//purpose : -//======================================================================= - -STEPControl_ActorWrite::STEPControl_ActorWrite () -: mygroup (0) , mytoler (-1.) -{ - SetMode(STEPControl_ShellBasedSurfaceModel); -} - //======================================================================= //method: getNMSSRForGroup //purpose: allows to get NMSSR (NON_MANIFOLD_SURFACE_SHAPE_REPRESENTATION) @@ -274,6 +263,7 @@ Handle(StepShape_NonManifoldSurfaceShapeRepresentation) STEPControl_ActorWrite:: //function : mergeInfoForNM //purpose : bind already written shared faces to STEP entity for non-manifold //======================================================================= + void STEPControl_ActorWrite::mergeInfoForNM(const Handle(Transfer_FinderProcess)& theFP, const Handle(Standard_Transient) &theInfo) const { @@ -307,14 +297,14 @@ void STEPControl_ActorWrite::mergeInfoForNM(const Handle(Transfer_FinderProcess) void STEPControl_ActorWrite::SetMode (const STEPControl_StepModelType M) { switch (M) { - case STEPControl_AsIs : ModeTrans() = 0; break; - case STEPControl_ManifoldSolidBrep : ModeTrans() = 3; break; - case STEPControl_BrepWithVoids : ModeTrans() = 5; break; - case STEPControl_FacetedBrep : ModeTrans() = 1; break; - case STEPControl_FacetedBrepAndBrepWithVoids : ModeTrans() = 6; break; - case STEPControl_ShellBasedSurfaceModel : ModeTrans() = 2; - case STEPControl_GeometricCurveSet : ModeTrans() = 4; - case STEPControl_Hybrid : ModeTrans() = 0; break; // PAS IMPLEMENTE !! + case STEPControl_AsIs : themodetrans = 0; break; + case STEPControl_ManifoldSolidBrep : themodetrans = 3; break; + case STEPControl_BrepWithVoids : themodetrans = 5; break; + case STEPControl_FacetedBrep : themodetrans = 1; break; + case STEPControl_FacetedBrepAndBrepWithVoids : themodetrans = 6; break; + case STEPControl_ShellBasedSurfaceModel : themodetrans = 2; + case STEPControl_GeometricCurveSet : themodetrans = 4; + case STEPControl_Hybrid : themodetrans = 0; break; // PAS IMPLEMENTE !! default: break; } } @@ -339,43 +329,13 @@ STEPControl_StepModelType STEPControl_ActorWrite::Mode () const return STEPControl_AsIs; } -//======================================================================= -//function : SetGroupMode -//purpose : -//======================================================================= - -void STEPControl_ActorWrite::SetGroupMode (const Standard_Integer mode) -{ - if (mode >= 0) mygroup = mode; -} - -//======================================================================= -//function : GroupMode -//purpose : -//======================================================================= - -Standard_Integer STEPControl_ActorWrite::GroupMode () const -{ - return mygroup; -} - -//======================================================================= -//function : SetTolerance -//purpose : -//======================================================================= - -void STEPControl_ActorWrite::SetTolerance (const Standard_Real Tol) -{ - mytoler = Tol; -} - //======================================================================= //function : Recognize // ATTENTION, Recognize doit s aligner sur ce que Transfer sait faire //purpose : //======================================================================= -Standard_Boolean STEPControl_ActorWrite::Recognize (const Handle(Transfer_Finder)& start) +Standard_Boolean STEPControl_ActorWrite::Recognize (const Handle(Standard_Transient)& start) { STEPControl_StepModelType mymode = Mode(); Handle(TransferBRep_ShapeMapper) mapper = Handle(TransferBRep_ShapeMapper)::DownCast(start); @@ -386,8 +346,7 @@ Standard_Boolean STEPControl_ActorWrite::Recognize (const Handle(Transfer_Finde yaface = Standard_False; TopoDS_Shape theShape, aShape; -// theShape = TopoDSToStep::DirectFaces(mapper->Value()); - theShape = mapper->Value(); // pour une reconnaissance c est bien assez + theShape = mapper->Shape(); // pour une reconnaissance c est bien assez if (theShape.ShapeType() == TopAbs_COMPOUND) { @@ -441,19 +400,16 @@ Standard_Boolean STEPControl_ActorWrite::Recognize (const Handle(Transfer_Finde // ######## MAKE PRODUCT DATA + CONTEXT ######## //======================================================================= -//function : Transfer +//function : Transferring //purpose : //======================================================================= -Handle(Transfer_Binder) STEPControl_ActorWrite::Transfer (const Handle(Transfer_Finder)& start, - const Handle(Transfer_FinderProcess)& FP) +Handle(Transfer_Binder) STEPControl_ActorWrite::Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_ProcessForFinder)& FP) { XSAlgo::AlgoContainer()->PrepareForTransfer(); Handle(TransferBRep_ShapeMapper) mapper = Handle(TransferBRep_ShapeMapper)::DownCast(start); - - if (mapper.IsNull()) return NullResult(); - TopoDS_Shape shape = mapper->Value(); + if (mapper.IsNull()) return NULL; // init context Handle(StepData_StepModel) model = Handle(StepData_StepModel)::DownCast ( FP->Model() ); @@ -473,21 +429,18 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::Transfer (const Handle(Transfer_ Handle(StepShape_ShapeDefinitionRepresentation) sdr = SDRTool.SDRValue(); // transfer shape - Handle(Transfer_Binder) resbind = TransferShape (mapper,sdr,FP); - -// Handle(StepShape_ShapeRepresentation) resultat; -// FP->GetTypedTransient (resbind,STANDARD_TYPE(StepShape_ShapeRepresentation),resultat); -// sdr->SetUsedRepresentation (resultat); + Handle(Transfer_Binder) resbind = TransferShape (mapper,sdr,Handle(Transfer_FinderProcess)::DownCast(FP)); // create binder with all root entities produced from shape Handle(TColStd_HSequenceOfTransient) roots = myContext.GetRootsForPart ( SDRTool ); - Handle(Transfer_Binder) resprod = TransientResult ( myContext.GetAPD() ); - for ( Standard_Integer i=1; i <= roots->Length(); i++ ) - resprod->AddResult ( TransientResult ( roots->Value(i) ) ); - resprod->AddResult(resbind); + Handle(Transfer_Binder) resprod = Transfer_SimpleBinderOfTransient::TransientResult ( myContext.GetAPD() ); + if (!resprod.IsNull()) { + for ( Standard_Integer i=1; i <= roots->Length(); i++ ) + resprod->AddResult ( Transfer_SimpleBinderOfTransient::TransientResult ( roots->Value(i) ) ); + resprod->AddResult(resbind); + } // bind and exit - //FP->Bind (mapper,resprod); myContext.NextIndex(); return resprod; } @@ -557,28 +510,6 @@ Standard_Boolean STEPControl_ActorWrite::IsAssembly (TopoDS_Shape &S) const //purpose : //======================================================================= -/* -static void UpdateMap (const TopoDS_Shape &shape, - BRepTools_Modifier &M1, - BRepTools_Modifier &M2, - const Handle(Transfer_FinderProcess) &FinderProcess) -{ - TopoDS_Shape S = M1.ModifiedShape ( shape ); - S = M2.ModifiedShape ( S ); - if ( S == shape ) return; - - Handle(TransferBRep_ShapeMapper) mapper = TransferBRep::ShapeMapper ( FinderProcess, S ); - Handle(Transfer_Binder) binder = FinderProcess->Find ( mapper ); - if ( ! binder.IsNull() ) { - mapper = TransferBRep::ShapeMapper ( FinderProcess, shape ); - FinderProcess->Bind ( mapper, binder ); - } - - for ( TopoDS_Iterator it(shape); it.More(); it.Next() ) - UpdateMap ( it.Value(), M1, M2, FinderProcess ); -} -*/ - // PTV 16.09.2002 added for transfering vertices. static Standard_Boolean transferVertex (const Handle(Transfer_FinderProcess)& FP, Handle(StepShape_HArray1OfGeometricSetSelect)& aGSS, @@ -621,7 +552,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape (const Handle(Tran Standard_Boolean useExistingNMSSR = Standard_False; if (mapper.IsNull()) return binder; - TopoDS_Shape theShape = mapper->Value(); + TopoDS_Shape theShape = mapper->Shape(); if (theShape.IsNull()) return binder; @@ -740,7 +671,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape (const Handle(Tran sdr = SDRTool.SDRValue(); } - aNMBinder = TransientResult(sdr); + aNMBinder = Transfer_SimpleBinderOfTransient::TransientResult(sdr); // Complete SDR with shape representations. // NOTE: aNMBinder is connected now with this SDR. It will be added to the resulting @@ -1086,15 +1017,15 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape (const Handle(Tran // add resulting item to the FP ItemSeq->Append(item); Handle(TransferBRep_ShapeMapper) submapper; - if ( xShape.IsSame ( mapper->Value() ) ) + if ( xShape.IsSame ( mapper->Shape() ) ) submapper = Handle(TransferBRep_ShapeMapper)::DownCast ( start ); if ( submapper.IsNull() ) submapper = TransferBRep::ShapeMapper (FP,xShape); Handle(Transfer_Binder) subbind = FP->Find ( submapper ); if ( subbind.IsNull() ) { - subbind = TransientResult ( item ); + subbind = Transfer_SimpleBinderOfTransient::TransientResult ( item ); FP->Bind ( submapper, subbind ); } - else subbind->AddResult ( TransientResult ( item ) ); + else subbind->AddResult ( Transfer_SimpleBinderOfTransient::TransientResult ( item ) ); //:abv 24Jan99 CAX-IF TRJ3: Update FinderProcess map to take into account shape processing // UpdateMap ( xShape, CSMT, DMT, FP ); @@ -1213,7 +1144,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape (const Handle(Tran aShapeRel->SetRep2(shapeRep); aShapeRel->SetRep1(ShapeRepr1); - aSeqBindRelation.Append(TransientResult (aShapeRel)); + aSeqBindRelation.Append(Transfer_SimpleBinderOfTransient::TransientResult(aShapeRel)); } } else { @@ -1242,24 +1173,24 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape (const Handle(Tran if (!useExistingNMSSR) { SDR0->SetUsedRepresentation (shapeRep); // create binder for SR and attach to it binder for RepItem (if exists) - Handle(Transfer_Binder) resbind = TransientResult(shapeRep); - binder = FP->Find(start); - if ( ! binder.IsNull() ) { - resbind->AddResult ( binder ); - FP->Rebind(start,resbind); - //binder->AddResult ( resbind ); - //resbind = binder; - } - for(Standard_Integer k = 1; k <= aSeqBindRelation.Length(); k++) - resbind->AddResult(aSeqBindRelation.Value(k)); - - // Add SDR for non-manifold topology in group mode 0 (ssv; 18.11.2010) - if ( !aNMBinder.IsNull() ) - resbind->AddResult(aNMBinder); + Handle(Transfer_Binder) resbind = Transfer_SimpleBinderOfTransient::TransientResult(shapeRep); + if (!resbind.IsNull()) { + binder = FP->Find(start); + if ( ! binder.IsNull() ) { + resbind->AddResult ( binder ); + FP->Bind(start,resbind); + } + for(Standard_Integer k = 1; k <= aSeqBindRelation.Length(); k++) + resbind->AddResult(aSeqBindRelation.Value(k)); + // Add SDR for non-manifold topology in group mode 0 (ssv; 18.11.2010) + if ( !aNMBinder.IsNull() ) + resbind->AddResult(aNMBinder); + } return resbind; - } else return FP->Find(start); - + } + + return FP->Find(start); } //======================================================================= @@ -1275,7 +1206,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferCompound (const Handle(T Handle(TransferBRep_ShapeMapper) mapper = Handle(TransferBRep_ShapeMapper)::DownCast(start); Handle(Transfer_Binder) binder; if (mapper.IsNull()) return binder; - TopoDS_Shape theShape = mapper->Value(); + const TopoDS_Shape &theShape = mapper->Shape(); // Inspect non-manifold topology case (ssv; 10.11.2010) Standard_Boolean isNMMode = Interface_Static::IVal("write.step.nonmanifold") != 0; @@ -1340,8 +1271,8 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferCompound (const Handle(T shapeRep = new StepShape_ShapeRepresentation; SDR0->SetUsedRepresentation(shapeRep); // to be used by MakeItem } - binder = TransientResult(SDR0); // set SDR as first item in order to be found first (but not SDR of subshape!) - binder->AddResult ( TransientResult(shapeRep) ); + binder = Transfer_SimpleBinderOfTransient::TransientResult(SDR0); // set SDR as first item in order to be found first (but not SDR of subshape!) + binder->AddResult ( Transfer_SimpleBinderOfTransient::TransientResult(shapeRep) ); // translate components Standard_Integer i, nbs = RepItemSeq->Length(); @@ -1364,7 +1295,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferCompound (const Handle(T if (!isManifold && i > 1) break; else - binder->AddResult( TransientResult( bx->Result() ) ); + binder->AddResult( Transfer_SimpleBinderOfTransient::TransientResult( bx->Result() ) ); } bnd = bnd->NextResult(); } @@ -1404,8 +1335,8 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferSubShape (const Handle( const Standard_Boolean isManifold) { Handle(TransferBRep_ShapeMapper) mapper = Handle(TransferBRep_ShapeMapper)::DownCast(start); - if (mapper.IsNull()) return NullResult(); - TopoDS_Shape shape = mapper->Value(); + if (mapper.IsNull()) return NULL; + const TopoDS_Shape &shape = mapper->Shape(); // SHAPE EN POSITION VENANT D UN ASSEMBLAGE // Il faut alors distinguer la transformation de la shape meme @@ -1420,12 +1351,10 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferSubShape (const Handle( TopLoc_Location shident; sh0.Location (shident); mapper = TransferBRep::ShapeMapper(FP,sh0); - mapper->SameAttributes (start); } Handle(Transfer_Binder) resbind = FP->Find(mapper); Handle(StepShape_ShapeDefinitionRepresentation) sdr; -// Handle(StepShape_ShapeRepresentation) resultat; STEPConstruct_Part SDRTool; // Already SDR and SR available : take them as are @@ -1436,11 +1365,10 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferSubShape (const Handle( SDRTool.MakeSDR ( 0, myContext.GetProductName(), myContext.GetAPD()->Application() ); sdr = SDRTool.SDRValue(); } -// resultat = GetCasted(StepShape_ShapeRepresentation,sdr->UsedRepresentation()); // if shape itself not yet translated, do it now //:abv 20.05.02: see comment in TransferShape(): added "! iasdr ||" - Handle(Transfer_Binder) resprod = TransientResult(sdr); //KA - OCC7141(skl 10.11.2004) + Handle(Transfer_Binder) resprod = Transfer_SimpleBinderOfTransient::TransientResult(sdr); //KA - OCC7141(skl 10.11.2004) if ( ! iasdr || resbind.IsNull() ) { resbind = TransferShape(mapper, sdr, FP, shapeGroup, isManifold); Handle(Transfer_Binder) oldbind = FP->Find ( mapper ); @@ -1451,12 +1379,6 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferSubShape (const Handle( if (resprod.IsNull()) return resprod; - // A new resbind may have been produced -// DeclareAndCast(Transfer_SimpleBinderOfTransient,restrans,resbind); -// if (restrans.IsNull()) return resbind; -// FP->GetTypedTransient (resbind,STANDARD_TYPE(StepShape_ShapeRepresentation),resultat); -// sdr->SetUsedRepresentation(resultat); // to be used by MakeItem - // make location for assembly placement GeomToStep_MakeAxis2Placement3d mkax (aLoc); Handle(StepGeom_Axis2Placement3d) AxLoc = mkax.Value(); @@ -1469,28 +1391,23 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferSubShape (const Handle( Handle(TColStd_HSequenceOfTransient) roots = myContext.GetRootsForAssemblyLink ( mkitem ); // add roots corresponding to assembly and product structures to binder - //Handle(Transfer_Binder) resprod = resbind; //KA - OCC7141(skl 10.11.2004) - //KA: we need only the current subshape in resprod, since the binder is copied - // in Transfershape which calls Transfersubshape [ OCC7141(skl 10.11.2004) ] if ( ! iasdr ) { - resprod->AddResult ( TransientResult ( SDRTool.SDRValue() ) ); - resbind->AddResult ( TransientResult ( SDRTool.SDRValue() ) ); //KA - OCC7141(skl 10.11.2004) + resprod->AddResult ( Transfer_SimpleBinderOfTransient::TransientResult ( SDRTool.SDRValue() ) ); + resbind->AddResult ( Transfer_SimpleBinderOfTransient::TransientResult ( SDRTool.SDRValue() ) ); //KA - OCC7141(skl 10.11.2004) roots->Append ( myContext.GetRootsForPart ( SDRTool ) ); } for ( Standard_Integer i=1; i <= roots->Length(); i++ ) { - resprod->AddResult ( TransientResult ( roots->Value(i) ) ); - resbind->AddResult ( TransientResult ( roots->Value(i) ) ); //KA - OCC7141(skl 10.11.2004) + resprod->AddResult ( Transfer_SimpleBinderOfTransient::TransientResult ( roots->Value(i) ) ); + resbind->AddResult ( Transfer_SimpleBinderOfTransient::TransientResult ( roots->Value(i) ) ); //KA - OCC7141(skl 10.11.2004) } myContext.NextIndex(); - //FP->Bind (mapper,resprod); //KA - OCC7141(skl 10.11.2004) - // abv 16.10.00: bind CDSR (et al) to located shape in order to be able to track instances if ( mapper != start ) { Handle(Transfer_Binder) bnd = FP->Find ( start ); for ( Standard_Integer j=1; j <= roots->Length(); j++ ) - if ( bnd.IsNull() ) bnd = TransientResult ( roots->Value(j) ); - else bnd->AddResult ( TransientResult ( roots->Value(j) ) ); + if ( bnd.IsNull() ) bnd = Transfer_SimpleBinderOfTransient::TransientResult ( roots->Value(j) ); + else bnd->AddResult ( Transfer_SimpleBinderOfTransient::TransientResult ( roots->Value(j) ) ); FP->Bind ( start, bnd ); } diff --git a/src/STEPControl/STEPControl_ActorWrite.hxx b/src/STEPControl/STEPControl_ActorWrite.hxx index afc1869a9e..4e8ca23179 100644 --- a/src/STEPControl/STEPControl_ActorWrite.hxx +++ b/src/STEPControl/STEPControl_ActorWrite.hxx @@ -20,15 +20,10 @@ #include #include -#include -#include -#include #include -#include #include #include -class Transfer_Finder; -class Transfer_Binder; +#include class Transfer_FinderProcess; class StepShape_ShapeDefinitionRepresentation; class StepGeom_Axis2Placement3d; @@ -43,15 +38,16 @@ DEFINE_STANDARD_HANDLE(STEPControl_ActorWrite, Transfer_ActorOfFinderProcess) //! to AP203 or AP214 (CD2 or DIS) class STEPControl_ActorWrite : public Transfer_ActorOfFinderProcess { - -public: - + public: - Standard_EXPORT STEPControl_ActorWrite(); + STEPControl_ActorWrite() : mygroup (0) , mytoler (-1.) + { + SetMode(STEPControl_ShellBasedSurfaceModel); + } - Standard_EXPORT virtual Standard_Boolean Recognize (const Handle(Transfer_Finder)& start) Standard_OVERRIDE; + Standard_EXPORT virtual Standard_Boolean Recognize (const Handle(Standard_Transient)& start) Standard_OVERRIDE; - Standard_EXPORT virtual Handle(Transfer_Binder) Transfer (const Handle(Transfer_Finder)& start, const Handle(Transfer_FinderProcess)& FP) Standard_OVERRIDE; + Standard_EXPORT virtual Handle(Transfer_Binder) Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_ProcessForFinder)& FP) Standard_OVERRIDE; Standard_EXPORT Handle(Transfer_Binder) TransferSubShape (const Handle(Transfer_Finder)& start, const Handle(StepShape_ShapeDefinitionRepresentation)& SDR, Handle(StepGeom_Axis2Placement3d)& AX1, const Handle(Transfer_FinderProcess)& FP, const Handle(TopTools_HSequenceOfShape)& shapeGroup = NULL, const Standard_Boolean isManifold = Standard_True); @@ -63,11 +59,11 @@ public: Standard_EXPORT STEPControl_StepModelType Mode() const; - Standard_EXPORT void SetGroupMode (const Standard_Integer mode); + void SetGroupMode (const Standard_Integer mode) { if (mode >= 0) mygroup = mode; } - Standard_EXPORT Standard_Integer GroupMode() const; + Standard_Integer GroupMode() const { return mygroup; } - Standard_EXPORT void SetTolerance (const Standard_Real Tol); + void SetTolerance (const Standard_Real Tol) { mytoler = Tol; } //! Customizable method to check whether shape S should //! be written as assembly or not @@ -76,18 +72,9 @@ public: //! NOTE: this method can modify shape Standard_EXPORT virtual Standard_Boolean IsAssembly (TopoDS_Shape& S) const; - - - DEFINE_STANDARD_RTTIEXT(STEPControl_ActorWrite,Transfer_ActorOfFinderProcess) -protected: - - - - -private: - + private: //! Non-manifold shapes are stored in NMSSR group //! (NON_MANIFOLD_SURFACE_SHAPE_REPRESENTATION). @@ -102,14 +89,6 @@ private: Standard_Integer mygroup; Standard_Real mytoler; STEPConstruct_ContextTool myContext; - - }; - - - - - - #endif // _STEPControl_ActorWrite_HeaderFile diff --git a/src/STEPControl/STEPControl_Reader.cxx b/src/STEPControl/STEPControl_Reader.cxx index 3ef05c4785..b79c2d9348 100644 --- a/src/STEPControl/STEPControl_Reader.cxx +++ b/src/STEPControl/STEPControl_Reader.cxx @@ -131,14 +131,14 @@ Standard_Integer STEPControl_Reader::NbRootsForTransfer() Interface_EntityIterator aShareds = WS()->Graph().Sharings(ent); if (!aShareds.More()) { theroots.Append(ent); - WS()->TransferReader()->TransientProcess()->RootsForTransfer()->Append(ent); + WS()->TransferReader()->TransientProcess()->RootsForTransfer().Append(ent); } } if (ent->IsKind(STANDARD_TYPE(StepShape_ShellBasedSurfaceModel))) { Interface_EntityIterator aShareds = WS()->Graph().Sharings(ent); if (!aShareds.More()) { theroots.Append(ent); - WS()->TransferReader()->TransientProcess()->RootsForTransfer()->Append(ent); + WS()->TransferReader()->TransientProcess()->RootsForTransfer().Append(ent); } } } @@ -216,7 +216,7 @@ Standard_Integer STEPControl_Reader::NbRootsForTransfer() //} if (IsRoot) { theroots.Append(ent); - WS()->TransferReader()->TransientProcess()->RootsForTransfer()->Append(ent); + WS()->TransferReader()->TransientProcess()->RootsForTransfer().Append(ent); } } TCollection_AsciiString aProdMode = Interface_Static::CVal("read.step.product.mode"); @@ -250,7 +250,7 @@ Standard_Integer STEPControl_Reader::NbRootsForTransfer() } if(IsRoot) { theroots.Append(ent); - WS()->TransferReader()->TransientProcess()->RootsForTransfer()->Append(ent); + WS()->TransferReader()->TransientProcess()->RootsForTransfer().Append(ent); } } if(ent->IsKind(STANDARD_TYPE(StepShape_ShapeRepresentation))) { @@ -303,7 +303,7 @@ Standard_Integer STEPControl_Reader::NbRootsForTransfer() } if(IsRoot) { theroots.Append(ent); - WS()->TransferReader()->TransientProcess()->RootsForTransfer()->Append(ent); + WS()->TransferReader()->TransientProcess()->RootsForTransfer().Append(ent); } } } diff --git a/src/STEPControl/STEPControl_Reader.hxx b/src/STEPControl/STEPControl_Reader.hxx index 52fcfaade1..60315d50ea 100644 --- a/src/STEPControl/STEPControl_Reader.hxx +++ b/src/STEPControl/STEPControl_Reader.hxx @@ -42,8 +42,6 @@ class StepRepr_RepresentationContext; //! translation (see STEP Parameters and General Parameters) //! Creation of reader - STEPControl_Reader reader; //! To load s file in a model use method reader.ReadFile("filename.stp") -//! To print load results reader.PrintCheckLoad(failsonly,mode) -//! where mode is equal to the value of enumeration IFSelect_PrintCount //! For definition number of candidates : //! Standard_Integer nbroots = reader. NbRootsForTransfer(); //! To transfer entities from a model the following methods can be used: @@ -57,10 +55,6 @@ class StepRepr_RepresentationContext; //! reader.TransferRoot(num) //! To obtain the result the following method can be used: //! reader.NbShapes() and reader.Shape(num); or reader.OneShape(); -//! To print the results of transfer use method: -//! reader.PrintCheckTransfer(failwarn,mode); -//! where printfail is equal to the value of enumeration -//! IFSelect_PrintFail, mode see above; or reader.PrintStatsTransfer(); //! Gets correspondence between a STEP entity and a result //! shape obtained from it. //! Handle(XSControl_WorkSession) diff --git a/src/STEPControl/STEPControl_Writer.cxx b/src/STEPControl/STEPControl_Writer.cxx index fd6e09a744..68aa1bf58b 100644 --- a/src/STEPControl/STEPControl_Writer.cxx +++ b/src/STEPControl/STEPControl_Writer.cxx @@ -22,13 +22,13 @@ #include #include #include -#include #include //======================================================================= //function : STEPControl_Writer //purpose : //======================================================================= + STEPControl_Writer::STEPControl_Writer () { STEPControl_Controller::Init(); @@ -42,8 +42,7 @@ STEPControl_Writer::STEPControl_Writer () //purpose : //======================================================================= -STEPControl_Writer::STEPControl_Writer - (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch) +STEPControl_Writer::STEPControl_Writer (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch) { STEPControl_Controller::Init(); SetWS (WS,scratch); @@ -56,8 +55,7 @@ STEPControl_Writer::STEPControl_Writer //purpose : //======================================================================= -void STEPControl_Writer::SetWS(const Handle(XSControl_WorkSession)& WS, - const Standard_Boolean scratch) +void STEPControl_Writer::SetWS(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch) { thesession = WS; thesession->SelectNorm("STEP"); @@ -66,24 +64,12 @@ void STEPControl_Writer::SetWS(const Handle(XSControl_WorkSession)& WS, } -//======================================================================= -//function : WS -//purpose : -//======================================================================= - -Handle(XSControl_WorkSession) STEPControl_Writer::WS () const -{ - return thesession; -} - - //======================================================================= //function : Model //purpose : //======================================================================= -Handle(StepData_StepModel) STEPControl_Writer::Model - (const Standard_Boolean newone) +Handle(StepData_StepModel) STEPControl_Writer::Model (const Standard_Boolean newone) { DeclareAndCast(StepData_StepModel,model,thesession->Model()); if (newone || model.IsNull()) @@ -104,17 +90,6 @@ void STEPControl_Writer::SetTolerance (const Standard_Real Tol) } -//======================================================================= -//function : UnsetTolerance -//purpose : -//======================================================================= - -void STEPControl_Writer::UnsetTolerance () -{ - SetTolerance (-1.); -} - - //======================================================================= //function : Transfer //purpose : @@ -158,15 +133,3 @@ IFSelect_ReturnStatus STEPControl_Writer::Write (const Standard_CString filename { return thesession->SendAll(filename); } - - -//======================================================================= -//function : PrintStatsTransfer -//purpose : -//======================================================================= - -void STEPControl_Writer::PrintStatsTransfer - (const Standard_Integer what, const Standard_Integer mode) const -{ - thesession->TransferWriter()->PrintStats (what,mode); -} diff --git a/src/STEPControl/STEPControl_Writer.hxx b/src/STEPControl/STEPControl_Writer.hxx index f60d3b3cf3..772716c9f7 100644 --- a/src/STEPControl/STEPControl_Writer.hxx +++ b/src/STEPControl/STEPControl_Writer.hxx @@ -21,17 +21,13 @@ #include #include -#include -#include #include #include #include -#include class XSControl_WorkSession; class StepData_StepModel; class TopoDS_Shape; - //! This class creates and writes //! STEP files from Open CASCADE models. A STEP file can be //! written to an existing STEP file or to a new one. @@ -39,10 +35,9 @@ class TopoDS_Shape; //! translation operation outputs a distinct root entity in the STEP file. class STEPControl_Writer { -public: + public: DEFINE_STANDARD_ALLOC - //! Creates a Writer from scratch Standard_EXPORT STEPControl_Writer(); @@ -57,13 +52,13 @@ public: Standard_EXPORT void SetTolerance (const Standard_Real Tol); //! Unsets the tolerance formerly forced by SetTolerance - Standard_EXPORT void UnsetTolerance(); + void UnsetTolerance() { SetTolerance (-1.); } //! Sets a specific session to Standard_EXPORT void SetWS (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True); //! Returns the session used in - Standard_EXPORT Handle(XSControl_WorkSession) WS() const; + const Handle(XSControl_WorkSession) & WS() const { return thesession; } //! Returns the produced model. Produces a new one if not yet done //! or if is True @@ -87,51 +82,10 @@ public: //! Writes a STEP model in the file identified by filename. Standard_EXPORT IFSelect_ReturnStatus Write (const Standard_CString filename); - - //! Displays the statistics for the - //! last translation. what defines the kind of statistics that are displayed: - //! - 0 gives general statistics (number of translated roots, - //! number of warnings, number of fail messages), - //! - 1 gives root results, - //! - 2 gives statistics for all checked entities, - //! - 3 gives the list of translated entities, - //! - 4 gives warning and fail messages, - //! - 5 gives fail messages only. - //! mode is used according to the use of what. If what is 0, mode is - //! ignored. If what is 1, 2 or 3, mode defines the following: - //! - 0 lists the numbers of STEP entities in a STEP model, - //! - 1 gives the number, identifier, type and result type for each - //! STEP entity and/or its status (fail, warning, etc.), - //! - 2 gives maximum information for each STEP entity (i.e. checks), - //! - 3 gives the number of entities by the type of a STEP entity, - //! - 4 gives the number of of STEP entities per result type and/or status, - //! - 5 gives the number of pairs (STEP or result type and status), - //! - 6 gives the number of pairs (STEP or result type and status) - //! AND the list of entity numbers in the STEP model. - Standard_EXPORT void PrintStatsTransfer (const Standard_Integer what, const Standard_Integer mode = 0) const; - - - - -protected: - - - - - -private: - + private: Handle(XSControl_WorkSession) thesession; - - }; - - - - - - #endif // _STEPControl_Writer_HeaderFile diff --git a/src/STEPSelections/STEPSelections_SelectForTransfer.cxx b/src/STEPSelections/STEPSelections_SelectForTransfer.cxx index 775d5c9f3d..eaa924260d 100644 --- a/src/STEPSelections/STEPSelections_SelectForTransfer.cxx +++ b/src/STEPSelections/STEPSelections_SelectForTransfer.cxx @@ -48,10 +48,9 @@ STEPSelections_SelectForTransfer::STEPSelections_SelectForTransfer(const Handle( Interface_EntityIterator STEPSelections_SelectForTransfer::RootResult(const Interface_Graph& /*G*/) const { Interface_EntityIterator iter; - Handle(TColStd_HSequenceOfTransient) roots = Reader()->TransientProcess()->RootsForTransfer(); - Standard_Integer nb = roots->Length(); - for(Standard_Integer i = 1; i <= nb ; i++) - iter.GetOneItem(roots->Value(i)); + TColStd_SequenceOfTransient &roots = Reader()->TransientProcess()->RootsForTransfer(); + const Standard_Integer nb = roots.Length(); + for(Standard_Integer i = 1; i <= nb ; i++) + iter.GetOneItem(roots.Value(i)); return iter; } - diff --git a/src/StepFile/StepFile_Transfer.hxx b/src/StepFile/StepFile_Transfer.hxx index 83714afea5..87c64230f2 100644 --- a/src/StepFile/StepFile_Transfer.hxx +++ b/src/StepFile/StepFile_Transfer.hxx @@ -17,9 +17,6 @@ #include #include -#include -//#include -//#include #include // and, to allow easy DownCasting : diff --git a/src/StepToTopoDS/StepToTopoDS_TranslateEdgeLoop.cxx b/src/StepToTopoDS/StepToTopoDS_TranslateEdgeLoop.cxx index b4a94dc5f3..1a1e3ac197 100644 --- a/src/StepToTopoDS/StepToTopoDS_TranslateEdgeLoop.cxx +++ b/src/StepToTopoDS/StepToTopoDS_TranslateEdgeLoop.cxx @@ -298,20 +298,8 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac if (C->IsKind(STANDARD_TYPE(StepGeom_SurfaceCurve))) { Handle(StepGeom_SurfaceCurve) Sc = Handle(StepGeom_SurfaceCurve)::DownCast(C); C = Sc->Curve3d(); -// if (modepcurve != 3) { -// lastpcurve = StepToTopoDS_GeometricTool::PCurve (Sc,StepSurf,StepPCurve1); -// if (StepPCurve1 == StepPCurve) modepcurve = -1; -// StepPCurve = StepPCurve1; -// } } } -//// else if (C->IsKind(STANDARD_TYPE(StepGeom_Polyline))) { } -// else if (C->IsKind(STANDARD_TYPE(StepGeom_Pcurve))) { -// if (modepcurve != 3) { -// if (C == StepPCurve) modepcurve = -1; -// StepPCurve = Handle(StepGeom_Pcurve)::DownCast(C); -// } -// } Handle(Geom_Curve) C1; if (!C.IsNull()) { try diff --git a/src/Transfer/FILES b/src/Transfer/FILES index 2fff748cd3..870e8c1fad 100644 --- a/src/Transfer/FILES +++ b/src/Transfer/FILES @@ -1,44 +1,23 @@ -Transfer_Actor.gxx -Transfer_ActorDispatch.cxx -Transfer_ActorDispatch.hxx -Transfer_ActorOfFinderProcess.cxx +Transfer_Actor.hxx Transfer_ActorOfFinderProcess.hxx -Transfer_ActorOfProcessForFinder.hxx -Transfer_ActorOfProcessForFinder_0.cxx -Transfer_ActorOfProcessForTransient.hxx -Transfer_ActorOfProcessForTransient_0.cxx -Transfer_ActorOfTransientProcess.cxx Transfer_ActorOfTransientProcess.hxx Transfer_Binder.cxx Transfer_Binder.hxx -Transfer_BinderOfTransientInteger.cxx -Transfer_BinderOfTransientInteger.hxx -Transfer_DataInfo.cxx Transfer_DataInfo.hxx -Transfer_DispatchControl.cxx -Transfer_DispatchControl.hxx Transfer_Finder.cxx Transfer_Finder.hxx Transfer_FinderProcess.cxx Transfer_FinderProcess.hxx -Transfer_FindHasher.cxx -Transfer_FindHasher.hxx +Transfer_Hasher.cxx +Transfer_Hasher.hxx Transfer_HSequenceOfBinder.hxx Transfer_HSequenceOfFinder.hxx -Transfer_Iterator.gxx Transfer_IteratorOfProcessForFinder.hxx -Transfer_IteratorOfProcessForFinder_0.cxx Transfer_IteratorOfProcessForTransient.hxx -Transfer_IteratorOfProcessForTransient_0.cxx Transfer_MapContainer.cxx Transfer_MapContainer.hxx -Transfer_Mapper.gxx -Transfer_MultipleBinder.cxx -Transfer_MultipleBinder.hxx Transfer_ProcessForFinder.hxx -Transfer_ProcessForFinder_0.cxx Transfer_ProcessForTransient.hxx -Transfer_ProcessForTransient_0.cxx Transfer_ResultFromModel.cxx Transfer_ResultFromModel.hxx Transfer_ResultFromTransient.cxx @@ -50,24 +29,15 @@ Transfer_SimpleBinderOfTransient.hxx Transfer_StatusExec.hxx Transfer_StatusResult.hxx Transfer_TransferDeadLoop.hxx -Transfer_TransferDispatch.cxx -Transfer_TransferDispatch.hxx Transfer_TransferFailure.hxx -Transfer_TransferInput.cxx -Transfer_TransferInput.hxx -Transfer_TransferIterator.cxx -Transfer_TransferIterator.hxx +Transfer_Iterator.cxx +Transfer_Iterator.hxx Transfer_TransferMapOfProcessForFinder.hxx Transfer_TransferMapOfProcessForTransient.hxx -Transfer_TransferOutput.cxx -Transfer_TransferOutput.hxx -Transfer_TransferProcess.gxx +Transfer_ProcessGen.hxx Transfer_TransientListBinder.cxx Transfer_TransientListBinder.hxx -Transfer_TransientMapper.hxx -Transfer_TransientMapper_0.cxx Transfer_TransientProcess.cxx Transfer_TransientProcess.hxx -Transfer_UndefMode.hxx Transfer_VoidBinder.cxx Transfer_VoidBinder.hxx diff --git a/src/Transfer/Transfer_Actor.gxx b/src/Transfer/Transfer_Actor.gxx deleted file mode 100644 index 2ad8a3ff07..0000000000 --- a/src/Transfer/Transfer_Actor.gxx +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) 1999-2014 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 - -// TheStart : Handle(Standard_Transient) ou (Transfer_Finder) - - - -Transfer_Actor::Transfer_Actor () { } - - - Standard_Boolean Transfer_Actor::Recognize (const TheStart& /*start*/) - { return Standard_True; } - - Handle(Transfer_Binder) Transfer_Actor::Transferring - (const TheStart& /*start*/, - const Handle(Transfer_TransferProcess)& /*TP*/) - { return NullResult(); } - - - Handle(Transfer_SimpleBinderOfTransient) - Transfer_Actor::TransientResult - (const Handle(Standard_Transient)& res) const -{ - Handle(Transfer_SimpleBinderOfTransient) binder; - if (res.IsNull()) return binder; - binder = new Transfer_SimpleBinderOfTransient; - binder->SetResult (res); - return binder; -} - - - Handle(Transfer_Binder) Transfer_Actor::NullResult () const -{ - Handle(Transfer_Binder) binder; - return binder; -} - - - void Transfer_Actor::SetNext - (const Handle(Transfer_Actor)& next) -{ - if (thenext == next) return; - if (thenext.IsNull()) thenext = next; - else if (thenext->IsLast()) { next->SetNext(thenext); thenext = next; } - else thenext->SetNext(next); -} - - Handle(Transfer_Actor) Transfer_Actor::Next () const - { return thenext; } - - void Transfer_Actor::SetLast (const Standard_Boolean mode) - { thelast = mode; } - - - Standard_Boolean Transfer_Actor::IsLast () const - { return thelast; } diff --git a/src/Transfer/Transfer_Actor.hxx b/src/Transfer/Transfer_Actor.hxx new file mode 100644 index 0000000000..ce1644b786 --- /dev/null +++ b/src/Transfer/Transfer_Actor.hxx @@ -0,0 +1,37 @@ +// Copyright (c) 1999-2014 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 _Transfer_Actor_HeaderFile +#define _Transfer_Actor_HeaderFile + +#include +#include +#include + +class Transfer_Actor : public MMgt_TShared +{ + public: + + Transfer_Actor() : themodetrans(0) {} + + //! Set a specific transfer mode + void SetTransferMode (const Standard_Integer theMode) { themodetrans = theMode; } + + DEFINE_STANDARD_RTTI_INLINE(Transfer_Actor,MMgt_TShared) + + protected: + + Standard_Integer themodetrans; +}; + +#endif // _Transfer_Actor_HeaderFile diff --git a/src/Transfer/Transfer_ActorDispatch.cxx b/src/Transfer/Transfer_ActorDispatch.cxx deleted file mode 100644 index b675188086..0000000000 --- a/src/Transfer/Transfer_ActorDispatch.cxx +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 1999-2014 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -IMPLEMENT_STANDARD_RTTIEXT(Transfer_ActorDispatch,Transfer_ActorOfTransientProcess) - -Transfer_ActorDispatch::Transfer_ActorDispatch - (const Handle(Interface_InterfaceModel)& amodel, - const Interface_GeneralLib& lib) - : thetool (amodel,lib) -{ - SetLast(Standard_True); // actor par defaut - thetool.TransientProcess()->SetActor(this); -} - - Transfer_ActorDispatch::Transfer_ActorDispatch - (const Handle(Interface_InterfaceModel)& amodel, - const Handle(Interface_Protocol)& protocol) - : thetool (amodel,protocol) -{ - SetLast(Standard_True); // actor par defaut - thetool.TransientProcess()->SetActor(this); -} - - Transfer_ActorDispatch::Transfer_ActorDispatch - (const Handle(Interface_InterfaceModel)& amodel) - : thetool (amodel) -{ - SetLast(Standard_True); // actor par defaut - thetool.TransientProcess()->SetActor(this); -} - - - void Transfer_ActorDispatch::AddActor - (const Handle(Transfer_ActorOfTransientProcess)& actor) - { thetool.TransientProcess()->SetActor(actor); } - - Transfer_TransferDispatch& Transfer_ActorDispatch::TransferDispatch () - { return thetool; } - - - Handle(Transfer_Binder) Transfer_ActorDispatch::Transfer - (const Handle(Standard_Transient)& start, - const Handle(Transfer_TransientProcess)& /*TP*/) -{ - thetool.TransferEntity(start); - return thetool.TransientProcess()->Find(start); -} diff --git a/src/Transfer/Transfer_ActorDispatch.hxx b/src/Transfer/Transfer_ActorDispatch.hxx deleted file mode 100644 index b1c4d94eef..0000000000 --- a/src/Transfer/Transfer_ActorDispatch.hxx +++ /dev/null @@ -1,104 +0,0 @@ -// Created on: 1994-05-24 -// Created by: Christian CAILLET -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 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 _Transfer_ActorDispatch_HeaderFile -#define _Transfer_ActorDispatch_HeaderFile - -#include -#include - -#include -#include -class Interface_InterfaceError; -class Interface_InterfaceModel; -class Interface_GeneralLib; -class Interface_Protocol; -class Transfer_ActorOfTransientProcess; -class Transfer_TransferDispatch; -class Transfer_Binder; -class Standard_Transient; -class Transfer_TransientProcess; - - -class Transfer_ActorDispatch; -DEFINE_STANDARD_HANDLE(Transfer_ActorDispatch, Transfer_ActorOfTransientProcess) - -//! This class allows to work with a TransferDispatch, i.e. to -//! transfer entities from a data set to another one defined by -//! the same interface norm, with the following features : -//! - ActorDispatch itself acts as a default actor, i.e. it copies -//! entities with the general service Copy, as CopyTool does -//! - it allows to add other actors for specific ways of transfer, -//! which may include data modifications, conversions ... -//! - and other features from TransferDispatch (such as mapping -//! other than one-one) -class Transfer_ActorDispatch : public Transfer_ActorOfTransientProcess -{ - -public: - - - //! Creates an ActorDispatch from a Model. Works with a General - //! Service Library, given as an Argument - //! This causes TransferDispatch and its TransientProcess to be - //! created, with default actor - Standard_EXPORT Transfer_ActorDispatch(const Handle(Interface_InterfaceModel)& amodel, const Interface_GeneralLib& lib); - - //! Same as above, but Library is defined through a Protocol - Standard_EXPORT Transfer_ActorDispatch(const Handle(Interface_InterfaceModel)& amodel, const Handle(Interface_Protocol)& protocol); - - //! Same as above, but works with the Active Protocol - Standard_EXPORT Transfer_ActorDispatch(const Handle(Interface_InterfaceModel)& amodel); - - //! Utility which adds an actor to the default (it calls - //! SetActor from the TransientProcess) - Standard_EXPORT void AddActor (const Handle(Transfer_ActorOfTransientProcess)& actor); - - //! Returns the TransferDispatch, which does the work, records - //! the intermediate data, etc... - //! See TransferDispatch & CopyTool, to see the available methods - Standard_EXPORT Transfer_TransferDispatch& TransferDispatch(); - - //! Specific action : it calls the method Transfer from CopyTool - //! i.e. the general service Copy, then returns the Binder - //! produced by the TransientProcess - Standard_EXPORT virtual Handle(Transfer_Binder) Transfer (const Handle(Standard_Transient)& start, const Handle(Transfer_TransientProcess)& TP) Standard_OVERRIDE; - - - - - DEFINE_STANDARD_RTTIEXT(Transfer_ActorDispatch,Transfer_ActorOfTransientProcess) - -protected: - - - - -private: - - - Transfer_TransferDispatch thetool; - - -}; - - - - - - - -#endif // _Transfer_ActorDispatch_HeaderFile diff --git a/src/Transfer/Transfer_ActorOfFinderProcess.cxx b/src/Transfer/Transfer_ActorOfFinderProcess.cxx deleted file mode 100644 index b3a145072c..0000000000 --- a/src/Transfer/Transfer_ActorOfFinderProcess.cxx +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 1999-2014 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 -#include -#include -#include -#include -#include -#include -#include -#include - -IMPLEMENT_STANDARD_RTTIEXT(Transfer_ActorOfFinderProcess,Transfer_ActorOfProcessForFinder) - -Transfer_ActorOfFinderProcess::Transfer_ActorOfFinderProcess () { themodetrans = 0; } - -Standard_Integer& Transfer_ActorOfFinderProcess::ModeTrans () -{ return themodetrans; } - -Handle(Transfer_Binder) Transfer_ActorOfFinderProcess::Transfer - (const Handle(Transfer_Finder)& fnd, - const Handle(Transfer_FinderProcess)& FP) -{ - Handle(Transfer_TransientMapper) tm = Handle(Transfer_TransientMapper)::DownCast (fnd); - if (tm.IsNull()) return NullResult(); - Handle(Standard_Transient) res = TransferTransient (tm->Value(),FP); - if (res.IsNull()) return NullResult(); - return TransientResult (res); -} - -Handle(Transfer_Binder) Transfer_ActorOfFinderProcess::Transferring - (const Handle(Transfer_Finder)& ent, - const Handle(Transfer_ProcessForFinder)& TP) -{ - return Transfer(ent,Handle(Transfer_FinderProcess)::DownCast(TP)); -} - -Handle(Standard_Transient) Transfer_ActorOfFinderProcess::TransferTransient - (const Handle(Standard_Transient)& /*ent*/, - const Handle(Transfer_FinderProcess)& ) -{ - Handle(Standard_Transient) nulres; - return nulres; -} diff --git a/src/Transfer/Transfer_ActorOfFinderProcess.hxx b/src/Transfer/Transfer_ActorOfFinderProcess.hxx index bceaed9a61..73609c4cc0 100644 --- a/src/Transfer/Transfer_ActorOfFinderProcess.hxx +++ b/src/Transfer/Transfer_ActorOfFinderProcess.hxx @@ -17,64 +17,8 @@ #ifndef _Transfer_ActorOfFinderProcess_HeaderFile #define _Transfer_ActorOfFinderProcess_HeaderFile -#include -#include - -#include -#include -class Transfer_Binder; -class Transfer_Finder; -class Transfer_ProcessForFinder; -class Transfer_FinderProcess; -class Standard_Transient; - - -class Transfer_ActorOfFinderProcess; -DEFINE_STANDARD_HANDLE(Transfer_ActorOfFinderProcess, Transfer_ActorOfProcessForFinder) - -//! The original class was renamed. Compatibility only -//! -//! ModeTrans : a simple way of transmitting a transfer mode from -//! a user. To be interpreted for each norm -class Transfer_ActorOfFinderProcess : public Transfer_ActorOfProcessForFinder -{ - -public: - - - Standard_EXPORT Transfer_ActorOfFinderProcess(); - - //! Returns the Transfer Mode, modifiable - Standard_EXPORT Standard_Integer& ModeTrans(); - - Standard_EXPORT virtual Handle(Transfer_Binder) Transferring (const Handle(Transfer_Finder)& start, const Handle(Transfer_ProcessForFinder)& TP) Standard_OVERRIDE; - - Standard_EXPORT virtual Handle(Transfer_Binder) Transfer (const Handle(Transfer_Finder)& start, const Handle(Transfer_FinderProcess)& TP); - - Standard_EXPORT virtual Handle(Standard_Transient) TransferTransient (const Handle(Standard_Transient)& start, const Handle(Transfer_FinderProcess)& TP); - - - - - DEFINE_STANDARD_RTTIEXT(Transfer_ActorOfFinderProcess,Transfer_ActorOfProcessForFinder) - -protected: - - - Standard_Integer themodetrans; - - -private: - - - - -}; - - - - - +#include +#define Transfer_ActorOfFinderProcess Transfer_ProcessForFinder::Actor #endif // _Transfer_ActorOfFinderProcess_HeaderFile diff --git a/src/Transfer/Transfer_ActorOfProcessForFinder.hxx b/src/Transfer/Transfer_ActorOfProcessForFinder.hxx deleted file mode 100644 index 7191780d7b..0000000000 --- a/src/Transfer/Transfer_ActorOfProcessForFinder.hxx +++ /dev/null @@ -1,122 +0,0 @@ -// Created on: 1992-02-03 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 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 _Transfer_ActorOfProcessForFinder_HeaderFile -#define _Transfer_ActorOfProcessForFinder_HeaderFile - -#include -#include - -#include -#include -#include -#include - -class Standard_DomainError; -class Transfer_Finder; -class Transfer_FindHasher; -class Transfer_ProcessForFinder; -class Transfer_IteratorOfProcessForFinder; -class Transfer_Binder; -class Transfer_SimpleBinderOfTransient; -class Standard_Transient; - - -class Transfer_ActorOfProcessForFinder; -DEFINE_STANDARD_HANDLE(Transfer_ActorOfProcessForFinder, MMgt_TShared) - - -class Transfer_ActorOfProcessForFinder : public MMgt_TShared -{ - -public: - - - Standard_EXPORT Transfer_ActorOfProcessForFinder(); - - //! Prerequesite for Transfer : the method Transfer is - //! called on a starting object only if Recognize has - //! returned True on it - //! This allows to define a list of Actors, each one - //! processing a definite kind of data - //! TransferProcess calls Recognize on each one before - //! calling Transfer. But even if Recognize has returned - //! True, Transfer can reject by returning a Null Binder - //! (afterwards rejection), the next actor is then invoked - //! - //! The provided default returns True, can be redefined - Standard_EXPORT virtual Standard_Boolean Recognize (const Handle(Transfer_Finder)& start); - - //! Specific action of Transfer. The Result is stored in - //! the returned Binder, or a Null Handle for "No result" - //! (Default defined as doing nothing; should be deffered) - //! "mutable" allows the Actor to record intermediate - //! information, in addition to those of TransferProcess - Standard_EXPORT virtual Handle(Transfer_Binder) Transferring (const Handle(Transfer_Finder)& start, const Handle(Transfer_ProcessForFinder)& TP); - - //! Prepares and Returns a Binder for a Transient Result - //! Returns a Null Handle if is itself Null - Standard_EXPORT Handle(Transfer_SimpleBinderOfTransient) TransientResult (const Handle(Standard_Transient)& res) const; - - //! Returns a Binder for No Result, i.e. a Null Handle - Standard_EXPORT Handle(Transfer_Binder) NullResult() const; - - //! If is True, commands an Actor to be set at the - //! end of the list of Actors (see SetNext) - //! If it is False (creation default), each add Actor is - //! set at the beginning of the list - //! This allows to define default Actors (which are Last) - Standard_EXPORT void SetLast (const Standard_Boolean mode = Standard_True); - - //! Returns the Last status (see SetLast). - Standard_EXPORT Standard_Boolean IsLast() const; - - //! Defines a Next Actor : it can then be asked to work if - //! produces no result for a given type of Object. - //! If Next is already set and is not "Last", calls - //! SetNext on it. If Next defined and "Last", the new - //! actor is added before it in the list - Standard_EXPORT void SetNext (const Handle(Transfer_ActorOfProcessForFinder)& next); - - //! Returns the Actor defined as Next, or a Null Handle - Standard_EXPORT Handle(Transfer_ActorOfProcessForFinder) Next() const; - - - - - DEFINE_STANDARD_RTTI_INLINE(Transfer_ActorOfProcessForFinder,MMgt_TShared) - -protected: - - - - -private: - - - Handle(Transfer_ActorOfProcessForFinder) thenext; - Standard_Boolean thelast; - - -}; - - - - - - - -#endif // _Transfer_ActorOfProcessForFinder_HeaderFile diff --git a/src/Transfer/Transfer_ActorOfProcessForFinder_0.cxx b/src/Transfer/Transfer_ActorOfProcessForFinder_0.cxx deleted file mode 100644 index 74f6e4285d..0000000000 --- a/src/Transfer/Transfer_ActorOfProcessForFinder_0.cxx +++ /dev/null @@ -1,50 +0,0 @@ -// Created on: 1992-02-03 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 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 - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define TheStart Handle(Transfer_Finder) -#define TheStart_hxx -#define TheMapHasher Transfer_FindHasher -#define TheMapHasher_hxx -#define Handle_TheList Handle(Transfer_HSequenceOfFinder) -#define TheList Transfer_HSequenceOfFinder -#define TheList_hxx -#define Transfer_TransferMap Transfer_TransferMapOfProcessForFinder -#define Transfer_TransferMap_hxx -#define Transfer_Iterator Transfer_IteratorOfProcessForFinder -#define Transfer_Iterator_hxx -#define Transfer_Actor Transfer_ActorOfProcessForFinder -#define Transfer_Actor_hxx -#define Handle_Transfer_Actor Handle(Transfer_ActorOfProcessForFinder) -#define Transfer_TransferProcess Transfer_ProcessForFinder -#define Transfer_TransferProcess_hxx -#define Handle_Transfer_TransferProcess Handle(Transfer_ProcessForFinder) -#include - diff --git a/src/Transfer/Transfer_ActorOfProcessForTransient.hxx b/src/Transfer/Transfer_ActorOfProcessForTransient.hxx deleted file mode 100644 index 54fd6bba4e..0000000000 --- a/src/Transfer/Transfer_ActorOfProcessForTransient.hxx +++ /dev/null @@ -1,121 +0,0 @@ -// Created on: 1992-02-03 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 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 _Transfer_ActorOfProcessForTransient_HeaderFile -#define _Transfer_ActorOfProcessForTransient_HeaderFile - -#include -#include - -#include -#include -#include -#include -#include - -class Standard_DomainError; -class Standard_Transient; -class Transfer_ProcessForTransient; -class Transfer_IteratorOfProcessForTransient; -class Transfer_Binder; -class Transfer_SimpleBinderOfTransient; - - -class Transfer_ActorOfProcessForTransient; -DEFINE_STANDARD_HANDLE(Transfer_ActorOfProcessForTransient, MMgt_TShared) - - -class Transfer_ActorOfProcessForTransient : public MMgt_TShared -{ - -public: - - - Standard_EXPORT Transfer_ActorOfProcessForTransient(); - - //! Prerequesite for Transfer : the method Transfer is - //! called on a starting object only if Recognize has - //! returned True on it - //! This allows to define a list of Actors, each one - //! processing a definite kind of data - //! TransferProcess calls Recognize on each one before - //! calling Transfer. But even if Recognize has returned - //! True, Transfer can reject by returning a Null Binder - //! (afterwards rejection), the next actor is then invoked - //! - //! The provided default returns True, can be redefined - Standard_EXPORT virtual Standard_Boolean Recognize (const Handle(Standard_Transient)& start); - - //! Specific action of Transfer. The Result is stored in - //! the returned Binder, or a Null Handle for "No result" - //! (Default defined as doing nothing; should be deffered) - //! "mutable" allows the Actor to record intermediate - //! information, in addition to those of TransferProcess - Standard_EXPORT virtual Handle(Transfer_Binder) Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_ProcessForTransient)& TP); - - //! Prepares and Returns a Binder for a Transient Result - //! Returns a Null Handle if is itself Null - Standard_EXPORT Handle(Transfer_SimpleBinderOfTransient) TransientResult (const Handle(Standard_Transient)& res) const; - - //! Returns a Binder for No Result, i.e. a Null Handle - Standard_EXPORT Handle(Transfer_Binder) NullResult() const; - - //! If is True, commands an Actor to be set at the - //! end of the list of Actors (see SetNext) - //! If it is False (creation default), each add Actor is - //! set at the beginning of the list - //! This allows to define default Actors (which are Last) - Standard_EXPORT void SetLast (const Standard_Boolean mode = Standard_True); - - //! Returns the Last status (see SetLast). - Standard_EXPORT Standard_Boolean IsLast() const; - - //! Defines a Next Actor : it can then be asked to work if - //! produces no result for a given type of Object. - //! If Next is already set and is not "Last", calls - //! SetNext on it. If Next defined and "Last", the new - //! actor is added before it in the list - Standard_EXPORT void SetNext (const Handle(Transfer_ActorOfProcessForTransient)& next); - - //! Returns the Actor defined as Next, or a Null Handle - Standard_EXPORT Handle(Transfer_ActorOfProcessForTransient) Next() const; - - - - - DEFINE_STANDARD_RTTI_INLINE(Transfer_ActorOfProcessForTransient,MMgt_TShared) - -protected: - - - - -private: - - - Handle(Transfer_ActorOfProcessForTransient) thenext; - Standard_Boolean thelast; - - -}; - - - - - - - -#endif // _Transfer_ActorOfProcessForTransient_HeaderFile diff --git a/src/Transfer/Transfer_ActorOfProcessForTransient_0.cxx b/src/Transfer/Transfer_ActorOfProcessForTransient_0.cxx deleted file mode 100644 index d69b1f1bfa..0000000000 --- a/src/Transfer/Transfer_ActorOfProcessForTransient_0.cxx +++ /dev/null @@ -1,48 +0,0 @@ -// Created on: 1992-02-03 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 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 - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#define TheStart Handle(Standard_Transient) -#define TheStart_hxx -#define TheMapHasher TColStd_MapTransientHasher -#define TheMapHasher_hxx -#define Handle_TheList Handle(TColStd_HSequenceOfTransient) -#define TheList TColStd_HSequenceOfTransient -#define TheList_hxx -#define Transfer_TransferMap Transfer_TransferMapOfProcessForTransient -#define Transfer_TransferMap_hxx -#define Transfer_Iterator Transfer_IteratorOfProcessForTransient -#define Transfer_Iterator_hxx -#define Transfer_Actor Transfer_ActorOfProcessForTransient -#define Transfer_Actor_hxx -#define Handle_Transfer_Actor Handle(Transfer_ActorOfProcessForTransient) -#define Transfer_TransferProcess Transfer_ProcessForTransient -#define Transfer_TransferProcess_hxx -#define Handle_Transfer_TransferProcess Handle(Transfer_ProcessForTransient) -#include - diff --git a/src/Transfer/Transfer_ActorOfTransientProcess.cxx b/src/Transfer/Transfer_ActorOfTransientProcess.cxx deleted file mode 100644 index dc454f57d3..0000000000 --- a/src/Transfer/Transfer_ActorOfTransientProcess.cxx +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 1999-2014 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 -#include -#include -#include -#include -#include -#include - -IMPLEMENT_STANDARD_RTTIEXT(Transfer_ActorOfTransientProcess,Transfer_ActorOfProcessForTransient) - -Transfer_ActorOfTransientProcess::Transfer_ActorOfTransientProcess () { } - -Handle(Transfer_Binder) Transfer_ActorOfTransientProcess::Transfer - (const Handle(Standard_Transient)& start, - const Handle(Transfer_TransientProcess)& TP) -{ - Handle(Standard_Transient) res = TransferTransient (start,TP); - if (res.IsNull()) return NullResult(); - return TransientResult (res); -} - -Handle(Transfer_Binder) Transfer_ActorOfTransientProcess::Transferring - (const Handle(Standard_Transient)& ent, - const Handle(Transfer_ProcessForTransient)& TP) -{ - return Transfer(ent,Handle(Transfer_TransientProcess)::DownCast(TP)); -} - -Handle(Standard_Transient) Transfer_ActorOfTransientProcess::TransferTransient - (const Handle(Standard_Transient)& /*ent*/, - const Handle(Transfer_TransientProcess)& /*TP*/) -{ - Handle(Standard_Transient) nulres; - return nulres; -} diff --git a/src/Transfer/Transfer_ActorOfTransientProcess.hxx b/src/Transfer/Transfer_ActorOfTransientProcess.hxx index e52441e523..8ad3392fe6 100644 --- a/src/Transfer/Transfer_ActorOfTransientProcess.hxx +++ b/src/Transfer/Transfer_ActorOfTransientProcess.hxx @@ -17,55 +17,8 @@ #ifndef _Transfer_ActorOfTransientProcess_HeaderFile #define _Transfer_ActorOfTransientProcess_HeaderFile -#include -#include - -#include -class Transfer_Binder; -class Standard_Transient; -class Transfer_ProcessForTransient; -class Transfer_TransientProcess; - - -class Transfer_ActorOfTransientProcess; -DEFINE_STANDARD_HANDLE(Transfer_ActorOfTransientProcess, Transfer_ActorOfProcessForTransient) - -//! The original class was renamed. Compatibility only -class Transfer_ActorOfTransientProcess : public Transfer_ActorOfProcessForTransient -{ - -public: - - - Standard_EXPORT Transfer_ActorOfTransientProcess(); - - Standard_EXPORT virtual Handle(Transfer_Binder) Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_ProcessForTransient)& TP) Standard_OVERRIDE; - - Standard_EXPORT virtual Handle(Transfer_Binder) Transfer (const Handle(Standard_Transient)& start, const Handle(Transfer_TransientProcess)& TP); - - Standard_EXPORT virtual Handle(Standard_Transient) TransferTransient (const Handle(Standard_Transient)& start, const Handle(Transfer_TransientProcess)& TP); - - - - - DEFINE_STANDARD_RTTIEXT(Transfer_ActorOfTransientProcess,Transfer_ActorOfProcessForTransient) - -protected: - - - - -private: - - - - -}; - - - - - +#include +#define Transfer_ActorOfTransientProcess Transfer_ProcessForTransient::Actor #endif // _Transfer_ActorOfTransientProcess_HeaderFile diff --git a/src/Transfer/Transfer_Binder.cxx b/src/Transfer/Transfer_Binder.cxx index c13e858982..2323241246 100644 --- a/src/Transfer/Transfer_Binder.cxx +++ b/src/Transfer/Transfer_Binder.cxx @@ -12,10 +12,8 @@ // commercial license or contractual agreement. -#include #include #include -#include #include #include #include @@ -27,12 +25,13 @@ IMPLEMENT_STANDARD_RTTIEXT(Transfer_Binder,MMgt_TShared) //function : Transfer_Binder //purpose : //======================================================================= + Transfer_Binder::Transfer_Binder () -{ - thestatus = Transfer_StatusVoid; - theexecst = Transfer_StatusInitial; - thecheck = new Interface_Check; -} +: thestatus(Transfer_StatusVoid), + theexecst(Transfer_StatusInitial), + thecheck(new Interface_Check) +{ +} //======================================================================= //function : Merge @@ -51,7 +50,7 @@ void Transfer_Binder::Merge (const Handle(Transfer_Binder)& other) //purpose : //======================================================================= -Standard_Boolean Transfer_Binder::IsMultiple () const +Standard_Boolean Transfer_Binder::IsMultiple () const { if (thenextr.IsNull()) return Standard_False; if (!HasResult()) return thenextr->IsMultiple(); @@ -69,14 +68,13 @@ Standard_Boolean Transfer_Binder::IsMultiple () const //purpose : //======================================================================= -void Transfer_Binder::AddResult (const Handle(Transfer_Binder)& next) +void Transfer_Binder::AddResult (const Handle(Transfer_Binder)& next) { if (next == this || next.IsNull()) return; next->CutResult(this); if (thenextr.IsNull()) thenextr = next; else { - //Modification of recursive to cycle Handle(Transfer_Binder) theBinder = thenextr; while( theBinder != next ) { if( theBinder->NextResult().IsNull() ) { @@ -87,10 +85,6 @@ void Transfer_Binder::AddResult (const Handle(Transfer_Binder)& next) theBinder = theBinder->NextResult(); } } - //former recursive - // if (thenextr.IsNull()) thenextr = next; - // else if (thenextr == next) return; - // else thenextr->AddResult (next); } //======================================================================= @@ -98,11 +92,10 @@ void Transfer_Binder::AddResult (const Handle(Transfer_Binder)& next) //purpose : //======================================================================= -void Transfer_Binder::CutResult (const Handle(Transfer_Binder)& next) +void Transfer_Binder::CutResult (const Handle(Transfer_Binder)& next) { if (thenextr.IsNull()) return; if (thenextr == next) thenextr.Nullify(); - //else thenextr->CutResult (next); else { Handle(Transfer_Binder) currBinder = thenextr, currNext; while( !( (currNext = currBinder->NextResult()) == next ) ) { @@ -114,15 +107,6 @@ void Transfer_Binder::CutResult (const Handle(Transfer_Binder)& next) } } -//======================================================================= -//function : NextResult -//purpose : -//======================================================================= - -Handle(Transfer_Binder) Transfer_Binder::NextResult () const - { return thenextr; } - - //======================================================================= //function : SetResultPresent //purpose : @@ -130,63 +114,20 @@ Handle(Transfer_Binder) Transfer_Binder::NextResult () const void Transfer_Binder::SetResultPresent () { - if (thestatus == Transfer_StatusUsed) Transfer_TransferFailure::Raise - ("Binder : SetResult, Result is Already Set and Used"); + if (thestatus == Transfer_StatusUsed) + Transfer_TransferFailure::Raise("Transfer_Binder::SetResultPresent : Result is Already Set and Used"); theexecst = Transfer_StatusDone; thestatus = Transfer_StatusDefined; } -//======================================================================= -//function : HasResult -//purpose : -//======================================================================= - -Standard_Boolean Transfer_Binder::HasResult () const - { return (thestatus != Transfer_StatusVoid); } - -//======================================================================= -//function : SetAlreadyUsed -//purpose : -//======================================================================= - -void Transfer_Binder::SetAlreadyUsed () -{ if (thestatus != Transfer_StatusVoid) thestatus = Transfer_StatusUsed; } - - -//======================================================================= -//function : Status -//purpose : -//======================================================================= - -Transfer_StatusResult Transfer_Binder::Status () const -{ return thestatus; } - - // ############ Checks ############ -//======================================================================= -//function : StatusExec -//purpose : -//======================================================================= - -Transfer_StatusExec Transfer_Binder::StatusExec () const -{ return theexecst; } - -//======================================================================= -//function : SetStatusExec -//purpose : -//======================================================================= - -void Transfer_Binder::SetStatusExec (const Transfer_StatusExec stat) -{ theexecst = stat; } - //======================================================================= //function : AddFail //purpose : //======================================================================= -void Transfer_Binder::AddFail - (const Standard_CString mess, const Standard_CString orig) +void Transfer_Binder::AddFail (const Standard_CString mess, const Standard_CString orig) { theexecst = Transfer_StatusError; thecheck->AddFail(mess,orig); @@ -197,30 +138,7 @@ void Transfer_Binder::AddFail //purpose : //======================================================================= -void Transfer_Binder::AddWarning - (const Standard_CString mess, const Standard_CString orig) +void Transfer_Binder::AddWarning (const Standard_CString mess, const Standard_CString orig) { -// theexecst = Transfer_StatusError; thecheck->AddWarning(mess,orig); } - -//======================================================================= -//function : Check -//purpose : -//======================================================================= - -const Handle(Interface_Check) Transfer_Binder::Check () const -{ - return thecheck; -} - -//======================================================================= -//function : CCheck -//purpose : -//======================================================================= - -Handle(Interface_Check) Transfer_Binder::CCheck () -{ - return thecheck; -} - diff --git a/src/Transfer/Transfer_Binder.hxx b/src/Transfer/Transfer_Binder.hxx index 50ed06a143..79645d5f9e 100644 --- a/src/Transfer/Transfer_Binder.hxx +++ b/src/Transfer/Transfer_Binder.hxx @@ -19,15 +19,11 @@ #include #include +#include #include #include -#include -#include -#include -#include class Interface_Check; -class Transfer_TransferFailure; class Transfer_Binder; @@ -57,9 +53,7 @@ DEFINE_STANDARD_HANDLE(Transfer_Binder, MMgt_TShared) //! Attributes, which are additional data, each of them has a name class Transfer_Binder : public MMgt_TShared { - -public: - + public: //! Merges basic data (Check, ExecStatus) from another Binder but //! keeps its result. Used when a binder is replaced by another @@ -83,30 +77,30 @@ public: Standard_EXPORT void AddResult (const Handle(Transfer_Binder)& next); //! Returns the next result, Null if none - Standard_EXPORT Handle(Transfer_Binder) NextResult() const; + const Handle(Transfer_Binder) & NextResult() const { return thenextr; } //! Returns True if a Result is available (StatusResult = Defined) //! A Unique Result will be gotten by Result (which must be //! defined in each sub-class according to result type) //! For a Multiple Result, see class MultipleBinder //! For other case, specific access has to be forecast - Standard_EXPORT Standard_Boolean HasResult() const; + Standard_Boolean HasResult() const { return (thestatus != Transfer_StatusVoid); } //! Declares that result is now used by another one, it means that //! it cannot be modified (by Rebind) - Standard_EXPORT void SetAlreadyUsed(); + void SetAlreadyUsed() { if (thestatus != Transfer_StatusVoid) thestatus = Transfer_StatusUsed; } //! Returns status, which can be Initial (not yet done), Made (a //! result is recorded, not yet shared), Used (it is shared and //! cannot be modified) - Standard_EXPORT Transfer_StatusResult Status() const; + Transfer_StatusResult Status() const { return thestatus; } //! Returns execution status - Standard_EXPORT Transfer_StatusExec StatusExec() const; + Transfer_StatusExec StatusExec() const { return theexecst; } //! Modifies execution status; called by TransferProcess only //! (for StatusError, rather use SetError, below) - Standard_EXPORT void SetStatusExec (const Transfer_StatusExec stat); + void SetStatusExec (const Transfer_StatusExec stat) { theexecst = stat; } //! Used to declare an individual transfer as beeing erroneous //! (Status is set to Void, StatusExec is set to Error, @@ -124,19 +118,15 @@ public: //! Returns Check which stores Fail messages //! Note that no Entity is associated in this Check - Standard_EXPORT const Handle(Interface_Check) Check() const; + const Handle(Interface_Check) & Check() const { return thecheck; } //! Returns Check which stores Fail messages, in order to modify //! it (adding messages, or replacing it) - Standard_EXPORT Handle(Interface_Check) CCheck(); - - - + Handle(Interface_Check) CCheck() { return thecheck; } DEFINE_STANDARD_RTTIEXT(Transfer_Binder,MMgt_TShared) -protected: - + protected: //! Sets fields at initial values Standard_EXPORT Transfer_Binder(); @@ -149,10 +139,7 @@ protected: //! senseless if called isolately Standard_EXPORT void SetResultPresent(); - - -private: - + private: //! Called by AddResult, to keep unicity of each item in the list Standard_EXPORT void CutResult (const Handle(Transfer_Binder)& next); @@ -161,14 +148,6 @@ private: Transfer_StatusExec theexecst; Handle(Interface_Check) thecheck; Handle(Transfer_Binder) thenextr; - - }; - - - - - - #endif // _Transfer_Binder_HeaderFile diff --git a/src/Transfer/Transfer_BinderOfTransientInteger.cxx b/src/Transfer/Transfer_BinderOfTransientInteger.cxx deleted file mode 100644 index 72adcae2d3..0000000000 --- a/src/Transfer/Transfer_BinderOfTransientInteger.cxx +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 1999-2014 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 -#include - -IMPLEMENT_STANDARD_RTTIEXT(Transfer_BinderOfTransientInteger,Transfer_SimpleBinderOfTransient) - -Transfer_BinderOfTransientInteger::Transfer_BinderOfTransientInteger () - : theintval (0) { } - - void Transfer_BinderOfTransientInteger::SetInteger - (const Standard_Integer val) - { theintval = val; } - - Standard_Integer Transfer_BinderOfTransientInteger::Integer () const - { return theintval; } diff --git a/src/Transfer/Transfer_BinderOfTransientInteger.hxx b/src/Transfer/Transfer_BinderOfTransientInteger.hxx deleted file mode 100644 index 3b08e9208e..0000000000 --- a/src/Transfer/Transfer_BinderOfTransientInteger.hxx +++ /dev/null @@ -1,76 +0,0 @@ -// Created on: 1995-02-27 -// Created by: Christian CAILLET -// Copyright (c) 1995-1999 Matra Datavision -// Copyright (c) 1999-2014 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 _Transfer_BinderOfTransientInteger_HeaderFile -#define _Transfer_BinderOfTransientInteger_HeaderFile - -#include -#include - -#include -#include - - -class Transfer_BinderOfTransientInteger; -DEFINE_STANDARD_HANDLE(Transfer_BinderOfTransientInteger, Transfer_SimpleBinderOfTransient) - -//! This type of Binder allows to attach as result, besides a -//! Transient Object, an Integer Value, which can be an Index -//! in the Object if it defines a List, for instance -//! -//! This Binder is otherwise a kind of SimpleBinderOfTransient, -//! i.e. its basic result (for iterators, etc) is the Transient -class Transfer_BinderOfTransientInteger : public Transfer_SimpleBinderOfTransient -{ - -public: - - - //! Creates an empty BinderOfTransientInteger; Default value for - //! the integer part is zero - Standard_EXPORT Transfer_BinderOfTransientInteger(); - - //! Sets a value for the integer part - Standard_EXPORT void SetInteger (const Standard_Integer value); - - //! Returns the value set for the integer part - Standard_EXPORT Standard_Integer Integer() const; - - - - - DEFINE_STANDARD_RTTIEXT(Transfer_BinderOfTransientInteger,Transfer_SimpleBinderOfTransient) - -protected: - - - - -private: - - - Standard_Integer theintval; - - -}; - - - - - - - -#endif // _Transfer_BinderOfTransientInteger_HeaderFile diff --git a/src/Transfer/Transfer_DataInfo.cxx b/src/Transfer/Transfer_DataInfo.cxx deleted file mode 100644 index 6cc07c0c1c..0000000000 --- a/src/Transfer/Transfer_DataInfo.cxx +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) 1999-2014 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 -#include - -Handle(Standard_Type) Transfer_DataInfo::Type - (const Handle(Standard_Transient)& ent) - { return ent->DynamicType(); } - - Standard_CString Transfer_DataInfo::TypeName - (const Handle(Standard_Transient)& ent) - { return ent->DynamicType()->Name(); } diff --git a/src/Transfer/Transfer_DataInfo.hxx b/src/Transfer/Transfer_DataInfo.hxx index 39f0a626f3..11c5af164f 100644 --- a/src/Transfer/Transfer_DataInfo.hxx +++ b/src/Transfer/Transfer_DataInfo.hxx @@ -18,53 +18,19 @@ #define _Transfer_DataInfo_HeaderFile #include -#include #include - #include -#include -class Standard_Transient; - //! Gives informations on an object //! Used as template to instantiate Mapper and SimpleBinder //! This class is for Transient class Transfer_DataInfo { -public: - - DEFINE_STANDARD_ALLOC - - - //! Returns the Type attached to an object - //! Here, the Dynamic Type of a Transient. Null Type if unknown - Standard_EXPORT static Handle(Standard_Type) Type (const Handle(Standard_Transient)& ent); + public: //! Returns Type Name (string) //! Allows to name type of non-handled objects - Standard_EXPORT static Standard_CString TypeName (const Handle(Standard_Transient)& ent); - - - - -protected: - - - - - -private: - - - - - + static Standard_CString TypeName (const Handle(Standard_Transient)& ent) { return ent->DynamicType()->Name(); } }; - - - - - - #endif // _Transfer_DataInfo_HeaderFile diff --git a/src/Transfer/Transfer_DispatchControl.cxx b/src/Transfer/Transfer_DispatchControl.cxx deleted file mode 100644 index 4e3829a530..0000000000 --- a/src/Transfer/Transfer_DispatchControl.cxx +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 1999-2014 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 -#include -#include -#include -#include -#include - -IMPLEMENT_STANDARD_RTTIEXT(Transfer_DispatchControl,Interface_CopyControl) - -Transfer_DispatchControl::Transfer_DispatchControl - (const Handle(Interface_InterfaceModel)& model, - const Handle(Transfer_TransientProcess)& TP) - { themodel = model; theTP = TP; } - - - const Handle(Transfer_TransientProcess)& - Transfer_DispatchControl::TransientProcess () const - { return theTP; } - - const Handle(Interface_InterfaceModel)& - Transfer_DispatchControl::StartingModel () const - { return themodel; } - - void Transfer_DispatchControl::Clear () { theTP->Clear(); } - - - void Transfer_DispatchControl::Bind - (const Handle(Standard_Transient)& ent, - const Handle(Standard_Transient)& res) - { theTP->BindTransient(ent,res); } - - - Standard_Boolean Transfer_DispatchControl::Search - (const Handle(Standard_Transient)& ent, - Handle(Standard_Transient)&res) const - { res = theTP->FindTransient(ent); return !res.IsNull(); } diff --git a/src/Transfer/Transfer_DispatchControl.hxx b/src/Transfer/Transfer_DispatchControl.hxx deleted file mode 100644 index 2d426fe3e0..0000000000 --- a/src/Transfer/Transfer_DispatchControl.hxx +++ /dev/null @@ -1,90 +0,0 @@ -// Created on: 1993-06-17 -// Created by: Christian CAILLET -// Copyright (c) 1993-1999 Matra Datavision -// Copyright (c) 1999-2014 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 _Transfer_DispatchControl_HeaderFile -#define _Transfer_DispatchControl_HeaderFile - -#include -#include - -#include -#include -class Transfer_TransientProcess; -class Interface_InterfaceModel; -class Interface_InterfaceError; -class Standard_Transient; - - -class Transfer_DispatchControl; -DEFINE_STANDARD_HANDLE(Transfer_DispatchControl, Interface_CopyControl) - -//! This is an auxiliary class for TransferDispatch, which allows -//! to record simple copies, as CopyControl from Interface, but -//! based on a TransientProcess. Hence, it allows in addition -//! more actions (such as recording results of adaptations) -class Transfer_DispatchControl : public Interface_CopyControl -{ - -public: - - - //! Creates the DispatchControl, ready for use - Standard_EXPORT Transfer_DispatchControl(const Handle(Interface_InterfaceModel)& model, const Handle(Transfer_TransientProcess)& TP); - - //! Returns the content of the DispatchControl : it can be used - //! for a direct call, if the basic methods do not suffice - Standard_EXPORT const Handle(Transfer_TransientProcess)& TransientProcess() const; - - //! Returns the Model from which the transfer is to be done - Standard_EXPORT const Handle(Interface_InterfaceModel)& StartingModel() const; - - //! Clears the List of Copied Results - Standard_EXPORT void Clear() Standard_OVERRIDE; - - //! Binds a (Transient) Result to a (Transient) Starting Entity - Standard_EXPORT void Bind (const Handle(Standard_Transient)& ent, const Handle(Standard_Transient)& res) Standard_OVERRIDE; - - //! Searches for the Result bound to a Starting Entity - //! If Found, returns True and fills - //! Else, returns False and nullifies - Standard_EXPORT Standard_Boolean Search (const Handle(Standard_Transient)& ent, Handle(Standard_Transient)& res) const Standard_OVERRIDE; - - - - - DEFINE_STANDARD_RTTIEXT(Transfer_DispatchControl,Interface_CopyControl) - -protected: - - - - -private: - - - Handle(Transfer_TransientProcess) theTP; - Handle(Interface_InterfaceModel) themodel; - - -}; - - - - - - - -#endif // _Transfer_DispatchControl_HeaderFile diff --git a/src/Transfer/Transfer_FindHasher.cxx b/src/Transfer/Transfer_FindHasher.cxx deleted file mode 100644 index f81a5feb15..0000000000 --- a/src/Transfer/Transfer_FindHasher.cxx +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 1999-2014 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 -#include - -Standard_Integer Transfer_FindHasher::HashCode - (const Handle(Transfer_Finder)& K, const Standard_Integer Upper) -{ - return ((K->GetHashCode() - 1) % Upper) + 1; -} - - Standard_Boolean Transfer_FindHasher::IsEqual - (const Handle(Transfer_Finder)& K1, const Handle(Transfer_Finder)& K2) -{ - if (K1.IsNull()) return Standard_False; - return K1->Equates(K2); -} diff --git a/src/Transfer/Transfer_FindHasher.hxx b/src/Transfer/Transfer_FindHasher.hxx deleted file mode 100644 index 6a9c450995..0000000000 --- a/src/Transfer/Transfer_FindHasher.hxx +++ /dev/null @@ -1,75 +0,0 @@ -// Created on: 1994-11-04 -// Created by: Christian CAILLET -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 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 _Transfer_FindHasher_HeaderFile -#define _Transfer_FindHasher_HeaderFile - -#include -#include -#include - -#include -#include -class Transfer_Finder; - - -//! FindHasher defines HashCode for Finder, which is : ask a -//! Finder its HashCode ! Because this is the Finder itself which -//! brings the HashCode for its Key -//! -//! This class complies to the template given in TCollection by -//! MapHasher itself -class Transfer_FindHasher -{ -public: - - DEFINE_STANDARD_ALLOC - - - //! Returns a HashCode in the range <0,Upper> for a Finder : - //! asks the Finder its HashCode then transforms it to be in the - //! required range - Standard_EXPORT static Standard_Integer HashCode (const Handle(Transfer_Finder)& K, const Standard_Integer Upper); - - //! Returns True if two keys are the same. - //! The test does not work on the Finders themselves but by - //! calling their methods Equates - Standard_EXPORT static Standard_Boolean IsEqual (const Handle(Transfer_Finder)& K1, const Handle(Transfer_Finder)& K2); - - - - -protected: - - - - - -private: - - - - - -}; - - - - - - - -#endif // _Transfer_FindHasher_HeaderFile diff --git a/src/Transfer/Transfer_Finder.cxx b/src/Transfer/Transfer_Finder.cxx index d1f67652ba..1f46987afe 100644 --- a/src/Transfer/Transfer_Finder.cxx +++ b/src/Transfer/Transfer_Finder.cxx @@ -11,207 +11,6 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. - -#include -#include -#include -#include -#include -#include -#include #include IMPLEMENT_STANDARD_RTTIEXT(Transfer_Finder,MMgt_TShared) - -void Transfer_Finder::SetHashCode (const Standard_Integer code) - { thecode = code; } - - Standard_Integer Transfer_Finder::GetHashCode () const - { return thecode; } - - Handle(Standard_Type) Transfer_Finder::ValueType () const - { return DynamicType(); } - - Standard_CString Transfer_Finder::ValueTypeName () const - { return "(finder)"; } - - -// #### ATTRIBUTES #### - - -// Integer -> IntVal, Real -> Geom2d_CartesianPoint, CString -> HAsciiString - - void Transfer_Finder::SetAttribute - (const Standard_CString name, const Handle(Standard_Transient)& val) -{ - if (theattrib.IsNull()) theattrib = new Dico_DictionaryOfTransient; - theattrib->SetItem (name,val); -} - - Standard_Boolean Transfer_Finder::RemoveAttribute - (const Standard_CString name) -{ - if (theattrib.IsNull()) return Standard_False; - return theattrib->RemoveItem (name); -} - - Standard_Boolean Transfer_Finder::GetAttribute - (const Standard_CString name, const Handle(Standard_Type)& type, - Handle(Standard_Transient)& val) const -{ - if (theattrib.IsNull()) { val.Nullify(); return Standard_False; } - if (!theattrib->GetItem (name,val)) { val.Nullify(); return Standard_False; } - if (!val->IsKind(type)) { val.Nullify(); return Standard_False; } - return Standard_True; -} - - Handle(Standard_Transient) Transfer_Finder::Attribute - (const Standard_CString name) const -{ - Handle(Standard_Transient) atr; - if (theattrib.IsNull()) return atr; - if (!theattrib->GetItem (name,atr)) atr.Nullify(); - return atr; -} - - Interface_ParamType Transfer_Finder::AttributeType - (const Standard_CString name) const -{ - Handle(Standard_Transient) atr = Attribute(name); - if (atr.IsNull()) return Interface_ParamVoid; - if (atr->DynamicType() == STANDARD_TYPE(Interface_IntVal)) - return Interface_ParamInteger; - if (atr->DynamicType() == STANDARD_TYPE(Geom2d_CartesianPoint)) - return Interface_ParamReal; - if (atr->DynamicType() == STANDARD_TYPE(TCollection_HAsciiString)) - return Interface_ParamText; - return Interface_ParamIdent; -} - - - void Transfer_Finder::SetIntegerAttribute - (const Standard_CString name, const Standard_Integer val) -{ - Handle(Interface_IntVal) ival = new Interface_IntVal; - ival->CValue() = val; - SetAttribute (name, ival); -} - - Standard_Boolean Transfer_Finder::GetIntegerAttribute - (const Standard_CString name, Standard_Integer& val) const -{ - Handle(Interface_IntVal) ival = Handle(Interface_IntVal)::DownCast - (Attribute(name)); - if (ival.IsNull()) { val = 0; return Standard_False; } - val = ival->Value(); - return Standard_True; -} - - Standard_Integer Transfer_Finder::IntegerAttribute - (const Standard_CString name) const -{ - Handle(Interface_IntVal) ival = Handle(Interface_IntVal)::DownCast - (Attribute(name)); - if (ival.IsNull()) return 0; - return ival->Value(); -} - - void Transfer_Finder::SetRealAttribute - (const Standard_CString name, const Standard_Real val) -{ - Handle(Geom2d_CartesianPoint) rval = new Geom2d_CartesianPoint (val,0); - SetAttribute (name,rval); -} - - Standard_Boolean Transfer_Finder::GetRealAttribute - (const Standard_CString name, Standard_Real& val) const -{ - Handle(Geom2d_CartesianPoint) rval = Handle(Geom2d_CartesianPoint)::DownCast - (Attribute(name)); - if (rval.IsNull()) { val = 0.0; return Standard_False; } - val = rval->X(); - return Standard_True; -} - - Standard_Real Transfer_Finder::RealAttribute (const Standard_CString name) const -{ - Handle(Geom2d_CartesianPoint) rval = Handle(Geom2d_CartesianPoint)::DownCast - (Attribute(name)); - if (rval.IsNull()) return 0; - return rval->X(); -} - - void Transfer_Finder::SetStringAttribute - (const Standard_CString name, const Standard_CString val) -{ - Handle(TCollection_HAsciiString) hval = new TCollection_HAsciiString (val); - SetAttribute (name,hval); -} - - Standard_Boolean Transfer_Finder::GetStringAttribute - (const Standard_CString name, Standard_CString& val) const -{ - Handle(TCollection_HAsciiString) hval = Handle(TCollection_HAsciiString)::DownCast - (Attribute(name)); - if (hval.IsNull()) { val = ""; return Standard_False; } - val = hval->ToCString(); - return Standard_True; -} - - Standard_CString Transfer_Finder::StringAttribute (const Standard_CString name) const -{ - Handle(TCollection_HAsciiString) hval = Handle(TCollection_HAsciiString)::DownCast - (Attribute(name)); - if (hval.IsNull()) return ""; - return hval->ToCString(); -} - - Handle(Dico_DictionaryOfTransient) Transfer_Finder::AttrList () const - { return theattrib; } - - void Transfer_Finder::SameAttributes (const Handle(Transfer_Finder)& other) - { if (!other.IsNull()) theattrib = other->AttrList(); } - - void Transfer_Finder::GetAttributes - (const Handle(Transfer_Finder)& other, - const Standard_CString fromname, const Standard_Boolean copied) -{ - if (other.IsNull()) return; - Handle(Dico_DictionaryOfTransient) list = other->AttrList(); - if (list.IsNull()) return; - if (theattrib.IsNull()) theattrib = new Dico_DictionaryOfTransient; - - for (Dico_IteratorOfDictionaryOfTransient iter (list,fromname); - iter.More(); iter.Next()) { - TCollection_AsciiString name = iter.Name(); - Handle(Standard_Transient) atr = iter.Value(); - Handle(Standard_Transient) newatr = atr; - -// Copy ? according type - if (copied) { - Handle(Interface_IntVal) ival = Handle(Interface_IntVal)::DownCast(atr); - if (!ival.IsNull()) { - Standard_Integer intval = ival->Value(); - ival = new Interface_IntVal; - ival->CValue() = intval; - newatr = ival; - } - Handle(Geom2d_CartesianPoint) rval = Handle(Geom2d_CartesianPoint)::DownCast(atr); - if (!rval.IsNull()) { - Standard_Real realval = rval->X(); - rval = new Geom2d_CartesianPoint (realval,0); - newatr = rval; - } - Handle(TCollection_HAsciiString) hval = Handle(TCollection_HAsciiString)::DownCast(atr); - if (!hval.IsNull()) { - Handle(TCollection_HAsciiString) strval = new TCollection_HAsciiString - (hval->ToCString()); - newatr = strval; - } - - } - - theattrib->SetItem (name.ToCString(),newatr); - - } -} diff --git a/src/Transfer/Transfer_Finder.hxx b/src/Transfer/Transfer_Finder.hxx index f25dbb806a..e8eef4fe18 100644 --- a/src/Transfer/Transfer_Finder.hxx +++ b/src/Transfer/Transfer_Finder.hxx @@ -19,158 +19,35 @@ #include #include - -#include #include -#include -#include -#include -#include -#include -class Dico_DictionaryOfTransient; -class Standard_Transient; - -class Transfer_Finder; -DEFINE_STANDARD_HANDLE(Transfer_Finder, MMgt_TShared) - -//! a Finder allows to map any kind of object as a Key for a Map. +//! A Finder allows to map any kind of object as a Key for a Map. //! This works by defining, for a Hash Code, that of the real Key, //! not of the Finder which acts only as an intermediate. //! When a Map asks for the HashCode of a Finder, this one returns //! the code it has determined at creation time class Transfer_Finder : public MMgt_TShared { + public: -public: + //! Default constructor + Transfer_Finder() {} - //! Returns the HashCode which has been stored by SetHashCode //! (remark that HashCode could be deferred then be defined by //! sub-classes, the result is the same) - Standard_EXPORT Standard_Integer GetHashCode() const; + Standard_Integer virtual GetHashCode(const Standard_Integer theUpper) const = 0; - //! Specific testof equallity : to be defined by each sub-class, + //! Specific test of equality : to be defined by each sub-class, //! must be False if Finders have not the same true Type, else //! their contents must be compared - Standard_EXPORT virtual Standard_Boolean Equates (const Handle(Transfer_Finder)& other) const = 0; - - //! Returns the Type of the Value. By default, returns the - //! DynamicType of , but can be redefined - Standard_EXPORT virtual Handle(Standard_Type) ValueType() const; + Standard_EXPORT virtual Standard_Boolean Equates (const Handle(Transfer_Finder)& theOther) const = 0; //! Returns the name of the Type of the Value. Default is name //! of ValueType, unless it is for a non-handled object - Standard_EXPORT virtual Standard_CString ValueTypeName() const; - - //! Adds an attribute with a given name (replaces the former one - //! with the same name if already exists) - Standard_EXPORT void SetAttribute (const Standard_CString name, const Handle(Standard_Transient)& val); - - //! Removes an attribute - //! Returns True when done, False if this attribute did not exist - Standard_EXPORT Standard_Boolean RemoveAttribute (const Standard_CString name); - - //! Returns an attribute from its name, filtered by a type - //! If no attribute has this name, or if it is not kind of this - //! type, is Null and returned value is False - //! Else, it is True - Standard_EXPORT Standard_Boolean GetAttribute (const Standard_CString name, const Handle(Standard_Type)& type, Handle(Standard_Transient)& val) const; - - //! Returns an attribute from its name. Null Handle if not recorded - //! (whatever Transient, Integer, Real ...) - Standard_EXPORT Handle(Standard_Transient) Attribute (const Standard_CString name) const; - - //! Returns the type of an attribute : - //! ParamInt , ParamReal , ParamText (String) , ParamIdent (any) - //! or ParamVoid (not recorded) - Standard_EXPORT Interface_ParamType AttributeType (const Standard_CString name) const; - - //! Adds an integer value for an attribute - Standard_EXPORT void SetIntegerAttribute (const Standard_CString name, const Standard_Integer val); - - //! Returns an attribute from its name, as integer - //! If no attribute has this name, or not an integer, - //! is 0 and returned value is False - //! Else, it is True - Standard_EXPORT Standard_Boolean GetIntegerAttribute (const Standard_CString name, Standard_Integer& val) const; - - //! Returns an integer attribute from its name. 0 if not recorded - Standard_EXPORT Standard_Integer IntegerAttribute (const Standard_CString name) const; - - //! Adds a real value for an attribute - Standard_EXPORT void SetRealAttribute (const Standard_CString name, const Standard_Real val); - - //! Returns an attribute from its name, as real - //! If no attribute has this name, or not a real - //! is 0.0 and returned value is False - //! Else, it is True - Standard_EXPORT Standard_Boolean GetRealAttribute (const Standard_CString name, Standard_Real& val) const; - - //! Returns a real attribute from its name. 0.0 if not recorded - Standard_EXPORT Standard_Real RealAttribute (const Standard_CString name) const; - - //! Adds a String value for an attribute - Standard_EXPORT void SetStringAttribute (const Standard_CString name, const Standard_CString val); - - //! Returns an attribute from its name, as String - //! If no attribute has this name, or not a String - //! is 0.0 and returned value is False - //! Else, it is True - Standard_EXPORT Standard_Boolean GetStringAttribute (const Standard_CString name, Standard_CString& val) const; - - //! Returns a String attribute from its name. "" if not recorded - Standard_EXPORT Standard_CString StringAttribute (const Standard_CString name) const; - - //! Returns the exhaustive list of attributes - Standard_EXPORT Handle(Dico_DictionaryOfTransient) AttrList() const; - - //! Gets the list of attributes from , as such, i.e. - //! not copied : attributes are shared, any attribute edited, - //! added, or removed in is also in and vice versa - //! The former list of attributes of is dropped - Standard_EXPORT void SameAttributes (const Handle(Transfer_Finder)& other); - - //! Gets the list of attributes from , by copying it - //! By default, considers all the attributes from - //! If is given, considers only the attributes with - //! name beginning by - //! - //! For each attribute, if is True (D), its value is also - //! copied if it is a basic type (Integer,Real,String), else it - //! remains shared between and - //! - //! These new attributes are added to the existing ones in , - //! in case of same name, they replace the existing ones - Standard_EXPORT void GetAttributes (const Handle(Transfer_Finder)& other, const Standard_CString fromname = "", const Standard_Boolean copied = Standard_True); - - - + Standard_EXPORT virtual Standard_CString ValueTypeName() const = 0; DEFINE_STANDARD_RTTIEXT(Transfer_Finder,MMgt_TShared) - -protected: - - - //! Stores the HashCode which corresponds to the Value given to - //! create the Mapper - Standard_EXPORT void SetHashCode (const Standard_Integer code); - - - -private: - - - Standard_Integer thecode; - Handle(Dico_DictionaryOfTransient) theattrib; - - }; - - - - - - #endif // _Transfer_Finder_HeaderFile diff --git a/src/Transfer/Transfer_FinderProcess.cxx b/src/Transfer/Transfer_FinderProcess.cxx index 16e7f74d29..abbfffc9ef 100644 --- a/src/Transfer/Transfer_FinderProcess.cxx +++ b/src/Transfer/Transfer_FinderProcess.cxx @@ -11,87 +11,6 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. - -#include -#include -#include -#include -#include -#include -#include -#include #include -#include IMPLEMENT_STANDARD_RTTIEXT(Transfer_FinderProcess,Transfer_ProcessForFinder) - -Transfer_FinderProcess::Transfer_FinderProcess (const Standard_Integer nb) - : Transfer_ProcessForFinder (nb) { } - - void Transfer_FinderProcess::SetModel - (const Handle(Interface_InterfaceModel)& model) - { themodel = model; } - - Handle(Interface_InterfaceModel) Transfer_FinderProcess::Model () const - { return themodel; } - - - Standard_Integer Transfer_FinderProcess::NextMappedWithAttribute - (const Standard_CString name, const Standard_Integer num0) const -{ - Standard_Integer num, nb = NbMapped(); - for (num = num0+1; num <= nb; num ++) { - Handle(Transfer_Finder) fnd = Mapped (num); - if (fnd.IsNull()) continue; - if (!fnd->Attribute(name).IsNull()) return num; - } - return 0; -} - - Handle(Transfer_TransientMapper) Transfer_FinderProcess::TransientMapper - (const Handle(Standard_Transient)& obj) const -{ - Handle(Transfer_TransientMapper) mapper = new Transfer_TransientMapper(obj); - Standard_Integer index = MapIndex (mapper); - if (index == 0) return mapper; - return Handle(Transfer_TransientMapper)::DownCast(Mapped(index)); -} - - - void Transfer_FinderProcess::PrintTrace - (const Handle(Transfer_Finder)& start, const Handle(Message_Messenger)& S) const - { if (!start.IsNull()) S<<" Type:"<ValueTypeName(); } - - void Transfer_FinderProcess::PrintStats - (const Standard_Integer mode, const Handle(Message_Messenger)& S) const -{ - S<<"\n*******************************************************************\n"; - if (mode == 1) { // Statistiques de base - S << "******** Basic Statistics ********"<Check(); - Transfer_StatusExec stat = binder->StatusExec(); - if (stat != Transfer_StatusInitial && stat != Transfer_StatusDone) - nbe ++; - else { - if (ach->NbWarnings() > 0) nbw ++; - if (binder->HasResult()) nbr ++; - } - } - if (nbr > nbroots) - S<<"**** ( Itermediate Results : "< 0) - S<<"**** Errors on :"< 0) - S<<"**** Warnings on : "< -#include -class Interface_InterfaceModel; -class Transfer_TransientMapper; -class Transfer_Finder; -class Message_Messenger; - -class Transfer_FinderProcess; -DEFINE_STANDARD_HANDLE(Transfer_FinderProcess, Transfer_ProcessForFinder) - -//! Adds specific features to the generic definition : -//! PrintTrace is adapted class Transfer_FinderProcess : public Transfer_ProcessForFinder { + public: -public: - - //! Sets FinderProcess at initial state, with an initial size - Standard_EXPORT Transfer_FinderProcess(const Standard_Integer nb = 10000); - - //! Sets an InterfaceModel, which can be used during transfer - //! for instance if a context must be managed, it is in the Model - Standard_EXPORT void SetModel (const Handle(Interface_InterfaceModel)& model); - - //! Returns the Model which can be used for context - Standard_EXPORT Handle(Interface_InterfaceModel) Model() const; - - //! In the list of mapped items (between 1 and NbMapped), - //! searches for the first mapped item which follows - //! (not included) and which has an attribute named - //! The considered Attributes are those brought by Finders,i.e. - //! by Input data. - //! While NextItemWithAttribute works on Result data (Binders) - //! - //! Hence, allows such an iteration - //! - //! for (num = FP->NextMappedWithAttribute(name,0); - //! num > 0; - //! num = FP->NextMappedWithAttribute(name,num) { - //! .. process mapped item - //! } - Standard_EXPORT Standard_Integer NextMappedWithAttribute (const Standard_CString name, const Standard_Integer num0) const; - - //! Returns a TransientMapper for a given Transient Object - //! Either is already mapped, then its Mapper is returned - //! Or it is not, then a new one is created then returned, BUT - //! it is not mapped here (use Bind or FindElseBind to do this) - Standard_EXPORT Handle(Transfer_TransientMapper) TransientMapper (const Handle(Standard_Transient)& obj) const; - - //! Specific printing to trace a Finder (by its method ValueType) - Standard_EXPORT virtual void PrintTrace (const Handle(Transfer_Finder)& start, const Handle(Message_Messenger)& S) const Standard_OVERRIDE; - - //! Prints statistics on a given output, according mode - Standard_EXPORT void PrintStats (const Standard_Integer mode, const Handle(Message_Messenger)& S) const; + Transfer_FinderProcess(const Standard_Integer nb = 10000) + : Transfer_ProcessForFinder (nb) + {} DEFINE_STANDARD_RTTIEXT(Transfer_FinderProcess,Transfer_ProcessForFinder) - -private: - Handle(Interface_InterfaceModel) themodel; }; #endif // _Transfer_FinderProcess_HeaderFile diff --git a/src/Transfer/Transfer_Hasher.cxx b/src/Transfer/Transfer_Hasher.cxx new file mode 100644 index 0000000000..6b409eb69d --- /dev/null +++ b/src/Transfer/Transfer_Hasher.cxx @@ -0,0 +1,33 @@ +// Copyright (c) 1999-2014 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 +#include +#include + +Standard_Integer Transfer_Hasher::HashCode (const Handle(Standard_Transient)& K, const Standard_Integer Upper) +{ + Handle(Transfer_Finder) F = Handle(Transfer_Finder)::DownCast(K); + if (F.IsNull()) return TColStd_MapTransientHasher::HashCode(K,Upper); + //szv_c1:return ((F->GetHashCode() - 1) % Upper) + 1; + return F->GetHashCode(Upper); +} + +Standard_Boolean Transfer_Hasher::IsEqual (const Handle(Standard_Transient)& K1, const Handle(Standard_Transient)& K2) +{ + Handle(Transfer_Finder) F1 = Handle(Transfer_Finder)::DownCast(K1); + if (F1.IsNull()) return TColStd_MapTransientHasher::IsEqual(K1,K2); + Handle(Transfer_Finder) F2 = Handle(Transfer_Finder)::DownCast(K2); + if (F2.IsNull()) return Standard_False; + return F1->Equates(F2); +} diff --git a/src/Transfer/Transfer_Hasher.hxx b/src/Transfer/Transfer_Hasher.hxx new file mode 100644 index 0000000000..8d1d784224 --- /dev/null +++ b/src/Transfer/Transfer_Hasher.hxx @@ -0,0 +1,38 @@ +// Created on: 2016-09-27 +// Created by: Sergey ZERCHANINOV +// Copyright (c) 2016 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 _Transfer_Hasher_HeaderFile +#define _Transfer_Hasher_HeaderFile + +#include +#include + +#include +#include +class Standard_Transient; + + +class Transfer_Hasher +{ + public: + + //! Returns a HashCode in the range <0,Upper> for an object K + Standard_EXPORT static Standard_Integer HashCode (const Handle(Standard_Transient)& K, const Standard_Integer Upper); + + //! Returns True if two objects are the same. + Standard_EXPORT static Standard_Boolean IsEqual (const Handle(Standard_Transient)& K1, const Handle(Standard_Transient)& K2); +}; + +#endif // _Transfer_Hasher_HeaderFile diff --git a/src/Transfer/Transfer_Iterator.cxx b/src/Transfer/Transfer_Iterator.cxx new file mode 100644 index 0000000000..ba48dfcc77 --- /dev/null +++ b/src/Transfer/Transfer_Iterator.cxx @@ -0,0 +1,73 @@ +// Copyright (c) 1999-2014 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 +#include +#include +#include +#include + +Transfer_Iterator::Transfer_Iterator () +{ + theitems = new Transfer_HSequenceOfBinder; + theselect = new TColStd_HSequenceOfInteger; + thecurr = 1; +} + +void Transfer_Iterator::AddItem (const Handle(Transfer_Binder)& atr) +{ + theitems->Append(atr); + theselect->Append(1); +} + +void Transfer_Iterator::SelectItem (const Standard_Integer num, const Standard_Boolean keep) +{ + if (num < 1 || num > theselect->Length()) return; + theselect->SetValue (num,(keep? 1 : 0)); +} + +// .... Iteration-Interrogations .... + +Standard_Integer Transfer_Iterator::Number () const +{ + Standard_Integer i, n = theselect->Length(), numb = 0; + for (i = 1; i <= n; i ++) { + if (theselect->Value(i) != 0) numb++; + } + return numb; +} + +Standard_Boolean Transfer_Iterator::More () +{ + if (thecurr > theselect->Length()) return Standard_False; + if (theselect->Value(thecurr) == 0) Next(); + if (thecurr > theselect->Length()) return Standard_False; + return (theselect->Value(thecurr) > 0); +} + +void Transfer_Iterator::Next () +{ + thecurr++; + if (thecurr > theselect->Length()) return; + if (theselect->Value(thecurr) == 0) Next(); +} + +const Handle(Transfer_Binder)& Transfer_Iterator::Value () const +{ + if (thecurr == 0 || thecurr > theselect->Length()) + Standard_NoSuchObject::Raise ("Transfer_Iterator::Value"); + if (theselect->Value(thecurr) == 0) + Standard_NoSuchObject::Raise ("Transfer_Iterator::Value"); + return theitems->Value(thecurr); +} diff --git a/src/Transfer/Transfer_Iterator.gxx b/src/Transfer/Transfer_Iterator.gxx deleted file mode 100644 index c5b0fa34b4..0000000000 --- a/src/Transfer/Transfer_Iterator.gxx +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) 1999-2014 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. - -// Transfer_Iterator.gxx -#include - - -// TheStart est suppose Handle(Standard_Transient) ou (Transfer_Finder) -// Il a servi a instancier TheList qui est une HSequence - - -Transfer_Iterator::Transfer_Iterator (const Standard_Boolean withstarts) - : Transfer_TransferIterator () -{ if (withstarts) thestarts = new TheList(); } - - - void Transfer_Iterator::Add - (const Handle(Transfer_Binder)& binder) -{ - if (!thestarts.IsNull()) Standard_NoSuchObject::Raise - ("Transfer_Iterator : Add, Starting Object required not provided"); - AddItem(binder); -} - - void Transfer_Iterator::Add - (const Handle(Transfer_Binder)& binder, const TheStart& start) -{ - AddItem(binder); - if (!thestarts.IsNull()) thestarts->Append(start); -} - - void Transfer_Iterator::Filter - (const Handle(TheList)& list, const Standard_Boolean keep) -{ - if (list.IsNull() || thestarts.IsNull()) return; - Standard_Integer i, j, nb = thestarts->Length(); - if (nb == 0) return; - Handle(Transfer_Binder) factice; - Transfer_TransferMap amap (nb); - for (i = 1; i <= nb; i ++) { - j = amap.Add (thestarts->Value(i),factice); - SelectItem (j,!keep); - } - -// Comparaison - nb = list->Length(); - for (i = 1; i <= nb; i ++) { - j = amap.FindIndex (list->Value(i)); - if (j > 0) SelectItem (j,keep); - } -} - - Standard_Boolean Transfer_Iterator::HasStarting () const - { return (!thestarts.IsNull()); } - - const TheStart& Transfer_Iterator::Starting () const -{ -// if (thecurr == 0 || thecurr > themaxi) Standard_NoSuchObject::Raise -// ("TransferIterator : Starting"); -// if (theselect->Value(thecurr) == 0) Standard_NoSuchObject::Raise -// ("TransferIterator : Starting"); - if (thestarts.IsNull()) Standard_NoSuchObject::Raise - ("TransferIterator : No Starting defined at all"); - return thestarts->Value(thecurr); -} diff --git a/src/Transfer/Transfer_Iterator.hxx b/src/Transfer/Transfer_Iterator.hxx new file mode 100644 index 0000000000..61bedca6db --- /dev/null +++ b/src/Transfer/Transfer_Iterator.hxx @@ -0,0 +1,73 @@ +// Created on: 1992-10-28 +// Created by: Christian CAILLET +// Copyright (c) 1992-1999 Matra Datavision +// Copyright (c) 1999-2014 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 _Transfer_Iterator_HeaderFile +#define _Transfer_Iterator_HeaderFile + +#include +#include +#include + +class Transfer_HSequenceOfBinder; +class TColStd_HSequenceOfInteger; + +//! Defines an Iterator on the result of a Transfer +//! Available for Normal Results or not (Erroneous Transfer) +//! It gives several kinds of Informations, and allows to consider +//! various criteria (criteria are cumulative) +class Transfer_Iterator +{ +public: + + DEFINE_STANDARD_ALLOC + + //! Creates an empty Iterator + Standard_EXPORT Transfer_Iterator(); + + //! Returns count of Binders to be iterated + Standard_EXPORT Standard_Integer Number() const; + + //! Clears Iteration in progress, to allow it to be restarted + void Start() { thecurr = 0; Next(); } + + //! Returns True if there are other Items to iterate + Standard_EXPORT Standard_Boolean More(); + + //! Sets Iteration to the next Item + Standard_EXPORT void Next(); + + //! Returns the current Binder + Standard_EXPORT const Handle(Transfer_Binder)& Value() const; + + protected: + + //! Adds a Binder to the iteration list (construction) + Standard_EXPORT void AddItem (const Handle(Transfer_Binder)& atr); + + //! Selects/Unselect (according to an item designated by + //! its rank in the list + //! Used by sub-classes which have specific criteria + Standard_EXPORT void SelectItem (const Standard_Integer num, const Standard_Boolean keep); + + Standard_Integer thecurr; + + private: + + Handle(Transfer_HSequenceOfBinder) theitems; + Handle(TColStd_HSequenceOfInteger) theselect; +}; + +#endif // _Transfer_Iterator_HeaderFile diff --git a/src/Transfer/Transfer_IteratorOfProcessForFinder.hxx b/src/Transfer/Transfer_IteratorOfProcessForFinder.hxx index d10d81a0c5..cd0297d544 100644 --- a/src/Transfer/Transfer_IteratorOfProcessForFinder.hxx +++ b/src/Transfer/Transfer_IteratorOfProcessForFinder.hxx @@ -17,79 +17,8 @@ #ifndef _Transfer_IteratorOfProcessForFinder_HeaderFile #define _Transfer_IteratorOfProcessForFinder_HeaderFile -#include -#include -#include - -#include -#include -#include - -class Standard_NoSuchObject; -class Transfer_Finder; -class Transfer_FindHasher; -class Transfer_ProcessForFinder; -class Transfer_ActorOfProcessForFinder; -class Transfer_Binder; - -class Transfer_IteratorOfProcessForFinder : public Transfer_TransferIterator -{ -public: - - DEFINE_STANDARD_ALLOC - - - //! Creates an empty Iterator - //! if withstarts is True, each Binder to be iterated will - //! be associated to its corresponding Starting Object - Standard_EXPORT Transfer_IteratorOfProcessForFinder(const Standard_Boolean withstarts); - - //! Adds a Binder to the iteration list (construction) - //! with no corresponding Starting Object - //! (note that Result is brought by Binder) - Standard_EXPORT void Add (const Handle(Transfer_Binder)& binder); - - //! Adds a Binder to the iteration list, associated with - //! its corresponding Starting Object "start" - //! Starting Object is ignored if not required at - //! Creation time - Standard_EXPORT void Add (const Handle(Transfer_Binder)& binder, const Handle(Transfer_Finder)& start); - - //! After having added all items, keeps or rejects items - //! which are attached to starting data given by - //! = True (D) : keeps. = False : rejects - //! Does nothing if was False - Standard_EXPORT void Filter (const Handle(Transfer_HSequenceOfFinder)& list, const Standard_Boolean keep = Standard_True); - - //! Returns True if Starting Object is available - //! (defined at Creation Time) - Standard_EXPORT Standard_Boolean HasStarting() const; - - //! Returns corresponding Starting Object - Standard_EXPORT const Handle(Transfer_Finder)& Starting() const; - - - - -protected: - - - - - -private: - - - - Handle(Transfer_HSequenceOfFinder) thestarts; - - -}; - - - - - +#include +typedef Transfer_ProcessForFinder::Iterator Transfer_IteratorOfProcessForFinder; #endif // _Transfer_IteratorOfProcessForFinder_HeaderFile diff --git a/src/Transfer/Transfer_IteratorOfProcessForFinder_0.cxx b/src/Transfer/Transfer_IteratorOfProcessForFinder_0.cxx deleted file mode 100644 index a985812876..0000000000 --- a/src/Transfer/Transfer_IteratorOfProcessForFinder_0.cxx +++ /dev/null @@ -1,46 +0,0 @@ -// Created on: 1992-02-03 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 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 - -#include -#include -#include -#include -#include -#include -#include - - -#define TheStart Handle(Transfer_Finder) -#define TheStart_hxx -#define TheMapHasher Transfer_FindHasher -#define TheMapHasher_hxx -#define Handle_TheList Handle(Transfer_HSequenceOfFinder) -#define TheList Transfer_HSequenceOfFinder -#define TheList_hxx -#define Transfer_TransferMap Transfer_TransferMapOfProcessForFinder -#define Transfer_TransferMap_hxx -#define Transfer_Iterator Transfer_IteratorOfProcessForFinder -#define Transfer_Iterator_hxx -#define Transfer_Actor Transfer_ActorOfProcessForFinder -#define Transfer_Actor_hxx -#define Handle_Transfer_Actor Handle(Transfer_ActorOfProcessForFinder) -#define Transfer_TransferProcess Transfer_ProcessForFinder -#define Transfer_TransferProcess_hxx -#define Handle_Transfer_TransferProcess Handle(Transfer_ProcessForFinder) -#include - diff --git a/src/Transfer/Transfer_IteratorOfProcessForTransient.hxx b/src/Transfer/Transfer_IteratorOfProcessForTransient.hxx index 69a6952c18..0b0e2694df 100644 --- a/src/Transfer/Transfer_IteratorOfProcessForTransient.hxx +++ b/src/Transfer/Transfer_IteratorOfProcessForTransient.hxx @@ -17,78 +17,8 @@ #ifndef _Transfer_IteratorOfProcessForTransient_HeaderFile #define _Transfer_IteratorOfProcessForTransient_HeaderFile -#include -#include -#include - -#include -#include -#include - -class Standard_NoSuchObject; -class Standard_Transient; -class Transfer_ProcessForTransient; -class Transfer_ActorOfProcessForTransient; -class Transfer_Binder; - -class Transfer_IteratorOfProcessForTransient : public Transfer_TransferIterator -{ -public: - - DEFINE_STANDARD_ALLOC - - - //! Creates an empty Iterator - //! if withstarts is True, each Binder to be iterated will - //! be associated to its corresponding Starting Object - Standard_EXPORT Transfer_IteratorOfProcessForTransient(const Standard_Boolean withstarts); - - //! Adds a Binder to the iteration list (construction) - //! with no corresponding Starting Object - //! (note that Result is brought by Binder) - Standard_EXPORT void Add (const Handle(Transfer_Binder)& binder); - - //! Adds a Binder to the iteration list, associated with - //! its corresponding Starting Object "start" - //! Starting Object is ignored if not required at - //! Creation time - Standard_EXPORT void Add (const Handle(Transfer_Binder)& binder, const Handle(Standard_Transient)& start); - - //! After having added all items, keeps or rejects items - //! which are attached to starting data given by - //! = True (D) : keeps. = False : rejects - //! Does nothing if was False - Standard_EXPORT void Filter (const Handle(TColStd_HSequenceOfTransient)& list, const Standard_Boolean keep = Standard_True); - - //! Returns True if Starting Object is available - //! (defined at Creation Time) - Standard_EXPORT Standard_Boolean HasStarting() const; - - //! Returns corresponding Starting Object - Standard_EXPORT const Handle(Standard_Transient)& Starting() const; - - - - -protected: - - - - - -private: - - - - Handle(TColStd_HSequenceOfTransient) thestarts; - - -}; - - - - - +#include +typedef Transfer_ProcessForTransient::Iterator Transfer_IteratorOfProcessForTransient; #endif // _Transfer_IteratorOfProcessForTransient_HeaderFile diff --git a/src/Transfer/Transfer_IteratorOfProcessForTransient_0.cxx b/src/Transfer/Transfer_IteratorOfProcessForTransient_0.cxx deleted file mode 100644 index 49332227d9..0000000000 --- a/src/Transfer/Transfer_IteratorOfProcessForTransient_0.cxx +++ /dev/null @@ -1,45 +0,0 @@ -// Created on: 1992-02-03 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 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 - -#include -#include -#include -#include -#include -#include - - -#define TheStart Handle(Standard_Transient) -#define TheStart_hxx -#define TheMapHasher TColStd_MapTransientHasher -#define TheMapHasher_hxx -#define Handle_TheList Handle(TColStd_HSequenceOfTransient) -#define TheList TColStd_HSequenceOfTransient -#define TheList_hxx -#define Transfer_TransferMap Transfer_TransferMapOfProcessForTransient -#define Transfer_TransferMap_hxx -#define Transfer_Iterator Transfer_IteratorOfProcessForTransient -#define Transfer_Iterator_hxx -#define Transfer_Actor Transfer_ActorOfProcessForTransient -#define Transfer_Actor_hxx -#define Handle_Transfer_Actor Handle(Transfer_ActorOfProcessForTransient) -#define Transfer_TransferProcess Transfer_ProcessForTransient -#define Transfer_TransferProcess_hxx -#define Handle_Transfer_TransferProcess Handle(Transfer_ProcessForTransient) -#include - diff --git a/src/Transfer/Transfer_MapContainer.cxx b/src/Transfer/Transfer_MapContainer.cxx index d27a42804c..2f9214d8d0 100644 --- a/src/Transfer/Transfer_MapContainer.cxx +++ b/src/Transfer/Transfer_MapContainer.cxx @@ -11,22 +11,6 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. - -#include #include IMPLEMENT_STANDARD_RTTIEXT(Transfer_MapContainer,MMgt_TShared) - -Transfer_MapContainer::Transfer_MapContainer() -{ -} - - void Transfer_MapContainer::SetMapObjects(TColStd_DataMapOfTransientTransient& theMapObjects) -{ - myMapObj= theMapObjects; -} - - TColStd_DataMapOfTransientTransient& Transfer_MapContainer::GetMapObjects() -{ - return myMapObj; -} diff --git a/src/Transfer/Transfer_MapContainer.hxx b/src/Transfer/Transfer_MapContainer.hxx index dd19f8c0e3..52e296bec1 100644 --- a/src/Transfer/Transfer_MapContainer.hxx +++ b/src/Transfer/Transfer_MapContainer.hxx @@ -19,50 +19,28 @@ #include #include -#include #include +#include - -class Transfer_MapContainer; -DEFINE_STANDARD_HANDLE(Transfer_MapContainer, MMgt_TShared) - +typedef NCollection_DataMap Transfer_DataMapOfTransient; class Transfer_MapContainer : public MMgt_TShared { + public: -public: - - - Standard_EXPORT Transfer_MapContainer(); - - //! Set map already translated geometry objects. - Standard_EXPORT void SetMapObjects (TColStd_DataMapOfTransientTransient& theMapObjects); + Transfer_MapContainer() {} - //! Get map already translated geometry objects. - Standard_EXPORT TColStd_DataMapOfTransientTransient& GetMapObjects(); - - + Standard_Boolean Find(const Handle(Standard_Transient) &theKey, Handle(Standard_Transient) &theValue) + { return myMapObj.Find(theKey,theValue); } + Standard_Boolean Bind(const Handle(Standard_Transient) &theKey, const Handle(Standard_Transient) &theValue) + { return myMapObj.Bind(theKey,theValue); } DEFINE_STANDARD_RTTIEXT(Transfer_MapContainer,MMgt_TShared) -protected: - - - - -private: - - - TColStd_DataMapOfTransientTransient myMapObj; - + private: + Transfer_DataMapOfTransient myMapObj; }; - - - - - - #endif // _Transfer_MapContainer_HeaderFile diff --git a/src/Transfer/Transfer_Mapper.gxx b/src/Transfer/Transfer_Mapper.gxx deleted file mode 100644 index f446f0eeb3..0000000000 --- a/src/Transfer/Transfer_Mapper.gxx +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 1999-2014 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 -#include - - -Transfer_Mapper::Transfer_Mapper (const TheKey& akey) - : theval (akey) -{ SetHashCode ( TheHasher::HashCode (akey, IntegerLast() ) ); } - - - const TheKey& Transfer_Mapper::Value () const - { return theval; } - - Standard_Boolean Transfer_Mapper::Equates - (const Handle(Transfer_Finder)& other) const -{ - if (other.IsNull()) return Standard_False; - if (GetHashCode() != other->GetHashCode()) return Standard_False; - if (other->DynamicType() != DynamicType()) return Standard_False; - Handle(Transfer_Mapper) another = Handle(Transfer_Mapper)::DownCast(other); -// return (theval == another->Value()); - return TheHasher::IsEqual (theval,another->Value()); -} - - Handle(Standard_Type) Transfer_Mapper::ValueType () const - { return TheInfo::Type(theval); } - - Standard_CString Transfer_Mapper::ValueTypeName () const - { return TheInfo::TypeName(theval); } diff --git a/src/Transfer/Transfer_MultipleBinder.cxx b/src/Transfer/Transfer_MultipleBinder.cxx deleted file mode 100644 index f88c07167e..0000000000 --- a/src/Transfer/Transfer_MultipleBinder.cxx +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) 1999-2014 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 -#include -#include -#include -#include - -IMPLEMENT_STANDARD_RTTIEXT(Transfer_MultipleBinder,Transfer_Binder) - -// Resultat Multiple -// Possibilite de definir un Resultat Multiple : plusieurs objets resultant -// d un Transfert, sans pouvoir les distinguer -// N.B. : Pour l heure, tous Transients (pourra evoluer) -Transfer_MultipleBinder::Transfer_MultipleBinder () { } - - - Standard_Boolean Transfer_MultipleBinder::IsMultiple () const -{ - if (themulres.IsNull()) return Standard_False; - return (themulres->Length() != 1); -} - - Handle(Standard_Type) Transfer_MultipleBinder::ResultType () const - { return STANDARD_TYPE(Standard_Transient); } - - Standard_CString Transfer_MultipleBinder::ResultTypeName () const - { return "(list)"; } - -// .... Gestion du Resultat Multiple .... - - void Transfer_MultipleBinder::AddResult - (const Handle(Standard_Transient)& res) -{ - if (themulres.IsNull()) themulres = new TColStd_HSequenceOfTransient(); - themulres->Append(res); -} - - Standard_Integer Transfer_MultipleBinder::NbResults () const - { return (themulres.IsNull() ? 0 : themulres->Length()); } - - Handle(Standard_Transient) Transfer_MultipleBinder::ResultValue - (const Standard_Integer num) const - { return themulres->Value(num); } - - Handle(TColStd_HSequenceOfTransient) Transfer_MultipleBinder::MultipleResult - () const -{ - if (!themulres.IsNull()) return themulres; - return new TColStd_HSequenceOfTransient(); -} - - void Transfer_MultipleBinder::SetMultipleResult - (const Handle(TColStd_HSequenceOfTransient)& mulres) - { themulres = mulres; } diff --git a/src/Transfer/Transfer_MultipleBinder.hxx b/src/Transfer/Transfer_MultipleBinder.hxx deleted file mode 100644 index 7c292d9d0c..0000000000 --- a/src/Transfer/Transfer_MultipleBinder.hxx +++ /dev/null @@ -1,116 +0,0 @@ -// Created on: 1993-04-07 -// Created by: Christian CAILLET -// Copyright (c) 1993-1999 Matra Datavision -// Copyright (c) 1999-2014 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 _Transfer_MultipleBinder_HeaderFile -#define _Transfer_MultipleBinder_HeaderFile - -#include -#include - -#include -#include -#include -#include -#include -#include -class Transfer_TransferFailure; -class Standard_OutOfRange; -class Standard_Transient; - - -class Transfer_MultipleBinder; -DEFINE_STANDARD_HANDLE(Transfer_MultipleBinder, Transfer_Binder) - -//! Allows direct binding between a starting Object and the Result -//! of its transfer, when it can be made of several Transient -//! Objects. Compared to a Transcriptor, it has no Transfer Action -//! -//! Result is a list of Transient Results. Unique Result is not -//! available : SetResult is redefined to start the list on the -//! first call, and refuse the other times. -//! -//! rr -//! -//! Remark : MultipleBinder itself is intended to be created and -//! filled by TransferProcess itself (method Bind). In particular, -//! conflicts between Unique (Standard) result and Multiple result -//! are avoided through management made by TransferProcess. -//! -//! Also, a Transcriptor (with an effective Transfer Method) which -//! can produce a Multiple Result, may be defined as a sub-class -//! of MultipleBinder by redefining method Transfer. -class Transfer_MultipleBinder : public Transfer_Binder -{ - -public: - - - //! normal standard constructor, creates an empty MultipleBinder - Standard_EXPORT Transfer_MultipleBinder(); - - //! Returns True if a starting object is bound with SEVERAL - //! results : Here, returns allways True - Standard_EXPORT virtual Standard_Boolean IsMultiple() const Standard_OVERRIDE; - - //! Returns the Type permitted for Results, i.e. here Transient - Standard_EXPORT Handle(Standard_Type) ResultType() const Standard_OVERRIDE; - - //! Returns the Name of the Type which characterizes the Result - //! Here, returns "(list)" - Standard_EXPORT Standard_CString ResultTypeName() const Standard_OVERRIDE; - - //! Adds a new Item to the Multiple Result - Standard_EXPORT void AddResult (const Handle(Standard_Transient)& res); - - //! Returns the actual count of recorded (Transient) results - Standard_EXPORT Standard_Integer NbResults() const; - - //! Returns the value of the recorded result n0 - Standard_EXPORT Handle(Standard_Transient) ResultValue (const Standard_Integer num) const; - - //! Returns the Multiple Result, if it is defined (at least one - //! Item). Else, returns a Null Handle - Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MultipleResult() const; - - //! Defines a Binding with a Multiple Result, given as a Sequence - //! Error if a Unique Result has yet been defined - Standard_EXPORT void SetMultipleResult (const Handle(TColStd_HSequenceOfTransient)& mulres); - - - - - DEFINE_STANDARD_RTTIEXT(Transfer_MultipleBinder,Transfer_Binder) - -protected: - - - - -private: - - - Handle(TColStd_HSequenceOfTransient) themulres; - - -}; - - - - - - - -#endif // _Transfer_MultipleBinder_HeaderFile diff --git a/src/Transfer/Transfer_ProcessForFinder.hxx b/src/Transfer/Transfer_ProcessForFinder.hxx index d84700e9d8..a20e0e5e7a 100644 --- a/src/Transfer/Transfer_ProcessForFinder.hxx +++ b/src/Transfer/Transfer_ProcessForFinder.hxx @@ -17,451 +17,10 @@ #ifndef _Transfer_ProcessForFinder_HeaderFile #define _Transfer_ProcessForFinder_HeaderFile -#include -#include -#include - -class Message_Messenger; -class Transfer_Finder; -class Transfer_Binder; -class Transfer_ActorOfProcessForFinder; -class Message_ProgressIndicator; -class Interface_InterfaceError; -class Transfer_TransferFailure; -class Transfer_FindHasher; -class Transfer_IteratorOfProcessForFinder; -class Message_Msg; -class Interface_Check; -class Standard_Transient; -class Interface_CheckIterator; - - -class Transfer_ProcessForFinder; -DEFINE_STANDARD_HANDLE(Transfer_ProcessForFinder, MMgt_TShared) - - -class Transfer_ProcessForFinder : public MMgt_TShared -{ - -public: - - - //! Sets TransferProcess at initial state. Gives an Initial size - //! (indicative) for the Map when known (default is 10000). - //! Sets default trace file as a printer and default trace level - //! (see Message_TraceFile). - Standard_EXPORT Transfer_ProcessForFinder(const Standard_Integer nb = 10000); - - //! Sets TransferProcess at initial state. Gives an Initial size - //! (indicative) for the Map when known (default is 10000). - //! Sets a specified printer. - Standard_EXPORT Transfer_ProcessForFinder(const Handle(Message_Messenger)& printer, const Standard_Integer nb = 10000); - - //! Resets a TransferProcess as ready for a completely new work. - //! Clears general data (roots) and the Map - Standard_EXPORT void Clear(); - - //! Rebuilds the Map and the roots to really remove Unbound items - //! Because Unbind keeps the entity in place, even if not bound - //! Hence, working by checking new items is meaningless if a - //! formerly unbound item is rebound - Standard_EXPORT void Clean(); - - //! Resizes the Map as required (if a new reliable value has been - //! determined). Acts only if is greater than actual NbMapped - Standard_EXPORT void Resize (const Standard_Integer nb); - - //! Defines an Actor, which is used for automatic Transfer - //! If already defined, the new Actor is cumulated - //! (see SetNext from Actor) - Standard_EXPORT void SetActor (const Handle(Transfer_ActorOfProcessForFinder)& actor); - - //! Returns the defined Actor. Returns a Null Handle if - //! not set. - Standard_EXPORT Handle(Transfer_ActorOfProcessForFinder) Actor() const; - - //! Returns the Binder which is linked with a starting Object - //! It can either bring a Result (Transfer done) or none (for a - //! pre-binding). - //! If no Binder is linked with , returns a Null Handle - //! Considers a category number, by default 0 - Standard_EXPORT Handle(Transfer_Binder) Find (const Handle(Transfer_Finder)& start) const; - - //! Returns True if a Result (whatever its form) is Bound with - //! a starting Object. I.e., if a Binder with a Result set, - //! is linked with it - //! Considers a category number, by default 0 - Standard_EXPORT Standard_Boolean IsBound (const Handle(Transfer_Finder)& start) const; - - //! Returns True if the result of the transfer of an object is - //! already used in other ones. If it is, Rebind cannot change it. - //! Considers a category number, by default 0 - Standard_EXPORT Standard_Boolean IsAlreadyUsed (const Handle(Transfer_Finder)& start) const; - - //! Creates a Link a starting Object with a Binder. This Binder - //! can either bring a Result (effective Binding) or none (it can - //! be set later : pre-binding). - //! Considers a category number, by default 0 - Standard_EXPORT void Bind (const Handle(Transfer_Finder)& start, const Handle(Transfer_Binder)& binder); - - //! Changes the Binder linked with a starting Object for its - //! unitary transfer. This it can be useful when the exact form - //! of the result is known once the transfer is widely engaged. - //! This can be done only on first transfer. - //! Considers a category number, by default 0 - Standard_EXPORT void Rebind (const Handle(Transfer_Finder)& start, const Handle(Transfer_Binder)& binder); - - //! Removes the Binder linked with a starting object - //! If this Binder brings a non-empty Check, it is replaced by - //! a VoidBinder. Also removes from the list of Roots as required. - //! Returns True if done, False if was not bound - //! Considers a category number, by default 0 - Standard_EXPORT Standard_Boolean Unbind (const Handle(Transfer_Finder)& start); - - //! Returns a Binder for a starting entity, as follows : - //! Tries to Find the already bound one - //! If none found, creates a VoidBinder and Binds it - Standard_EXPORT Handle(Transfer_Binder) FindElseBind (const Handle(Transfer_Finder)& start); - - //! Sets Messenger used for outputting messages. - Standard_EXPORT void SetMessenger (const Handle(Message_Messenger)& messenger); - - //! Returns Messenger used for outputting messages. - //! The returned object is guaranteed to be non-null; - //! default is Message::Messenger(). - Standard_EXPORT Handle(Message_Messenger) Messenger() const; - - //! Sets trace level used for outputting messages: - //! = 0 : no trace at all - //! = 1 : handled exceptions and calls to AddError - //! = 2 : also calls to AddWarning - //! = 3 : also traces new Roots - //! (uses method ErrorTrace). - //! Default is 1 : Errors traced - Standard_EXPORT void SetTraceLevel (const Standard_Integer tracelev); - - //! Returns trace level used for outputting messages. - Standard_EXPORT Standard_Integer TraceLevel() const; - - //! New name for AddFail (Msg) - Standard_EXPORT void SendFail (const Handle(Transfer_Finder)& start, const Message_Msg& amsg); - - //! New name for AddWarning (Msg) - Standard_EXPORT void SendWarning (const Handle(Transfer_Finder)& start, const Message_Msg& amsg); - - //! Adds an information message - //! Trace is filled if trace level is at least 3 - Standard_EXPORT void SendMsg (const Handle(Transfer_Finder)& start, const Message_Msg& amsg); - - //! Adds an Error message to a starting entity (to the check of - //! its Binder of category 0, as a Fail) - Standard_EXPORT void AddFail (const Handle(Transfer_Finder)& start, const Standard_CString mess, const Standard_CString orig = ""); - - //! (other name of AddFail, maintained for compatibility) - Standard_EXPORT void AddError (const Handle(Transfer_Finder)& start, const Standard_CString mess, const Standard_CString orig = ""); - - //! Adds an Error Message to a starting entity from the definition - //! of a Msg (Original+Value) - Standard_EXPORT void AddFail (const Handle(Transfer_Finder)& start, const Message_Msg& amsg); - - //! Adds a Warning message to a starting entity (to the check of - //! its Binder of category 0) - Standard_EXPORT void AddWarning (const Handle(Transfer_Finder)& start, const Standard_CString mess, const Standard_CString orig = ""); - - //! Adds a Warning Message to a starting entity from the definition - //! of a Msg (Original+Value) - Standard_EXPORT void AddWarning (const Handle(Transfer_Finder)& start, const Message_Msg& amsg); - - Standard_EXPORT void Mend (const Handle(Transfer_Finder)& start, const Standard_CString pref = ""); - - //! Returns the Check attached to a starting entity. If - //! is unknown, returns an empty Check - //! Adds a case name to a starting entity - //! Adds a case value to a starting entity - //! Returns the complete case list for an entity. Null Handle if empty - //! In the list of mapped items (between 1 and NbMapped), - //! searches for the first item which follows (not included) - //! and which has an attribute named - //! Attributes are brought by Binders - //! Hence, allows such an iteration - //! - //! for (num = TP->NextItemWithAttribute(name,0); - //! num > 0; - //! num = TP->NextItemWithAttribute(name,num) { - //! .. process mapped item - //! } - //! Returns the type of an Attribute attached to binders - //! If this name gives no Attribute, returns ParamVoid - //! If this name gives several different types, returns ParamMisc - //! Else, returns the effective type (ParamInteger, ParamReal, - //! ParamIdent, or ParamText) - //! Returns the list of recorded Attribute Names, as a Dictionary - //! of Integer : each value gives the count of items which bring - //! this attribute name - //! By default, considers all the attribute names - //! If is given, considers only the attribute names - //! which begin by - Standard_EXPORT Handle(Interface_Check) Check (const Handle(Transfer_Finder)& start) const; - - //! Binds a starting object with a Transient Result. - //! Uses a SimpleBinderOfTransient to work. If there is already - //! one but with no Result set, sets its Result. - //! Considers a category number, by default 0 - Standard_EXPORT void BindTransient (const Handle(Transfer_Finder)& start, const Handle(Standard_Transient)& res); - - //! Returns the Result of the Transfer of an object as a - //! Transient Result. - //! Returns a Null Handle if there is no Transient Result - //! Considers a category number, by default 0 - //! Warning : Supposes that Binding is done with a SimpleBinderOfTransient - Standard_EXPORT const Handle(Standard_Transient)& FindTransient (const Handle(Transfer_Finder)& start) const; - - //! Prepares an object to be bound with several results. - //! If no Binder is yet attached to , a MultipleBinder - //! is created, empty. If a Binder is already set, it must - //! accept Multiple Binding. - //! Considers a category number, by default 0 - Standard_EXPORT void BindMultiple (const Handle(Transfer_Finder)& start); - - //! Adds an item to a list of results bound to a starting object. - //! Considers a category number, by default 0, for all results - Standard_EXPORT void AddMultiple (const Handle(Transfer_Finder)& start, const Handle(Standard_Transient)& res); - - //! Searches for a transient result attached to a starting object, - //! according to its type, by criterium IsKind(atype) - //! - //! In case of multiple result, explores the list and gives in - //! the first transient result IsKind(atype) - //! Returns True and fills if found - //! Else, returns False ( is not touched, not even nullified) - //! - //! This syntactic form avoids to do DownCast : if a result is - //! found with the good type, it is loaded in and can be - //! immediately used, well initialised - Standard_EXPORT Standard_Boolean FindTypedTransient (const Handle(Transfer_Finder)& start, const Handle(Standard_Type)& atype, Handle(Standard_Transient)& val) const; - - //! Safe variant for arbitrary type of argument - template - Standard_Boolean FindTypedTransient (const Handle(Transfer_Finder)& start, const Handle(Standard_Type)& atype, Handle(T)& val) const - { - Handle(Standard_Transient) aVal = val; - return FindTypedTransient (start, atype, aVal) && ! (val = Handle(T)::DownCast(aVal)).IsNull(); - } - - //! Searches for a transient result recorded in a Binder, whatever - //! this Binder is recorded or not in - //! - //! This is strictly equivalent to the class method GetTypedResult - //! from class SimpleBinderOfTransient, but is just lighter to call - //! - //! Apart from this, works as FindTypedTransient - Standard_EXPORT Standard_Boolean GetTypedTransient (const Handle(Transfer_Binder)& binder, const Handle(Standard_Type)& atype, Handle(Standard_Transient)& val) const; - - //! Safe variant for arbitrary type of argument - template - Standard_Boolean GetTypedTransient (const Handle(Transfer_Binder)& start, const Handle(Standard_Type)& atype, Handle(T)& val) const - { - Handle(Standard_Transient) aVal = val; - return GetTypedTransient (start, atype, aVal) && ! (val = Handle(T)::DownCast(aVal)).IsNull(); - } - - //! Returns the maximum possible value for Map Index - //! (no result can be bound with a value greater than it) - Standard_EXPORT Standard_Integer NbMapped() const; - - //! Returns the Starting Object bound to an Index, - Standard_EXPORT const Handle(Transfer_Finder)& Mapped (const Standard_Integer num) const; - - //! Returns the Index value bound to a Starting Object, 0 if none - Standard_EXPORT Standard_Integer MapIndex (const Handle(Transfer_Finder)& start) const; - - //! Returns the Binder bound to an Index - //! Considers a category number, by default 0 - Standard_EXPORT Handle(Transfer_Binder) MapItem (const Standard_Integer num) const; - - //! Declares (and its Result) as Root. This status will be - //! later exploited by RootResult, see below (Result can be - //! produced at any time) - Standard_EXPORT void SetRoot (const Handle(Transfer_Finder)& start); - - //! Enable (if True) or Disables (if False) Root - //! Management. If it is set, Transfers are considered as stacked - //! (a first Transfer commands other Transfers, and so on) and - //! the Transfers commanded by an external caller are "Root". - //! Remark : SetRoot can be called whatever this status, on every - //! object. - //! Default is set to True. - Standard_EXPORT void SetRootManagement (const Standard_Boolean stat); - - //! Returns the count of recorded Roots - Standard_EXPORT Standard_Integer NbRoots() const; - - //! Returns a Root Entity given its number in the list (1-NbRoots) - Standard_EXPORT const Handle(Transfer_Finder)& Root (const Standard_Integer num) const; - - //! Returns the Binder bound with a Root Entity given its number - //! Considers a category number, by default 0 - Standard_EXPORT Handle(Transfer_Binder) RootItem (const Standard_Integer num) const; - - //! Returns the index in the list of roots for a starting item, - //! or 0 if it is not recorded as a root - Standard_EXPORT Standard_Integer RootIndex (const Handle(Transfer_Finder)& start) const; - - //! Returns Nesting Level of Transfers (managed by methods - //! TranscriptWith & Co). Starts to zero. If no automatic Transfer - //! is used, it remains to zero. Zero means Root Level. - Standard_EXPORT Standard_Integer NestingLevel() const; - - //! Resets Nesting Level of Transfers to Zero (Root Level), - //! whatever its current value. - Standard_EXPORT void ResetNestingLevel(); - - //! Tells if has been recognized as good candidate for - //! Transfer. i.e. queries the Actor and its Nexts - Standard_EXPORT Standard_Boolean Recognize (const Handle(Transfer_Finder)& start) const; - - //! Performs the Transfer of a Starting Object, by calling - //! the method TransferProduct (see below). - //! Mapping and Roots are managed : nothing is done if a Result is - //! already Bound, an exception is raised in case of error. - Standard_EXPORT Handle(Transfer_Binder) Transferring (const Handle(Transfer_Finder)& start); - - //! Same as Transferring but does not return the Binder. - //! Simply returns True in case of success (for user call) - Standard_EXPORT Standard_Boolean Transfer (const Handle(Transfer_Finder)& start); - - //! Allows controls if exceptions will be handled - //! Transfer Operations - //! False : they are not handled with try {} catch {} - //! True : they are - //! Default is False: no handling performed - Standard_EXPORT void SetErrorHandle (const Standard_Boolean err); - - //! Returns error handling flag - Standard_EXPORT Standard_Boolean ErrorHandle() const; - - //! Method called when trace is asked - //! Calls PrintTrace to display information relevant for starting - //! objects (which can be redefined) - //! is Nesting Level of Transfer (0 = root) - //! controls the way the trace is done : - //! 0 neutral, 1 for Error, 2 for Warning message, 3 for new Root - Standard_EXPORT void StartTrace (const Handle(Transfer_Binder)& binder, const Handle(Transfer_Finder)& start, const Standard_Integer level, const Standard_Integer mode) const; - - //! Prints a short information on a starting object. By default - //! prints its Dynamic Type. Can be redefined - Standard_EXPORT virtual void PrintTrace (const Handle(Transfer_Finder)& start, const Handle(Message_Messenger)& S) const; - - //! Returns True if we are surely in a DeadLoop. Evaluation is not - //! exact, it is a "majorant" which must be computed fast. - //! This "majorant" is : greater than NbMapped. - Standard_EXPORT Standard_Boolean IsLooping (const Standard_Integer alevel) const; - - //! Returns, as an iterator, the log of root transfer, i.e. the - //! created objects and Binders bound to starting roots - //! If withstart is given True, Starting Objets are also returned - Standard_EXPORT Transfer_IteratorOfProcessForFinder RootResult (const Standard_Boolean withstart = Standard_False) const; - - //! Returns, as an Iterator, the entire log of transfer (list of - //! created objects and Binders which can bring errors) - //! If withstart is given True, Starting Objets are also returned - Standard_EXPORT Transfer_IteratorOfProcessForFinder CompleteResult (const Standard_Boolean withstart = Standard_False) const; - - //! Returns Binders which are neither "Done" nor "Initial", - //! that is Error,Loop or Run (abnormal states at end of Transfer) - //! Starting Objects are given in correspondance in the iterator - Standard_EXPORT Transfer_IteratorOfProcessForFinder AbnormalResult() const; - - //! Returns a CheckList as a list of Check : each one is for a - //! starting entity which have either check (warning or fail) - //! messages are attached, or are in abnormal state : that case - //! gives a specific message - //! If is True, checks with Warnings only are ignored - Standard_EXPORT Interface_CheckIterator CheckList (const Standard_Boolean erronly) const; - - //! Returns, as an Iterator, the log of transfer for one object - //! = 0 : this object only - //! and if is a scope owner (else, is ignored) : - //! = 1 : object plus its immediate scoped ones - //! = 2 : object plus all its scoped ones - Standard_EXPORT Transfer_IteratorOfProcessForFinder ResultOne (const Handle(Transfer_Finder)& start, const Standard_Integer level, const Standard_Boolean withstart = Standard_False) const; - - //! Returns a CheckList for one starting object - //! interpreted as by ResultOne - //! If is True, checks with Warnings only are ignored - Standard_EXPORT Interface_CheckIterator CheckListOne (const Handle(Transfer_Finder)& start, const Standard_Integer level, const Standard_Boolean erronly) const; - - //! Returns True if no check message is attached to a starting - //! object. interpreted as by ResultOne - //! If is True, checks with Warnings only are ignored - Standard_EXPORT Standard_Boolean IsCheckListEmpty (const Handle(Transfer_Finder)& start, const Standard_Integer level, const Standard_Boolean erronly) const; - - //! Removes Results attached to (== Unbinds) a given object and, - //! according : - //! = 0 : only it - //! = 1 : it plus its immediately owned sub-results(scope) - //! = 2 : it plus all its owned sub-results(scope) - Standard_EXPORT void RemoveResult (const Handle(Transfer_Finder)& start, const Standard_Integer level, const Standard_Boolean compute = Standard_True); - - //! Computes a number to be associated to a starting object in - //! a check or a check-list - //! By default, returns 0; can be redefined - Standard_EXPORT virtual Standard_Integer CheckNum (const Handle(Transfer_Finder)& start) const; - - //! Sets Progress indicator - Standard_EXPORT void SetProgress (const Handle(Message_ProgressIndicator)& theProgress); - - //! Gets Progress indicator - Standard_EXPORT Handle(Message_ProgressIndicator) GetProgress() const; - - - - - DEFINE_STANDARD_RTTI_INLINE(Transfer_ProcessForFinder,MMgt_TShared) - -protected: - - - - -private: - - - //! Same as Find but stores the last access to the map, for a - //! faster access on next calls (as Bind does too) - //! Considers a category number, by default 0 - //! C++ : return const & - Standard_EXPORT Handle(Transfer_Binder) FindAndMask (const Handle(Transfer_Finder)& start); - - //! Internal action of Transfer, called by Transferring, with or - //! without ErrorHandle. It invokes the Actor to work (set by - //! SetActor), and tries its Nexts if no result is produced, - //! until a Non Null Binder is produced. - //! But keep in mind that a Null Binder can allways be returned - //! if a Starting Entity has not been recognized at all. - Standard_EXPORT Handle(Transfer_Binder) TransferProduct (const Handle(Transfer_Finder)& start); - - Standard_Boolean theerrh; - Standard_Integer thetrace; - Handle(Message_Messenger) themessenger; - Standard_Integer thelevel; - Standard_Integer therootl; - Standard_Boolean therootm; - TColStd_IndexedMapOfInteger theroots; - Handle(Transfer_Finder) thelastobj; - Handle(Transfer_Binder) thelastbnd; - Standard_Integer theindex; - Handle(Transfer_ActorOfProcessForFinder) theactor; - Transfer_TransferMapOfProcessForFinder themap; - Handle(Message_ProgressIndicator) myProgress; - - -}; - - - - +#include +#include +typedef Transfer_ProcessGen Transfer_ProcessForFinder; #endif // _Transfer_ProcessForFinder_HeaderFile diff --git a/src/Transfer/Transfer_ProcessForFinder_0.cxx b/src/Transfer/Transfer_ProcessForFinder_0.cxx deleted file mode 100644 index c28c75b096..0000000000 --- a/src/Transfer/Transfer_ProcessForFinder_0.cxx +++ /dev/null @@ -1,54 +0,0 @@ -// Created on: 1992-02-03 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 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 - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define TheStart Handle(Transfer_Finder) -#define TheStart_hxx -#define TheMapHasher Transfer_FindHasher -#define TheMapHasher_hxx -#define Handle_TheList Handle(Transfer_HSequenceOfFinder) -#define TheList Transfer_HSequenceOfFinder -#define TheList_hxx -#define Transfer_TransferMap Transfer_TransferMapOfProcessForFinder -#define Transfer_TransferMap_hxx -#define Transfer_Iterator Transfer_IteratorOfProcessForFinder -#define Transfer_Iterator_hxx -#define Transfer_Actor Transfer_ActorOfProcessForFinder -#define Transfer_Actor_hxx -#define Handle_Transfer_Actor Handle(Transfer_ActorOfProcessForFinder) -#define Transfer_TransferProcess Transfer_ProcessForFinder -#define Transfer_TransferProcess_hxx -#define Handle_Transfer_TransferProcess Handle(Transfer_ProcessForFinder) -#include - diff --git a/src/Transfer/Transfer_ProcessForTransient.hxx b/src/Transfer/Transfer_ProcessForTransient.hxx index 51b55461e0..dbc67c566a 100644 --- a/src/Transfer/Transfer_ProcessForTransient.hxx +++ b/src/Transfer/Transfer_ProcessForTransient.hxx @@ -17,439 +17,10 @@ #ifndef _Transfer_ProcessForTransient_HeaderFile #define _Transfer_ProcessForTransient_HeaderFile -#include -#include -#include -#include - -class Message_Messenger; -class Standard_Transient; -class Transfer_Binder; -class Transfer_ActorOfProcessForTransient; -class Message_ProgressIndicator; -class Interface_InterfaceError; -class Transfer_TransferFailure; -class Transfer_IteratorOfProcessForTransient; -class Message_Msg; -class Interface_Check; -class Interface_CheckIterator; - - -class Transfer_ProcessForTransient; -DEFINE_STANDARD_HANDLE(Transfer_ProcessForTransient, MMgt_TShared) - -//! Manages Transfer of Transient Objects. Produces also -//! ActorOfTransientProcess (deferred class), -//! IteratorOfTransientProcess (for Results), -//! TransferMapOfTransientProcess (internally used) -//! Normally uses as TransientProcess, which adds some specifics - -class Transfer_ProcessForTransient : public MMgt_TShared -{ - -public: - - - //! Sets TransferProcess at initial state. Gives an Initial size - //! (indicative) for the Map when known (default is 10000). - //! Sets default trace file as a printer and default trace level - //! (see Message_TraceFile). - Standard_EXPORT Transfer_ProcessForTransient(const Standard_Integer nb = 10000); - - //! Sets TransferProcess at initial state. Gives an Initial size - //! (indicative) for the Map when known (default is 10000). - //! Sets a specified printer. - Standard_EXPORT Transfer_ProcessForTransient(const Handle(Message_Messenger)& printer, const Standard_Integer nb = 10000); - - //! Resets a TransferProcess as ready for a completely new work. - //! Clears general data (roots) and the Map - Standard_EXPORT void Clear(); - - //! Rebuilds the Map and the roots to really remove Unbound items - //! Because Unbind keeps the entity in place, even if not bound - //! Hence, working by checking new items is meaningless if a - //! formerly unbound item is rebound - Standard_EXPORT void Clean(); - - //! Resizes the Map as required (if a new reliable value has been - //! determined). Acts only if is greater than actual NbMapped - Standard_EXPORT void Resize (const Standard_Integer nb); - - //! Defines an Actor, which is used for automatic Transfer - //! If already defined, the new Actor is cumulated - //! (see SetNext from Actor) - Standard_EXPORT void SetActor (const Handle(Transfer_ActorOfProcessForTransient)& actor); - - //! Returns the defined Actor. Returns a Null Handle if - //! not set. - Standard_EXPORT Handle(Transfer_ActorOfProcessForTransient) Actor() const; - - //! Returns the Binder which is linked with a starting Object - //! It can either bring a Result (Transfer done) or none (for a - //! pre-binding). - //! If no Binder is linked with , returns a Null Handle - //! Considers a category number, by default 0 - Standard_EXPORT Handle(Transfer_Binder) Find (const Handle(Standard_Transient)& start) const; - - //! Returns True if a Result (whatever its form) is Bound with - //! a starting Object. I.e., if a Binder with a Result set, - //! is linked with it - //! Considers a category number, by default 0 - Standard_EXPORT Standard_Boolean IsBound (const Handle(Standard_Transient)& start) const; - - //! Returns True if the result of the transfer of an object is - //! already used in other ones. If it is, Rebind cannot change it. - //! Considers a category number, by default 0 - Standard_EXPORT Standard_Boolean IsAlreadyUsed (const Handle(Standard_Transient)& start) const; - - //! Creates a Link a starting Object with a Binder. This Binder - //! can either bring a Result (effective Binding) or none (it can - //! be set later : pre-binding). - //! Considers a category number, by default 0 - Standard_EXPORT void Bind (const Handle(Standard_Transient)& start, const Handle(Transfer_Binder)& binder); - - //! Changes the Binder linked with a starting Object for its - //! unitary transfer. This it can be useful when the exact form - //! of the result is known once the transfer is widely engaged. - //! This can be done only on first transfer. - //! Considers a category number, by default 0 - Standard_EXPORT void Rebind (const Handle(Standard_Transient)& start, const Handle(Transfer_Binder)& binder); - - //! Removes the Binder linked with a starting object - //! If this Binder brings a non-empty Check, it is replaced by - //! a VoidBinder. Also removes from the list of Roots as required. - //! Returns True if done, False if was not bound - //! Considers a category number, by default 0 - Standard_EXPORT Standard_Boolean Unbind (const Handle(Standard_Transient)& start); - - //! Returns a Binder for a starting entity, as follows : - //! Tries to Find the already bound one - //! If none found, creates a VoidBinder and Binds it - Standard_EXPORT Handle(Transfer_Binder) FindElseBind (const Handle(Standard_Transient)& start); - - //! Sets Messenger used for outputting messages. - Standard_EXPORT void SetMessenger (const Handle(Message_Messenger)& messenger); - - //! Returns Messenger used for outputting messages. - //! The returned object is guaranteed to be non-null; - //! default is Message::Messenger(). - Standard_EXPORT Handle(Message_Messenger) Messenger() const; - - //! Sets trace level used for outputting messages: - //! = 0 : no trace at all - //! = 1 : handled exceptions and calls to AddError - //! = 2 : also calls to AddWarning - //! = 3 : also traces new Roots - //! (uses method ErrorTrace). - //! Default is 1 : Errors traced - Standard_EXPORT void SetTraceLevel (const Standard_Integer tracelev); - - //! Returns trace level used for outputting messages. - Standard_EXPORT Standard_Integer TraceLevel() const; - - //! New name for AddFail (Msg) - Standard_EXPORT void SendFail (const Handle(Standard_Transient)& start, const Message_Msg& amsg); - - //! New name for AddWarning (Msg) - Standard_EXPORT void SendWarning (const Handle(Standard_Transient)& start, const Message_Msg& amsg); - - //! Adds an information message - //! Trace is filled if trace level is at least 3 - Standard_EXPORT void SendMsg (const Handle(Standard_Transient)& start, const Message_Msg& amsg); - - //! Adds an Error message to a starting entity (to the check of - //! its Binder of category 0, as a Fail) - Standard_EXPORT void AddFail (const Handle(Standard_Transient)& start, const Standard_CString mess, const Standard_CString orig = ""); - - //! (other name of AddFail, maintained for compatibility) - Standard_EXPORT void AddError (const Handle(Standard_Transient)& start, const Standard_CString mess, const Standard_CString orig = ""); - - //! Adds an Error Message to a starting entity from the definition - //! of a Msg (Original+Value) - Standard_EXPORT void AddFail (const Handle(Standard_Transient)& start, const Message_Msg& amsg); - - //! Adds a Warning message to a starting entity (to the check of - //! its Binder of category 0) - Standard_EXPORT void AddWarning (const Handle(Standard_Transient)& start, const Standard_CString mess, const Standard_CString orig = ""); - - //! Adds a Warning Message to a starting entity from the definition - //! of a Msg (Original+Value) - Standard_EXPORT void AddWarning (const Handle(Standard_Transient)& start, const Message_Msg& amsg); - - Standard_EXPORT void Mend (const Handle(Standard_Transient)& start, const Standard_CString pref = ""); - - //! Returns the Check attached to a starting entity. If - //! is unknown, returns an empty Check - //! Adds a case name to a starting entity - //! Adds a case value to a starting entity - //! Returns the complete case list for an entity. Null Handle if empty - //! In the list of mapped items (between 1 and NbMapped), - //! searches for the first item which follows (not included) - //! and which has an attribute named - //! Attributes are brought by Binders - //! Hence, allows such an iteration - //! - //! for (num = TP->NextItemWithAttribute(name,0); - //! num > 0; - //! num = TP->NextItemWithAttribute(name,num) { - //! .. process mapped item - //! } - //! Returns the type of an Attribute attached to binders - //! If this name gives no Attribute, returns ParamVoid - //! If this name gives several different types, returns ParamMisc - //! Else, returns the effective type (ParamInteger, ParamReal, - //! ParamIdent, or ParamText) - //! Returns the list of recorded Attribute Names, as a Dictionary - //! of Integer : each value gives the count of items which bring - //! this attribute name - //! By default, considers all the attribute names - //! If is given, considers only the attribute names - //! which begin by - Standard_EXPORT Handle(Interface_Check) Check (const Handle(Standard_Transient)& start) const; - - //! Binds a starting object with a Transient Result. - //! Uses a SimpleBinderOfTransient to work. If there is already - //! one but with no Result set, sets its Result. - //! Considers a category number, by default 0 - Standard_EXPORT void BindTransient (const Handle(Standard_Transient)& start, const Handle(Standard_Transient)& res); - - //! Returns the Result of the Transfer of an object as a - //! Transient Result. - //! Returns a Null Handle if there is no Transient Result - //! Considers a category number, by default 0 - //! Warning : Supposes that Binding is done with a SimpleBinderOfTransient - Standard_EXPORT const Handle(Standard_Transient)& FindTransient (const Handle(Standard_Transient)& start) const; - - //! Prepares an object to be bound with several results. - //! If no Binder is yet attached to , a MultipleBinder - //! is created, empty. If a Binder is already set, it must - //! accept Multiple Binding. - //! Considers a category number, by default 0 - Standard_EXPORT void BindMultiple (const Handle(Standard_Transient)& start); - - //! Adds an item to a list of results bound to a starting object. - //! Considers a category number, by default 0, for all results - Standard_EXPORT void AddMultiple (const Handle(Standard_Transient)& start, const Handle(Standard_Transient)& res); - - //! Searches for a transient result attached to a starting object, - //! according to its type, by criterium IsKind(atype) - //! - //! In case of multiple result, explores the list and gives in - //! the first transient result IsKind(atype) - //! Returns True and fills if found - //! Else, returns False ( is not touched, not even nullified) - //! - //! This syntactic form avoids to do DownCast : if a result is - //! found with the good type, it is loaded in and can be - //! immediately used, well initialised - Standard_EXPORT Standard_Boolean FindTypedTransient (const Handle(Standard_Transient)& start, const Handle(Standard_Type)& atype, Handle(Standard_Transient)& val) const; - - //! Searches for a transient result recorded in a Binder, whatever - //! this Binder is recorded or not in - //! - //! This is strictly equivalent to the class method GetTypedResult - //! from class SimpleBinderOfTransient, but is just lighter to call - //! - //! Apart from this, works as FindTypedTransient - Standard_EXPORT Standard_Boolean GetTypedTransient (const Handle(Transfer_Binder)& binder, const Handle(Standard_Type)& atype, Handle(Standard_Transient)& val) const; - - //! Returns the maximum possible value for Map Index - //! (no result can be bound with a value greater than it) - Standard_EXPORT Standard_Integer NbMapped() const; - - //! Returns the Starting Object bound to an Index, - Standard_EXPORT const Handle(Standard_Transient)& Mapped (const Standard_Integer num) const; - - //! Returns the Index value bound to a Starting Object, 0 if none - Standard_EXPORT Standard_Integer MapIndex (const Handle(Standard_Transient)& start) const; - - //! Returns the Binder bound to an Index - //! Considers a category number, by default 0 - Standard_EXPORT Handle(Transfer_Binder) MapItem (const Standard_Integer num) const; - - //! Declares (and its Result) as Root. This status will be - //! later exploited by RootResult, see below (Result can be - //! produced at any time) - Standard_EXPORT void SetRoot (const Handle(Standard_Transient)& start); - - //! Enable (if True) or Disables (if False) Root - //! Management. If it is set, Transfers are considered as stacked - //! (a first Transfer commands other Transfers, and so on) and - //! the Transfers commanded by an external caller are "Root". - //! Remark : SetRoot can be called whatever this status, on every - //! object. - //! Default is set to True. - Standard_EXPORT void SetRootManagement (const Standard_Boolean stat); - - //! Returns the count of recorded Roots - Standard_EXPORT Standard_Integer NbRoots() const; - - //! Returns a Root Entity given its number in the list (1-NbRoots) - Standard_EXPORT const Handle(Standard_Transient)& Root (const Standard_Integer num) const; - - //! Returns the Binder bound with a Root Entity given its number - //! Considers a category number, by default 0 - Standard_EXPORT Handle(Transfer_Binder) RootItem (const Standard_Integer num) const; - - //! Returns the index in the list of roots for a starting item, - //! or 0 if it is not recorded as a root - Standard_EXPORT Standard_Integer RootIndex (const Handle(Standard_Transient)& start) const; - - //! Returns Nesting Level of Transfers (managed by methods - //! TranscriptWith & Co). Starts to zero. If no automatic Transfer - //! is used, it remains to zero. Zero means Root Level. - Standard_EXPORT Standard_Integer NestingLevel() const; - - //! Resets Nesting Level of Transfers to Zero (Root Level), - //! whatever its current value. - Standard_EXPORT void ResetNestingLevel(); - - //! Tells if has been recognized as good candidate for - //! Transfer. i.e. queries the Actor and its Nexts - Standard_EXPORT Standard_Boolean Recognize (const Handle(Standard_Transient)& start) const; - - //! Performs the Transfer of a Starting Object, by calling - //! the method TransferProduct (see below). - //! Mapping and Roots are managed : nothing is done if a Result is - //! already Bound, an exception is raised in case of error. - Standard_EXPORT Handle(Transfer_Binder) Transferring (const Handle(Standard_Transient)& start); - - //! Same as Transferring but does not return the Binder. - //! Simply returns True in case of success (for user call) - Standard_EXPORT Standard_Boolean Transfer (const Handle(Standard_Transient)& start); - - //! Allows controls if exceptions will be handled - //! Transfer Operations - //! False : they are not handled with try {} catch {} - //! True : they are - //! Default is False: no handling performed - Standard_EXPORT void SetErrorHandle (const Standard_Boolean err); - - //! Returns error handling flag - Standard_EXPORT Standard_Boolean ErrorHandle() const; - - //! Method called when trace is asked - //! Calls PrintTrace to display information relevant for starting - //! objects (which can be redefined) - //! is Nesting Level of Transfer (0 = root) - //! controls the way the trace is done : - //! 0 neutral, 1 for Error, 2 for Warning message, 3 for new Root - Standard_EXPORT void StartTrace (const Handle(Transfer_Binder)& binder, const Handle(Standard_Transient)& start, const Standard_Integer level, const Standard_Integer mode) const; - - //! Prints a short information on a starting object. By default - //! prints its Dynamic Type. Can be redefined - Standard_EXPORT virtual void PrintTrace (const Handle(Standard_Transient)& start, const Handle(Message_Messenger)& S) const; - - //! Returns True if we are surely in a DeadLoop. Evaluation is not - //! exact, it is a "majorant" which must be computed fast. - //! This "majorant" is : greater than NbMapped. - Standard_EXPORT Standard_Boolean IsLooping (const Standard_Integer alevel) const; - - //! Returns, as an iterator, the log of root transfer, i.e. the - //! created objects and Binders bound to starting roots - //! If withstart is given True, Starting Objets are also returned - Standard_EXPORT Transfer_IteratorOfProcessForTransient RootResult (const Standard_Boolean withstart = Standard_False) const; - - //! Returns, as an Iterator, the entire log of transfer (list of - //! created objects and Binders which can bring errors) - //! If withstart is given True, Starting Objets are also returned - Standard_EXPORT Transfer_IteratorOfProcessForTransient CompleteResult (const Standard_Boolean withstart = Standard_False) const; - - //! Returns Binders which are neither "Done" nor "Initial", - //! that is Error,Loop or Run (abnormal states at end of Transfer) - //! Starting Objects are given in correspondance in the iterator - Standard_EXPORT Transfer_IteratorOfProcessForTransient AbnormalResult() const; - - //! Returns a CheckList as a list of Check : each one is for a - //! starting entity which have either check (warning or fail) - //! messages are attached, or are in abnormal state : that case - //! gives a specific message - //! If is True, checks with Warnings only are ignored - Standard_EXPORT Interface_CheckIterator CheckList (const Standard_Boolean erronly) const; - - //! Returns, as an Iterator, the log of transfer for one object - //! = 0 : this object only - //! and if is a scope owner (else, is ignored) : - //! = 1 : object plus its immediate scoped ones - //! = 2 : object plus all its scoped ones - Standard_EXPORT Transfer_IteratorOfProcessForTransient ResultOne (const Handle(Standard_Transient)& start, const Standard_Integer level, const Standard_Boolean withstart = Standard_False) const; - - //! Returns a CheckList for one starting object - //! interpreted as by ResultOne - //! If is True, checks with Warnings only are ignored - Standard_EXPORT Interface_CheckIterator CheckListOne (const Handle(Standard_Transient)& start, const Standard_Integer level, const Standard_Boolean erronly) const; - - //! Returns True if no check message is attached to a starting - //! object. interpreted as by ResultOne - //! If is True, checks with Warnings only are ignored - Standard_EXPORT Standard_Boolean IsCheckListEmpty (const Handle(Standard_Transient)& start, const Standard_Integer level, const Standard_Boolean erronly) const; - - //! Removes Results attached to (== Unbinds) a given object and, - //! according : - //! = 0 : only it - //! = 1 : it plus its immediately owned sub-results(scope) - //! = 2 : it plus all its owned sub-results(scope) - Standard_EXPORT void RemoveResult (const Handle(Standard_Transient)& start, const Standard_Integer level, const Standard_Boolean compute = Standard_True); - - //! Computes a number to be associated to a starting object in - //! a check or a check-list - //! By default, returns 0; can be redefined - Standard_EXPORT virtual Standard_Integer CheckNum (const Handle(Standard_Transient)& start) const; - - //! Sets Progress indicator - Standard_EXPORT void SetProgress (const Handle(Message_ProgressIndicator)& theProgress); - - //! Gets Progress indicator - Standard_EXPORT Handle(Message_ProgressIndicator) GetProgress() const; - - - - - DEFINE_STANDARD_RTTI_INLINE(Transfer_ProcessForTransient,MMgt_TShared) - -protected: - - - - -private: - - - //! Same as Find but stores the last access to the map, for a - //! faster access on next calls (as Bind does too) - //! Considers a category number, by default 0 - //! C++ : return const & - Standard_EXPORT Handle(Transfer_Binder) FindAndMask (const Handle(Standard_Transient)& start); - - //! Internal action of Transfer, called by Transferring, with or - //! without ErrorHandle. It invokes the Actor to work (set by - //! SetActor), and tries its Nexts if no result is produced, - //! until a Non Null Binder is produced. - //! But keep in mind that a Null Binder can allways be returned - //! if a Starting Entity has not been recognized at all. - Standard_EXPORT Handle(Transfer_Binder) TransferProduct (const Handle(Standard_Transient)& start); - - Standard_Boolean theerrh; - Standard_Integer thetrace; - Handle(Message_Messenger) themessenger; - Standard_Integer thelevel; - Standard_Integer therootl; - Standard_Boolean therootm; - TColStd_IndexedMapOfInteger theroots; - Handle(Standard_Transient) thelastobj; - Handle(Transfer_Binder) thelastbnd; - Standard_Integer theindex; - Handle(Transfer_ActorOfProcessForTransient) theactor; - Transfer_TransferMapOfProcessForTransient themap; - Handle(Message_ProgressIndicator) myProgress; - - -}; - - - - +#include +#include +typedef Transfer_ProcessGen Transfer_ProcessForTransient; #endif // _Transfer_ProcessForTransient_HeaderFile diff --git a/src/Transfer/Transfer_ProcessForTransient_0.cxx b/src/Transfer/Transfer_ProcessForTransient_0.cxx deleted file mode 100644 index 8680af0eea..0000000000 --- a/src/Transfer/Transfer_ProcessForTransient_0.cxx +++ /dev/null @@ -1,52 +0,0 @@ -// Created on: 1992-02-03 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 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 - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define TheStart Handle(Standard_Transient) -#define TheStart_hxx -#define TheMapHasher TColStd_MapTransientHasher -#define TheMapHasher_hxx -#define Handle_TheList Handle(TColStd_HSequenceOfTransient) -#define TheList TColStd_HSequenceOfTransient -#define TheList_hxx -#define Transfer_TransferMap Transfer_TransferMapOfProcessForTransient -#define Transfer_TransferMap_hxx -#define Transfer_Iterator Transfer_IteratorOfProcessForTransient -#define Transfer_Iterator_hxx -#define Transfer_Actor Transfer_ActorOfProcessForTransient -#define Transfer_Actor_hxx -#define Handle_Transfer_Actor Handle(Transfer_ActorOfProcessForTransient) -#define Transfer_TransferProcess Transfer_ProcessForTransient -#define Transfer_TransferProcess_hxx -#define Handle_Transfer_TransferProcess Handle(Transfer_ProcessForTransient) -#include - diff --git a/src/Transfer/Transfer_ProcessGen.hxx b/src/Transfer/Transfer_ProcessGen.hxx new file mode 100644 index 0000000000..2942636559 --- /dev/null +++ b/src/Transfer/Transfer_ProcessGen.hxx @@ -0,0 +1,1017 @@ +// Copyright (c) 1999-2014 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. + +// TheSourceType is assumed Handle(Standard_Transient) or Handle(Transfer_Finder) +// It should provide : "==" , .IsNull() , ->DynamicType() + +#ifndef _Transfer_ProcessGen_HeaderFile +#define _Transfer_ProcessGen_HeaderFile + +#include + +#include +#include + +#include +#include +#include + +class Interface_InterfaceModel; +#include +#include + +class Transfer_Binder; +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include + + +template < class TheKeyType, + class TheListType > +class Transfer_ProcessGen : public MMgt_TShared +{ + public: + + typedef NCollection_IndexedDataMap Transfer_MapOfProcess; + + class Actor : public Transfer_Actor + { + public: + + Standard_EXPORT Actor() {} + + //! Prerequesite for Transfer : the method Transfer is + //! called on a starting object only if Recognize has + //! returned True on it + //! This allows to define a list of Actors, each one + //! processing a definite kind of data + //! TransferProcess calls Recognize on each one before + //! calling Transfer. But even if Recognize has returned + //! True, Transfer can reject by returning a Null Binder + //! (afterwards rejection), the next actor is then invoked + //! + //! The provided default returns True, can be redefined + Standard_EXPORT virtual Standard_Boolean Recognize (const TheKeyType& /*start*/) { return Standard_True; } + + //! Specific action of Transfer. The Result is stored in + //! the returned Binder, or a Null Handle for "No result" + //! (Default defined as doing nothing; should be deffered) + //! "mutable" allows the Actor to record intermediate + //! information, in addition to those of TransferProcess + Standard_EXPORT virtual Handle(Transfer_Binder) Transferring (const TheKeyType& /*start*/, const Handle(Transfer_ProcessGen)& /*TP*/) { return NULL; } + + //! Defines a Next Actor : it can then be asked to work if + //! produces no result for a given type of Object. + //! If Next is already set and is not "Last", calls + //! SetNext on it. If Next defined and "Last", the new + //! actor is added before it in the list + Standard_EXPORT void SetNext (const Handle(Actor)& next) + { + if (thenext == next) return; + if (thenext.IsNull()) thenext = next; + else thenext->SetNext(next); + } + + //! Returns the Actor defined as Next, or a Null Handle + const Handle(Actor) & Next() const { return thenext; } + + DEFINE_STANDARD_RTTI_INLINE(Actor,Transfer_Actor) + + protected: + + Handle(Actor) thenext; + }; + + class Iterator : public Transfer_Iterator + { + public: + + DEFINE_STANDARD_ALLOC + + //! Creates an empty Iterator + //! If WithSource is True, each Binder to be iterated will + //! be associated to its corresponding Source Object + Standard_EXPORT Iterator(const Standard_Boolean WithSource) + { if (WithSource) mySourceObjects = new TheListType(); } + + //! Adds a Binder to the iteration list (construction) + //! with no corresponding Starting Object + //! (note that Result is brought by Binder) + Standard_EXPORT void Add (const Handle(Transfer_Binder)& theBinder) + { + if (!mySourceObjects.IsNull()) + Standard_NoSuchObject::Raise("Transfer_ProcessGen::Iterator::Add, Source Object required but not provided"); + AddItem(theBinder); + } + + //! Adds a Binder to the iteration list, associated with + //! its corresponding Starting Object "start" + //! Starting Object is ignored if not required at + //! Creation time + Standard_EXPORT void Add (const Handle(Transfer_Binder)& theBinder, const TheKeyType& theSource) + { + AddItem(theBinder); + if (!mySourceObjects.IsNull()) mySourceObjects->Append(theSource); + } + + //! After having added all items, keeps or rejects items + //! which are attached to starting data given by + //! = True (D) : keeps. = False : rejects + //! Does nothing if was False + Standard_EXPORT void Filter (const Handle(TheListType)& theList) + { + if (theList.IsNull() || mySourceObjects.IsNull()) return; + Standard_Integer i, j, nb = mySourceObjects->Length(); + if (nb == 0) return; + Handle(Transfer_Binder) factice; + Transfer_MapOfProcess amap (nb); + for (i = 1; i <= nb; i ++) { + j = amap.Add (mySourceObjects->Value(i),factice); + SelectItem (j,Standard_False); + } + + // Comparaison + nb = theList->Length(); + for (i = 1; i <= nb; i ++) { + j = amap.FindIndex (theList->Value(i)); + if (j > 0) SelectItem (j,Standard_True); + } + } + + //! Returns corresponding Source Object + Standard_EXPORT const TheKeyType& SourceObject() const + { + if (mySourceObjects.IsNull()) + Standard_NoSuchObject::Raise("Transfer_ProcessGen::Iterator : No Source Objects defined at all"); + return mySourceObjects->Value(thecurr); + } + + private: + + Handle(TheListType) mySourceObjects; + }; + + public: + + //! Sets TransferProcess at initial state. Gives an Initial size + //! (indicative) for the Map when known (default is 10000). + //! Sets default trace file as a printer and default trace level + //! (see Message_TraceFile). + Standard_EXPORT Transfer_ProcessGen(const Standard_Integer nb = 10000) + : themap (nb) + { + therootm = Standard_False; + thelevel = 0; therootl = 0; + themessenger = Message::DefaultMessenger(); + thetrace = 0; + theindex = 0; + } + + //! Sets TransferProcess at initial state. Gives an Initial size + //! (indicative) for the Map when known (default is 10000). + //! Sets a specified printer. + Standard_EXPORT Transfer_ProcessGen(const Handle(Message_Messenger)& messenger, const Standard_Integer nb = 10000) + : themap (nb) + { + therootm = Standard_False; + thelevel = 0; therootl = 0; + SetMessenger (messenger); + thetrace = 1; + theindex = 0; + } + + //! Sets an InterfaceModel, which can be used during transfer + //! for instance if a context must be managed, it is in the Model + void SetModel (const Handle(Interface_InterfaceModel)& model) { themodel = model; } + + //! Returns the Model which can be used for context + const Handle(Interface_InterfaceModel)& Model() const { return themodel; } + + //! Resets a TransferProcess as ready for a completely new work. + //! Clears general data (roots) and the Map + Standard_EXPORT void Clear() + { + thelevel = 0; therootl = 0; + theroots.Clear(); + themap.Clear(); + theindex = 0; thelastobj.Nullify(); thelastbnd.Nullify(); + } + + //! Rebuilds the Map and the roots to really remove Unbound items + //! Because Unbind keeps the entity in place, even if not bound + //! Hence, working by checking new items is meaningless if a + //! formerly unbound item is rebound + Standard_EXPORT void Clean() + { + Standard_Integer i, nb = NbMapped(); + Standard_Integer j,unb = 0; + for (i = 1; i <= nb; i ++) { + if (themap(i).IsNull()) unb ++; + } + if (unb == 0) return; + + // Refaire la map -> decalages + TColStd_Array1OfInteger unbs (1,nb); unbs.Init(0); + Transfer_TransferMap newmap (nb*2); + for (i = 1; i <= nb; i ++) { + TheKeyType ent = Mapped(i); + Handle(Transfer_Binder) bnd = MapItem(i); + if (bnd.IsNull()) continue; + j = newmap.Add (ent,bnd); + unbs.SetValue (i,j); + } + themap.Assign (newmap); + + // Update the map of roots + TColStd_IndexedMapOfInteger aNewRoots; + for( i=1; i<= theroots.Extent(); i++ ) { + j = theroots.FindKey(i); + Standard_Integer k = unbs.Value(j); + if ( k ) aNewRoots.Add ( k ); + } + theroots.Clear(); + theroots = aNewRoots; + + // Le reste : nettoyage + thelastobj.Nullify(); + thelastbnd.Nullify(); + theindex = 0; + } + + //! Resizes the Map as required (if a new reliable value has been + //! determined). Acts only if is greater than actual NbMapped + Standard_EXPORT void Resize (const Standard_Integer nb) { if (nb > themap.NbBuckets()) themap.ReSize(nb); } + + //! Defines an Actor, which is used for automatic Transfer + //! If already defined, the new Actor is cumulated + //! (see SetNext from Actor) + Standard_EXPORT void SetActor (const Handle(Actor)& actor) + { + if (theactor == actor) return; + if (theactor.IsNull()) theactor = actor; + else if (actor.IsNull()) theactor = actor; // declenche RAZ + else theactor->SetNext(actor); + } + + //! Returns the Binder which is linked with a starting Object + //! It can either bring a Result (Transfer done) or none (for a + //! pre-binding). + //! If no Binder is linked with , returns a Null Handle + //! Considers a category number, by default 0 + Standard_EXPORT Handle(Transfer_Binder) Find (const TheKeyType& start) const + { + if (thelastobj == start) { + if (theindex > 0) return thelastbnd; + } + const Standard_Integer index = themap.FindIndex (start); + if (index > 0) { + return themap.FindFromIndex(index); + } + return NULL; + } + + //! Returns True if a Result (whatever its form) is Bound with a starting Object. + //! I.e., if a Binder with a Result set, is linked with it + Standard_EXPORT Standard_Boolean IsBound (const TheKeyType& start) const + { + Handle(Transfer_Binder) binder = Find(start); + return (binder.IsNull()? Standard_False : binder->HasResult()); + } + + //! Creates a Link a starting Object with a Binder. This Binder + //! can either bring a Result (effective Binding) or none (it can + //! be set later : pre-binding). + //! Considers a category number, by default 0 + Standard_EXPORT void Bind (const TheKeyType& start, const Handle(Transfer_Binder)& binder) + { + if (binder.IsNull()) return; + Handle(Transfer_Binder) former = FindAndMask(start); + if (!former.IsNull()) { + // On admet VoidBinder : alors on reprend son Check + if (former->DynamicType() == STANDARD_TYPE(Transfer_VoidBinder)) { + binder->Merge(former); + themap(theindex) = binder; // Substitution + } + else if (former->Status() == Transfer_StatusUsed) { + StartTrace (former,start,thelevel,4); + Transfer_TransferFailure::Raise ("TransferProcess : Bind, already Bound"); + } + else { + if (thetrace > 2) StartTrace (former,start,thelevel,5); + binder->CCheck()->GetMessages (former->Check()); + } + } + if (theindex == 0 || thelastbnd.IsNull()) { + if (theindex == 0) theindex = themap.Add(start,binder); // Nouveau + else themap(theindex) = binder; // idem en fait + thelastbnd = binder; + } + else { + thelastbnd = binder; + themap(theindex) = binder; + } + } + + //! Removes the Binder linked with a starting object + //! If this Binder brings a non-empty Check, it is replaced by + //! a VoidBinder. Also removes from the list of Roots as required. + //! Returns True if done, False if was not bound + //! Considers a category number, by default 0 + Standard_EXPORT Standard_Boolean Unbind (const TheKeyType& start) + { + Handle(Transfer_Binder) former = FindAndMask(start); + if (theindex == 0) return Standard_False; + if (former.IsNull()) return Standard_False; + if (former->DynamicType() == STANDARD_TYPE(Transfer_VoidBinder)) return Standard_True; + themap(theindex) = thelastbnd; + if(theroots.Contains(theindex)) { + TColStd_IndexedMapOfInteger aNewRoots; + for(Standard_Integer i = 1; i <= theroots.Extent(); i++) + if(theindex!= theroots.FindKey(i)) + aNewRoots.Add(theroots.FindKey(i)); + + theroots.Clear(); + theroots = aNewRoots; + } + + thelastobj.Nullify(); + thelastbnd.Nullify(); + theindex = 0; + return Standard_True; + } + + //! Sets Messenger used for outputting messages. + Standard_EXPORT void SetMessenger (const Handle(Message_Messenger)& messenger) + { themessenger = messenger.IsNull()? Message::DefaultMessenger() : messenger; } + + //! Returns Messenger used for outputting messages. + //! The returned object is guaranteed to be non-null; + //! default is Message::Messenger(). + Standard_EXPORT const Handle(Message_Messenger) & Messenger() const { return themessenger; } + + //! Sets trace level used for outputting messages: + //! = 0 : no trace at all + //! = 1 : handled exceptions and calls to AddError + //! = 2 : also calls to AddWarning + //! = 3 : also traces new Roots + //! (uses method ErrorTrace). + //! Default is 1 : Errors traced + Standard_EXPORT void SetTraceLevel (const Standard_Integer tracelev) { thetrace = tracelev; } + + //! Returns trace level used for outputting messages. + Standard_EXPORT Standard_Integer TraceLevel() const { return thetrace; } + + //! New name for AddFail (Msg) + Standard_EXPORT void SendFail (const TheKeyType& start, const Message_Msg& amsg) { AddFail(start,amsg); } + + //! New name for AddWarning (Msg) + Standard_EXPORT void SendWarning (const TheKeyType& start, const Message_Msg& amsg) { AddWarning(start,amsg); } + + //! Adds an information message + //! Trace is filled if trace level is at least 3 + Standard_EXPORT void SendMsg (const TheKeyType& start, const Message_Msg& amsg) + { + Handle(Transfer_Binder) binder = FindAndMask(start); + if (binder.IsNull()) { + binder = new Transfer_VoidBinder; + Bind (start,binder); + } + // Alimente la trace : Regle causant (user messages) + if (thetrace > 0) { + StartTrace (binder,start,thelevel,6); + themessenger << amsg.Value(); + if (amsg.IsEdited()&&thetrace>2) + themessenger << " [from: " << amsg.Original() << "]"; + themessenger << endl; + } + } + + //! Adds an Error message to a starting entity (to the check of + //! its Binder of category 0, as a Fail) + Standard_EXPORT void AddFail (const TheKeyType& start, const Standard_CString mess, const Standard_CString orig = "") + { + Handle(Transfer_Binder) binder = FindAndMask(start); + if (binder.IsNull()) { + binder = new Transfer_VoidBinder; + Bind (start,binder); + } + binder->AddFail (mess,orig); + if (thetrace > 0) { + StartTrace (binder,start,thelevel,1); + themessenger << " --> Fail : " << mess; + if (orig[0] != '\0'&&thetrace>2) themessenger << " [from: " << orig << "]"; + themessenger << endl; + } + } + + //! (other name of AddFail, maintained for compatibility) + Standard_EXPORT void AddError (const TheKeyType& start, const Standard_CString mess, const Standard_CString orig = "") + { AddFail (start,mess,orig); } + + //! Adds an Error Message to a starting entity from the definition + //! of a Msg (Original+Value) + Standard_EXPORT void AddFail (const TheKeyType& start, const Message_Msg& amsg) + { + if (amsg.IsEdited()) AddFail (start,TCollection_AsciiString(amsg.Value()).ToCString(), TCollection_AsciiString(amsg.Original()).ToCString()); + else AddFail (start,TCollection_AsciiString(amsg.Value()).ToCString()); + } + + //! Adds a Warning message to a starting entity (to the check of + //! its Binder of category 0) + Standard_EXPORT void AddWarning (const TheKeyType& start, const Standard_CString mess, const Standard_CString orig = "") + { + Handle(Transfer_Binder) binder = FindAndMask(start); + if (binder.IsNull()) { + binder = new Transfer_VoidBinder; + Bind (start,binder); + } + binder->AddWarning(mess,orig); + if (thetrace > 1) { + StartTrace (binder,start,thelevel,2); + themessenger << " --> Warning : " << mess; + if (orig[0] != '\0'&&thetrace>2) themessenger << " [from: " << orig << "]"; + themessenger << endl; + } + } + + //! Adds a Warning Message to a starting entity from the definition + //! of a Msg (Original+Value) + Standard_EXPORT void AddWarning (const TheKeyType& start, const Message_Msg& amsg) + { + if (amsg.IsEdited()) AddWarning (start,TCollection_AsciiString(amsg.Value()).ToCString(), TCollection_AsciiString(amsg.Original()).ToCString()); + else AddWarning (start,TCollection_AsciiString(amsg.Value()).ToCString()); + } + + //! Returns the Check attached to a starting entity. If + //! is unknown, returns an empty Check + //! Adds a case name to a starting entity + //! Adds a case value to a starting entity + //! Returns the complete case list for an entity. Null Handle if empty + //! In the list of mapped items (between 1 and NbMapped), + //! searches for the first item which follows (not included) + //! and which has an attribute named + //! Attributes are brought by Binders + //! Hence, allows such an iteration + //! + //! for (num = TP->NextItemWithAttribute(name,0); + //! num > 0; + //! num = TP->NextItemWithAttribute(name,num) { + //! .. process mapped item + //! } + //! Returns the type of an Attribute attached to binders + //! If this name gives no Attribute, returns ParamVoid + //! If this name gives several different types, returns ParamMisc + //! Else, returns the effective type (ParamInteger, ParamReal, + //! ParamIdent, or ParamText) + //! Returns the list of recorded Attribute Names, as a Dictionary + //! of Integer : each value gives the count of items which bring + //! this attribute name + //! By default, considers all the attribute names + //! If is given, considers only the attribute names + //! which begin by + Standard_EXPORT Handle(Interface_Check) Check (const TheKeyType& start) const + { + const Handle(Transfer_Binder)& binder = Find(start); + return (binder.IsNull()? NULL : binder->Check()); + } + + //! Binds a starting object with a Transient Result. + //! Uses a SimpleBinderOfTransient to work. If there is already + //! one but with no Result set, sets its Result. + //! Considers a category number, by default 0 + Standard_EXPORT void BindTransient (const TheKeyType& start, const Handle(Standard_Transient)& res) + { + if (res.IsNull()) return; + Handle(Transfer_SimpleBinderOfTransient) binder = Handle(Transfer_SimpleBinderOfTransient)::DownCast(Find(start)); + // Binding sur place ? + if (!binder.IsNull() && binder->Status() == Transfer_StatusVoid) { + binder->SetResult(res); return; + } + // Sinon, refaire + binder = new Transfer_SimpleBinderOfTransient(res); + Bind(start,binder); + } + + //! Returns the Result of the Transfer of an object as a + //! Transient Result. + //! Returns a Null Handle if there is no Transient Result + //! Considers a category number, by default 0 + //! Warning : Supposes that Binding is done with a SimpleBinderOfTransient + Standard_EXPORT Handle(Standard_Transient) FindTransient (const TheKeyType& start) const + { + Handle(Transfer_SimpleBinderOfTransient) binder = Handle(Transfer_SimpleBinderOfTransient)::DownCast(Find(start)); + if (binder.IsNull()) return NULL; + if (!binder->HasResult()) return NULL; + return binder->Result(); + } + + //! Searches for a transient result attached to a starting object, + //! according to its type, by criterium IsKind(atype) + //! + //! In case of multiple result, explores the list and gives in + //! the first transient result IsKind(atype) + //! Returns True and fills if found + //! Else, returns False ( is not touched, not even nullified) + //! + //! This syntactic form avoids to do DownCast : if a result is + //! found with the good type, it is loaded in and can be + //! immediately used, well initialised + Standard_EXPORT Standard_Boolean FindTypedTransient (const TheKeyType& start, const Handle(Standard_Type)& atype, Handle(Standard_Transient)& val) const + { return GetTypedTransient (Find(start),atype,val); } + + //! Safe variant for arbitrary type of argument + template + Standard_Boolean FindTypedTransient (const TheKeyType& start, const Handle(Standard_Type)& atype, Handle(T)& val) const + { + Handle(Standard_Transient) aVal = val; + return FindTypedTransient (start, atype, aVal) && ! (val = Handle(T)::DownCast(aVal)).IsNull(); + } + + //! Searches for a transient result recorded in a Binder, whatever + //! this Binder is recorded or not in + //! + //! This is strictly equivalent to the class method GetTypedResult + //! from class SimpleBinderOfTransient, but is just lighter to call + //! + //! Apart from this, works as FindTypedTransient + Standard_EXPORT Standard_Boolean GetTypedTransient (const Handle(Transfer_Binder)& binder, const Handle(Standard_Type)& atype, Handle(Standard_Transient)& val) const + { return Transfer_SimpleBinderOfTransient::GetTypedResult(binder,atype,val); } + + //! Safe variant for arbitrary type of argument + template + Standard_Boolean GetTypedTransient (const Handle(Transfer_Binder)& start, const Handle(Standard_Type)& atype, Handle(T)& val) const + { + Handle(Standard_Transient) aVal = val; + return GetTypedTransient (start, atype, aVal) && ! (val = Handle(T)::DownCast(aVal)).IsNull(); + } + + //! Returns the maximum possible value for Map Index + //! (no result can be bound with a value greater than it) + Standard_EXPORT Standard_Integer NbMapped() const { return themap.Extent(); } + + //! Returns the Starting Object bound to an Index, + Standard_EXPORT const TheKeyType& Mapped (const Standard_Integer num) const { return themap.FindKey(num); } + + //! Returns the Index value bound to a Starting Object, 0 if none + Standard_EXPORT Standard_Integer MapIndex (const TheKeyType& start) const { return themap.FindIndex(start); } + + //! Returns the Binder bound to an Index + //! Considers a category number, by default 0 + Standard_EXPORT Handle(Transfer_Binder) MapItem (const Standard_Integer num) const { return themap.FindFromIndex(num); } + + //! Declares (and its Result) as Root. This status will be + //! later exploited by RootResult, see below (Result can be + //! produced at any time) + Standard_EXPORT void SetRoot (const TheKeyType& start) + { + Standard_Integer index = MapIndex(start); + if (index == 0) + return; + theroots.Add(index); + if (thetrace > 2) StartTrace (MapItem(index),start,thelevel,3); + } + + //! Enable (if True) or Disables (if False) Root + //! Management. If it is set, Transfers are considered as stacked + //! (a first Transfer commands other Transfers, and so on) and + //! the Transfers commanded by an external caller are "Root". + //! Remark : SetRoot can be called whatever this status, on every + //! object. + //! Default is set to True. + Standard_EXPORT void SetRootManagement (const Standard_Boolean stat) { therootm = stat; } + + //! Returns the count of recorded Roots + Standard_EXPORT Standard_Integer NbRoots() const { return theroots.Extent(); } + + //! Returns a Root Entity given its number in the list (1-NbRoots) + Standard_EXPORT const TheKeyType& Root (const Standard_Integer num) const + { + Standard_Integer ind = 0; + if (num > 0 && num <= theroots.Extent()) ind = theroots.FindKey(num); + return themap.FindKey (ind); + } + + //! Returns the Binder bound with a Root Entity given its number + //! Considers a category number, by default 0 + Standard_EXPORT Handle(Transfer_Binder) RootItem (const Standard_Integer num) const + { + Standard_Integer ind = 0; + if (num > 0 && num <= theroots.Extent()) ind = theroots.FindKey(num); + return themap.FindFromIndex(ind); + } + + //! Returns the index in the list of roots for a starting item, + //! or 0 if it is not recorded as a root + Standard_EXPORT Standard_Integer RootIndex (const TheKeyType& start) const + { + Standard_Integer index = MapIndex(start); + if (index == 0) return 0; + return theroots.FindIndex(index); + } + + //! Returns Nesting Level of Transfers (managed by methods + //! TranscriptWith & Co). Starts to zero. If no automatic Transfer + //! is used, it remains to zero. Zero means Root Level. + Standard_EXPORT Standard_Integer NestingLevel() const { return thelevel; } + + //! Resets Nesting Level of Transfers to Zero (Root Level), + //! whatever its current value. + Standard_EXPORT void ResetNestingLevel() { thelevel = 0; } + + //! Tells if has been recognized as good candidate for + //! Transfer. i.e. queries the Actor and its Nexts + Standard_EXPORT Standard_Boolean Recognize (const TheKeyType& start) const + { + Handle(Actor) actor = theactor; + // On balaie les Next jusqu a avoir un Resultat + while (!actor.IsNull()) { + if (actor->Recognize (start)) return Standard_True; + actor = actor->Next(); + } + return Standard_False; + } + + //! Performs the Transfer of a Source Object. + //! Mapping and Roots are managed : nothing is done if a Result is + //! already Bound, an exception is raised in case of error. + Standard_EXPORT Handle(Transfer_Binder) Transferring (const TheKeyType& theSource) + { + // Map deja alimentee ? + Handle(Transfer_Binder) former = FindAndMask(theSource); + + // .... Transfert deja effectue avec Resultat ? .... + + // On considere que cette nouvelle demande de Transfert correspond donc a une + // utilisation en plus : noter "AlreadyUsed", donc resultat non modifiable + if (!former.IsNull()) { + if (former->HasResult()) { + former->SetAlreadyUsed(); + return former; + } + + // .... Etat Initial : peut-etre deja fait ... ou infaisable ! + Transfer_StatusExec statex = former->StatusExec(); + switch (statex) { + case Transfer_StatusInitial : // Transfert prepare a faire + break; + case Transfer_StatusDone : // Transfert deja fait + themessenger << " .. and Transfer done" << endl; + return former; + case Transfer_StatusRun : // ca y est, on boucle + former->SetStatusExec(Transfer_StatusLoop); + return former; + case Transfer_StatusError : // pas propre, ca ... + if (thetrace) { + themessenger << " *** Transfer in Error Status :" << endl; + StartTrace (former, theSource, thelevel,0); + } + else StartTrace (former,theSource,thelevel,4); + Transfer_TransferFailure::Raise("TransferProcess : Transfer in Error Status"); + case Transfer_StatusLoop : // la boucle est bouclee ... + if (thetrace) { + themessenger << " *** Transfer Head of Dead Loop :" << endl; + StartTrace (former,theSource,thelevel,0); + } + else StartTrace (former,theSource,thelevel,4); + Transfer_TransferDeadLoop::Raise("TransferProcess : Transfer at Head of a Dead Loop"); + } + + // .... OK, on peut lancer l Execution + former->SetStatusExec(Transfer_StatusRun); + } + + Handle(Transfer_Binder) binder; + Standard_Boolean newbind = Standard_False; + + // Transfert sous protection pour les exceptions (pour notification en fait) + const Standard_Integer oldlev = thelevel; + try { + OCC_CATCH_SIGNALS + //! Invokes the Actor to work (set by SetActor), and tries its Nexts if no result is produced, + //! until a Non Null Binder is produced. + //! But keep in mind that a Null Binder can allways be returned + //! if a Starting Entity has not been recognized at all. + thelevel ++; // si decremente et == 0, transfert racine + + Handle(Actor) actor = theactor; + // On balaie les Next jusqu a avoir un Resultat + while (!actor.IsNull()) { + if (actor->Recognize (theSource)) binder = actor->Transferring(theSource,this); + else binder.Nullify(); + if (!binder.IsNull()) break; + actor = actor->Next(); + } + + if (!binder.IsNull()) { + // Gestion du niveau racine (.. a regarder de pres ..) + if (therootl == 0 && binder->StatusExec() == Transfer_StatusDone) + therootl = thelevel - 1; + } + + if (thelevel > 0) thelevel --; + } + + // ... Exceptions a Rattraper : elles ne se ressemblent pas toutes ... ! + catch (Transfer_TransferDeadLoop) { + if (binder.IsNull()) { + themessenger << " *** Dead Loop with no Result" << endl; + if (thetrace) StartTrace (binder,theSource,thelevel-1,0); + binder = new Transfer_VoidBinder; + Bind (theSource,binder); newbind = Standard_True; + } else if (binder->StatusExec() == Transfer_StatusLoop) { + if (thetrace) { + themessenger << " *** Dead Loop : Finding head of Loop :" << endl; + StartTrace (binder,theSource,thelevel-1,0); + } + else StartTrace (binder,theSource,thelevel-1,4); + Transfer_TransferFailure::Raise("TransferProcess : Head of Dead Loop"); + // Autrement dit, on change d exception (on est sorti de la boucle) + } else { + if (thetrace) { + themessenger << " *** Dead Loop : Actor in Loop :" << endl; + StartTrace (binder,theSource,thelevel-1,0); + } + } + binder->AddFail("Transfer in dead Loop"); + thelevel = oldlev; + } + catch (Standard_Failure) { + if (binder.IsNull()) { + themessenger << " *** Exception Raised with no Result" << endl; + binder = new Transfer_VoidBinder; + Bind (theSource,binder); newbind = Standard_True; + } + binder->AddFail("Transfer stopped by exception raising"); + if (thetrace) { + themessenger << " *** Raised : " << Standard_Failure::Caught()->GetMessageString() << endl; + StartTrace (binder,theSource,thelevel-1,4); + } + thelevel = oldlev; + } + + // .... Conclusion : Noter dans la Map .... + if (!newbind && !binder.IsNull()) { + Bind(theSource,binder); + } + else { + //= by ABV: 5 Oct 97: nothing generated, but former can be in run state - drop it + //= ASK: may be set it to StatusInitial ? + if ( !former.IsNull() ) former->SetStatusExec ( Transfer_StatusDone ); //+ + return NULL; // Binder Null ... que faire d autre ? + } + + // .... Gerer les Racines (si prevu) .... + if (therootl >= thelevel) { + therootl = 0; + if (therootm && binder->Status() != Transfer_StatusVoid) { + SetRoot (theSource); + } + } + return thelastbnd; + } + + //! Same as Transferring but does not return the Binder. + //! Simply returns True in case of success (for user call) + Standard_EXPORT Standard_Boolean Transfer (const TheKeyType& theSource) + { + Handle(Transfer_Binder) binder = Transferring(theSource); + return (!binder.IsNull()); + } + + //! Method called when trace is asked + //! Calls PrintTrace to display information relevant for starting + //! objects (which can be redefined) + //! is Nesting Level of Transfer (0 = root) + //! controls the way the trace is done : + //! 0 neutral, 1 for Error, 2 for Warning message, 3 for new Root + Standard_EXPORT void StartTrace (const Handle(Transfer_Binder)& binder, const TheKeyType& start, const Standard_Integer level, const Standard_Integer mode) const + { + // ### Fail (Roots:50) -- Start start->DynamicType() + // ### Fail (Roots:50) -- Start id:#label.. Type:start->DynamicType() + if (thetrace > 3) { // Internal to be switch when searching bug (trace >= 4) + if (mode == 1) themessenger << " ### Fail"; + if (mode == 2) themessenger << " ### Warning"; + if (mode == 3) themessenger << " ### New Root n0 " << theroots.Extent(); + if (mode == 4) themessenger << " ### Exception"; + if (mode == 5) themessenger << " ### Substitution"; + if (mode == 6) themessenger << " ### Information"; + if (level > 1) + themessenger << " (nested)"; // " at nesting Level:"<= 0 && mode != 3) + themessenger << " at " << theroots.Extent() << " Roots"; + } + if (!start.IsNull()) PrintTrace (start,themessenger); + + if (!binder.IsNull()) { + Handle(Transfer_Binder) bnd = binder; + Standard_Boolean hasres = Standard_False; + while (!bnd.IsNull()) { + if (bnd->Status() != Transfer_StatusVoid) { + // --- Result Type: binder->ResultType() --- Binder : binder->DynamicType(); + if (!hasres) + themessenger << "\n --- Result Type : "; + else + themessenger << " , "; + themessenger << bnd->ResultTypeName(); + hasres = Standard_True; + } + bnd = bnd->NextResult(); + } + if (!hasres && mode > 2) { + themessenger << "\n --- No Result recorded"; + } + } + themessenger << endl; + } + + //! Prints a short information on a source object. + Standard_EXPORT virtual void PrintTrace (const TheKeyType& theSource, const Handle(Message_Messenger)& S) const + { + if (!theSource.IsNull()) { + Handle(Transfer_Finder) aFinder = Handle(Transfer_Finder)::DownCast(theSource); + S << " Type:" << (aFinder.IsNull()? theSource->DynamicType()->Name() : aFinder->ValueTypeName()); + } + } + + //! Prints statistics on transfer + void PrintStats(const Handle(Message_Messenger)& S) const + { + S<<"\n*******************************************************************\n"; + S << "******** Basic Statistics ********"<NbEntities()<Check(); + Transfer_StatusExec stat = binder->StatusExec(); + if (stat != Transfer_StatusInitial && stat != Transfer_StatusDone) + nbe ++; + else { + if (ach->NbWarnings() > 0) nbw++; + if (binder->HasResult()) nbr++; + } + } + if (nbr > nbroots) + S<<"**** ( Itermediate Results : "< 0) + S<<"**** Errors on : "< 0) + S<<"**** Warnings on : "<StatusExec(); + if (statex != Transfer_StatusInitial && statex != Transfer_StatusDone) + iter.Add (binder,Mapped(i)); // on note les cas "pas normaux" + } + return iter; + } + + //! Returns a CheckList as a list of Check : each one is for a + //! starting entity which have either check (warning or fail) + //! messages are attached, or are in abnormal state : that case + //! gives a specific message + //! If is True, checks with Warnings only are ignored + Standard_EXPORT Interface_CheckIterator CheckList (const Standard_Boolean erronly) const + { + Interface_CheckIterator list; + Standard_Integer num, max = NbMapped(); + for (Standard_Integer i = 1; i <= max; i ++) { + Handle(Transfer_Binder) binder = MapItem(i); + if (binder.IsNull()) continue; + Transfer_StatusExec statex = binder->StatusExec(); + Handle(Interface_Check) check = binder->Check(); + if (statex != Transfer_StatusInitial && statex != Transfer_StatusDone && !check->HasFailed()) + check->AddFail("Transfer in Abnormal Status (!= Initial or Done)"); + if (!check->HasFailed() && (erronly || check->NbWarnings() == 0)) continue; + const TheKeyType& ent = Mapped(i); + num = CheckNum(ent); + if (num == 0) num = i; + check->SetEntity(ent); + list.Add(check,num); + } + return list; + } + + //! Sets Progress indicator + void SetProgress (const Handle(Message_ProgressIndicator)& theProgress) { myProgress = theProgress; } + + //! Gets Progress indicator + const Handle(Message_ProgressIndicator) & GetProgress() const { return myProgress; } + + DEFINE_STANDARD_RTTI_INLINE(Transfer_ProcessGen,MMgt_TShared) + + protected: + + //! Computes a number to be associated to a starting object in + //! a check or a check-list + //! By default, returns 0; can be redefined + Standard_EXPORT virtual Standard_Integer CheckNum (const TheKeyType&) const { return 0; } + + Handle(Interface_InterfaceModel) themodel; + + private: + + //! Same as Find but stores the last access to the map, for a + //! faster access on next calls (as Bind does too) + Standard_EXPORT const Handle(Transfer_Binder) & FindAndMask (const TheKeyType& start) + { + if (thelastobj == start) { + if (theindex > 0) return thelastbnd; + } + thelastobj = start; + theindex = themap.FindIndex (start); + if (theindex > 0) thelastbnd = themap.FindFromIndex(theindex); + else thelastbnd.Nullify(); + return thelastbnd; + } + + Standard_Integer thetrace; + Handle(Message_Messenger) themessenger; + Standard_Integer thelevel; + Standard_Integer therootl; + Standard_Boolean therootm; + TColStd_IndexedMapOfInteger theroots; + TheKeyType thelastobj; + Handle(Transfer_Binder) thelastbnd; + Standard_Integer theindex; + Handle(Actor) theactor; + Transfer_MapOfProcess themap; + Handle(Message_ProgressIndicator) myProgress; +}; + +#endif // _Transfer_ProcessGen_HeaderFile diff --git a/src/Transfer/Transfer_SequenceOfBinder.hxx b/src/Transfer/Transfer_SequenceOfBinder.hxx index f3b674932b..8a6044df0f 100644 --- a/src/Transfer/Transfer_SequenceOfBinder.hxx +++ b/src/Transfer/Transfer_SequenceOfBinder.hxx @@ -22,5 +22,4 @@ typedef NCollection_Sequence Transfer_SequenceOfBinder; - #endif diff --git a/src/Transfer/Transfer_SimpleBinderOfTransient.cxx b/src/Transfer/Transfer_SimpleBinderOfTransient.cxx index 44a7d14a8c..e58af271a2 100644 --- a/src/Transfer/Transfer_SimpleBinderOfTransient.cxx +++ b/src/Transfer/Transfer_SimpleBinderOfTransient.cxx @@ -11,56 +11,28 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. - -#include -#include -#include #include -#include IMPLEMENT_STANDARD_RTTIEXT(Transfer_SimpleBinderOfTransient,Transfer_Binder) -// "Handle(Standard_Transient)" : la classe de base pour le Resultat -Transfer_SimpleBinderOfTransient::Transfer_SimpleBinderOfTransient () { } - - -// Standard_Boolean Transfer_SimpleBinderOfTransient::IsMultiple() const -// { return Standard_False; } - - - Handle(Standard_Type) Transfer_SimpleBinderOfTransient::ResultType () const +Handle(Standard_Type) Transfer_SimpleBinderOfTransient::ResultType () const { - if (!HasResult() || theres.IsNull()) return STANDARD_TYPE(Standard_Transient); + if (!HasResult() || myResult.IsNull()) return STANDARD_TYPE(Standard_Transient); return Result()->DynamicType(); } - Standard_CString Transfer_SimpleBinderOfTransient::ResultTypeName () const +Standard_CString Transfer_SimpleBinderOfTransient::ResultTypeName () const { - if (!HasResult() || theres.IsNull()) return "(void)"; + if (!HasResult() || myResult.IsNull()) return "(void)"; return Result()->DynamicType()->Name(); } - - void Transfer_SimpleBinderOfTransient::SetResult - (const Handle(Standard_Transient)& res) -{ - SetResultPresent(); - theres = res; -} - - - const Handle(Standard_Transient)& Transfer_SimpleBinderOfTransient::Result () const - { return theres; } - - Standard_Boolean Transfer_SimpleBinderOfTransient::GetTypedResult - (const Handle(Transfer_Binder)& bnd, const Handle(Standard_Type)& atype, - Handle(Standard_Transient)& res) +Standard_Boolean Transfer_SimpleBinderOfTransient::GetTypedResult (const Handle(Transfer_Binder)& bnd, const Handle(Standard_Type)& atype, Handle(Standard_Transient)& res) { if (atype.IsNull()) return Standard_False; Handle(Transfer_Binder) bn = bnd; while (!bn.IsNull()) { - Handle(Transfer_SimpleBinderOfTransient) trb = - Handle(Transfer_SimpleBinderOfTransient)::DownCast(bn); + Handle(Transfer_SimpleBinderOfTransient) trb = Handle(Transfer_SimpleBinderOfTransient)::DownCast(bn); bn = bn->NextResult(); if (trb.IsNull()) continue; Handle(Standard_Transient) rs = trb->Result(); diff --git a/src/Transfer/Transfer_SimpleBinderOfTransient.hxx b/src/Transfer/Transfer_SimpleBinderOfTransient.hxx index 1b9ecb4ec4..9797a424c1 100644 --- a/src/Transfer/Transfer_SimpleBinderOfTransient.hxx +++ b/src/Transfer/Transfer_SimpleBinderOfTransient.hxx @@ -21,12 +21,6 @@ #include #include -#include -#include -#include -class Standard_Transient; -class Transfer_TransferFailure; -class Transfer_Binder; class Transfer_SimpleBinderOfTransient; @@ -37,15 +31,13 @@ DEFINE_STANDARD_HANDLE(Transfer_SimpleBinderOfTransient, Transfer_Binder) //! instead of being static class Transfer_SimpleBinderOfTransient : public Transfer_Binder { - -public: - + public: - //! Creates an empty SimpleBinderOfTransient - //! Returns True if a starting object is bound with SEVERAL - //! results : Here, returns allways False - //! See Binder itself - Standard_EXPORT Transfer_SimpleBinderOfTransient(); + //! Default constructor + Transfer_SimpleBinderOfTransient() {} + + //! Constructor from a result + Transfer_SimpleBinderOfTransient(const Handle(Standard_Transient) &theResult) : myResult(theResult) { SetResultPresent(); } //! Returns the Effective (Dynamic) Type of the Result //! (Standard_Transient if no Result is defined) @@ -56,10 +48,10 @@ public: Standard_EXPORT Standard_CString ResultTypeName() const Standard_OVERRIDE; //! Defines the Result - Standard_EXPORT void SetResult (const Handle(Standard_Transient)& res); - + void SetResult (const Handle(Standard_Transient)& theResult) { SetResultPresent(); myResult = theResult; } + //! Returns the defined Result, if there is one - Standard_EXPORT const Handle(Standard_Transient)& Result() const; + const Handle(Standard_Transient) & Result() const { return myResult; } //! Returns a transient result according to its type (IsKind) //! i.e. the result itself if IsKind(atype), else searches in @@ -70,29 +62,17 @@ public: //! found with the good type, it is loaded in and can be //! immediately used, well initialised Standard_EXPORT static Standard_Boolean GetTypedResult (const Handle(Transfer_Binder)& bnd, const Handle(Standard_Type)& atype, Handle(Standard_Transient)& res); - - - + + //! Prepares and Returns a Binder for a Transient Result + //! Returns a Null Handle if is itself Null + static Handle(Transfer_SimpleBinderOfTransient) TransientResult (const Handle(Standard_Transient)& res) + { return (res.IsNull()? NULL : new Transfer_SimpleBinderOfTransient(res)); } DEFINE_STANDARD_RTTIEXT(Transfer_SimpleBinderOfTransient,Transfer_Binder) -protected: - - - - -private: - - - Handle(Standard_Transient) theres; - + private: + Handle(Standard_Transient) myResult; }; - - - - - - #endif // _Transfer_SimpleBinderOfTransient_HeaderFile diff --git a/src/Transfer/Transfer_TransferDispatch.cxx b/src/Transfer/Transfer_TransferDispatch.cxx deleted file mode 100644 index 842698e791..0000000000 --- a/src/Transfer/Transfer_TransferDispatch.cxx +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) 1999-2014 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -Transfer_TransferDispatch::Transfer_TransferDispatch - (const Handle(Interface_InterfaceModel)& amodel, - const Interface_GeneralLib& lib) - : Interface_CopyTool (amodel,lib) -{ SetControl (new Transfer_DispatchControl - (amodel, new Transfer_TransientProcess(amodel->NbEntities()))); } - - - Transfer_TransferDispatch::Transfer_TransferDispatch - (const Handle(Interface_InterfaceModel)& amodel, - const Handle(Interface_Protocol)& protocol) - : Interface_CopyTool (amodel,protocol) -{ SetControl (new Transfer_DispatchControl - (amodel,new Transfer_TransientProcess(amodel->NbEntities()))); } - - - Transfer_TransferDispatch::Transfer_TransferDispatch - (const Handle(Interface_InterfaceModel)& amodel) - : Interface_CopyTool (amodel) -{ SetControl (new Transfer_DispatchControl - (amodel,new Transfer_TransientProcess(amodel->NbEntities()))); } - - - - Handle(Transfer_TransientProcess) Transfer_TransferDispatch::TransientProcess - () const -{ return Handle(Transfer_DispatchControl)::DownCast(Control())->TransientProcess(); } - - Standard_Boolean Transfer_TransferDispatch::Copy - (const Handle(Standard_Transient)& entfrom, - Handle(Standard_Transient)& entto, - const Standard_Boolean mapped, const Standard_Boolean errstat) -{ - Handle(Transfer_Binder) result = TransientProcess()->Transferring(entfrom); - if (result.IsNull()) - return Interface_CopyTool::Copy(entfrom,entto,mapped,errstat); - - if (!result->IsKind(STANDARD_TYPE(Transfer_SimpleBinderOfTransient))) - return Standard_False; // Produit qq chose, mais quoi ? - entto = GetCasted(Transfer_SimpleBinderOfTransient,result)->Result(); - return Standard_True; -} diff --git a/src/Transfer/Transfer_TransferDispatch.hxx b/src/Transfer/Transfer_TransferDispatch.hxx deleted file mode 100644 index 441c0b45c4..0000000000 --- a/src/Transfer/Transfer_TransferDispatch.hxx +++ /dev/null @@ -1,97 +0,0 @@ -// Created on: 1992-02-07 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 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 _Transfer_TransferDispatch_HeaderFile -#define _Transfer_TransferDispatch_HeaderFile - -#include -#include -#include - -#include -#include -class Interface_InterfaceError; -class Interface_InterfaceModel; -class Interface_GeneralLib; -class Interface_Protocol; -class Transfer_TransientProcess; -class Standard_Transient; - - -//! A TransferDispatch is aimed to dispatch Entities between two -//! Interface Models, by default by copying them, as CopyTool, but -//! with more capabilities of adapting : Copy is redefined to -//! firstly pass the hand to a TransferProcess. If this gives no -//! result, standard Copy is called. -//! -//! This allow, for instance, to modify the copied Entity (such as -//! changing a Name for a VDA Entity), or to do a deeper work -//! (such as Substituting a kind of Entity to another one). -//! -//! For these reasons, TransferDispatch is basically a CopyTool, -//! but uses a more sophiscated control, which is TransferProcess, -//! and its method Copy is redefined -class Transfer_TransferDispatch : public Interface_CopyTool -{ -public: - - DEFINE_STANDARD_ALLOC - - - //! Creates a TransferDispatch from a Model. Works with a General - //! Service Library, given as an Argument - //! A TransferDispatch is created as a CopyTool in which the - //! Control is set to TransientProcess - Standard_EXPORT Transfer_TransferDispatch(const Handle(Interface_InterfaceModel)& amodel, const Interface_GeneralLib& lib); - - //! Same as above, but Library is defined through a Protocol - Standard_EXPORT Transfer_TransferDispatch(const Handle(Interface_InterfaceModel)& amodel, const Handle(Interface_Protocol)& protocol); - - //! Same as above, but works with the Active Protocol - Standard_EXPORT Transfer_TransferDispatch(const Handle(Interface_InterfaceModel)& amodel); - - //! Returns the content of Control Object, as a TransientProcess - Standard_EXPORT Handle(Transfer_TransientProcess) TransientProcess() const; - - //! Copies an Entity by calling the method Transferring from the - //! TransferProcess. If this called produces a Null Binder, then - //! the standard, inherited Copy is called - Standard_EXPORT virtual Standard_Boolean Copy (const Handle(Standard_Transient)& entfrom, Handle(Standard_Transient)& entto, const Standard_Boolean mapped, const Standard_Boolean errstat) Standard_OVERRIDE; - - - - -protected: - - - - - -private: - - - - - -}; - - - - - - - -#endif // _Transfer_TransferDispatch_HeaderFile diff --git a/src/Transfer/Transfer_TransferInput.cxx b/src/Transfer/Transfer_TransferInput.cxx deleted file mode 100644 index d4dec90732..0000000000 --- a/src/Transfer/Transfer_TransferInput.cxx +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) 1999-2014 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -Transfer_TransferInput::Transfer_TransferInput () { } - - -// Resultats : Pour le Modele ... - - Interface_EntityIterator Transfer_TransferInput::Entities - (Transfer_TransferIterator& list) const -{ - Interface_EntityIterator iter; - for (list.Start(); list.More(); list.Next()) { - Handle(Transfer_Binder) binder = list.Value(); - if (binder.IsNull()) continue; - if (binder->IsKind(STANDARD_TYPE(Transfer_VoidBinder))) continue; - -// Vrai resultat : doit etre transient (simple ou liste) - DeclareAndCast(Transfer_SimpleBinderOfTransient,transb,binder); - DeclareAndCast(Transfer_MultipleBinder,multi,binder); - if (!transb.IsNull()) { - if (transb->HasResult()) iter.AddItem(transb->Result()); - } - else if (!multi.IsNull()) { - Handle(TColStd_HSequenceOfTransient) mulres = multi->MultipleResult(); - Standard_Integer nbres = 0; - if (!mulres.IsNull()) nbres = mulres->Length(); - for (Standard_Integer i = 1; i <= nbres; i ++) - iter.AddItem(mulres->Value(i)); - } - else Transfer_TransferFailure::Raise - ("TransferInput : Entities, one of the Results is not Transient Handle"); - } - return iter; -} - - - void Transfer_TransferInput::FillModel - (const Handle(Transfer_TransientProcess)& proc, - const Handle(Interface_InterfaceModel)& amodel) const -{ - Transfer_TransferIterator list = proc->CompleteResult(); - Interface_EntityIterator iter = Entities (list); - amodel->GetFromTransfer(iter); -} - - void Transfer_TransferInput::FillModel - (const Handle(Transfer_TransientProcess)& proc, - const Handle(Interface_InterfaceModel)& amodel, - const Handle(Interface_Protocol)& proto, - const Standard_Boolean roots) const -{ - Transfer_TransferIterator list; - if (roots) list = proc->RootResult(); - else list = proc->CompleteResult(); - Interface_EntityIterator iter = Entities (list); - for (iter.Start(); iter.More(); iter.Next()) - amodel->AddWithRefs (iter.Value(), proto); -} - - - void Transfer_TransferInput::FillModel - (const Handle(Transfer_FinderProcess)& proc, - const Handle(Interface_InterfaceModel)& amodel) const -{ - Transfer_TransferIterator list = proc->CompleteResult(); - Interface_EntityIterator iter = Entities (list); - amodel->GetFromTransfer(iter); -} - - void Transfer_TransferInput::FillModel - (const Handle(Transfer_FinderProcess)& proc, - const Handle(Interface_InterfaceModel)& amodel, - const Handle(Interface_Protocol)& proto, - const Standard_Boolean roots) const -{ - Transfer_TransferIterator list; - if (roots) list = proc->RootResult(); - else list = proc->CompleteResult(); - Interface_EntityIterator iter = Entities (list); - for (iter.Start(); iter.More(); iter.Next()) - amodel->AddWithRefs (iter.Value(), proto); -} diff --git a/src/Transfer/Transfer_TransferInput.hxx b/src/Transfer/Transfer_TransferInput.hxx deleted file mode 100644 index e3e49df5a5..0000000000 --- a/src/Transfer/Transfer_TransferInput.hxx +++ /dev/null @@ -1,99 +0,0 @@ -// Created on: 1992-02-04 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 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 _Transfer_TransferInput_HeaderFile -#define _Transfer_TransferInput_HeaderFile - -#include -#include -#include - -#include -class Transfer_TransferFailure; -class Interface_EntityIterator; -class Transfer_TransferIterator; -class Transfer_TransientProcess; -class Interface_InterfaceModel; -class Interface_Protocol; -class Transfer_FinderProcess; - - -//! A TransferInput is a Tool which fills an InterfaceModel with -//! the result of the Transfer of CasCade Objects, once determined -//! The Result comes from a TransferProcess, either from -//! Transient (the Complete Result is considered, it must contain -//! only Transient Objects) -class Transfer_TransferInput -{ -public: - - DEFINE_STANDARD_ALLOC - - - //! Creates a TransferInput ready to use - Standard_EXPORT Transfer_TransferInput(); - - //! Takes the transient items stored in a TransferIterator - Standard_EXPORT Interface_EntityIterator Entities (Transfer_TransferIterator& list) const; - - //! Fills an InterfaceModel with the Complete Result of a Transfer - //! stored in a TransientProcess (Starting Objects are Transient) - //! The complete result is exactly added to the model - Standard_EXPORT void FillModel (const Handle(Transfer_TransientProcess)& proc, const Handle(Interface_InterfaceModel)& amodel) const; - - //! Fills an InterfaceModel with results of the Transfer recorded - //! in a TransientProcess (Starting Objects are Transient) : - //! Root Result if is True (Default), Complete Result else - //! The entities added to the model are determined from the result - //! by by adding the referenced entities - Standard_EXPORT void FillModel (const Handle(Transfer_TransientProcess)& proc, const Handle(Interface_InterfaceModel)& amodel, const Handle(Interface_Protocol)& proto, const Standard_Boolean roots = Standard_True) const; - - //! Fills an InterfaceModel with the Complete Result of a Transfer - //! stored in a TransientProcess (Starting Objects are Transient) - //! The complete result is exactly added to the model - Standard_EXPORT void FillModel (const Handle(Transfer_FinderProcess)& proc, const Handle(Interface_InterfaceModel)& amodel) const; - - //! Fills an InterfaceModel with results of the Transfer recorded - //! in a TransientProcess (Starting Objects are Transient) : - //! Root Result if is True (Default), Complete Result else - //! The entities added to the model are determined from the result - //! by by adding the referenced entities - Standard_EXPORT void FillModel (const Handle(Transfer_FinderProcess)& proc, const Handle(Interface_InterfaceModel)& amodel, const Handle(Interface_Protocol)& proto, const Standard_Boolean roots = Standard_True) const; - - - - -protected: - - - - - -private: - - - - - -}; - - - - - - - -#endif // _Transfer_TransferInput_HeaderFile diff --git a/src/Transfer/Transfer_TransferIterator.cxx b/src/Transfer/Transfer_TransferIterator.cxx deleted file mode 100644 index 26502df016..0000000000 --- a/src/Transfer/Transfer_TransferIterator.cxx +++ /dev/null @@ -1,197 +0,0 @@ -// Copyright (c) 1999-2014 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 -#include -#include -#include -#include -#include - -static Handle(Standard_Transient) nultrans; // pour retour const&(Null) - - - Transfer_TransferIterator::Transfer_TransferIterator () -{ - theitems = new Transfer_HSequenceOfBinder(); - theselect = new TColStd_HSequenceOfInteger(); - themaxi = 0; - thecurr = 1; -} - - void Transfer_TransferIterator::AddItem - (const Handle(Transfer_Binder)& atr) -{ - theitems->Append(atr); - theselect->Append(1); - themaxi = theselect->Length(); -} - - void Transfer_TransferIterator::SelectBinder - (const Handle(Standard_Type)& atype, const Standard_Boolean keep) -{ - for (Standard_Integer i = theitems->Length(); i > 0; i --) { - if (theitems->Value(i)->IsKind(atype) != keep) { - theselect->SetValue(i,0); - if (themaxi == i) themaxi = i-1; - } - } -} - - void Transfer_TransferIterator::SelectResult - (const Handle(Standard_Type)& atype, const Standard_Boolean keep) -{ - Standard_Integer casetype = 0; - if (atype->SubType(STANDARD_TYPE(Standard_Transient))) casetype = 2; - - for (Standard_Integer i = theitems->Length(); i > 0; i --) { - Handle(Transfer_Binder) atr = theitems->Value(i); - Handle(Standard_Type) btype = ResultType(); - Standard_Boolean matchtype; - if (!atr->HasResult()) matchtype = Standard_False; - else if (atr->IsMultiple()) matchtype = Standard_False; - else if (casetype == 0) matchtype = (atype == btype); // Type fixe - else matchtype = (btype->SubType(atype)); // Dynamique - if (matchtype != keep) { - theselect->SetValue(i,0); - if (themaxi == i) themaxi = i-1; - } - } -} - - void Transfer_TransferIterator::SelectUnique - (const Standard_Boolean keep) -{ - for (Standard_Integer i = theitems->Length(); i > 0; i --) { - Handle(Transfer_Binder) atr = theitems->Value(i); - if (atr->IsMultiple() == keep) { - theselect->SetValue(i,0); - if (themaxi == i) themaxi = i-1; - } - } -} - - void Transfer_TransferIterator::SelectItem - (const Standard_Integer num, const Standard_Boolean keep) -{ - if (num < 1 || num > theselect->Length()) return; - if (keep) theselect->SetValue (num,1); - else theselect->SetValue (num,0); -} - -// .... Iteration-Interrogations .... - - Standard_Integer Transfer_TransferIterator::Number () const -{ - Standard_Integer numb,i; numb = 0; - for (i = 1; i <= themaxi; i ++) { - if (theselect->Value(i) != 0) numb ++; - } - return numb; -} - - void Transfer_TransferIterator::Start () - { thecurr = 0; Next(); } - - Standard_Boolean Transfer_TransferIterator::More () -{ - if (thecurr > themaxi) return Standard_False; - if (theselect->Value(thecurr) == 0) Next(); - if (thecurr > themaxi) return Standard_False; - return (theselect->Value(thecurr) > 0); -} - - void Transfer_TransferIterator::Next () -{ - thecurr ++; - if (thecurr > themaxi) return; - if (theselect->Value(thecurr) == 0) Next(); -} - - const Handle(Transfer_Binder)& Transfer_TransferIterator::Value () const -{ - if (thecurr == 0 || thecurr > themaxi) Standard_NoSuchObject::Raise - ("TransferIterator : Value"); - if (theselect->Value(thecurr) == 0) Standard_NoSuchObject::Raise - ("TransferIterator : Value"); - return theitems->Value(thecurr); -} - -// .... Acces aux Donnees du Binder Courant .... - - Standard_Boolean Transfer_TransferIterator::HasResult () const -{ - Handle(Transfer_Binder) atr = Value(); - return atr->HasResult(); -} - - Standard_Boolean Transfer_TransferIterator::HasUniqueResult () const -{ - Handle(Transfer_Binder) atr = Value(); - if (atr->IsMultiple()) return Standard_False; - return atr->HasResult(); -} - - - Handle(Standard_Type) Transfer_TransferIterator::ResultType () const -{ - Handle(Standard_Type) btype; - Handle(Transfer_Binder) atr = Value(); - if (!atr->IsMultiple()) btype = atr->ResultType(); -// ResultType de Binder prend en compte le Type Dynamique pour les Handle - return btype; -} - - - Standard_Boolean Transfer_TransferIterator::HasTransientResult () const -{ - Handle(Standard_Type) btype = ResultType(); - if (btype.IsNull()) return Standard_False; - return btype->SubType(STANDARD_TYPE(Standard_Transient)); -} - - const Handle(Standard_Transient)& - Transfer_TransferIterator::TransientResult () const -{ - Handle(Transfer_SimpleBinderOfTransient) atr = - Handle(Transfer_SimpleBinderOfTransient)::DownCast(Value()); - if (!atr.IsNull()) return atr->Result(); - return nultrans; -} - - - Transfer_StatusExec Transfer_TransferIterator::Status () const -{ - Handle(Transfer_Binder) atr = Value(); - return atr->StatusExec(); -} - - - Standard_Boolean Transfer_TransferIterator::HasFails () const -{ - Handle(Transfer_Binder) atr = Value(); - return atr->Check()->HasFailed(); -} - - Standard_Boolean Transfer_TransferIterator::HasWarnings () const -{ - Handle(Transfer_Binder) atr = Value(); - return atr->Check()->HasWarnings(); -} - - const Handle(Interface_Check) Transfer_TransferIterator::Check () const -{ - Handle(Transfer_Binder) atr = Value(); - return atr->Check(); -} diff --git a/src/Transfer/Transfer_TransferIterator.hxx b/src/Transfer/Transfer_TransferIterator.hxx deleted file mode 100644 index cf95a90cd3..0000000000 --- a/src/Transfer/Transfer_TransferIterator.hxx +++ /dev/null @@ -1,160 +0,0 @@ -// Created on: 1992-10-28 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 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 _Transfer_TransferIterator_HeaderFile -#define _Transfer_TransferIterator_HeaderFile - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -class Standard_NoSuchObject; -class Transfer_Binder; -class Standard_Transient; -class Interface_Check; - - -//! Defines an Iterator on the result of a Transfer -//! Available for Normal Results or not (Erroneous Transfer) -//! It gives several kinds of Informations, and allows to consider -//! various criteria (criteria are cumulative) -class Transfer_TransferIterator -{ -public: - - DEFINE_STANDARD_ALLOC - - - //! Creates an empty Iterator - Standard_EXPORT Transfer_TransferIterator(); - - //! Adds a Binder to the iteration list (construction) - Standard_EXPORT void AddItem (const Handle(Transfer_Binder)& atr); - - //! Selects Items on the Type of Binder : keep only - //! Binders which are of a given Type (if keep is True) or - //! reject only them (if keep is False) - Standard_EXPORT void SelectBinder (const Handle(Standard_Type)& atype, const Standard_Boolean keep); - - //! Selects Items on the Type of Result. Considers only Unique - //! Results. Considers Dynamic Type for Transient Result, - //! Static Type (the one given to define the Binder) else. - //! - //! Results which are of a given Type (if keep is True) or reject - //! only them (if keep is False) - Standard_EXPORT void SelectResult (const Handle(Standard_Type)& atype, const Standard_Boolean keep); - - //! Select Items according Unicity : keep only Unique Results (if - //! keep is True) or keep only Multiple Results (if keep is False) - Standard_EXPORT void SelectUnique (const Standard_Boolean keep); - - //! Selects/Unselect (according to an item designated by - //! its rank in the list - //! Used by sub-classes which have specific criteria - Standard_EXPORT void SelectItem (const Standard_Integer num, const Standard_Boolean keep); - - //! Returns count of Binders to be iterated - Standard_EXPORT Standard_Integer Number() const; - - //! Clears Iteration in progress, to allow it to be restarted - Standard_EXPORT void Start(); - - //! Returns True if there are other Items to iterate - Standard_EXPORT Standard_Boolean More(); - - //! Sets Iteration to the next Item - Standard_EXPORT void Next(); - - //! Returns the current Binder - Standard_EXPORT const Handle(Transfer_Binder)& Value() const; - - //! Returns True if current Item brings a Result, Transient - //! (Handle) or not or Multiple. That is to say, if it corresponds - //! to a normally acheived Transfer, Transient Result is read by - //! specific TransientResult below. - //! Other kind of Result must be read specifically from its Binder - Standard_EXPORT Standard_Boolean HasResult() const; - - //! Returns True if Current Item has a Unique Result - Standard_EXPORT Standard_Boolean HasUniqueResult() const; - - //! Returns the Type of the Result of the current Item, if Unique. - //! If No Unique Result (Error Transfert or Multiple Result), - //! returns a Null Handle - //! The Type is : the Dynamic Type for a Transient Result, - //! the Type defined by the Binder Class else - Standard_EXPORT Handle(Standard_Type) ResultType() const; - - //! Returns True if the current Item has a Transient Unique - //! Result (if yes, use TransientResult to get it) - Standard_EXPORT Standard_Boolean HasTransientResult() const; - - //! Returns the Transient Result of the current Item if there is - //! (else, returns a null Handle) - //! Supposes that Binding is done by a SimpleBinderOfTransient - Standard_EXPORT const Handle(Standard_Transient)& TransientResult() const; - - //! Returns Execution Status of current Binder - //! Normal transfer corresponds to StatusDone - Standard_EXPORT Transfer_StatusExec Status() const; - - //! Returns True if Fail Messages are recorded with the current - //! Binder. They can then be read through Check (see below) - Standard_EXPORT Standard_Boolean HasFails() const; - - //! Returns True if Warning Messages are recorded with the current - //! Binder. They can then be read through Check (see below) - Standard_EXPORT Standard_Boolean HasWarnings() const; - - //! Returns Check associated to current Binder - //! (in case of error, it brings Fail messages) - //! (in case of warnings, it brings Warning messages) - Standard_EXPORT const Handle(Interface_Check) Check() const; - - - - -protected: - - - - Standard_Integer thecurr; - - -private: - - - - Handle(Transfer_HSequenceOfBinder) theitems; - Handle(TColStd_HSequenceOfInteger) theselect; - Standard_Integer themaxi; - - -}; - - - - - - - -#endif // _Transfer_TransferIterator_HeaderFile diff --git a/src/Transfer/Transfer_TransferMapOfProcessForFinder.hxx b/src/Transfer/Transfer_TransferMapOfProcessForFinder.hxx index 87bcef8cce..aa37a50b85 100644 --- a/src/Transfer/Transfer_TransferMapOfProcessForFinder.hxx +++ b/src/Transfer/Transfer_TransferMapOfProcessForFinder.hxx @@ -20,8 +20,8 @@ #include #include #include -#include +#include -typedef NCollection_IndexedDataMap Transfer_TransferMapOfProcessForFinder; +typedef NCollection_IndexedDataMap Transfer_TransferMapOfProcessForFinder; #endif // _Transfer_TransferMapOfProcessForFinder_HeaderFile diff --git a/src/Transfer/Transfer_TransferOutput.cxx b/src/Transfer/Transfer_TransferOutput.cxx deleted file mode 100644 index 44db4d741e..0000000000 --- a/src/Transfer/Transfer_TransferOutput.cxx +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) 1999-2014 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. - -//szv#4 S4163 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -Transfer_TransferOutput::Transfer_TransferOutput (const Handle(Transfer_ActorOfTransientProcess)& actor, - const Handle(Interface_InterfaceModel)& amodel) -{ - theproc = new Transfer_TransientProcess (amodel->NbEntities()); - theproc->SetActor(actor); - themodel = amodel; -// thescope = Standard_False; -// theundef = Transfer_UndefIgnore; -} - -Transfer_TransferOutput::Transfer_TransferOutput (const Handle(Transfer_TransientProcess)& proc, - const Handle(Interface_InterfaceModel)& amodel) -{ - theproc = proc; - themodel = amodel; -// thescope = Standard_False; //szv#4:S4163:12Mar99 initialization needed -// theundef = Transfer_UndefIgnore; -} - -//Standard_Boolean& Transfer_TransferOutput::ScopeMode () -//{ return thescope; } - -Handle(Interface_InterfaceModel) Transfer_TransferOutput::Model () const -{ return themodel; } - -Handle(Transfer_TransientProcess) Transfer_TransferOutput::TransientProcess () const -{ return theproc; } - -void Transfer_TransferOutput::Transfer (const Handle(Standard_Transient)& obj) -{ - if (themodel->Number(obj) == 0) Transfer_TransferFailure::Raise - ("TransferOutput : Transfer, entities do not come from same initial model"); -// Standard_Integer scope = 0; -// if (thescope) scope = theproc->NewScope (obj); - - //:1 modified by ABV 5 Nov 97 - //:1 if (!theproc->Transfer(obj)) return; // auparavant, traitement Undefined -// Standard_Boolean ok = - theproc->Transfer ( obj ); -// if (scope > 0) theproc->EndScope (scope); -// if ( ! ok ) return; - -/* switch (theundef) { - case Transfer_UndefIgnore : return; - case Transfer_UndefFailure : Transfer_TransferFailure::Raise - ("TransferOutput : Transfer Undefined as Failure"); - case Transfer_UndefContent : break; // on ne sait pas traiter ... - case Transfer_UndefUser : break; // idem - } -*/ -} - - -// Resultats : -// Pour transferer tout simplement toutes les racines d'un modele d'interface -// Chacune est notee "Root" dans le Process final - -void Transfer_TransferOutput::TransferRoots () -{ TransferRoots(Interface_Protocol::Active()); } - -void Transfer_TransferOutput::TransferRoots (const Handle(Interface_Protocol)& protocol) -{ - theproc->SetRootManagement (Standard_False); - Interface_ShareFlags tool(themodel,protocol); - Interface_EntityIterator list = tool.RootEntities(); - for (list.Start(); list.More(); list.Next()) { - Handle(Standard_Transient) ent = list.Value(); -// Standard_Integer scope = 0; -// if (thescope) scope = theproc->NewScope (ent); - if (theproc->Transfer(ent)) theproc->SetRoot(ent); -// if (scope > 0) theproc->EndScope (scope); - } -} - -void Transfer_TransferOutput::TransferRoots (const Interface_Graph& G) -{ - theproc->SetRootManagement (Standard_False); - Interface_ShareFlags tool(G); - theproc->SetModel (G.Model()); - Interface_EntityIterator list = tool.RootEntities(); - for (list.Start(); list.More(); list.Next()) { - Handle(Standard_Transient) ent = list.Value(); -// Standard_Integer scope = 0; -// if (thescope) scope = theproc->NewScope (ent); - if (theproc->Transfer(ent)) theproc->SetRoot(ent); -// if (scope > 0) theproc->EndScope (scope); - } -} - - -Interface_EntityIterator Transfer_TransferOutput::ListForStatus (const Standard_Boolean normal, - const Standard_Boolean roots) const -{ - Interface_EntityIterator list; - Standard_Integer max = (roots ? theproc->NbRoots() : theproc->NbMapped()); - for (Standard_Integer i = 1; i <= max; i ++) { - const Handle(Transfer_Binder)& binder = - (roots ? theproc->RootItem(i) : theproc->MapItem(i)); - if (binder.IsNull()) continue; - Transfer_StatusExec statex = binder->StatusExec(); - Standard_Boolean ok = - (statex == Transfer_StatusInitial || statex == Transfer_StatusDone); - if (ok == normal) list.AddItem - ( (roots ? theproc->Root(i) : theproc->Mapped(i)) ); - } - return list; -} - -Handle(Interface_InterfaceModel) Transfer_TransferOutput::ModelForStatus - (const Handle(Interface_Protocol)& protocol, - const Standard_Boolean normal, const Standard_Boolean roots) const -{ - Handle(Interface_InterfaceModel) newmod; - if (themodel.IsNull()) return newmod; - newmod = themodel->NewEmptyModel(); - Interface_EntityIterator list = ListForStatus (normal, roots); - for (list.Start(); list.More(); list.Next()) - newmod->AddWithRefs (list.Value(),protocol); - return newmod; -} diff --git a/src/Transfer/Transfer_TransferOutput.hxx b/src/Transfer/Transfer_TransferOutput.hxx deleted file mode 100644 index f3361f297b..0000000000 --- a/src/Transfer/Transfer_TransferOutput.hxx +++ /dev/null @@ -1,134 +0,0 @@ -// Created on: 1992-02-04 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 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 _Transfer_TransferOutput_HeaderFile -#define _Transfer_TransferOutput_HeaderFile - -#include -#include -#include - -#include -class Transfer_TransientProcess; -class Interface_InterfaceModel; -class Standard_NoSuchObject; -class Transfer_TransferFailure; -class Transfer_ActorOfTransientProcess; -class Standard_Transient; -class Interface_Protocol; -class Interface_Graph; -class Interface_EntityIterator; - - -//! A TransferOutput is a Tool which manages the transfer of -//! entities created by an Interface, stored in an InterfaceModel, -//! into a set of Objects suitable for an Application -//! Objects to be transferred are given, by method Transfer -//! (which calls Transfer from TransientProcess) -//! A default action is available to get all roots of the Model -//! Result is given as a TransferIterator (see TransferProcess) -//! Also, it is possible to pilot directly the TransientProcess -class Transfer_TransferOutput -{ -public: - - DEFINE_STANDARD_ALLOC - - - //! Creates a TransferOutput ready to use, with a TransientProcess - Standard_EXPORT Transfer_TransferOutput(const Handle(Transfer_ActorOfTransientProcess)& actor, const Handle(Interface_InterfaceModel)& amodel); - - //! Creates a TransferOutput from an already existing - //! TransientProcess, and a Model - //! Returns (by Reference, hence can be changed) the Mode for - //! Scope Management. False (D) means Scope is ignored. - //! True means that each individual Transfer (direct or through - //! TransferRoots) is regarded as one Scope - Standard_EXPORT Transfer_TransferOutput(const Handle(Transfer_TransientProcess)& proc, const Handle(Interface_InterfaceModel)& amodel); - - //! Returns the Starting Model - Standard_EXPORT Handle(Interface_InterfaceModel) Model() const; - - //! Returns the TransientProcess used to work - Standard_EXPORT Handle(Transfer_TransientProcess) TransientProcess() const; - - //! Transfer checks that all taken Entities come from the same - //! Model, then calls Transfer from TransientProcess - Standard_EXPORT void Transfer (const Handle(Standard_Transient)& obj); - - //! Runs transfer on the roots of the Interface Model - //! The Roots are computed with a ShareFlags created from a - //! Protocol given as Argument - Standard_EXPORT void TransferRoots (const Handle(Interface_Protocol)& protocol); - - //! Runs transfer on the roots defined by a Graph of dependences - //! (which detains also a Model and its Entities) - //! Roots are computed with a ShareFlags created from the Graph - Standard_EXPORT void TransferRoots (const Interface_Graph& G); - - //! Runs transfer on the roots of the Interface Model - //! Remark : the Roots are computed with a ShareFlags created - //! from the Active Protocol - Standard_EXPORT void TransferRoots(); - - //! Returns the list of Starting Entities with these criteria : - //! - False, gives the entities bound with ABNORMAL STATUS - //! (e.g. : Fail recorded, Exception raised during Transfer) - //! - True, gives Entities with or without a Result, but - //! with no Fail, no Exception (Warnings are not counted) - //! - False, considers all entities recorded (either for - //! Result, or for at least one Fail or Warning message) - //! - True (Default), considers only roots of Transfer - //! (the Entities recorded at highest level) - //! This method is based on AbnormalResult from TransferProcess - Standard_EXPORT Interface_EntityIterator ListForStatus (const Standard_Boolean normal, const Standard_Boolean roots = Standard_True) const; - - //! Fills a Model with the list determined by ListForStatus - //! This model starts from scratch (made by NewEmptyModel from the - //! current Model), then is filled by AddWithRefs - //! - //! Useful to get separately from a transfer, the entities which - //! have caused problem, in order to furtherly analyse them (with - //! normal = False), or the "good" entities, to obtain a data set - //! "which works well" (with normal = True) - Standard_EXPORT Handle(Interface_InterfaceModel) ModelForStatus (const Handle(Interface_Protocol)& protocol, const Standard_Boolean normal, const Standard_Boolean roots = Standard_True) const; - - - - -protected: - - - - - -private: - - - - Handle(Transfer_TransientProcess) theproc; - Handle(Interface_InterfaceModel) themodel; - - -}; - - - - - - - -#endif // _Transfer_TransferOutput_HeaderFile diff --git a/src/Transfer/Transfer_TransferProcess.gxx b/src/Transfer/Transfer_TransferProcess.gxx deleted file mode 100644 index e367b6cd67..0000000000 --- a/src/Transfer/Transfer_TransferProcess.gxx +++ /dev/null @@ -1,1567 +0,0 @@ -// Copyright (c) 1999-2014 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. - -// DCE 21.01.99 S3767 Display original messages only -// if the level is greater than 2 - -//#include -// Class generique - -// TheStart est suppose Handle(Standard_Transient) ou (Transfer_Finder) -// Il doit offrir : "==" , .IsNull() , ->DynamicType() - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - - -//#define TRANSLOG // debug - -static Handle(Standard_Transient) nultrans; // pour retour const&(Null) ... -static Handle(Transfer_Binder) nulbinder; - - -//======================================================================= -//function : Transfer_TransferProcess -//purpose : -//======================================================================= - -Transfer_TransferProcess::Transfer_TransferProcess (const Standard_Integer nb) - : themap (nb) -{ - theerrh = Standard_True; - therootm = Standard_False; - thelevel = 0; therootl = 0; - themessenger = Message::DefaultMessenger(); - thetrace = 0; -// theroots = new TColStd_HSequenceOfInteger (); - theindex = 0; -} - - -//======================================================================= -//function : Transfer_TransferProcess -//purpose : -//======================================================================= - -Transfer_TransferProcess::Transfer_TransferProcess(const Handle(Message_Messenger)& messenger, - const Standard_Integer nb) - : themap (nb) -{ - theerrh = Standard_True; - therootm = Standard_False; - thelevel = 0; therootl = 0; - SetMessenger (messenger); - thetrace = 1; -// theroots = new TColStd_HSequenceOfInteger (); - theindex = 0; -} - - void Transfer_TransferProcess::Clear () -{ - thelevel = 0; therootl = 0; - theroots.Clear(); - themap.Clear(); - theindex = 0; thelastobj.Nullify(); thelastbnd.Nullify(); -} - - void Transfer_TransferProcess::Clean () -{ - Standard_Integer i, nb = NbMapped(); - Standard_Integer j,unb = 0; - for (i = 1; i <= nb; i ++) { - if (themap(i).IsNull()) unb ++; - } - if (unb == 0) return; - -// Refaire la map -> decalages - TColStd_Array1OfInteger unbs (1,nb); unbs.Init(0); - Transfer_TransferMap newmap (nb*2); - for (i = 1; i <= nb; i ++) { - TheStart ent = Mapped(i); - Handle(Transfer_Binder) bnd = MapItem(i); - if (bnd.IsNull()) continue; - j = newmap.Add (ent,bnd); - unbs.SetValue (i,j); - } - themap.Assign (newmap); - - // Update La liste des racines - TColStd_IndexedMapOfInteger aNewRoots; - for( i=1; i<= theroots.Extent(); i++ ) { - j = theroots.FindKey(i); - Standard_Integer k = unbs.Value(j); - if ( k ) aNewRoots.Add ( k ); - } - theroots.Clear(); - theroots = aNewRoots; - -// Le reste : nettoyage - thelastobj.Nullify(); - thelastbnd.Nullify(); - theindex = 0; -} - - -//======================================================================= -//function : Resize -//purpose : -//======================================================================= - -void Transfer_TransferProcess::Resize (const Standard_Integer nb) -{ - if (nb > themap.NbBuckets()) themap.ReSize(nb); -} - - -//======================================================================= -//function : SetActor -//purpose : -//======================================================================= - -void Transfer_TransferProcess::SetActor(const Handle(Transfer_Actor)& actor) -{ - if (theactor == actor) return; - if (theactor.IsNull()) theactor = actor; - else if (actor.IsNull()) theactor = actor; // declenche RAZ - else if (theactor->IsLast()) { actor->SetNext(theactor); theactor = actor; } - else theactor->SetNext(actor); -} - - -//======================================================================= -//function : Actor -//purpose : -//======================================================================= - -Handle(Transfer_Actor) Transfer_TransferProcess::Actor () const -{ - return theactor; -} - - -// ######################################################################## -// .... MAPPING .... - -// ## ## ## Actions Generales sur Binders ## ## ## -// ## ## ## Consultations ## ## ## - - -// ## ## Find ## ## - -//======================================================================= -//function : Find -//purpose : -//======================================================================= - -Handle(Transfer_Binder) Transfer_TransferProcess::Find (const TheStart& start) const -// const Standard_Integer categ) const -{ - if (thelastobj == start) { - //if (theindex > 0) return thelastbnd->Search(categ); //skl - if (theindex > 0) return thelastbnd; //skl - } - Standard_Integer index = themap.FindIndex (start); - if (index > 0) { - const Handle(Transfer_Binder)& binder = themap.FindFromIndex(index); - //if (binder.IsNull()) //skl - return binder; - //return binder->Search(categ); //skl - } - return nulbinder; -} - -// ## ## IsBound ## ## - -//======================================================================= -//function : IsBound -//purpose : -//======================================================================= - -Standard_Boolean Transfer_TransferProcess::IsBound(const TheStart& start) const -// const Standard_Integer categ) const -{ - Handle(Transfer_Binder) binder = Find(start); //,categ); skl - if (binder.IsNull()) return Standard_False; - return binder->HasResult(); -} - -// ## ## IsAlreadyUsed ## ## - -//======================================================================= -//function : IsAlreadyUsed -//purpose : -//======================================================================= - -Standard_Boolean Transfer_TransferProcess::IsAlreadyUsed(const TheStart& start) const -// const Standard_Integer categ) const -{ - Handle(Transfer_Binder) binder = Find(start); //,categ); skl - if (binder.IsNull()) { - StartTrace (binder,start,thelevel,4); - Transfer_TransferFailure::Raise - ("TransferProcess : IsAlreadyUsed, transfer not done cannot be used..."); - } - return (binder->Status() == Transfer_StatusUsed); -} - - -// ## ## FindAndMask (private) ## ## - -//======================================================================= -//function : FindAndMask -//purpose : -//======================================================================= - -Handle(Transfer_Binder) Transfer_TransferProcess::FindAndMask(const TheStart& start) -// const Standard_Integer categ) -{ - if (thelastobj == start) { - if (theindex > 0) return thelastbnd; //skl ->Search(categ); - } - thelastobj = start; - theindex = themap.FindIndex (start); - if (theindex > 0) thelastbnd = themap.FindFromIndex(theindex); - else thelastbnd.Nullify(); - //if (thelastbnd.IsNull()) skl - return thelastbnd; - //return thelastbnd->Search(categ); //skl -} - - -// ## ## ## Modifications ## ## ## - - -//======================================================================= -//function : Bind -//purpose : -//======================================================================= - -void Transfer_TransferProcess::Bind (const TheStart& start, - const Handle(Transfer_Binder)& binder) -// const Standard_Integer categ) -{ - if (binder.IsNull()) return; - Handle(Transfer_Binder) former = FindAndMask(start);//,categ);skl - if (!former.IsNull()) { -// On admet VoidBinder : alors on reprend son Check - if (former->DynamicType() == STANDARD_TYPE(Transfer_VoidBinder)) { - binder->Merge(former); - //binder->SetCategory(categ); //skl - themap(theindex) = binder; // Substitution - } - else if (former->Status() == Transfer_StatusUsed) { - StartTrace (former,start,thelevel,4); - Transfer_TransferFailure::Raise - ("TransferProcess : Bind, already Bound"); - } - else { - if (thetrace > 2) StartTrace (former,start,thelevel,5); - binder->CCheck()->GetMessages (former->Check()); - } - } - //binder->SetCategory(categ); //skl - if (theindex == 0 || thelastbnd.IsNull()) { - if (theindex == 0) theindex = themap.Add(start,binder); // Nouveau - else themap(theindex) = binder; // idem en fait - thelastbnd = binder; - } - else { //skl - //binder->AddResult(thelastbnd); - thelastbnd = binder; - themap(theindex) = binder; - } -/*skl else if (thelastbnd->Category() == categ) { // Substitue cette categorie - binder->Next(Standard_False)->SetNext(thelastbnd->Next(Standard_True),Standard_True); - thelastbnd = binder; - themap(theindex) = binder; - } else { - thelastbnd->AddNext (binder,categ,Standard_True); - } */ -} - - -//======================================================================= -//function : Rebind -//purpose : -//======================================================================= - -void Transfer_TransferProcess::Rebind (const TheStart& start, - const Handle(Transfer_Binder)& binder) -// const Standard_Integer categ) -{ - Bind(start,binder); //,categ);skl - // entre les deux, les differences allaient s amenuisant - // au debut, on criait si pas encore Bound (idiot) - // ne restait plus comme difference que le test StatusUsed sur Rebind, - // tandis que Bind refusait des lors qu il y avait un resultat - // -> a present, Bind s aligne sur Rebind -} - - -//======================================================================= -//function : Unbind -//purpose : -//======================================================================= - -Standard_Boolean Transfer_TransferProcess::Unbind(const TheStart& start) -// const Standard_Integer categ) -{ - Handle(Transfer_Binder) former = FindAndMask(start);//,categ);skl - if (theindex == 0) return Standard_False; - if (former.IsNull()) return Standard_False; - if (former->DynamicType() == STANDARD_TYPE(Transfer_VoidBinder)) return Standard_True; - //const Interface_Check& ach = thelastbnd->Check(); - //Handle(Transfer_Binder) newbinder = thelastbnd->RemoveNext(categ);skl - //if (newbinder != thelastbnd)skl - themap(theindex) = thelastbnd;// = newbinder;skl - if(theroots.Contains(theindex)) { - TColStd_IndexedMapOfInteger aNewRoots; - for(Standard_Integer i = 1; i <= theroots.Extent(); i++) - if(theindex!= theroots.FindKey(i)) - aNewRoots.Add(theroots.FindKey(i)); - - theroots.Clear(); - theroots = aNewRoots; - } - - thelastobj.Nullify(); - thelastbnd.Nullify(); - theindex = 0; - return Standard_True; -} - - -//======================================================================= -//function : FindElseBind -//purpose : -//======================================================================= - -Handle(Transfer_Binder) Transfer_TransferProcess::FindElseBind(const TheStart& start) -// const Standard_Integer categ) -{ - Handle(Transfer_Binder) binder = FindAndMask (start);//,categ);skl - if (!binder.IsNull()) return binder; - binder = new Transfer_VoidBinder; - Bind(start,binder);//,categ);skl - return binder; -} - - -// ## ## ## Messages associes ## ## ## - -//======================================================================= -//function : SetMessenger -//purpose : -//======================================================================= - -void Transfer_TransferProcess::SetMessenger (const Handle(Message_Messenger)& messenger) -{ - if ( messenger.IsNull() ) - themessenger = Message::DefaultMessenger(); - else - themessenger = messenger; -} - -//======================================================================= -//function : Messenger -//purpose : -//======================================================================= - -Handle(Message_Messenger) Transfer_TransferProcess::Messenger () const -{ - return themessenger; -} - -//======================================================================= -//function : SetTraceLevel -//purpose : -//======================================================================= - -void Transfer_TransferProcess::SetTraceLevel (const Standard_Integer tracelev) -{ - thetrace = tracelev; -} - -//======================================================================= -//function : TraceLevel -//purpose : -//======================================================================= - -Standard_Integer Transfer_TransferProcess::TraceLevel () const -{ - return thetrace; -} - -//======================================================================= -//function : SendFail -//purpose : -//======================================================================= - -void Transfer_TransferProcess::SendFail(const TheStart& start, - const Message_Msg& amsg) -{ - AddFail(start,amsg); -} - - -//======================================================================= -//function : SendWarning -//purpose : -//======================================================================= - -void Transfer_TransferProcess::SendWarning(const TheStart& start, - const Message_Msg& amsg) -{ - AddWarning(start,amsg); -} - - -//======================================================================= -//function : SendMsg -//purpose : -//======================================================================= - -void Transfer_TransferProcess::SendMsg(const TheStart& start, - const Message_Msg& amsg) -{ - Handle(Transfer_Binder) binder = FindAndMask(start); - if (binder.IsNull()) { - binder = new Transfer_VoidBinder; - Bind (start,binder); - } - // Alimente la trace : Regle causant (user messages) - if (thetrace > 0) { - StartTrace (binder,start,thelevel,6); - themessenger << amsg.Value(); - if (amsg.IsEdited()&&thetrace>2) - themessenger << " [from: " << amsg.Original() << "]"; - themessenger << endl; - } -} - - -//======================================================================= -//function : AddFail -//purpose : -//======================================================================= - -void Transfer_TransferProcess::AddFail(const TheStart& start, - const Standard_CString mess, - const Standard_CString orig) -{ - Handle(Transfer_Binder) binder = FindAndMask(start); - if (binder.IsNull()) { - binder = new Transfer_VoidBinder; - Bind (start,binder); - } - binder->AddFail (mess,orig); - if (thetrace > 0) { - StartTrace (binder,start,thelevel,1); - themessenger << " --> Fail : " << mess; - if (orig[0] != '\0'&&thetrace>2) themessenger << " [from: " << orig << "]"; - themessenger << endl; - } -} - - -//======================================================================= -//function : AddError -//purpose : -//======================================================================= - -void Transfer_TransferProcess::AddError(const TheStart& start, - const Standard_CString mess, - const Standard_CString orig) -{ - AddFail (start,mess,orig); -} - - -//======================================================================= -//function : AddFail -//purpose : -//======================================================================= - -void Transfer_TransferProcess::AddFail(const TheStart& start, - const Message_Msg& amsg) -{ - if (amsg.IsEdited()) AddFail (start,TCollection_AsciiString(amsg.Value()).ToCString(), - TCollection_AsciiString(amsg.Original()).ToCString()); - else AddFail (start,TCollection_AsciiString(amsg.Value()).ToCString()); -} - - -//======================================================================= -//function : AddWarning -//purpose : -//======================================================================= - -void Transfer_TransferProcess::AddWarning(const TheStart& start, - const Standard_CString mess, - const Standard_CString orig) -{ - Handle(Transfer_Binder) binder = FindAndMask(start); - if (binder.IsNull()) { - binder = new Transfer_VoidBinder; - Bind (start,binder); - } - binder->AddWarning(mess,orig); - if (thetrace > 1) { - StartTrace (binder,start,thelevel,2); - themessenger << " --> Warning : " << mess; - if (orig[0] != '\0'&&thetrace>2) themessenger << " [from: " << orig << "]"; - themessenger << endl; - } -} - - -//======================================================================= -//function : AddWarning -//purpose : -//======================================================================= - -void Transfer_TransferProcess::AddWarning(const TheStart& start, - const Message_Msg& amsg) -{ - if (amsg.IsEdited()) AddWarning (start,TCollection_AsciiString(amsg.Value()).ToCString(), - TCollection_AsciiString(amsg.Original()).ToCString()); - else AddWarning (start,TCollection_AsciiString(amsg.Value()).ToCString()); -} - - -//======================================================================= -//function : Mend -//purpose : -//======================================================================= - -void Transfer_TransferProcess::Mend(const TheStart& start, - const Standard_CString pref) -{ - Handle(Transfer_Binder) binder = FindAndMask(start); - if (binder.IsNull()) return; // rien a faire ... - Handle(Interface_Check) ach = binder->CCheck(); - ach->Mend (pref); -} - - -//======================================================================= -//function : Check -//purpose : -//======================================================================= - -Handle(Interface_Check) Transfer_TransferProcess::Check(const TheStart& start) const -{ - const Handle(Transfer_Binder)& binder = Find(start); - if (binder.IsNull()) { - Handle(Interface_Check) check; - return check; - } - return binder->Check(); -} - -/*skl -void Transfer_TransferProcess::AddCaseName(const TheStart& start, - const Standard_CString casename) -{ - AddCaseValue (start, new TCollection_HAsciiString (casename)); -} - - -void Transfer_TransferProcess::AddCaseValue(const TheStart& start, - const Handle(Standard_Transient)& caseval) -{ - Handle(Transfer_Binder) binder = FindAndMask(start); - if (binder.IsNull()) { - binder = new Transfer_VoidBinder; - Bind (start,binder); - } - binder->AddCaseValue (caseval); -} - - -Handle(TColStd_HSequenceOfTransient) Transfer_TransferProcess::CaseList - (const TheStart& start) const -{ - Handle(TColStd_HSequenceOfTransient) list; - const Handle(Transfer_Binder)& binder = Find(start); - if (binder.IsNull()) return list; - return binder->CaseList(); -} - -Standard_Integer Transfer_TransferProcess::NextItemWithAttribute - (const Standard_CString name, const Standard_Integer num0) const -{ - Standard_Integer num, nb = NbMapped(); - for (num = num0+1; num <= nb; num ++) { - Handle(Transfer_Binder) bnd = MapItem (num); - if (bnd.IsNull()) continue; - if (!bnd->Attribute(name).IsNull()) return num; - } - return 0; -} - - -Interface_ParamType Transfer_TransferProcess::AttributeType - (const Standard_CString name) const -{ - Interface_ParamType aty, res = Interface_ParamVoid; - Standard_Integer num, nb = NbMapped(); - for (num = 1; num <= nb; num ++) { - Handle(Transfer_Binder) bnd = MapItem (num); - if (bnd.IsNull()) continue; - aty = bnd->AttributeType(name); - if (aty == Interface_ParamVoid) continue; - if (res == Interface_ParamVoid) res = aty; - else if (res != aty) return Interface_ParamMisc; - } - return res; -} - -Handle(Dico_DictionaryOfInteger) Transfer_TransferProcess::Attributes - (const Standard_CString rootname) const -{ - Handle(Dico_DictionaryOfInteger) list = new Dico_DictionaryOfInteger; - Standard_Integer num, nb = NbMapped(); - for (num = 1; num <= nb; num ++) { - Handle(Transfer_Binder) bnd = MapItem (num); - if (bnd.IsNull()) continue; - Handle(Dico_DictionaryOfTransient) atr = bnd->AttrList(); - if (atr.IsNull()) continue; - Dico_IteratorOfDictionaryOfTransient iatr(atr,rootname); - for (; iatr.More(); iatr.Next()) { - TCollection_AsciiString name = iatr.Name(); - Standard_Boolean deja; - Standard_Integer& nbval = list->NewItem (name.ToCString(),deja); - if (!deja) nbval = 0; - nbval ++; - } - - } - return list; -} -skl*/ - - -// ## ## ## Actions sur Types Privilegies ## ## ## -// ## ## ## (Transient) ## ## ## - -// Bind associe un objet a un objet resultat; or la Map associe un Objet a un -// Binder (qui designe son resultat) -// *Transient travaillent avec un SimpleBinderOfTransient -// si deja la, on considere son resultat -// sinon, on cree un Binder du bon type - - -//======================================================================= -//function : BindTransient -//purpose : -//======================================================================= - -void Transfer_TransferProcess::BindTransient(const TheStart& start, - const Handle(Standard_Transient)& res) -// const Standard_Integer categ) -{ - if (res.IsNull()) return; - Handle(Transfer_Binder) former = Find(start);//,categ);skl - Handle(Transfer_SimpleBinderOfTransient) binder = - Handle(Transfer_SimpleBinderOfTransient)::DownCast(former); -// Binding sur place ? - if (!binder.IsNull()) { - if (binder->Status() == Transfer_StatusVoid) { binder->SetResult(res); return; } - } -// Sinon, refaire - binder = new Transfer_SimpleBinderOfTransient; - binder->SetResult (res); - if (former.IsNull()) Bind(start,binder);//,categ);skl - else Rebind(start,binder);//,categ);skl -} - - -//======================================================================= -//function : FindTransient -//purpose : -//======================================================================= - -const Handle(Standard_Transient)& Transfer_TransferProcess::FindTransient - (const TheStart& start) const -{ - Handle(Transfer_SimpleBinderOfTransient) binder = - Handle(Transfer_SimpleBinderOfTransient)::DownCast(Find(start)); - if (binder.IsNull()) return nultrans; - if (!binder->HasResult()) return nultrans; - return binder->Result(); -} - - -// Binding Multiple : D abord le declarer par BindMultiple (si pas deja fait) -// Puis ajouter les termes par AddMultiple - -//======================================================================= -//function : BindMultiple -//purpose : -//======================================================================= - -void Transfer_TransferProcess::BindMultiple(const TheStart& start) -// const Standard_Integer categ) -{ - Handle(Transfer_Binder) binder = FindAndMask (start);//,categ);skl - if (!binder.IsNull()) { - if (!binder->IsKind(STANDARD_TYPE(Transfer_MultipleBinder))) { - StartTrace (thelastbnd,start,thelevel,4); - Transfer_TransferFailure::Raise ("TransferProcess : BindMultiple"); - } - } - else Bind(start,new Transfer_MultipleBinder);//,categ);skl -} - - -//======================================================================= -//function : AddMultiple -//purpose : -//======================================================================= - -void Transfer_TransferProcess::AddMultiple(const TheStart& start, - const Handle(Standard_Transient)& res) -// const Standard_Integer categ) -{ - Handle(Transfer_Binder) binder = FindAndMask(start);//,categ);skl - Handle(Transfer_MultipleBinder) multr = - Handle(Transfer_MultipleBinder)::DownCast(binder); - if (multr.IsNull()) { - StartTrace (binder,start,thelevel,4); - if (binder.IsNull()) Transfer_TransferFailure::Raise - ("TransferProcess : AddMultiple, nothing bound"); - else Transfer_TransferFailure::Raise - ("TransferProcess : AddMultiple, Binder not a MultipleBinder"); - } - multr->AddResult(res); -} - - -//======================================================================= -//function : FindTypedTransient -//purpose : -//======================================================================= - -Standard_Boolean Transfer_TransferProcess::FindTypedTransient - (const TheStart& start, const Handle(Standard_Type)& atype, - Handle(Standard_Transient)& val) const -{ - return GetTypedTransient (Find(start),atype,val); -} - - -//======================================================================= -//function : GetTypedTransient -//purpose : -//======================================================================= - -Standard_Boolean Transfer_TransferProcess::GetTypedTransient - (const Handle(Transfer_Binder)& binder, const Handle(Standard_Type)& atype, - Handle(Standard_Transient)& val) const -{ - return Transfer_SimpleBinderOfTransient::GetTypedResult(binder,atype,val); -} - - -// ## ## ## ## ## Acces Atomique ## ## ## ## ## -// (ne gere pas le scope mais donne acces aux categories) - -//======================================================================= -//function : NbMapped -//purpose : -//======================================================================= - -Standard_Integer Transfer_TransferProcess::NbMapped () const -{ - return themap.Extent(); -} - - -//======================================================================= -//function : Mapped -//purpose : -//======================================================================= - -const TheStart& Transfer_TransferProcess::Mapped(const Standard_Integer num) const -{ - return themap.FindKey(num); -} - - -//======================================================================= -//function : MapIndex -//purpose : -//======================================================================= - -Standard_Integer Transfer_TransferProcess::MapIndex(const TheStart& start) const -{ - return themap.FindIndex(start); -} - - -//======================================================================= -//function : MapItem -//purpose : -//======================================================================= - -Handle(Transfer_Binder) Transfer_TransferProcess::MapItem(const Standard_Integer num) const -// const Standard_Integer categ) const -{ - Handle(Transfer_Binder) binder = themap.FindFromIndex(num); - //sklif (binder.IsNull()) - return binder; - //sklreturn binder->Search (categ); -} - - -// ######################################################################## -// .... ROOT MANAGEMENT .... - -//======================================================================= -//function : SetRoot -//purpose : -//======================================================================= - -void Transfer_TransferProcess::SetRoot (const TheStart& start) -{ - Standard_Integer index = MapIndex(start); - if (index == 0) { - //StartTrace (thelastbnd,start,thelevel,4); - //Transfer_TransferFailure::Raise("TransferProcess : SetRoot"); - return; - } - - theroots.Add(index); - if (thetrace > 2) StartTrace (MapItem(index),start,thelevel,3); -} - - -//======================================================================= -//function : SetRootManagement -//purpose : -//======================================================================= - -void Transfer_TransferProcess::SetRootManagement(const Standard_Boolean stat) -{ - therootm = stat; -} - - -//======================================================================= -//function : NbRoots -//purpose : -//======================================================================= - -Standard_Integer Transfer_TransferProcess::NbRoots () const -{ - return theroots.Extent(); -} - - -//======================================================================= -//function : Root -//purpose : -//======================================================================= - -const TheStart& Transfer_TransferProcess::Root(const Standard_Integer num) const -{ - Standard_Integer ind = 0; - if (num > 0 && num <= theroots.Extent()) ind = theroots.FindKey(num); - return themap.FindKey (ind); -} - - -//======================================================================= -//function : RootItem -//purpose : -//======================================================================= - -Handle(Transfer_Binder) Transfer_TransferProcess::RootItem(const Standard_Integer num) const -// const Standard_Integer categ) const -{ - Standard_Integer ind = 0; - if (num > 0 && num <= theroots.Extent()) ind = theroots.FindKey(num); - return themap.FindFromIndex(ind);//->Search(categ);skl -} - - -//======================================================================= -//function : RootIndex -//purpose : -//======================================================================= - -Standard_Integer Transfer_TransferProcess::RootIndex(const TheStart& start) const -{ - Standard_Integer index = MapIndex(start); - if (index == 0) return 0; - return theroots.FindIndex(index); -} - - -//======================================================================= -//function : NestingLevel -//purpose : -//======================================================================= - -Standard_Integer Transfer_TransferProcess::NestingLevel () const -{ - return thelevel; -} - - -//======================================================================= -//function : ResetNestingLevel -//purpose : -//======================================================================= - -void Transfer_TransferProcess::ResetNestingLevel () -{ - thelevel = 0; -} - - -// ######################################################################## -// .... SCOPE MANAGEMENT .... - - -//====================================================================== -//Purpose : gka TRJ9 for writing SDR for solid -// Check if binder has already been bound to the result binder. -//====================================================================== - -// static Standard_Boolean Contains(const Handle(Transfer_Binder)& resbinder, -// const Handle(Transfer_Binder)& addbinder) -// { -// Handle(Transfer_Binder) tmpbind = resbinder; -// for ( ; ! tmpbind.IsNull(); tmpbind = tmpbind->NextResult() ) -// if ( tmpbind == addbinder ) return Standard_True; -// return Standard_False; -// } - -// ######################################################################## -// .... AUTOMATISMES DE TRANSFERT .... - -// ## ## ## ## ## Fonctions de Base ## ## ## ## ## - - -//======================================================================= -//function : Recognize -//purpose : -//======================================================================= - -Standard_Boolean Transfer_TransferProcess::Recognize(const TheStart& start) const -{ - Handle(Transfer_Actor) actor = theactor; - // On balaie les Next jusqu a avoir un Resultat - while (!actor.IsNull()) { - if (actor->Recognize (start)) return Standard_True; - actor = actor->Next(); - } - return Standard_False; -} - - -//======================================================================= -//function : Transferring -//purpose : -//======================================================================= - -Handle(Transfer_Binder) Transfer_TransferProcess::Transferring(const TheStart& start) -{ - // Map deja alimentee ? - Handle(Transfer_Binder) former = FindAndMask(start); - - // .... Transfert deja effectue avec Resultat ? .... - - // On considere que cette nouvelle demande de Transfert correspond donc a une - // utilisation en plus : noter "AlreadyUsed", donc resultat non modifiable - if (!former.IsNull()) { - if (former->HasResult()) { - former->SetAlreadyUsed(); - return former; - } - //} - - // .... Etat Initial : peut-etre deja fait ... ou infaisable ! - - //if (!former.IsNull()) { - Transfer_StatusExec statex = former->StatusExec(); - switch (statex) { - case Transfer_StatusInitial : // Transfert prepare a faire - break; - case Transfer_StatusDone : // Transfert deja fait -//#ifdef TRANSLOG - themessenger << " .. and Transfer done" << endl; -//#endif -// if (former->HasResult()) former->SetAlreadyUsed(); - return former; - case Transfer_StatusRun : // ca y est, on boucle - former->SetStatusExec(Transfer_StatusLoop); - return former; - case Transfer_StatusError : // pas propre, ca ... - if (thetrace) { - themessenger << " *** Transfer in Error Status :" << endl; - StartTrace (former, start, thelevel,0); -// (*themessenger->Out()) << flush; - } - else StartTrace (former, start,thelevel,4); - Transfer_TransferFailure::Raise - ("TransferProcess : Transfer in Error Status"); - case Transfer_StatusLoop : // la boucle est bouclee ... - if (thetrace) { - themessenger << " *** Transfer Head of Dead Loop :" << endl; - StartTrace (former, start, thelevel,0); -// (*themessenger->Out()) << flush; - } - else StartTrace (former, start,thelevel,4); - Transfer_TransferDeadLoop::Raise - ("TransferProcess : Transfer at Head of a Dead Loop"); - } -#ifdef TRANSLOG - cout << "Transfer,level "<SetStatusExec(Transfer_StatusRun); - } -#ifdef TRANSLOG - cout << " GO .." << endl; -#endif - - Handle(Transfer_Binder) binder; - Standard_Boolean newbind = Standard_False; - if (theerrh) { - // Transfert sous protection pour les exceptions (pour notification en fait) - Standard_Integer oldlev = thelevel; - try { - OCC_CATCH_SIGNALS - binder = TransferProduct(start); - } - - // ... Exceptions a Rattraper : elles ne se ressemblent pas toutes ... ! - catch (Transfer_TransferDeadLoop) { - if (binder.IsNull()) { - themessenger << " *** Dead Loop with no Result" << endl; - if (thetrace) StartTrace (binder, start, thelevel-1,0); - binder = new Transfer_VoidBinder; - Bind (start,binder); newbind = Standard_True; - } else if (binder->StatusExec() == Transfer_StatusLoop) { - if (thetrace) { - themessenger << " *** Dead Loop : Finding head of Loop :" << endl; - StartTrace (binder, start, thelevel-1,0); - } - else StartTrace (binder, start,thelevel-1,4); - Transfer_TransferFailure::Raise("TransferProcess : Head of Dead Loop"); -// Autrement dit, on change d exception (on est sorti de la boucle) - } else { - if (thetrace) { - themessenger << " *** Dead Loop : Actor in Loop :" << endl; - StartTrace (binder, start, thelevel-1,0); - } - } - binder->AddFail("Transfer in dead Loop"); - thelevel = oldlev; - } - catch (Standard_Failure) { - if (binder.IsNull()) { - themessenger << " *** Exception Raised with no Result" << endl; - binder = new Transfer_VoidBinder; - Bind (start,binder); newbind = Standard_True; - } - binder->AddFail("Transfer stopped by exception raising"); - if (thetrace) { - themessenger << " *** Raised : " << Standard_Failure::Caught()->GetMessageString() << endl; - StartTrace (binder, start, thelevel-1,4); - } - thelevel = oldlev; - } - } - -// Transfert non protege (ainsi, dbx a la main en cas de plantage par Raise) - else binder = TransferProduct(start); - -// .... Conclusion : Noter dans la Map .... - - if (!newbind && !binder.IsNull()) { - if (former.IsNull()) { -// Peut-etre a fait lui meme Bind ... verifier sinon le faire - if (!IsBound(start)) Bind(start,binder); // resultat = categorie 0 - else { // gka TRJ9 for writing SDR for solid -// Handle(Transfer_Binder) tmpbind = Find(start); -// if(!Contains(binder,tmpbind)) -// binder->AddResult(tmpbind); - Rebind(start,binder); // test_pattern.sat - } - } - else Rebind(start,binder); -// (du coup, vaut ) -#ifdef TRANSLOG - cout << " ... OK" << endl; -#endif - } - else { - //= by ABV: 5 Oct 97: nothing generated, but former can be in run state - drop it - //= ASK: may be set it to StatusInitial ? - if ( ! former.IsNull() ) former->SetStatusExec ( Transfer_StatusDone ); //+ - return nulbinder; // Binder Null ... que faire d autre ? - } - -// .... Gerer les Racines (si prevu) .... - - if (therootl >= thelevel) { - therootl = 0; - if (therootm && binder->Status() != Transfer_StatusVoid) { - SetRoot (start); - } - } - return thelastbnd; -} - -// ## ## TransferProduct : Action proprement dite ## ## - - Handle(Transfer_Binder) Transfer_TransferProcess::TransferProduct - (const TheStart& start) -{ - thelevel ++; // si decremente et == 0, transfert racine - Handle(Transfer_Binder) binder; - Handle(Transfer_Actor) actor = theactor; - -// On balaie les Next jusqu a avoir un Resultat - while (!actor.IsNull()) { - if (actor->Recognize (start)) binder = actor->Transferring(start,this); - else binder.Nullify(); - if (!binder.IsNull()) break; - actor = actor->Next(); - } - if (binder.IsNull()) { -// if (thetrace) { -// themessenger << "Transfer has produced no Result" < 0) thelevel --; - return binder; - } -// Gestion du niveau racine (.. a regarder de pres ..) - if (therootl == 0 && binder->StatusExec() == Transfer_StatusDone) - therootl = thelevel - 1; - - if (thelevel > 0) thelevel --; - return binder; -} - - -//======================================================================= -//function : Transfer -//purpose : -//======================================================================= - -Standard_Boolean Transfer_TransferProcess::Transfer(const TheStart& start) -{ - Handle(Transfer_Binder) binder = Transferring(start); - return (!binder.IsNull()); -} - - -// ######################################################################### -// .... Error Handling + Trace .... - -// trace : 1 pour Fail et Exception , 2 pour Root et Warning - - -//======================================================================= -//function : SetErrorHandle -//purpose : -//======================================================================= - -void Transfer_TransferProcess::SetErrorHandle(const Standard_Boolean err) -{ - theerrh = err; -} // traite par Transferring - - -//======================================================================= -//function : ErrorHandle -//purpose : -//======================================================================= - -Standard_Boolean Transfer_TransferProcess::ErrorHandle() const -{ - return theerrh; -} - -//======================================================================= -//function : StartTrace -//purpose : -//======================================================================= - -void Transfer_TransferProcess::StartTrace(const Handle(Transfer_Binder)& binder, - const TheStart& start, - const Standard_Integer level, - const Standard_Integer mode) const -{ - // ### Fail (Roots:50) -- Start start->DynamicType() - // ### Fail (Roots:50) -- Start id:#label.. Type:start->DynamicType() - if (thetrace > 3) { // Internal to be switch when searching bug (trace >= 4) - if (mode == 1) themessenger << " ### Fail"; - if (mode == 2) themessenger << " ### Warning"; - if (mode == 3) themessenger << " ### New Root n0 " << theroots.Extent(); - if (mode == 4) themessenger << " ### Exception"; - if (mode == 5) themessenger << " ### Substitution"; - if (mode == 6) themessenger << " ### Information"; - if (level > 1) - themessenger << " (nested)"; // " at nesting Level:"<= 0 && mode != 3) - themessenger << " at " << theroots.Extent() << " Roots"; - } - if (!start.IsNull()) PrintTrace (start,themessenger); -//// sout << endl; - - if (!binder.IsNull()) { // old: if IsNull sout <Status() != Transfer_StatusVoid) { -// --- Result Type: binder->ResultType() --- Binder : binder->DynamicType(); - if (!hasres) - themessenger << "\n --- Result Type : "; - else - themessenger << " , "; - themessenger << bnd->ResultTypeName(); -// CKY 9-JAN-1999: waiting for XSTEP Kernel message (not IGES_2075) -/* Message_Msg Msg2075("IGES_2075"); - Msg2075.AddString(bnd->ResultTypeName()); - Msg2075.TraceEver(); */ - hasres = Standard_True; - } - bnd = bnd->NextResult(); - } - if (!hasres && mode > 2) { - themessenger << "\n --- No Result recorded"; -// CKY 9-JAN-1999 : waiting for XSTEP Kernel message -// (not IGES_2075, no reference to specifically TopoDS_Shape) -/* Message_Msg Msg2075("IGES_2075"); - Msg2075.AddString("No TopoDS_Shape"); - Msg2075.TraceEver(); */ - } -//old if (isused) sout << " -- (Already Used in another Transfer)"; - } - themessenger << endl; -} - - -//======================================================================= -//function : PrintTrace -//purpose : -//======================================================================= - -void Transfer_TransferProcess::PrintTrace(const TheStart& start, - const Handle(Message_Messenger)& S) const -{ - if (!start.IsNull()) S <<" Type:" << start->DynamicType()->Name(); -} - - -//======================================================================= -//function : IsLooping -//purpose : -//======================================================================= - -Standard_Boolean Transfer_TransferProcess::IsLooping - (const Standard_Integer alevel) const - { return alevel > NbMapped(); } - - - -// ######################################################################### -// .... RESULTATS .... - - -// ## ## RootResult : Les Racines ## ## - - -//======================================================================= -//function : RootResult -//purpose : -//======================================================================= - -Transfer_Iterator Transfer_TransferProcess::RootResult(const Standard_Boolean withstart) const -{ - Transfer_Iterator iter(withstart); - Standard_Integer max = theroots.Extent(); - for (Standard_Integer j = 1; j <= max; j ++) { - Standard_Integer i = theroots.FindKey(j); - Handle(Transfer_Binder) binder = MapItem(i); - if (binder.IsNull()) continue; - if (withstart) iter.Add (binder,Mapped(i)); - else iter.Add (binder); - } - return iter; -} - - -// ## ## CompleteResult : Tous les Resultats ## ## - -//======================================================================= -//function : CompleteResult -//purpose : -//======================================================================= - -Transfer_Iterator Transfer_TransferProcess::CompleteResult - (const Standard_Boolean withstart) const -{ - Transfer_Iterator iter(withstart); - Standard_Integer max = NbMapped(); - for (Standard_Integer i = 1; i <= max; i ++) { - Handle(Transfer_Binder) binder = MapItem(i); - if (binder.IsNull()) continue; - if (withstart) iter.Add (binder,Mapped(i)); - else iter.Add (binder); - } - return iter; -} - - -// ## ## AbnormalResult : Transferts a probleme ## ## -//======================================================================= -//function : AbnormalResult -//purpose : -//======================================================================= - -Transfer_Iterator Transfer_TransferProcess::AbnormalResult() const -{ - Transfer_Iterator iter(Standard_True); - Standard_Integer max = NbMapped(); - for (Standard_Integer i = 1; i <= max; i ++) { - Handle(Transfer_Binder) binder = MapItem(i); - if (binder.IsNull()) continue; - Transfer_StatusExec statex = binder->StatusExec(); - if (statex != Transfer_StatusInitial && statex != Transfer_StatusDone) - iter.Add (binder,Mapped(i)); // on note les cas "pas normaux" - } - return iter; -} - - -// ## ## ## CheckList : les messages ## ## ## -//======================================================================= -//function : CheckList -//purpose : -//======================================================================= - -Interface_CheckIterator Transfer_TransferProcess::CheckList - (const Standard_Boolean erronly) const -{ - Interface_CheckIterator list; - Standard_Integer num, max = NbMapped(); - for (Standard_Integer i = 1; i <= max; i ++) { - Handle(Transfer_Binder) binder = MapItem(i); - if (binder.IsNull()) continue; - Transfer_StatusExec statex = binder->StatusExec(); - Handle(Interface_Check) check = binder->Check(); - if (statex != Transfer_StatusInitial && statex != Transfer_StatusDone && - !check->HasFailed()) - check->AddFail("Transfer in Abnormal Status (!= Initial or Done)"); - if (!check->HasFailed() && (erronly || check->NbWarnings() == 0)) continue; - const TheStart& ent = Mapped(i); - num = CheckNum(ent); - if (num == 0) num = i; - check->SetEntity(ent); - list.Add(check,num); - } - return list; -} - - -// ######################################################################### -// .... RESULTATS PAR ENTITE .... - -//======================================================================= -//function : ResultOne -//purpose : -//======================================================================= - -Transfer_Iterator Transfer_TransferProcess::ResultOne(const TheStart& start, - const Standard_Integer level, - const Standard_Boolean withstart) const -{ - Transfer_Iterator iter(withstart); - Standard_Integer max = NbMapped(); - Standard_Integer ind = MapIndex (start); - if (ind == 0) return iter; - Standard_Integer i1 = (level == 0 ? ind : 1); - Standard_Integer i2 = (level == 0 ? ind : max); - Handle(TColStd_HArray1OfInteger) map = new TColStd_HArray1OfInteger (i1,i2,0); - //MarkScoped (ind,level,map); - - for (Standard_Integer i = i1; i <= i2; i ++) { - ind = map->Value(i); - if (ind == 0) continue; - Handle(Transfer_Binder) binder = MapItem(i); - if (binder.IsNull()) continue; - if (withstart) iter.Add (binder,Mapped(ind)); - else iter.Add (binder); - } - return iter; -} - - -//======================================================================= -//function : CheckListOne -//purpose : -//======================================================================= - -Interface_CheckIterator Transfer_TransferProcess::CheckListOne - (const TheStart& start,const Standard_Integer level, - const Standard_Boolean erronly) const -{ - Interface_CheckIterator list; - Standard_Integer max = NbMapped(); - Standard_Integer num, ind = MapIndex (start); - if (ind == 0) return list; - Standard_Integer i1 = (level == 0 ? ind : 1); - Standard_Integer i2 = (level == 0 ? ind : max); - Handle(TColStd_HArray1OfInteger) map = new TColStd_HArray1OfInteger (i1,i2,0); - //MarkScoped (ind,level,map); - - for (Standard_Integer i = i1; i <= i2; i ++) { - ind = map->Value(i); - if (ind == 0) continue; - Handle(Transfer_Binder) binder = MapItem(ind); - if (binder.IsNull()) continue; - Transfer_StatusExec statex = binder->StatusExec(); - Handle(Interface_Check) check = binder->Check(); - if (statex != Transfer_StatusInitial && statex != Transfer_StatusDone && - !check->HasFailed()) - check->AddFail("Transfer in Abnormal Status (!= Initial or Done)"); - if (!check->HasFailed() && (erronly || check->NbWarnings() == 0)) continue; - const TheStart& ent = Mapped(ind); - num = CheckNum(ent); if (num == 0) num = ind; - check->SetEntity(ent); - list.Add(check,num); - } - return list; -} - - -//======================================================================= -//function : IsCheckListEmpty -//purpose : -//======================================================================= - -Standard_Boolean Transfer_TransferProcess::IsCheckListEmpty - (const TheStart& start, const Standard_Integer level, - const Standard_Boolean erronly) const -{ - Standard_Integer max = NbMapped(); - Standard_Integer ind = MapIndex (start); - if (ind == 0) return Standard_False; - Standard_Integer i1 = (level == 0 ? ind : 1); - Standard_Integer i2 = (level == 0 ? ind : max); - Handle(TColStd_HArray1OfInteger) map = new TColStd_HArray1OfInteger (i1,i2,0); -// MarkScoped (ind,level,map); - - for (Standard_Integer i = i1; i <= i2; i ++) { - ind = map->Value(i); - if (ind == 0) continue; - Handle(Transfer_Binder) binder = MapItem(ind); - if (binder.IsNull()) continue; - - Transfer_StatusExec statex = binder->StatusExec(); - Handle(Interface_Check) check = binder->Check(); - if (statex != Transfer_StatusInitial && statex != Transfer_StatusDone) - return Standard_False; - if (check->HasFailed() || (!erronly && check->NbWarnings() > 0)) return Standard_False; - } - return Standard_True; -} - - -//======================================================================= -//function : RemoveResult -//purpose : -//======================================================================= - -void Transfer_TransferProcess::RemoveResult(const TheStart& start, - const Standard_Integer level, - const Standard_Boolean /*compute*/) -{ - //if (compute) ComputeScopes(); - Standard_Integer max = NbMapped(); - Standard_Integer ind = MapIndex (start); - if (ind == 0) return; - Standard_Integer i1 = (level == 0 ? ind : 1); - Standard_Integer i2 = (level == 0 ? ind : max); - Handle(TColStd_HArray1OfInteger) map = new TColStd_HArray1OfInteger (i1,i2,0); -// MarkScoped (ind,level,map); - - Standard_Integer i; // svv Jan11 2000 : porting on DEC - for (i = i1; i <= i2; i ++) { - ind = map->Value(i); - if (ind == 0) continue; - Handle(Transfer_Binder) binder = MapItem(ind); - if (binder.IsNull()) continue; -// Standard_Boolean cayest = binder->SetNbUserScopes (-1); -// if (cayest) themap(ind) = nulbinder; // RAZ ! - } - -//pdn commented for (i = NbRoots(); i > 0; i --) -// if (theroots.Value(i) == ind) theroots.Remove(i); -} - - -Standard_Integer Transfer_TransferProcess::CheckNum(const TheStart& ) const -{ - return 0; -} - - -//======================================================================= -//function : SetProgress -//purpose : Sets Progress indicator -//======================================================================= - -void Transfer_TransferProcess::SetProgress(const Handle(Message_ProgressIndicator)& theProgress) -{ - myProgress = theProgress; -} - -//======================================================================= -//function : GetProgress -//purpose : Returns Progress indicator -//======================================================================= - -Handle(Message_ProgressIndicator) Transfer_TransferProcess::GetProgress() const -{ - return myProgress; -} diff --git a/src/Transfer/Transfer_TransientListBinder.cxx b/src/Transfer/Transfer_TransientListBinder.cxx index f4c722638c..0f75871375 100644 --- a/src/Transfer/Transfer_TransientListBinder.cxx +++ b/src/Transfer/Transfer_TransientListBinder.cxx @@ -11,96 +11,25 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. - -#include -#include -#include -#include #include IMPLEMENT_STANDARD_RTTIEXT(Transfer_TransientListBinder,Transfer_Binder) -//#include -//======================================================================= -//function : Constructor -//purpose : -//======================================================================= -Transfer_TransientListBinder::Transfer_TransientListBinder () -{ theres = new TColStd_HSequenceOfTransient(); } - -//======================================================================= -//function : Constructor -//purpose : -//======================================================================= - -Transfer_TransientListBinder::Transfer_TransientListBinder - (const Handle(TColStd_HSequenceOfTransient)& list) -{ theres = list; } - -//======================================================================= -//function : IsMultiple -//purpose : -//======================================================================= - -Standard_Boolean Transfer_TransientListBinder::IsMultiple () const -{ return (NbTransients() > 1); } +Standard_Boolean Transfer_TransientListBinder::IsMultiple () const +{ return (myResults.Length() > 1); } //======================================================================= //function : ResultType //purpose : //======================================================================= -Handle(Standard_Type) Transfer_TransientListBinder::ResultType () const -{ return STANDARD_TYPE(Transfer_TransientListBinder); } +Handle(Standard_Type) Transfer_TransientListBinder::ResultType () const +{ return STANDARD_TYPE(Transfer_TransientListBinder); } //======================================================================= //function : ResultTypeName //purpose : //======================================================================= -Standard_CString Transfer_TransientListBinder::ResultTypeName () const -{ return "list(Standard_Transient)"; } - - -//======================================================================= -//function : AddResult -//purpose : -//======================================================================= - -void Transfer_TransientListBinder::AddResult (const Handle(Standard_Transient)& Transient) -{ theres->Append(Transient); } - -//======================================================================= -//function : Result -//purpose : -//======================================================================= - -Handle(TColStd_HSequenceOfTransient) Transfer_TransientListBinder::Result () const -{ return theres; } - -//======================================================================= -//function : SetResult -//purpose : -//======================================================================= - -void Transfer_TransientListBinder::SetResult - (const Standard_Integer num, const Handle(Standard_Transient)& Transient) -{ theres->SetValue(num,Transient); } - -//======================================================================= -//function : NbTransients -//purpose : -//======================================================================= - -Standard_Integer Transfer_TransientListBinder::NbTransients () const -{ return theres->Length(); } - -//======================================================================= -//function : Transient -//purpose : -//======================================================================= - -const Handle(Standard_Transient)& - Transfer_TransientListBinder::Transient (const Standard_Integer num) const -{ return theres->Value(num); } - +Standard_CString Transfer_TransientListBinder::ResultTypeName () const +{ return "list(Standard_Transient)"; } diff --git a/src/Transfer/Transfer_TransientListBinder.hxx b/src/Transfer/Transfer_TransientListBinder.hxx index 756c79b779..1d6e8570a4 100644 --- a/src/Transfer/Transfer_TransientListBinder.hxx +++ b/src/Transfer/Transfer_TransientListBinder.hxx @@ -20,19 +20,8 @@ #include #include -#include +#include #include -#include -#include -#include -#include -class Standard_TypeMismatch; -class Standard_OutOfRange; -class Standard_Transient; - - -class Transfer_TransientListBinder; -DEFINE_STANDARD_HANDLE(Transfer_TransientListBinder, Transfer_Binder) //! This binder binds several (a list of) Transients with a starting //! entity, when this entity itself corresponds to a simple list @@ -40,13 +29,9 @@ DEFINE_STANDARD_HANDLE(Transfer_TransientListBinder, Transfer_Binder) //! independant componant, but as an item of a built-in list class Transfer_TransientListBinder : public Transfer_Binder { - -public: - - - Standard_EXPORT Transfer_TransientListBinder(); + public: - Standard_EXPORT Transfer_TransientListBinder(const Handle(TColStd_HSequenceOfTransient)& list); + Transfer_TransientListBinder() {} Standard_EXPORT virtual Standard_Boolean IsMultiple() const Standard_OVERRIDE; @@ -55,39 +40,15 @@ public: Standard_EXPORT Standard_CString ResultTypeName() const Standard_OVERRIDE; //! Adds an item to the result list - Standard_EXPORT void AddResult (const Handle(Standard_Transient)& res); - - Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Result() const; + void AddResult (const Handle(Standard_Transient)& res) { myResults.Append(res); } - //! Changes an already defined sub-result - Standard_EXPORT void SetResult (const Standard_Integer num, const Handle(Standard_Transient)& res); - - Standard_EXPORT Standard_Integer NbTransients() const; - - Standard_EXPORT const Handle(Standard_Transient)& Transient (const Standard_Integer num) const; - - - + const TColStd_SequenceOfTransient & Result() const { return myResults; } DEFINE_STANDARD_RTTIEXT(Transfer_TransientListBinder,Transfer_Binder) + + private: -protected: - - - - -private: - - - Handle(TColStd_HSequenceOfTransient) theres; - - + TColStd_SequenceOfTransient myResults; }; - - - - - - #endif // _Transfer_TransientListBinder_HeaderFile diff --git a/src/Transfer/Transfer_TransientMapper.hxx b/src/Transfer/Transfer_TransientMapper.hxx deleted file mode 100644 index 13bf4c4a79..0000000000 --- a/src/Transfer/Transfer_TransientMapper.hxx +++ /dev/null @@ -1,88 +0,0 @@ -// Created on: 1992-02-03 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 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 _Transfer_TransientMapper_HeaderFile -#define _Transfer_TransientMapper_HeaderFile - -#include -#include - -#include -#include -#include -#include -#include -class Standard_Transient; -class Transfer_DataInfo; -class Transfer_Finder; - - -class Transfer_TransientMapper; -DEFINE_STANDARD_HANDLE(Transfer_TransientMapper, Transfer_Finder) - - -class Transfer_TransientMapper : public Transfer_Finder -{ - -public: - - - //! Creates a Mapper with a Value. This Value can then not be - //! changed. It is used by the Hasher to compute the HashCode, - //! which will then be stored for an immediate reading. - Standard_EXPORT Transfer_TransientMapper(const Handle(Standard_Transient)& akey); - - //! Returns the contained value - Standard_EXPORT const Handle(Standard_Transient)& Value() const; - - //! Specific testof equallity : defined as False if has - //! not the same true Type, else contents are compared (by - //! C++ operator ==) - Standard_EXPORT Standard_Boolean Equates (const Handle(Transfer_Finder)& other) const Standard_OVERRIDE; - - //! Returns the Type of the Value. By default, returns the - //! DynamicType of , but can be redefined - Standard_EXPORT virtual Handle(Standard_Type) ValueType() const Standard_OVERRIDE; - - //! Returns the name of the Type of the Value. Default is name - //! of ValueType, unless it is for a non-handled object - Standard_EXPORT virtual Standard_CString ValueTypeName() const Standard_OVERRIDE; - - - - - DEFINE_STANDARD_RTTI_INLINE(Transfer_TransientMapper,Transfer_Finder) - -protected: - - - - -private: - - - Handle(Standard_Transient) theval; - - -}; - - - - - - - -#endif // _Transfer_TransientMapper_HeaderFile diff --git a/src/Transfer/Transfer_TransientMapper_0.cxx b/src/Transfer/Transfer_TransientMapper_0.cxx deleted file mode 100644 index c323d31bd0..0000000000 --- a/src/Transfer/Transfer_TransientMapper_0.cxx +++ /dev/null @@ -1,44 +0,0 @@ -// Created on: 1992-02-03 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 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 - -#include - -#include -#include -#include - - - - - - - - - - -#define TheKey Handle(Standard_Transient) -#define TheKey_hxx -#define TheHasher TColStd_MapTransientHasher -#define TheHasher_hxx -#define TheInfo Transfer_DataInfo -#define TheInfo_hxx -#define Transfer_Mapper Transfer_TransientMapper -#define Transfer_Mapper_hxx -#define Handle_Transfer_Mapper Handle(Transfer_TransientMapper) -#include - diff --git a/src/Transfer/Transfer_TransientProcess.cxx b/src/Transfer/Transfer_TransientProcess.cxx index f124aa6ebb..4cae84c26b 100644 --- a/src/Transfer/Transfer_TransientProcess.cxx +++ b/src/Transfer/Transfer_TransientProcess.cxx @@ -20,8 +20,6 @@ #include #include #include -#include -#include #include #include #include @@ -29,38 +27,9 @@ IMPLEMENT_STANDARD_RTTIEXT(Transfer_TransientProcess,Transfer_ProcessForTransient) //======================================================================= -//function : Transfer_TransientProcess +//function : SetGraph //purpose : //======================================================================= -Transfer_TransientProcess::Transfer_TransientProcess - (const Standard_Integer nb) : Transfer_ProcessForTransient (nb) -{ - thetrroots = new TColStd_HSequenceOfTransient; -} - - -//======================================================================= -//function : SetModel -//purpose : -//======================================================================= - -void Transfer_TransientProcess::SetModel - (const Handle(Interface_InterfaceModel)& model) -{ - themodel = model; -} - - -//======================================================================= -//function : Model -//purpose : -//======================================================================= - -Handle(Interface_InterfaceModel) Transfer_TransientProcess::Model () const -{ - return themodel; -} - void Transfer_TransientProcess::SetGraph(const Handle(Interface_HGraph)& HG) { @@ -72,39 +41,6 @@ void Transfer_TransientProcess::SetGraph(const Handle(Interface_HGraph)& HG) } -//======================================================================= -//function : HasGraph -//purpose : -//======================================================================= - -Standard_Boolean Transfer_TransientProcess::HasGraph () const -{ - return !thegraph.IsNull(); -} - - -//======================================================================= -//function : HGraph -//purpose : -//======================================================================= - -Handle(Interface_HGraph) Transfer_TransientProcess::HGraph () const -{ - return thegraph; -} - - -//======================================================================= -//function : Graph -//purpose : -//======================================================================= - -const Interface_Graph& Transfer_TransientProcess::Graph () const -{ - return thegraph->Graph(); -} - - //======================================================================= //function : SetContext //purpose : @@ -136,34 +72,19 @@ Standard_Boolean Transfer_TransientProcess::GetContext } -//======================================================================= -//function : Context -//purpose : -//======================================================================= - -Handle(Dico_DictionaryOfTransient)& Transfer_TransientProcess::Context () -{ - return thectx; -} - - //======================================================================= //function : PrintTrace //purpose : //======================================================================= -void Transfer_TransientProcess::PrintTrace - (const Handle(Standard_Transient)& start, const Handle(Message_Messenger)& S) const +void Transfer_TransientProcess::PrintTrace (const Handle(Standard_Transient)& start, const Handle(Message_Messenger)& S) const { if (!start.IsNull()) { S << "Entity "; - if (!themodel.IsNull()) { + if (!themodel.IsNull()) themodel->Print (start,S,1); -// S<<"id "; themodel->Print (start,S); -// S<<" Type:"<TypeName (start); - } - else S<<" Type:"<< Interface_InterfaceModel::ClassName(start->DynamicType()->Name()); - // << start (handle) ?? + else + S<<" Type:"<< Interface_InterfaceModel::ClassName(start->DynamicType()->Name()); } } @@ -173,112 +94,7 @@ void Transfer_TransientProcess::PrintTrace //purpose : //======================================================================= -Standard_Integer Transfer_TransientProcess::CheckNum - (const Handle(Standard_Transient)& start) const +Standard_Integer Transfer_TransientProcess::CheckNum (const Handle(Standard_Transient)& start) const { return (themodel.IsNull() ? 0 : themodel->Number(start)); } - - -//======================================================================= -//function : TypedSharings -//purpose : -//======================================================================= - -Interface_EntityIterator Transfer_TransientProcess::TypedSharings - (const Handle(Standard_Transient)& start, - const Handle(Standard_Type)& type) const -{ - Interface_EntityIterator iter; - if (thegraph.IsNull()) return iter; - return thegraph->Graph().TypedSharings (start,type); -} - - -//======================================================================= -//function : IsDataLoaded -//purpose : -//======================================================================= - -Standard_Boolean Transfer_TransientProcess::IsDataLoaded - (const Handle(Standard_Transient)& start) const -{ - if (themodel.IsNull()) return Standard_True; - Standard_Integer num = themodel->Number(start); - if (num == 0) return Standard_True; - if (themodel->IsUnknownEntity(num)) return Standard_False; - return !themodel->IsRedefinedContent(num); -} - - -//======================================================================= -//function : IsDataFail -//purpose : -//======================================================================= - -Standard_Boolean Transfer_TransientProcess::IsDataFail - (const Handle(Standard_Transient)& start) const -{ - if (themodel.IsNull()) return Standard_False; - Standard_Integer num = themodel->Number(start); - if (num == 0) return Standard_False; - if (themodel->IsErrorEntity(num)) return Standard_True; - const Handle(Interface_Check) ach = themodel->Check(num,Standard_False); // semantic - return ach->HasFailed(); -} - - -//======================================================================= -//function : PrintStats -//purpose : -//======================================================================= - -void Transfer_TransientProcess::PrintStats(const Standard_Integer /*mode*/, - const Handle(Message_Messenger)& S) const -{ - S<<"\n*******************************************************************\n"; -// if (mode == 1) { // Statistiques de base - S << "******** Basic Statistics ********"<NbEntities()<Check(); - Transfer_StatusExec stat = binder->StatusExec(); - if (stat != Transfer_StatusInitial && stat != Transfer_StatusDone) - nbe ++; - else { - if (ach->NbWarnings() > 0) nbw ++; - if (binder->HasResult()) nbr ++; - } - } - if (nbr > nbroots) - S<<"**** ( Itermediate Results : "< 0) - S<<"**** Errors on : "< 0) - S<<"**** Warnings on : "< #include -#include +#include #include -#include -#include -#include -#include -class Interface_InterfaceModel; -class Interface_HGraph; class Dico_DictionaryOfTransient; -class Interface_Graph; -class Standard_Transient; class Message_Messenger; +class Interface_HGraph; class Interface_EntityIterator; - class Transfer_TransientProcess; DEFINE_STANDARD_HANDLE(Transfer_TransientProcess, Transfer_ProcessForTransient) @@ -46,28 +38,19 @@ DEFINE_STANDARD_HANDLE(Transfer_TransientProcess, Transfer_ProcessForTransient) //! from the model : for Trace, CheckList, Integrity Status class Transfer_TransientProcess : public Transfer_ProcessForTransient { - -public: - + public: //! Sets TransientProcess at initial state, with an initial size - Standard_EXPORT Transfer_TransientProcess(const Standard_Integer nb = 10000); - - //! Sets an InterfaceModel, used by StartTrace, CheckList, queries - //! on Integrity, to give informations significant for each norm. - Standard_EXPORT void SetModel (const Handle(Interface_InterfaceModel)& model); - - //! Returns the Model used for StartTrace - Standard_EXPORT Handle(Interface_InterfaceModel) Model() const; - + Transfer_TransientProcess(const Standard_Integer nb = 10000) + : Transfer_ProcessForTransient (nb) + {} + //! Sets a Graph : superseedes SetModel if already done Standard_EXPORT void SetGraph (const Handle(Interface_HGraph)& HG); - Standard_EXPORT Standard_Boolean HasGraph() const; - - Standard_EXPORT Handle(Interface_HGraph) HGraph() const; + Standard_Boolean HasGraph() const { return !thegraph.IsNull(); } - Standard_EXPORT const Interface_Graph& Graph() const; + const Handle(Interface_HGraph) & HGraph() const { return thegraph; } //! Sets a Context : according to receiving appli, to be //! interpreted by the Actor @@ -80,64 +63,26 @@ public: //! Returns (modifiable) the whole definition of Context //! Rather for internal use (ex.: preparing and setting in once) - Standard_EXPORT Handle(Dico_DictionaryOfTransient)& Context(); + Handle(Dico_DictionaryOfTransient)& Context() { return thectx; } //! Specific printing to trace an entity : prints label and type //! (if model is set) Standard_EXPORT virtual void PrintTrace (const Handle(Standard_Transient)& start, const Handle(Message_Messenger)& S) const Standard_OVERRIDE; - //! Specific number of a starting object for check-list : Number - //! in model - Standard_EXPORT virtual Standard_Integer CheckNum (const Handle(Standard_Transient)& ent) const Standard_OVERRIDE; - - //! Returns the list of sharings entities, AT ANY LEVEL, which are - //! kind of a given type. Calls TypedSharings from Graph - //! Returns an empty list if the Graph has not been aknowledged - Standard_EXPORT Interface_EntityIterator TypedSharings (const Handle(Standard_Transient)& start, const Handle(Standard_Type)& type) const; - - //! Tells if an entity is well loaded from file (even if its data - //! fail on checking, they are present). Mostly often, answers - //! True. Else, there was a syntactic error in the file. - //! A non-loaded entity MAY NOT BE transferred, unless its Report - //! (in the model) is interpreted - Standard_EXPORT Standard_Boolean IsDataLoaded (const Handle(Standard_Transient)& ent) const; - - //! Tells if an entity fails on data checking (load time, - //! syntactic, or semantic check). Normally, should answer False. - //! It is not prudent to try transferring an entity which fails on - //! data checking - Standard_EXPORT Standard_Boolean IsDataFail (const Handle(Standard_Transient)& ent) const; - - //! Prints statistics on a given output, according mode - Standard_EXPORT void PrintStats (const Standard_Integer mode, const Handle(Message_Messenger)& S) const; - - Standard_EXPORT Handle(TColStd_HSequenceOfTransient) RootsForTransfer(); - - - + TColStd_SequenceOfTransient & RootsForTransfer() { return thetrroots; } DEFINE_STANDARD_RTTIEXT(Transfer_TransientProcess,Transfer_ProcessForTransient) -protected: - - - - -private: + protected: + + //! Specific number of a source object for check-list : Number in model + Standard_EXPORT virtual Standard_Integer CheckNum (const Handle(Standard_Transient)& ent) const Standard_OVERRIDE; + private: - Handle(Interface_InterfaceModel) themodel; Handle(Interface_HGraph) thegraph; Handle(Dico_DictionaryOfTransient) thectx; - Handle(TColStd_HSequenceOfTransient) thetrroots; - - + TColStd_SequenceOfTransient thetrroots; }; - - - - - - #endif // _Transfer_TransientProcess_HeaderFile diff --git a/src/Transfer/Transfer_UndefMode.hxx b/src/Transfer/Transfer_UndefMode.hxx deleted file mode 100644 index 9e404d040d..0000000000 --- a/src/Transfer/Transfer_UndefMode.hxx +++ /dev/null @@ -1,29 +0,0 @@ -// Created on: 1992-02-03 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 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 _Transfer_UndefMode_HeaderFile -#define _Transfer_UndefMode_HeaderFile - -//! used on processing Undefined Entities (see TransferOutput) -enum Transfer_UndefMode -{ -Transfer_UndefIgnore, -Transfer_UndefFailure, -Transfer_UndefContent, -Transfer_UndefUser -}; - -#endif // _Transfer_UndefMode_HeaderFile diff --git a/src/Transfer/Transfer_VoidBinder.cxx b/src/Transfer/Transfer_VoidBinder.cxx index dc35ebbbf3..ed268e1f21 100644 --- a/src/Transfer/Transfer_VoidBinder.cxx +++ b/src/Transfer/Transfer_VoidBinder.cxx @@ -14,21 +14,12 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -// - -#include #include IMPLEMENT_STANDARD_RTTIEXT(Transfer_VoidBinder,Transfer_Binder) -Transfer_VoidBinder::Transfer_VoidBinder () { } - -// Standard_Boolean Transfer_VoidBinder::IsMultiple () const -// { return Standard_False; } - - - Handle(Standard_Type) Transfer_VoidBinder::ResultType () const - { return DynamicType(); } +Handle(Standard_Type) Transfer_VoidBinder::ResultType () const +{ return DynamicType(); } - Standard_CString Transfer_VoidBinder::ResultTypeName () const - { return "(void)"; } +Standard_CString Transfer_VoidBinder::ResultTypeName () const +{ return "(void)"; } diff --git a/src/Transfer/Transfer_VoidBinder.hxx b/src/Transfer/Transfer_VoidBinder.hxx index 80a0d5ea70..3263f29553 100644 --- a/src/Transfer/Transfer_VoidBinder.hxx +++ b/src/Transfer/Transfer_VoidBinder.hxx @@ -28,49 +28,27 @@ class Transfer_VoidBinder; DEFINE_STANDARD_HANDLE(Transfer_VoidBinder, Transfer_Binder) -//! a VoidBinder is used to bind a starting item with a status, +//! VoidBinder is used to bind a starting item with a status, //! error or warning messages, but no result //! It is interpreted by TransferProcess, which admits a //! VoidBinder to be over-written, and copies its check to the //! new Binder class Transfer_VoidBinder : public Transfer_Binder { - -public: - + public: //! a VoidBinder is not Multiple (Remark : it is not Simple too) //! But it can bring next results ... - Standard_EXPORT Transfer_VoidBinder(); + Transfer_VoidBinder() {} //! while a VoidBinder admits no Result, its ResultType returns //! the type of - Standard_EXPORT Handle(Standard_Type) ResultType() const Standard_OVERRIDE; + Standard_EXPORT virtual Handle(Standard_Type) ResultType() const Standard_OVERRIDE; //! Returns "(void)" - Standard_EXPORT Standard_CString ResultTypeName() const Standard_OVERRIDE; - - - + Standard_EXPORT virtual Standard_CString ResultTypeName() const Standard_OVERRIDE; DEFINE_STANDARD_RTTIEXT(Transfer_VoidBinder,Transfer_Binder) - -protected: - - - - -private: - - - - }; - - - - - - #endif // _Transfer_VoidBinder_HeaderFile diff --git a/src/TransferBRep/FILES b/src/TransferBRep/FILES index 039db07c1d..ed3805fbe7 100644 --- a/src/TransferBRep/FILES +++ b/src/TransferBRep/FILES @@ -1,21 +1,8 @@ TransferBRep.cxx TransferBRep.hxx -TransferBRep_BinderOfShape.cxx -TransferBRep_BinderOfShape.hxx -TransferBRep_HSequenceOfTransferResultInfo.hxx -TransferBRep_OrientedShapeMapper.hxx -TransferBRep_OrientedShapeMapper_0.cxx -TransferBRep_Reader.cxx -TransferBRep_Reader.hxx -TransferBRep_SequenceOfTransferResultInfo.hxx TransferBRep_ShapeBinder.cxx TransferBRep_ShapeBinder.hxx -TransferBRep_ShapeInfo.cxx -TransferBRep_ShapeInfo.hxx TransferBRep_ShapeListBinder.cxx TransferBRep_ShapeListBinder.hxx +TransferBRep_ShapeMapper.cxx TransferBRep_ShapeMapper.hxx -TransferBRep_ShapeMapper_0.cxx -TransferBRep_TransferResultInfo.cxx -TransferBRep_TransferResultInfo.hxx -TransferBRep_TransferResultInfo.lxx diff --git a/src/TransferBRep/TransferBRep.cxx b/src/TransferBRep/TransferBRep.cxx index b9c45100b7..b102f236f2 100644 --- a/src/TransferBRep/TransferBRep.cxx +++ b/src/TransferBRep/TransferBRep.cxx @@ -12,51 +12,33 @@ // commercial license or contractual agreement. -#include -#include -#include -#include -#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include #include -#include -#include +#include #include #include #include + #include -#include #include -#include #include -#include +#include -#include -//#include static void ShapeAppend (const Handle(Transfer_Binder)& binder, const Handle(TopTools_HSequenceOfShape)& shapes) { if (binder.IsNull()) return; - if (binder->IsKind(STANDARD_TYPE(TransferBRep_BinderOfShape))) { - DeclareAndCast(TransferBRep_BinderOfShape,shbind,binder); + if (binder->IsKind(STANDARD_TYPE(TransferBRep_ShapeBinder))) { + DeclareAndCast(TransferBRep_ShapeBinder,shbind,binder); if (shbind->HasResult()) shapes->Append (shbind->Result()); } else if (binder->IsKind(STANDARD_TYPE(TransferBRep_ShapeListBinder))) { DeclareAndCast(TransferBRep_ShapeListBinder,slbind,binder); - Standard_Integer i,nb = slbind->NbShapes(); - for (i = 1; i <= nb; i ++) shapes->Append (slbind->Shape(i)); + Standard_Integer i,nb = slbind->Result().Length(); + for (i = 1; i <= nb; i ++) shapes->Append (slbind->Result().Value(i)); } else if (binder->IsKind(STANDARD_TYPE(Transfer_SimpleBinderOfTransient))) { DeclareAndCast(Transfer_SimpleBinderOfTransient,trbind,binder); @@ -68,13 +50,12 @@ static void ShapeAppend } - TopoDS_Shape TransferBRep::ShapeResult - (const Handle(Transfer_Binder)& binder) +TopoDS_Shape TransferBRep::ShapeResult (const Handle(Transfer_Binder)& binder) { TopoDS_Shape shape; Handle(Transfer_Binder) bnd = binder; while (!bnd.IsNull()) { - DeclareAndCast(TransferBRep_BinderOfShape,shb,bnd); + DeclareAndCast(TransferBRep_ShapeBinder,shb,bnd); if (!shb.IsNull()) return shb->Result(); DeclareAndCast(Transfer_SimpleBinderOfTransient,hsb,bnd); if (!hsb.IsNull()) { @@ -86,9 +67,7 @@ static void ShapeAppend return shape; } - TopoDS_Shape TransferBRep::ShapeResult - (const Handle(Transfer_TransientProcess)& TP, - const Handle(Standard_Transient)& ent) +TopoDS_Shape TransferBRep::ShapeResult (const Handle(Transfer_TransientProcess)& TP, const Handle(Standard_Transient)& ent) { TopoDS_Shape shape; Handle(Transfer_Binder) binder = TP->Find(ent); @@ -99,36 +78,27 @@ static void ShapeAppend return shape; } - - void TransferBRep::SetShapeResult - (const Handle(Transfer_TransientProcess)& TP, - const Handle(Standard_Transient)& ent, const TopoDS_Shape& result) +void TransferBRep::SetShapeResult (const Handle(Transfer_TransientProcess)& TP, const Handle(Standard_Transient)& ent, const TopoDS_Shape& theShape) { - if (result.IsNull() || ent.IsNull() || TP.IsNull()) return; - TP->Bind (ent,new TransferBRep_ShapeBinder(result)); + if (theShape.IsNull() || ent.IsNull() || TP.IsNull()) return; + TP->Bind (ent,new TransferBRep_ShapeBinder(theShape)); } - - Handle(TopTools_HSequenceOfShape) TransferBRep::Shapes - (const Handle(Transfer_TransientProcess)& TP, const Standard_Boolean roots) +Handle(TopTools_HSequenceOfShape) TransferBRep::Shapes (const Handle(Transfer_TransientProcess)& TP, const Standard_Boolean roots) { Handle(TopTools_HSequenceOfShape) shapes; if (TP.IsNull()) return shapes; shapes = new TopTools_HSequenceOfShape(); - Transfer_IteratorOfProcessForTransient list = - (roots ? TP->RootResult() : TP->CompleteResult()); - + Transfer_IteratorOfProcessForTransient list = (roots ? TP->RootResult() : TP->CompleteResult()); for (list.Start(); list.More(); list.Next()) { - Handle(Transfer_Binder) binder = list.Value(); + const Handle(Transfer_Binder) &binder = list.Value(); ShapeAppend (binder,shapes); } return shapes; } - Handle(TopTools_HSequenceOfShape) TransferBRep::Shapes - (const Handle(Transfer_TransientProcess)& TP, - const Handle(TColStd_HSequenceOfTransient)& list) +Handle(TopTools_HSequenceOfShape) TransferBRep::Shapes (const Handle(Transfer_TransientProcess)& TP, const Handle(TColStd_HSequenceOfTransient)& list) { Handle(TopTools_HSequenceOfShape) shapes; if (TP.IsNull() && list.IsNull()) return shapes; @@ -139,356 +109,30 @@ static void ShapeAppend Handle(Transfer_Binder) binder = TP->Find(list->Value(ie)); ShapeAppend (binder,shapes); } - return shapes; } - - TopAbs_Orientation TransferBRep::ShapeState - (const Handle(Transfer_FinderProcess)& FP, const TopoDS_Shape& shape) +Handle(TransferBRep_ShapeMapper) TransferBRep::ShapeMapper (const Handle(Transfer_ProcessForFinder)& FP, const TopoDS_Shape& theShape) { - if (FP.IsNull() || shape.IsNull()) return TopAbs_EXTERNAL; - Handle(TransferBRep_ShapeMapper) sm = new TransferBRep_ShapeMapper(shape); - Standard_Integer index = FP->MapIndex (sm); - if (index == 0) return TopAbs_EXTERNAL; - sm = Handle(TransferBRep_ShapeMapper)::DownCast(FP->Mapped(index)); - if (sm.IsNull()) return TopAbs_EXTERNAL; - const TopoDS_Shape& mapped = sm->Value(); -// l egalite est assumee, on ne teste que l orientation - if (mapped.Orientation() != shape.Orientation()) return TopAbs_REVERSED; - return TopAbs_FORWARD; -} - - Handle(Transfer_Binder) TransferBRep::ResultFromShape - (const Handle(Transfer_FinderProcess)& FP, const TopoDS_Shape& shape) -{ - Handle(Transfer_Binder) res; - if (FP.IsNull() || shape.IsNull()) return res; - Handle(TransferBRep_ShapeMapper) sm = new TransferBRep_ShapeMapper(shape); - return FP->Find (sm); -} - - Handle(Standard_Transient) TransferBRep::TransientFromShape - (const Handle(Transfer_FinderProcess)& FP, const TopoDS_Shape& shape) -{ - Handle(Standard_Transient) res; - if (FP.IsNull() || shape.IsNull()) return res; - Handle(TransferBRep_ShapeMapper) sm = new TransferBRep_ShapeMapper(shape); - return FP->FindTransient (sm); -} - - - void TransferBRep::SetTransientFromShape - (const Handle(Transfer_FinderProcess)& FP, - const TopoDS_Shape& shape, const Handle(Standard_Transient)& result) -{ - if (FP.IsNull() || shape.IsNull()) return; - Handle(TransferBRep_ShapeMapper) sm = new TransferBRep_ShapeMapper(shape); - FP->BindTransient (sm,result); -} - - Handle(TransferBRep_ShapeMapper) TransferBRep::ShapeMapper - (const Handle(Transfer_FinderProcess)& FP, - const TopoDS_Shape& shape) -{ - Handle(TransferBRep_ShapeMapper) mapper = new TransferBRep_ShapeMapper(shape); - Standard_Integer index = FP->MapIndex (mapper); + Handle(TransferBRep_ShapeMapper) mapper = new TransferBRep_ShapeMapper(theShape); + const Standard_Integer index = FP->MapIndex (mapper); if (index == 0) return mapper; return Handle(TransferBRep_ShapeMapper)::DownCast(FP->Mapped(index)); } -// Functions to collect transfer result information - -//======================================================================= -//function : FillInfo -//purpose : -//======================================================================= - -static void FillInfo (const Handle(Transfer_Binder)& Binder, - const Handle(Interface_Check)& Check, - const Handle(TransferBRep_TransferResultInfo)& Info) -{ - Standard_Integer R = 0, RW = 0, RF = 0, RWF = 0, NR = 0, NRW = 0, NRF = 0, NRWF = 0; - if (Binder->HasResult()) - if (Check->HasWarnings() && Check->HasFailed()) RWF++; - else if (Check->HasWarnings()) RW++; - else if (Check->HasFailed()) RF++; - else R++; - else - if (Check->HasWarnings() && Check->HasFailed()) NRWF++; - else if (Check->HasWarnings()) NRW++; - else if (Check->HasFailed()) NRF++; - else NR++; - Info->Result() += R; Info->ResultWarning() += RW; Info->ResultFail() += RF; Info->ResultWarningFail() += RWF; - Info->NoResult() += NR; Info->NoResultWarning() += NRW; Info->NoResultFail() += NRF; Info->NoResultWarningFail() += NRWF; -} - -//======================================================================= -//function : TransferResultInfo -//purpose : -//======================================================================= - - void TransferBRep::TransferResultInfo (const Handle(Transfer_TransientProcess)& TP, - const Handle(TColStd_HSequenceOfTransient)& EntityTypes, - Handle(TransferBRep_HSequenceOfTransferResultInfo)& InfoSeq) -{ - // create output Sequence in accordance with required ShapeTypes - InfoSeq = new TransferBRep_HSequenceOfTransferResultInfo; - if (TP.IsNull() || EntityTypes.IsNull()) return; - Standard_Integer SeqLen = EntityTypes->Length(); - Standard_Integer i; // svv Jan11 2000 : porting on DEC - for (i = 1; i <= SeqLen; i++) { - InfoSeq->Append (new TransferBRep_TransferResultInfo); - } - - // fill Sequence - Standard_Integer NbMapped = TP->NbMapped(); - for (i = 1; i <= NbMapped; i++) { - Handle(Standard_Transient) Entity = TP->Mapped (i); - - Handle(Transfer_Binder) Binder = TP->Find (Entity); - if (Binder.IsNull()) continue; - const Handle(Interface_Check) Check = Binder->Check (); - - // find appropriate element in the Sequence - for (Standard_Integer index = 1; index <= SeqLen; index++) { - if (Entity->IsKind (EntityTypes->Value(index)->DynamicType())) { - Handle(TransferBRep_TransferResultInfo) Info = InfoSeq->Value (index); - // fill element - FillInfo (Binder, Check, Info); - } - } - } -} - -//======================================================================= -//function : TransferResultInfo -//purpose : -//======================================================================= - - void TransferBRep::TransferResultInfo (const Handle(Transfer_FinderProcess)& FP, - const Handle(TColStd_HSequenceOfInteger)& ShapeTypes, - Handle(TransferBRep_HSequenceOfTransferResultInfo)& InfoSeq) +Standard_CString TransferBRep::TypeName (const TopoDS_Shape &theShape) { - // create output Sequence in accordance with required ShapeTypes - InfoSeq = new TransferBRep_HSequenceOfTransferResultInfo; - if (FP.IsNull() || ShapeTypes.IsNull()) return; - Standard_Integer SeqLen = ShapeTypes->Length(); - Standard_Integer i; // svv Jan11 2000 : porting on DEC - for (i = 1; i <= SeqLen; i++) { - InfoSeq->Append (new TransferBRep_TransferResultInfo); + if (theShape.IsNull()) return "TopoDS_Shape"; + switch (theShape.ShapeType()) { + case TopAbs_VERTEX : return "TopoDS_Vertex"; + case TopAbs_EDGE : return "TopoDS_Edge"; + case TopAbs_WIRE : return "TopoDS_Wire"; + case TopAbs_FACE : return "TopoDS_Face"; + case TopAbs_SHELL : return "TopoDS_Shell"; + case TopAbs_SOLID : return "TopoDS_Solid"; + case TopAbs_COMPSOLID : return "TopoDS_CompSolid"; + case TopAbs_COMPOUND : return "TopoDS_Compound"; + default : break; } - - // fill Sequence - Standard_Integer NbMapped = FP->NbMapped(); - for (i = 1; i <= NbMapped; i++) { - Handle(TransferBRep_ShapeMapper) Mapper = Handle(TransferBRep_ShapeMapper)::DownCast (FP->Mapped (i)); - Handle(Transfer_Binder) Binder = FP->Find (Mapper); - if (Binder.IsNull()) continue; - const Handle(Interface_Check) Check = Binder->Check (); - - TopoDS_Shape S = Mapper->Value(); - TopAbs_ShapeEnum ShapeType = S.ShapeType(); - - // find appropriate element in the Sequence - for (Standard_Integer index = 1; index <= SeqLen; index++) { -//JR/Hp : - TopAbs_ShapeEnum CurrentType = (TopAbs_ShapeEnum)ShapeTypes->Value (index); -// TopAbs_ShapeEnum CurrentType = (TopAbs_ShapeEnum)ShapeTypes->Value (index); - if (CurrentType == ShapeType || CurrentType == TopAbs_SHAPE) { - Handle(TransferBRep_TransferResultInfo) Info = InfoSeq->Value (index); - // fill element - FillInfo (Binder, Check, Info); - } - } - } -} - -// ######## CHECK LOURD ######## - -// # # # # # # Enchainement General du CHECK LOURD # # # # # # - -/* -Interface_CheckIterator TransferBRep::BRepCheck - (const TopoDS_Shape& shape, const Standard_Integer lev) -{ - Interface_CheckIterator result; - TransferBRep_Analyzer ana; - ana.Check (shape,lev); - return ana.CheckResult (); -} -*/ - -// ### conversion resultat -> starting - - Interface_CheckIterator TransferBRep::ResultCheckList - (const Interface_CheckIterator& chl, - const Handle(Transfer_FinderProcess)& FP, - const Handle(Interface_InterfaceModel)& model) -{ - Interface_CheckIterator nchl; - if (FP.IsNull() || model.IsNull()) return nchl; - nchl.SetModel(model); - for (chl.Start(); chl.More(); chl.Next()) { - Standard_Integer num = 0; - Handle(Interface_Check) ach = chl.Value(); - if (ach->NbFails() + ach->NbWarnings() == 0) continue; - DeclareAndCast(Transfer_Finder,starting,ach->Entity()); - Handle(Standard_Transient) ent; - if (!starting.IsNull()) ent = FP->FindTransient(starting); - if (!ent.IsNull()) { - ach->SetEntity(ent); - num = model->Number(ent); - } - nchl.Add (ach,num); - } - return nchl; -} - - Handle(TColStd_HSequenceOfTransient) TransferBRep::Checked - (const Interface_CheckIterator& chl, const Standard_Boolean alsoshapes) -{ - Handle(TColStd_HSequenceOfTransient) ls = new TColStd_HSequenceOfTransient(); - for (chl.Start(); chl.More(); chl.Next()) { - const Handle(Interface_Check) ach = chl.Value(); - if (ach->NbFails() + ach->NbWarnings() == 0) continue; - Handle(Standard_Transient) ent = ach->Entity(); - if (ent.IsNull()) continue; - if (!alsoshapes) { - if (ent->IsKind(STANDARD_TYPE(TransferBRep_BinderOfShape)) || - ent->IsKind(STANDARD_TYPE(TopoDS_HShape)) || - ent->IsKind(STANDARD_TYPE(TransferBRep_ShapeMapper)) ) continue; - } - ls->Append(ent); - } - return ls; -} - - Handle(TopTools_HSequenceOfShape) TransferBRep::CheckedShapes - (const Interface_CheckIterator& chl) -{ - Handle(TopTools_HSequenceOfShape) ls = new TopTools_HSequenceOfShape(); - for (chl.Start(); chl.More(); chl.Next()) { - const Handle(Interface_Check) ach = chl.Value(); - if (ach->NbFails() + ach->NbWarnings() == 0) continue; - Handle(Standard_Transient) ent = ach->Entity(); - if (ent.IsNull()) continue; - DeclareAndCast(TopoDS_HShape,hs,ent); - DeclareAndCast(TransferBRep_BinderOfShape,sb,ent); - DeclareAndCast(TransferBRep_ShapeMapper,sm,ent); - if (!hs.IsNull()) ls->Append (hs->Shape()); - if (!sb.IsNull()) ls->Append (sb->Result()); - if (!sm.IsNull()) ls->Append (sm->Value()); - } - return ls; -} - - Interface_CheckIterator TransferBRep::CheckObject - (const Interface_CheckIterator& chl, const Handle(Standard_Transient)& obj) -{ - TopoDS_Shape S; - DeclareAndCast(TopoDS_HShape,hs,obj); - DeclareAndCast(TransferBRep_BinderOfShape,sb,obj); - DeclareAndCast(TransferBRep_ShapeMapper,sm,obj); - if (!hs.IsNull()) S = hs->Shape(); - if (!sb.IsNull()) S = sb->Result(); - if (!sm.IsNull()) S = sm->Value(); - Interface_CheckIterator nchl; - - for (chl.Start(); chl.More(); chl.Next()) { - const Handle(Interface_Check) ach = chl.Value(); - if (ach->NbFails() + ach->NbWarnings() == 0) continue; - Handle(Standard_Transient) ent = ach->Entity(); - if (ent.IsNull()) continue; - if (S.IsNull()) { - if (ent == obj) { - Handle(Interface_Check) bch(ach); bch->SetEntity(ent); - nchl.Add (bch,0); - } - } else { - TopoDS_Shape sh; - DeclareAndCast(TopoDS_HShape,hsh,ent); - DeclareAndCast(TransferBRep_BinderOfShape,sbs,ent); - DeclareAndCast(TransferBRep_ShapeMapper,smp,ent); - if (!hsh.IsNull()) sh = hsh->Shape(); - if (!sbs.IsNull()) sh = sbs->Result(); - if (!smp.IsNull()) sh = smp->Value(); - if (sh == S) { - Handle(Interface_Check) bch(ach); bch->SetEntity(ent); - nchl.Add (bch,0); - } - } - } - return nchl; -} - -//======================================================================= -//function : PrintResultInfo -//purpose : -//======================================================================= - -void TransferBRep::PrintResultInfo(const Handle(Message_Printer)& Printer, - const Message_Msg& Header, - const Handle(TransferBRep_TransferResultInfo)& ResultInfo, - const Standard_Boolean printEmpty) -{ - Standard_Integer R, RW, RF, RWF, NR, NRW, NRF, NRWF; - R = ResultInfo->Result(); - RW = ResultInfo->ResultWarning(); - RF = ResultInfo->ResultFail(); - RWF = ResultInfo->ResultWarningFail(); - NR = ResultInfo->NoResult(); - NRW = ResultInfo->NoResultWarning(); - NRF = ResultInfo->NoResultFail(); - NRWF = ResultInfo->NoResultWarningFail(); - - Message_Msg aLocalHeader = Header; - Printer->Send (aLocalHeader, Message_Info, Standard_True); - - Message_Msg EPMSG30 ("Result.Print.MSG30"); // Result: %d - EPMSG30.Arg (R); - Printer->Send (EPMSG30, Message_Info, Standard_True); - if(printEmpty || (RW > 0 )) { - Message_Msg EPMSG32 ("Result.Print.MSG32"); // Result + Warning(s): %d - EPMSG32.Arg (RW); - Printer->Send (EPMSG32, Message_Info, Standard_True); - } - if(printEmpty || (RF > 0 )) { - Message_Msg EPMSG34 ("Result.Print.MSG34"); // Result + Fail(s): %d - EPMSG34.Arg (RF); - Printer->Send (EPMSG34, Message_Info, Standard_True); - } - if(printEmpty || (RWF > 0)) { - Message_Msg EPMSG36 ("Result.Print.MSG36"); // Result + Warning(s) + Fail(s): %d - EPMSG36.Arg (RWF); - Printer->Send (EPMSG36, Message_Info, Standard_True); - } - Message_Msg EPMSG38 ("Result.Print.MSG38"); // TOTAL Result: %d - EPMSG38.Arg (R + RW + RF + RWF); - Printer->Send (EPMSG38, Message_Info, Standard_True); - if(printEmpty || (NR > 0)) { - Message_Msg EPMSG40 ("Result.Print.MSG40"); // No Result: %d - EPMSG40.Arg (NR); - Printer->Send (EPMSG40, Message_Info, Standard_True); - } - if(printEmpty || (NRW > 0)) { - Message_Msg EPMSG42 ("Result.Print.MSG42"); // No Result + Warning(s): %d - EPMSG42.Arg (NRW); - Printer->Send (EPMSG42, Message_Info, Standard_True); - } - if(printEmpty || (NRF > 0)) { - Message_Msg EPMSG44 ("Result.Print.MSG44"); // No Result + Fail(s): %d - EPMSG44.Arg (NRF); - Printer->Send (EPMSG44, Message_Info, Standard_True); - } - if(printEmpty || (NRWF > 0)) { - Message_Msg EPMSG46 ("Result.Print.MSG46"); // No Result + Warning(s) + Fail(s): %d - EPMSG46.Arg (NRWF); - Printer->Send (EPMSG46, Message_Info, Standard_True); - } - - Message_Msg EPMSG48 ("Result.Print.MSG48"); // TOTAL No Result: %d - EPMSG48.Arg (NR + NRW + NRF + NRWF); - Printer->Send (EPMSG48, Message_Info, Standard_True); - + return "TopoDS_Shape"; } diff --git a/src/TransferBRep/TransferBRep.hxx b/src/TransferBRep/TransferBRep.hxx index 0038ad9300..26d4e922c5 100644 --- a/src/TransferBRep/TransferBRep.hxx +++ b/src/TransferBRep/TransferBRep.hxx @@ -18,47 +18,24 @@ #define _TransferBRep_HeaderFile #include -#include #include -#include -#include #include #include -#include -#include -#include +#include +#include class TopoDS_Shape; class Transfer_Binder; class Transfer_TransientProcess; -class Standard_Transient; -class Transfer_FinderProcess; -class TransferBRep_ShapeMapper; -class Message_Printer; -class Message_Msg; -class TransferBRep_TransferResultInfo; -class Interface_CheckIterator; -class Interface_InterfaceModel; -class TransferBRep_Reader; -class TransferBRep_ShapeInfo; -class TransferBRep_BinderOfShape; -class TransferBRep_ShapeBinder; -class TransferBRep_ShapeListBinder; class TransferBRep_ShapeMapper; -class TransferBRep_OrientedShapeMapper; -class TransferBRep_TransferResultInfo; - //! This package gathers services to simply read files and convert //! them to Shapes from CasCade. IE. it can be used in conjunction //! with purely CasCade software class TransferBRep { -public: - - DEFINE_STANDARD_ALLOC + public: - //! Get the Shape recorded in a Binder //! If the Binder brings a multiple result, search for the Shape Standard_EXPORT static TopoDS_Shape ShapeResult (const Handle(Transfer_Binder)& binder); @@ -71,7 +48,7 @@ public: //! Sets a Shape as a result for a starting entity //! (reverse of ShapeResult) //! It simply creates a ShapeBinder then binds it to the entity - Standard_EXPORT static void SetShapeResult (const Handle(Transfer_TransientProcess)& TP, const Handle(Standard_Transient)& ent, const TopoDS_Shape& result); + Standard_EXPORT static void SetShapeResult (const Handle(Transfer_TransientProcess)& TP, const Handle(Standard_Transient)& ent, const TopoDS_Shape &theShape); //! Gets the Shapes recorded in a TransientProcess as result of a //! Transfer, considers roots only or all results according @@ -83,113 +60,15 @@ public: //! the shapes as a HSequence Standard_EXPORT static Handle(TopTools_HSequenceOfShape) Shapes (const Handle(Transfer_TransientProcess)& TP, const Handle(TColStd_HSequenceOfTransient)& list); - //! Returns a Status regarding a Shape in a FinderProcess - //! - FORWARD means bound with SAME Orientation - //! - REVERSED means bound with REVERSE Orientation - //! - EXTERNAL means NOT BOUND - //! - INTERNAL is not used - Standard_EXPORT static TopAbs_Orientation ShapeState (const Handle(Transfer_FinderProcess)& FP, const TopoDS_Shape& shape); - - //! Returns the result (as a Binder) attached to a given Shape - //! Null if none - Standard_EXPORT static Handle(Transfer_Binder) ResultFromShape (const Handle(Transfer_FinderProcess)& FP, const TopoDS_Shape& shape); - - //! Returns the result as pure Transient attached to a Shape - //! first one if multiple result - Standard_EXPORT static Handle(Standard_Transient) TransientFromShape (const Handle(Transfer_FinderProcess)& FP, const TopoDS_Shape& shape); - - //! Binds a Transient Result to a Shape in a FinderProcess - //! (as first result if multiple : does not add it to existing one) - Standard_EXPORT static void SetTransientFromShape (const Handle(Transfer_FinderProcess)& FP, const TopoDS_Shape& shape, const Handle(Standard_Transient)& result); - //! Returns a ShapeMapper for a given Shape (location included) //! Either is already mapped, then its Mapper is returned //! Or it is not, then a new one is created then returned, BUT - //! it is not mapped here (use Bind or FindElseBind to do this) - Standard_EXPORT static Handle(TransferBRep_ShapeMapper) ShapeMapper (const Handle(Transfer_FinderProcess)& FP, const TopoDS_Shape& shape); - - //! Fills sequence of TransferResultInfo for each type of entity - //! given in the EntityTypes (entity are given as objects). - //! Method IsKind applied to the entities in TP is used to - //! compare with entities in EntityTypes. - //! TopAbs_ShapeEnum). - Standard_EXPORT static void TransferResultInfo (const Handle(Transfer_TransientProcess)& TP, const Handle(TColStd_HSequenceOfTransient)& EntityTypes, Handle(TransferBRep_HSequenceOfTransferResultInfo)& InfoSeq); - - //! Fills sequence of TransferResultInfo for each type of shape - //! given in the ShapeTypes (which are in fact considered as - //! TopAbs_ShapeEnum). - //! The Finders in the FP are considered as ShapeMappers. - Standard_EXPORT static void TransferResultInfo (const Handle(Transfer_FinderProcess)& FP, const Handle(TColStd_HSequenceOfInteger)& ShapeTypes, Handle(TransferBRep_HSequenceOfTransferResultInfo)& InfoSeq); - - //! Prints the results of transfer to given priner with given header. - Standard_EXPORT static void PrintResultInfo (const Handle(Message_Printer)& Printer, const Message_Msg& Header, const Handle(TransferBRep_TransferResultInfo)& ResultInfo, const Standard_Boolean printEmpty = Standard_True); - - //! Performs a heavy check by calling the Analyser from BRepCheck - //! This tool computes a lot of informations about integrity of a - //! Shape. This method uses it and converts its internal result - //! to a classic check-list. - //! allows to get more informations : - //! 0 : BRepCheck only - //! 1(D) + Curves/Surfaces not C0 ; 2 + SameParameter on Edges - //! Warning : entities to which checks are bound are the Shapes themselves, - //! embedded in ShapeMapper - Standard_EXPORT static Interface_CheckIterator BRepCheck (const TopoDS_Shape& shape, const Standard_Integer lev = 1); - - //! Takes a starting CheckIterator which brings checks bound with - //! starting objects (Shapes, Transient from an Imagine appli ...) - //! and converts it to a CheckIterator in which checks are bound - //! with results in an InterfaceModel - //! Mapping is recorded in the FinderProcess - //! Starting objects for which no individual result is recorded - //! remain in their state - Standard_EXPORT static Interface_CheckIterator ResultCheckList (const Interface_CheckIterator& chl, const Handle(Transfer_FinderProcess)& FP, const Handle(Interface_InterfaceModel)& model); - - //! Returns the list of objects to which a non-empty Check is - //! bound in a check-list. Objects are transients, they can then - //! be either Imagine objects entities for an Interface Norm. - //! commands Shapes to be returned too - //! (as ShapeMapper), see also CheckedShapes - Standard_EXPORT static Handle(TColStd_HSequenceOfTransient) Checked (const Interface_CheckIterator& chl, const Standard_Boolean alsoshapes = Standard_False); - - //! Returns the list of shapes to which a non-empty Check is bound - //! in a check-list - Standard_EXPORT static Handle(TopTools_HSequenceOfShape) CheckedShapes (const Interface_CheckIterator& chl); - - //! Returns the check-list bound to a given object, generally none - //! (if OK) or one check. can be, either a true Transient - //! object or entity, or a ShapeMapper, in that case the Shape is - //! considered - Standard_EXPORT static Interface_CheckIterator CheckObject (const Interface_CheckIterator& chl, const Handle(Standard_Transient)& obj); - - - - -protected: - - - - - -private: - - - - -friend class TransferBRep_Reader; -friend class TransferBRep_ShapeInfo; -friend class TransferBRep_BinderOfShape; -friend class TransferBRep_ShapeBinder; -friend class TransferBRep_ShapeListBinder; -friend class TransferBRep_ShapeMapper; -friend class TransferBRep_OrientedShapeMapper; -friend class TransferBRep_TransferResultInfo; + //! it is not mapped here (use Bind to do this) + Standard_EXPORT static Handle(TransferBRep_ShapeMapper) ShapeMapper (const Handle(Transfer_ProcessForFinder)& FP, const TopoDS_Shape& theShape); + //! Returns Type Name (string) + //! Here, the true name of the Type of a Shape + Standard_EXPORT static Standard_CString TypeName (const TopoDS_Shape &theShape); }; - - - - - - #endif // _TransferBRep_HeaderFile diff --git a/src/TransferBRep/TransferBRep_BinderOfShape.cxx b/src/TransferBRep/TransferBRep_BinderOfShape.cxx deleted file mode 100644 index cdbe8ddfba..0000000000 --- a/src/TransferBRep/TransferBRep_BinderOfShape.cxx +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) 1999-2014 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 -#include -#include -#include -#include - -IMPLEMENT_STANDARD_RTTIEXT(TransferBRep_BinderOfShape,Transfer_Binder) - -TransferBRep_BinderOfShape::TransferBRep_BinderOfShape (){ } - -TransferBRep_BinderOfShape::TransferBRep_BinderOfShape (const TopoDS_Shape& res) -: theres (res) -{ SetResultPresent(); } - - -// Standard_Boolean TransferBRep_BinderOfShape::IsMultiple() const -// { return Standard_False; } - - -Handle(Standard_Type) TransferBRep_BinderOfShape::ResultType () const -{ return TransferBRep_ShapeInfo::Type (theres); } // correspond a "STANDARD_TYPE(TopoDS_Shape)" - -Standard_CString TransferBRep_BinderOfShape::ResultTypeName () const -{ return TransferBRep_ShapeInfo::TypeName (theres); } // correspond a "STANDARD_TYPE(TopoDS_Shape)" - - -void TransferBRep_BinderOfShape::SetResult (const TopoDS_Shape& res) -{ - SetResultPresent(); - theres = res; -} - -const TopoDS_Shape& TransferBRep_BinderOfShape::Result () const -{ return theres; } - -TopoDS_Shape& TransferBRep_BinderOfShape::CResult () -{ SetResultPresent(); return theres; } diff --git a/src/TransferBRep/TransferBRep_BinderOfShape.hxx b/src/TransferBRep/TransferBRep_BinderOfShape.hxx deleted file mode 100644 index 7509bb8de9..0000000000 --- a/src/TransferBRep/TransferBRep_BinderOfShape.hxx +++ /dev/null @@ -1,102 +0,0 @@ -// Created on: 1992-02-17 -// Created by: Christian CAILLET -// Copyright (c) 1992-1999 Matra Datavision -// Copyright (c) 1999-2014 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 _TransferBRep_BinderOfShape_HeaderFile -#define _TransferBRep_BinderOfShape_HeaderFile - -#include -#include - -#include -#include -#include -#include -class Transfer_TransferFailure; -class TopoDS_Shape; - - -class TransferBRep_BinderOfShape; -DEFINE_STANDARD_HANDLE(TransferBRep_BinderOfShape, Transfer_Binder) - -//! Allows direct binding between a starting Object and the Result -//! of its transfer when it is Unique. -//! The Result itself is defined as a formal parameter -//! Warning : While it is possible to instantiate BinderOfShape with any Type -//! for the Result, it is not advisable to instantiate it with -//! Transient Classes, because such Results are directly known and -//! managed by TransferProcess & Co, through -//! SimpleBinderOfTransient : this class looks like instantiation -//! of BinderOfShape, but its method ResultType -//! is adapted (reads DynamicType of the Result) -class TransferBRep_BinderOfShape : public Transfer_Binder -{ - -public: - - - //! normal standard constructor, creates an empty BinderOfShape - Standard_EXPORT TransferBRep_BinderOfShape(); - - //! constructor which in the same time defines the result - //! Returns True if a starting object is bound with SEVERAL - //! results : Here, returns allways False - //! But it can have next results - Standard_EXPORT TransferBRep_BinderOfShape(const TopoDS_Shape& res); - - //! Returns the Type permitted for the Result, i.e. the Type - //! of the Parameter Class (statically defined) - Standard_EXPORT Handle(Standard_Type) ResultType() const Standard_OVERRIDE; - - //! Returns the Type Name computed for the Result (dynamic) - Standard_EXPORT Standard_CString ResultTypeName() const Standard_OVERRIDE; - - //! Defines the Result - Standard_EXPORT void SetResult (const TopoDS_Shape& res); - - //! Returns the defined Result, if there is one - Standard_EXPORT const TopoDS_Shape& Result() const; - - //! Returns the defined Result, if there is one, and allows to - //! change it (avoids Result + SetResult). - //! Admits that Result can be not yet defined - //! Warning : a call to CResult causes Result to be known as defined - Standard_EXPORT TopoDS_Shape& CResult(); - - - - - DEFINE_STANDARD_RTTIEXT(TransferBRep_BinderOfShape,Transfer_Binder) - -protected: - - - - -private: - - - TopoDS_Shape theres; - - -}; - - - - - - - -#endif // _TransferBRep_BinderOfShape_HeaderFile diff --git a/src/TransferBRep/TransferBRep_HSequenceOfTransferResultInfo.hxx b/src/TransferBRep/TransferBRep_HSequenceOfTransferResultInfo.hxx deleted file mode 100644 index 3214d29e64..0000000000 --- a/src/TransferBRep/TransferBRep_HSequenceOfTransferResultInfo.hxx +++ /dev/null @@ -1,27 +0,0 @@ -// Created on: 1994-10-03 -// Created by: Christian CAILLET -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 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 TransferBRep_HSequenceOfTransferResultInfo_HeaderFile -#define TransferBRep_HSequenceOfTransferResultInfo_HeaderFile - -#include -#include -#include - -DEFINE_HSEQUENCE(TransferBRep_HSequenceOfTransferResultInfo, TransferBRep_SequenceOfTransferResultInfo) - - -#endif diff --git a/src/TransferBRep/TransferBRep_OrientedShapeMapper.hxx b/src/TransferBRep/TransferBRep_OrientedShapeMapper.hxx deleted file mode 100644 index 468a2b293b..0000000000 --- a/src/TransferBRep/TransferBRep_OrientedShapeMapper.hxx +++ /dev/null @@ -1,89 +0,0 @@ -// Created on: 1994-10-03 -// Created by: Christian CAILLET -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 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 _TransferBRep_OrientedShapeMapper_HeaderFile -#define _TransferBRep_OrientedShapeMapper_HeaderFile - -#include -#include - -#include -#include -#include -#include -#include -class TopoDS_Shape; -class TopTools_OrientedShapeMapHasher; -class TransferBRep_ShapeInfo; -class Transfer_Finder; - - -class TransferBRep_OrientedShapeMapper; -DEFINE_STANDARD_HANDLE(TransferBRep_OrientedShapeMapper, Transfer_Finder) - - -class TransferBRep_OrientedShapeMapper : public Transfer_Finder -{ - -public: - - - //! Creates a Mapper with a Value. This Value can then not be - //! changed. It is used by the Hasher to compute the HashCode, - //! which will then be stored for an immediate reading. - Standard_EXPORT TransferBRep_OrientedShapeMapper(const TopoDS_Shape& akey); - - //! Returns the contained value - Standard_EXPORT const TopoDS_Shape& Value() const; - - //! Specific testof equallity : defined as False if has - //! not the same true Type, else contents are compared (by - //! C++ operator ==) - Standard_EXPORT Standard_Boolean Equates (const Handle(Transfer_Finder)& other) const Standard_OVERRIDE; - - //! Returns the Type of the Value. By default, returns the - //! DynamicType of , but can be redefined - Standard_EXPORT virtual Handle(Standard_Type) ValueType() const Standard_OVERRIDE; - - //! Returns the name of the Type of the Value. Default is name - //! of ValueType, unless it is for a non-handled object - Standard_EXPORT virtual Standard_CString ValueTypeName() const Standard_OVERRIDE; - - - - - DEFINE_STANDARD_RTTI_INLINE(TransferBRep_OrientedShapeMapper,Transfer_Finder) - -protected: - - - - -private: - - - TopoDS_Shape theval; - - -}; - - - - - - - -#endif // _TransferBRep_OrientedShapeMapper_HeaderFile diff --git a/src/TransferBRep/TransferBRep_OrientedShapeMapper_0.cxx b/src/TransferBRep/TransferBRep_OrientedShapeMapper_0.cxx deleted file mode 100644 index 84cb6c24d0..0000000000 --- a/src/TransferBRep/TransferBRep_OrientedShapeMapper_0.cxx +++ /dev/null @@ -1,45 +0,0 @@ -// Created on: 1994-10-03 -// Created by: Christian CAILLET -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 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 - -#include - -#include -#include -#include -#include - - - - - - - - - - -#define TheKey TopoDS_Shape -#define TheKey_hxx -#define TheHasher TopTools_OrientedShapeMapHasher -#define TheHasher_hxx -#define TheInfo TransferBRep_ShapeInfo -#define TheInfo_hxx -#define Transfer_Mapper TransferBRep_OrientedShapeMapper -#define Transfer_Mapper_hxx -#define Handle_Transfer_Mapper Handle(TransferBRep_OrientedShapeMapper) -#include - diff --git a/src/TransferBRep/TransferBRep_Reader.cxx b/src/TransferBRep/TransferBRep_Reader.cxx deleted file mode 100644 index f7c63fa0f6..0000000000 --- a/src/TransferBRep/TransferBRep_Reader.cxx +++ /dev/null @@ -1,257 +0,0 @@ -// Copyright (c) 1999-2014 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -TransferBRep_Reader::TransferBRep_Reader () - : theDone (Standard_False) , theFilest (0) , theNewpr (Standard_False) - { theShapes = new TopTools_HSequenceOfShape(); theTransi = new TColStd_HSequenceOfTransient(); } - - void TransferBRep_Reader::SetProtocol - (const Handle(Interface_Protocol)& protocol) - { theProto = protocol; } - - Handle(Interface_Protocol) TransferBRep_Reader::Protocol () const - { return theProto; } - - void TransferBRep_Reader::SetActor - (const Handle(Transfer_ActorOfTransientProcess)& actor) - { theActor = actor; } - - Handle(Transfer_ActorOfTransientProcess) TransferBRep_Reader::Actor () const - { return theActor; } - - void TransferBRep_Reader::SetFileStatus (const Standard_Integer status) - { theFilest = status; } - - Standard_Integer TransferBRep_Reader::FileStatus () const - { return theFilest; } - - Standard_Boolean TransferBRep_Reader::FileNotFound () const - { return (theFilest < 0); } - - Standard_Boolean TransferBRep_Reader::SyntaxError () const - { return (theFilest > 0); } - - - void TransferBRep_Reader::SetModel - (const Handle(Interface_InterfaceModel)& model) -{ - theModel = model; - Clear(); -} - - Handle(Interface_InterfaceModel) TransferBRep_Reader::Model () const - { return theModel; } - - - void TransferBRep_Reader::Clear () -{ - theDone = Standard_False; - theShapes->Clear(); theTransi->Clear(); -} - - Standard_Boolean TransferBRep_Reader::CheckStatusModel - (const Standard_Boolean withprint) const -{ - Interface_CheckTool cht (theModel,theProto); - Interface_CheckIterator chl = cht.CompleteCheckList(); - if ( withprint && ! theProc.IsNull() ) - chl.Print (theProc->Messenger(), theModel, Standard_False); - return chl.IsEmpty(Standard_True); -} - - Interface_CheckIterator TransferBRep_Reader::CheckListModel () const -{ - Interface_CheckTool cht (theModel,theProto); - Interface_CheckIterator chl = cht.CompleteCheckList(); - return chl; -} - - Standard_Boolean& TransferBRep_Reader::ModeNewTransfer () - { return theNewpr; } - - Standard_Boolean TransferBRep_Reader::BeginTransfer () -{ - theDone = Standard_False; - if (theModel.IsNull()) return Standard_False; - - if (theNewpr || theProc.IsNull()) - theProc = new Transfer_TransientProcess (theModel->NbEntities()); - else theProc->Clear(); - theProc->SetErrorHandle(Standard_True); - theProc->SetModel (theModel); - PrepareTransfer(); - theProc->SetActor (theActor); - return Standard_True; -} - - void TransferBRep_Reader::EndTransfer () -{ - theShapes->Append ( TransferBRep::Shapes (theProc,Standard_True) ); - Standard_Integer i,nb = theProc->NbRoots(); - for (i = 1; i <= nb; i ++) { - Handle(Standard_Transient) ent = theProc->Root(i); - Handle(Standard_Transient) res = theProc->FindTransient(ent); - if (!res.IsNull()) theTransi->Append (res); - } - theDone = Standard_True; -} - - - void TransferBRep_Reader::PrepareTransfer () { } - - void TransferBRep_Reader::TransferRoots () -{ - Clear(); - if (!BeginTransfer()) return; - Transfer_TransferOutput TP (theProc,theModel); - - TP.TransferRoots(theProto); - EndTransfer(); -} - - Standard_Boolean TransferBRep_Reader::Transfer (const Standard_Integer num) -{ - if (!BeginTransfer()) return Standard_False; - if (num <= 0 || num > theModel->NbEntities()) return Standard_False; - Handle(Standard_Transient) ent = theModel->Value(num); - Transfer_TransferOutput TP (theProc,theModel); - - if (theProc->TraceLevel() > 1) { - Handle(Message_Messenger) sout = theProc->Messenger(); - sout<<"-- Transfer(Read) : "; - theModel->Print (ent,sout); - sout<SetRoot(ent); - EndTransfer(); - return Standard_True; -} - - void TransferBRep_Reader::TransferList - (const Handle(TColStd_HSequenceOfTransient)& list) -{ - if (!BeginTransfer()) return; - if (list.IsNull()) return; - Transfer_TransferOutput TP (theProc,theModel); - Standard_Integer i, nb = list->Length(); - Handle(Message_Messenger) sout = theProc->Messenger(); - - if (theProc->TraceLevel() > 1) - sout<<"-- Transfer(Read-List) : "<Value(i); - if (theModel->Number(ent) == 0) continue; - - if (theProc->TraceLevel() > 1) - { - sout<<"-- Transfer(Read-List), Item "<Print (ent,sout); - sout<SetRoot(ent); - } - EndTransfer(); -} - - Standard_Boolean TransferBRep_Reader::IsDone () const - { return theDone; } - -// ###### RESULTAT : SHAPES ###### - - Standard_Integer TransferBRep_Reader::NbShapes () const - { return theShapes->Length(); } - - Handle(TopTools_HSequenceOfShape) TransferBRep_Reader::Shapes () const - { return theShapes; } - - const TopoDS_Shape& TransferBRep_Reader::Shape - (const Standard_Integer num) const - { return theShapes->Value(num); } - - TopoDS_Shape TransferBRep_Reader::OneShape () const -{ - TopoDS_Shape res; - Standard_Integer nb = theShapes->Length(); - if (nb == 0) return res; - else if (nb == 1) return theShapes->Value(1); - else { - TopoDS_Compound C; - BRep_Builder B; - B.MakeCompound(C); - for (Standard_Integer i = 1; i <= nb; i ++) B.Add (C,theShapes->Value(i)); - return C; - } -} - - TopoDS_Shape TransferBRep_Reader::ShapeResult - (const Handle(Standard_Transient)& ent) const - { return TransferBRep::ShapeResult (theProc,ent); } - -// ###### RESULTAT : TRANSIENTS ###### - - Standard_Integer TransferBRep_Reader::NbTransients () const - { return theTransi->Length(); } - - Handle(TColStd_HSequenceOfTransient) TransferBRep_Reader::Transients () const - { return theTransi; } - - Handle(Standard_Transient) TransferBRep_Reader::Transient - (const Standard_Integer num) const - { return theTransi->Value(num); } - - -// ###### CHECKS ###### - - Standard_Boolean TransferBRep_Reader::CheckStatusResult - (const Standard_Boolean withprint) const -{ - Interface_CheckIterator chl; - if (!theProc.IsNull()) chl = theProc->CheckList(Standard_False); - if (withprint && ! theProc.IsNull()) - chl.Print (theProc->Messenger(), theModel, Standard_False); - return chl.IsEmpty(Standard_True); -} - - Interface_CheckIterator TransferBRep_Reader::CheckListResult () const -{ - if (!theProc.IsNull()) return theProc->CheckList(Standard_False); - Interface_CheckIterator chbid; return chbid; -} - - Handle(Transfer_TransientProcess) TransferBRep_Reader::TransientProcess - () const - { return theProc; } - -TransferBRep_Reader::~TransferBRep_Reader() -{} - diff --git a/src/TransferBRep/TransferBRep_Reader.hxx b/src/TransferBRep/TransferBRep_Reader.hxx deleted file mode 100644 index 6cf937f0e3..0000000000 --- a/src/TransferBRep/TransferBRep_Reader.hxx +++ /dev/null @@ -1,216 +0,0 @@ -// Created on: 1994-10-03 -// Created by: Christian CAILLET -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 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 _TransferBRep_Reader_HeaderFile -#define _TransferBRep_Reader_HeaderFile - -#include -#include -#include - -#include -#include -#include -#include -class Interface_Protocol; -class Transfer_ActorOfTransientProcess; -class Interface_InterfaceModel; -class Transfer_TransientProcess; -class Standard_OutOfRange; -class Interface_CheckIterator; -class TopoDS_Shape; -class Standard_Transient; - - -//! This class offers a simple, easy to call, way of transferring -//! data from interface files to Shapes from CasCade -//! It must be specialized according to each norm/protocol, by : -//! - defining how to read a file (specific method with protocol) -//! - definig transfer, by providing an Actor -class TransferBRep_Reader -{ -public: - - DEFINE_STANDARD_ALLOC - - - //! Initializes a non-specialised Reader. Typically, for each norm - //! or protocol, is will be required to define a specific Create - //! to load a file and transfer it - Standard_EXPORT TransferBRep_Reader(); - - //! Records the protocol to be used for read and transfer roots - Standard_EXPORT void SetProtocol (const Handle(Interface_Protocol)& protocol); - - //! Returns the recorded Protocol - Standard_EXPORT virtual Handle(Interface_Protocol) Protocol() const; - - //! Records the actor to be used for transfers - Standard_EXPORT void SetActor (const Handle(Transfer_ActorOfTransientProcess)& actor); - - //! Returns the recorded Actor - Standard_EXPORT virtual Handle(Transfer_ActorOfTransientProcess) Actor() const; - - //! Sets File Status to be interpreted as follows : - //! = 0 OK - //! < 0 file not found - //! > 0 read error, no Model could be created - Standard_EXPORT void SetFileStatus (const Standard_Integer status); - - //! Returns the File Status - Standard_EXPORT Standard_Integer FileStatus() const; - - //! Returns True if FileStatus is for FileNotFound - Standard_EXPORT Standard_Boolean FileNotFound() const; - - //! Returns True if FileStatus is for Error during read - //! (major error; for local error, see CheckModel) - Standard_EXPORT Standard_Boolean SyntaxError() const; - - //! Specifies a Model to work on - //! Also clears the result and Done status - Standard_EXPORT void SetModel (const Handle(Interface_InterfaceModel)& model); - - //! Returns the Model to be worked on - Standard_EXPORT Handle(Interface_InterfaceModel) Model() const; - - //! clears the result and Done status. But not the Model. - Standard_EXPORT void Clear(); - - //! Checks the Model. Returns True if there is NO FAIL at all - //! (regardless Warnings) - //! If is True, also sends Checks on standard output - Standard_EXPORT Standard_Boolean CheckStatusModel (const Standard_Boolean withprint) const; - - //! Checks the Model (complete : syntax + semantic) and returns - //! the produced Check List - Standard_EXPORT Interface_CheckIterator CheckListModel() const; - - //! Returns (by Reference, hence can be changed) the Mode for new - //! Transfer : True (D) means that each new Transfer produces a - //! new TransferProcess. Else keeps the original one but each - //! Transfer clears its (former results are not kept) - Standard_EXPORT Standard_Boolean& ModeNewTransfer(); - - //! Initializes the Reader for a Transfer (one,roots, or list) - //! Also calls PrepareTransfer - //! Returns True when done, False if could not be done - Standard_EXPORT Standard_Boolean BeginTransfer(); - - //! Ebds a Transfer (one, roots or list) by recording its result - Standard_EXPORT void EndTransfer(); - - //! Prepares the Transfer. Also can act on the Actor or change the - //! TransientProcess if required. - //! Should not set the Actor into the TransientProcess, it is done - //! by caller. The provided default does nothing. - Standard_EXPORT virtual void PrepareTransfer(); - - //! Transfers all Root Entities which are recognized as Geom-Topol - //! The result will be a list of Shapes. - //! This method calls user redefinable PrepareTransfer - //! Remark : former result is cleared - Standard_EXPORT virtual void TransferRoots(); - - //! Transfers an Entity given its rank in the Model (Root or not) - //! Returns True if it is recognized as Geom-Topol. - //! (But it can have failed : see IsDone) - Standard_EXPORT virtual Standard_Boolean Transfer (const Standard_Integer num); - - //! Transfers a list of Entities (only the ones also in the Model) - //! Remark : former result is cleared - Standard_EXPORT virtual void TransferList (const Handle(TColStd_HSequenceOfTransient)& list); - - //! Returns True if the LAST Transfer/TransferRoots was a success - Standard_EXPORT Standard_Boolean IsDone() const; - - //! Returns the count of produced Shapes (roots) - Standard_EXPORT Standard_Integer NbShapes() const; - - //! Returns the complete list of produced Shapes - Standard_EXPORT Handle(TopTools_HSequenceOfShape) Shapes() const; - - //! Returns a Shape given its rank, by default the first one - Standard_EXPORT const TopoDS_Shape& Shape (const Standard_Integer num = 1) const; - - //! Returns a Shape produced from a given entity (if it was - //! individually transferred or if an intermediate result is - //! known). If no Shape is bound with , returns a Null Shape - //! Warning : Runs on the last call to Transfer,TransferRoots,TransferList - Standard_EXPORT TopoDS_Shape ShapeResult (const Handle(Standard_Transient)& ent) const; - - //! Returns a unique Shape for the result : - //! - a void Shape (type = SHAPE) if result is empty - //! - a simple Shape if result has only one : returns this one - //! - a Compound if result has more than one Shape - Standard_EXPORT TopoDS_Shape OneShape() const; - - //! Returns the count of produced Transient Results (roots) - Standard_EXPORT Standard_Integer NbTransients() const; - - //! Returns the complete list of produced Transient Results - Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Transients() const; - - //! Returns a Transient Root Result, given its rank (by default - //! the first one) - Standard_EXPORT Handle(Standard_Transient) Transient (const Standard_Integer num = 1) const; - - //! Checks the Result of last Transfer (individual or roots, no - //! cumulation on several transfers). Returns True if NO fail - //! occured during Transfer (queries the TransientProcess) - Standard_EXPORT Standard_Boolean CheckStatusResult (const Standard_Boolean withprints) const; - - //! Checks the Result of last Transfer (individual or roots, no - //! cumulation on several transfers) and returns the produced list - Standard_EXPORT Interface_CheckIterator CheckListResult() const; - - //! Returns the TransientProcess. It records informations about - //! the very last transfer done. Null if no transfer yet done. - //! Can be used for queries more accurate than the default ones. - Standard_EXPORT Handle(Transfer_TransientProcess) TransientProcess() const; - - Standard_EXPORT virtual ~TransferBRep_Reader(); - -protected: - - - - Standard_Boolean theDone; - Handle(Transfer_TransientProcess) theProc; - - -private: - - - - Handle(Interface_Protocol) theProto; - Handle(Transfer_ActorOfTransientProcess) theActor; - Handle(Interface_InterfaceModel) theModel; - Standard_Integer theFilest; - Standard_Boolean theNewpr; - Handle(TopTools_HSequenceOfShape) theShapes; - Handle(TColStd_HSequenceOfTransient) theTransi; - - -}; - - - - - - - -#endif // _TransferBRep_Reader_HeaderFile diff --git a/src/TransferBRep/TransferBRep_SequenceOfTransferResultInfo.hxx b/src/TransferBRep/TransferBRep_SequenceOfTransferResultInfo.hxx deleted file mode 100644 index 9fdf9a00f1..0000000000 --- a/src/TransferBRep/TransferBRep_SequenceOfTransferResultInfo.hxx +++ /dev/null @@ -1,26 +0,0 @@ -// Created on: 1994-10-03 -// Created by: Christian CAILLET -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 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 TransferBRep_SequenceOfTransferResultInfo_HeaderFile -#define TransferBRep_SequenceOfTransferResultInfo_HeaderFile - -#include -#include - -typedef NCollection_Sequence TransferBRep_SequenceOfTransferResultInfo; - - -#endif diff --git a/src/TransferBRep/TransferBRep_ShapeBinder.cxx b/src/TransferBRep/TransferBRep_ShapeBinder.cxx index 8c28b74bd2..adece160ff 100644 --- a/src/TransferBRep/TransferBRep_ShapeBinder.cxx +++ b/src/TransferBRep/TransferBRep_ShapeBinder.cxx @@ -11,54 +11,14 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include +#include +#include -IMPLEMENT_STANDARD_RTTIEXT(TransferBRep_ShapeBinder,TransferBRep_BinderOfShape) - -TransferBRep_ShapeBinder::TransferBRep_ShapeBinder () { } - - TransferBRep_ShapeBinder::TransferBRep_ShapeBinder (const TopoDS_Shape& shape) - : TransferBRep_BinderOfShape (shape) { } - - TopAbs_ShapeEnum TransferBRep_ShapeBinder::ShapeType () const -{ - if (!HasResult()) return TopAbs_SHAPE; - return Result().ShapeType(); -} - - TopoDS_Vertex TransferBRep_ShapeBinder::Vertex() const - { return TopoDS::Vertex(Result()); } - - TopoDS_Edge TransferBRep_ShapeBinder::Edge() const - { return TopoDS::Edge(Result()); } - - TopoDS_Wire TransferBRep_ShapeBinder::Wire() const - { return TopoDS::Wire(Result()); } - - TopoDS_Face TransferBRep_ShapeBinder::Face() const - { return TopoDS::Face(Result()); } - - TopoDS_Shell TransferBRep_ShapeBinder::Shell() const - { return TopoDS::Shell(Result()); } - - TopoDS_Solid TransferBRep_ShapeBinder::Solid() const - { return TopoDS::Solid(Result()); } +IMPLEMENT_STANDARD_RTTIEXT(TransferBRep_ShapeBinder,Transfer_Binder) - TopoDS_CompSolid TransferBRep_ShapeBinder::CompSolid() const - { return TopoDS::CompSolid(Result()); } +Handle(Standard_Type) TransferBRep_ShapeBinder::ResultType () const +{ return STANDARD_TYPE(TopoDS_TShape); } - TopoDS_Compound TransferBRep_ShapeBinder::Compound() const - { return TopoDS::Compound(Result()); } +Standard_CString TransferBRep_ShapeBinder::ResultTypeName () const +{ return TransferBRep::TypeName (myResult); } diff --git a/src/TransferBRep/TransferBRep_ShapeBinder.hxx b/src/TransferBRep/TransferBRep_ShapeBinder.hxx index bdec1e6a59..14fc3c57a7 100644 --- a/src/TransferBRep/TransferBRep_ShapeBinder.hxx +++ b/src/TransferBRep/TransferBRep_ShapeBinder.hxx @@ -20,77 +20,47 @@ #include #include -#include -#include -class Standard_TypeMismatch; -class TopoDS_Shape; -class TopoDS_Vertex; -class TopoDS_Edge; -class TopoDS_Wire; -class TopoDS_Face; -class TopoDS_Shell; -class TopoDS_Solid; -class TopoDS_CompSolid; -class TopoDS_Compound; - - -class TransferBRep_ShapeBinder; -DEFINE_STANDARD_HANDLE(TransferBRep_ShapeBinder, TransferBRep_BinderOfShape) - -//! A ShapeBinder is a BinderOfShape with some additional services -//! to cast the Result under various kinds of Shapes -class TransferBRep_ShapeBinder : public TransferBRep_BinderOfShape +#include +#include + +//! Allows direct binding between a starting Object and the Result of its transfer when it is Unique. +//! The Result itself is defined as a formal parameter +//! Warning : While it is possible to instantiate ShapeBinder with any Type for the Result, +//! it is not advisable to instantiate it with Transient Classes, +//! because such Results are directly known and managed by TransferProcess & Co, +//! through SimpleBinderOfTransient : this class looks like instantiation of ShapeBinder, +//! but its method ResultType is adapted (reads DynamicType of the Result) +class TransferBRep_ShapeBinder : public Transfer_Binder { - -public: - + public: //! Creates an empty ShapeBinder - Standard_EXPORT TransferBRep_ShapeBinder(); - - //! Creates a ShapeBinder with a result - Standard_EXPORT TransferBRep_ShapeBinder(const TopoDS_Shape& res); - - //! Returns the Type of the Shape Result (under TopAbs form) - Standard_EXPORT TopAbs_ShapeEnum ShapeType() const; - - Standard_EXPORT TopoDS_Vertex Vertex() const; - - Standard_EXPORT TopoDS_Edge Edge() const; - - Standard_EXPORT TopoDS_Wire Wire() const; - - Standard_EXPORT TopoDS_Face Face() const; + TransferBRep_ShapeBinder() {} + + //! Constructor which in the same time defines the result + //! Returns True if a starting object is bound with SEVERAL + //! results : Here, returns allways False + //! But it can have next results + TransferBRep_ShapeBinder(const TopoDS_Shape& theResult) : myResult (theResult) { SetResultPresent(); } - Standard_EXPORT TopoDS_Shell Shell() const; + //! Returns the Type permitted for the Result, i.e. the Type + //! of the Parameter Class (statically defined) + Standard_EXPORT Handle(Standard_Type) ResultType() const Standard_OVERRIDE; - Standard_EXPORT TopoDS_Solid Solid() const; + //! Returns the Type Name computed for the Result (dynamic) + Standard_EXPORT Standard_CString ResultTypeName() const Standard_OVERRIDE; - Standard_EXPORT TopoDS_CompSolid CompSolid() const; + //! Defines the Result + void SetResult (const TopoDS_Shape &theResult) { SetResultPresent(); myResult = theResult; } - Standard_EXPORT TopoDS_Compound Compound() const; - - - - - DEFINE_STANDARD_RTTIEXT(TransferBRep_ShapeBinder,TransferBRep_BinderOfShape) - -protected: - - - - -private: - + //! Returns the defined Result, if there is one + const TopoDS_Shape & Result() const { return myResult; } + DEFINE_STANDARD_RTTIEXT(TransferBRep_ShapeBinder,Transfer_Binder) + private: + TopoDS_Shape myResult; }; - - - - - - #endif // _TransferBRep_ShapeBinder_HeaderFile diff --git a/src/TransferBRep/TransferBRep_ShapeInfo.cxx b/src/TransferBRep/TransferBRep_ShapeInfo.cxx deleted file mode 100644 index ff80ca3c45..0000000000 --- a/src/TransferBRep/TransferBRep_ShapeInfo.cxx +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 1999-2014 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 -#include -#include - -Handle(Standard_Type) TransferBRep_ShapeInfo::Type - (const TopoDS_Shape& /*ent*/) - { return STANDARD_TYPE(TopoDS_TShape); } - - Standard_CString TransferBRep_ShapeInfo::TypeName - (const TopoDS_Shape& ent) -{ - if (ent.IsNull()) return "TopoDS_Shape"; - switch (ent.ShapeType()) { - case TopAbs_VERTEX : return "TopoDS_Vertex"; - case TopAbs_EDGE : return "TopoDS_Edge"; - case TopAbs_WIRE : return "TopoDS_Wire"; - case TopAbs_FACE : return "TopoDS_Face"; - case TopAbs_SHELL : return "TopoDS_Shell"; - case TopAbs_SOLID : return "TopoDS_Solid"; - case TopAbs_COMPSOLID : return "TopoDS_CompSolid"; - case TopAbs_COMPOUND : return "TopoDS_Compound"; - default : break; - } - return "TopoDS_Shape"; -} diff --git a/src/TransferBRep/TransferBRep_ShapeInfo.hxx b/src/TransferBRep/TransferBRep_ShapeInfo.hxx deleted file mode 100644 index de54ddad9f..0000000000 --- a/src/TransferBRep/TransferBRep_ShapeInfo.hxx +++ /dev/null @@ -1,69 +0,0 @@ -// Created on: 1996-09-04 -// Created by: Christian CAILLET -// Copyright (c) 1996-1999 Matra Datavision -// Copyright (c) 1999-2014 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 _TransferBRep_ShapeInfo_HeaderFile -#define _TransferBRep_ShapeInfo_HeaderFile - -#include -#include -#include - -#include -#include -class TopoDS_Shape; - - -//! Gives informations on an object, see template DataInfo -//! This class is for Shape -class TransferBRep_ShapeInfo -{ -public: - - DEFINE_STANDARD_ALLOC - - - //! Returns the Type attached to an object - //! Here, TShape (Shape has no Dynamic Type) - Standard_EXPORT static Handle(Standard_Type) Type (const TopoDS_Shape& ent); - - //! Returns Type Name (string) - //! Here, the true name of the Type of a Shape - Standard_EXPORT static Standard_CString TypeName (const TopoDS_Shape& ent); - - - - -protected: - - - - - -private: - - - - - -}; - - - - - - - -#endif // _TransferBRep_ShapeInfo_HeaderFile diff --git a/src/TransferBRep/TransferBRep_ShapeListBinder.cxx b/src/TransferBRep/TransferBRep_ShapeListBinder.cxx index e63197ec65..ec86d7870c 100644 --- a/src/TransferBRep/TransferBRep_ShapeListBinder.cxx +++ b/src/TransferBRep/TransferBRep_ShapeListBinder.cxx @@ -11,93 +11,34 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include +#include +#include IMPLEMENT_STANDARD_RTTIEXT(TransferBRep_ShapeListBinder,Transfer_Binder) -TransferBRep_ShapeListBinder::TransferBRep_ShapeListBinder () - { theres = new TopTools_HSequenceOfShape(); } - - TransferBRep_ShapeListBinder::TransferBRep_ShapeListBinder - (const Handle(TopTools_HSequenceOfShape)& list) - { theres = list; } - - Standard_Boolean TransferBRep_ShapeListBinder::IsMultiple () const - { return (NbShapes() > 1); } - - Handle(Standard_Type) TransferBRep_ShapeListBinder::ResultType () const - { return STANDARD_TYPE(TransferBRep_ShapeListBinder); } - - Standard_CString TransferBRep_ShapeListBinder::ResultTypeName () const - { return "list(TopoDS_Shape)"; } - - - void TransferBRep_ShapeListBinder::AddResult (const TopoDS_Shape& shape) - { theres->Append(shape); } - - Handle(TopTools_HSequenceOfShape) TransferBRep_ShapeListBinder::Result - () const - { return theres; } - - void TransferBRep_ShapeListBinder::SetResult - (const Standard_Integer num, const TopoDS_Shape& shape) - { theres->SetValue(num,shape); } - - Standard_Integer TransferBRep_ShapeListBinder::NbShapes () const - { return theres->Length(); } - - const TopoDS_Shape& TransferBRep_ShapeListBinder::Shape - (const Standard_Integer num) const - { return theres->Value(num); } - - TopAbs_ShapeEnum TransferBRep_ShapeListBinder::ShapeType - (const Standard_Integer num) const - { return theres->Value(num).ShapeType(); } - - TopoDS_Vertex TransferBRep_ShapeListBinder::Vertex - (const Standard_Integer num) const - { return TopoDS::Vertex(theres->Value(num)); } - - TopoDS_Edge TransferBRep_ShapeListBinder::Edge - (const Standard_Integer num) const - { return TopoDS::Edge(theres->Value(num)); } - - TopoDS_Wire TransferBRep_ShapeListBinder::Wire - (const Standard_Integer num) const - { return TopoDS::Wire(theres->Value(num)); } - - TopoDS_Face TransferBRep_ShapeListBinder::Face - (const Standard_Integer num) const - { return TopoDS::Face(theres->Value(num)); } - - TopoDS_Shell TransferBRep_ShapeListBinder::Shell - (const Standard_Integer num) const - { return TopoDS::Shell(theres->Value(num)); } - - TopoDS_Solid TransferBRep_ShapeListBinder::Solid - (const Standard_Integer num) const - { return TopoDS::Solid(theres->Value(num)); } - - TopoDS_CompSolid TransferBRep_ShapeListBinder::CompSolid - (const Standard_Integer num) const - { return TopoDS::CompSolid(theres->Value(num)); } - - TopoDS_Compound TransferBRep_ShapeListBinder::Compound - (const Standard_Integer num) const - { return TopoDS::Compound(theres->Value(num)); } - - +Standard_Boolean TransferBRep_ShapeListBinder::IsMultiple () const +{ return (myShapes.Length() > 1); } + +Handle(Standard_Type) TransferBRep_ShapeListBinder::ResultType () const +{ return STANDARD_TYPE(TransferBRep_ShapeListBinder); } + +Standard_CString TransferBRep_ShapeListBinder::ResultTypeName () const +{ return "list(TopoDS_Shape)"; } + +Standard_Boolean TransferBRep_ShapeListBinder::GetOneShape (TopoDS_Shape &theShape) const +{ + const Standard_Integer aNbOfShapes = myShapes.Length(); + if (aNbOfShapes == 0) return Standard_False; + if (aNbOfShapes == 1) theShape = myShapes.First(); + else { + // Make a compound from the sequence + TopoDS_Compound aComp; + BRep_Builder aBuilder; + aBuilder.MakeCompound(aComp); + for (Standard_Integer i=1; i<=aNbOfShapes; i++) + aBuilder.Add(aComp, myShapes.Value(i)); + theShape = aComp; + } + return Standard_True; +} diff --git a/src/TransferBRep/TransferBRep_ShapeListBinder.hxx b/src/TransferBRep/TransferBRep_ShapeListBinder.hxx index f9a49d6186..cf265494d6 100644 --- a/src/TransferBRep/TransferBRep_ShapeListBinder.hxx +++ b/src/TransferBRep/TransferBRep_ShapeListBinder.hxx @@ -20,28 +20,9 @@ #include #include -#include +#include +#include #include -#include -#include -#include -#include -#include -class Standard_TypeMismatch; -class Standard_OutOfRange; -class TopoDS_Shape; -class TopoDS_Vertex; -class TopoDS_Edge; -class TopoDS_Wire; -class TopoDS_Face; -class TopoDS_Shell; -class TopoDS_Solid; -class TopoDS_CompSolid; -class TopoDS_Compound; - - -class TransferBRep_ShapeListBinder; -DEFINE_STANDARD_HANDLE(TransferBRep_ShapeListBinder, Transfer_Binder) //! This binder binds several (a list of) shapes with a starting //! entity, when this entity itself corresponds to a simple list @@ -49,13 +30,9 @@ DEFINE_STANDARD_HANDLE(TransferBRep_ShapeListBinder, Transfer_Binder) //! independant componant, but as an item of a built-in list class TransferBRep_ShapeListBinder : public Transfer_Binder { - -public: - + public: - Standard_EXPORT TransferBRep_ShapeListBinder(); - - Standard_EXPORT TransferBRep_ShapeListBinder(const Handle(TopTools_HSequenceOfShape)& list); + TransferBRep_ShapeListBinder() {} Standard_EXPORT virtual Standard_Boolean IsMultiple() const Standard_OVERRIDE; @@ -64,57 +41,18 @@ public: Standard_EXPORT Standard_CString ResultTypeName() const Standard_OVERRIDE; //! Adds an item to the result list - Standard_EXPORT void AddResult (const TopoDS_Shape& res); - - Standard_EXPORT Handle(TopTools_HSequenceOfShape) Result() const; - - //! Changes an already defined sub-result - Standard_EXPORT void SetResult (const Standard_Integer num, const TopoDS_Shape& res); - - Standard_EXPORT Standard_Integer NbShapes() const; - - Standard_EXPORT const TopoDS_Shape& Shape (const Standard_Integer num) const; - - Standard_EXPORT TopAbs_ShapeEnum ShapeType (const Standard_Integer num) const; - - Standard_EXPORT TopoDS_Vertex Vertex (const Standard_Integer num) const; - - Standard_EXPORT TopoDS_Edge Edge (const Standard_Integer num) const; - - Standard_EXPORT TopoDS_Wire Wire (const Standard_Integer num) const; - - Standard_EXPORT TopoDS_Face Face (const Standard_Integer num) const; - - Standard_EXPORT TopoDS_Shell Shell (const Standard_Integer num) const; - - Standard_EXPORT TopoDS_Solid Solid (const Standard_Integer num) const; - - Standard_EXPORT TopoDS_CompSolid CompSolid (const Standard_Integer num) const; - - Standard_EXPORT TopoDS_Compound Compound (const Standard_Integer num) const; - + void AddResult (const TopoDS_Shape &theShape) { myShapes.Append(theShape); } + const TopTools_SequenceOfShape & Result() const { return myShapes; } + //! Provides result as one shape + Standard_EXPORT Standard_Boolean GetOneShape(TopoDS_Shape &theShape) const; DEFINE_STANDARD_RTTIEXT(TransferBRep_ShapeListBinder,Transfer_Binder) -protected: - - - - -private: - - - Handle(TopTools_HSequenceOfShape) theres; - + private: + TopTools_SequenceOfShape myShapes; }; - - - - - - #endif // _TransferBRep_ShapeListBinder_HeaderFile diff --git a/src/TransferBRep/TransferBRep_ShapeMapper.cxx b/src/TransferBRep/TransferBRep_ShapeMapper.cxx new file mode 100644 index 0000000000..c7d5547a42 --- /dev/null +++ b/src/TransferBRep/TransferBRep_ShapeMapper.cxx @@ -0,0 +1,38 @@ +// Created on: 1994-10-03 +// Created by: Christian CAILLET +// Copyright (c) 1994-1999 Matra Datavision +// Copyright (c) 1999-2014 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 +#include +#include + +IMPLEMENT_STANDARD_RTTIEXT(TransferBRep_ShapeMapper,Transfer_Finder) + +Standard_Integer TransferBRep_ShapeMapper::GetHashCode(const Standard_Integer theUpper) const +{ + return TopTools_ShapeMapHasher::HashCode(myShape,theUpper); +} + +Standard_Boolean TransferBRep_ShapeMapper::Equates (const Handle(Transfer_Finder)& theOther) const +{ + Handle(TransferBRep_ShapeMapper) anOther = Handle(TransferBRep_ShapeMapper)::DownCast(theOther); + if (anOther.IsNull()) return Standard_False; + return TopTools_ShapeMapHasher::IsEqual (myShape,anOther->Shape()); +} + +Standard_CString TransferBRep_ShapeMapper::ValueTypeName () const +{ + return TransferBRep::TypeName(myShape); +} diff --git a/src/TransferBRep/TransferBRep_ShapeMapper.hxx b/src/TransferBRep/TransferBRep_ShapeMapper.hxx index 9e6b7f4ebe..a690bc483d 100644 --- a/src/TransferBRep/TransferBRep_ShapeMapper.hxx +++ b/src/TransferBRep/TransferBRep_ShapeMapper.hxx @@ -17,73 +17,28 @@ #ifndef _TransferBRep_ShapeMapper_HeaderFile #define _TransferBRep_ShapeMapper_HeaderFile -#include -#include - -#include #include -#include -#include -#include -class TopoDS_Shape; -class TopTools_ShapeMapHasher; -class TransferBRep_ShapeInfo; -class Transfer_Finder; - - -class TransferBRep_ShapeMapper; -DEFINE_STANDARD_HANDLE(TransferBRep_ShapeMapper, Transfer_Finder) - +#include class TransferBRep_ShapeMapper : public Transfer_Finder { + public: -public: - - - //! Creates a Mapper with a Value. This Value can then not be - //! changed. It is used by the Hasher to compute the HashCode, - //! which will then be stored for an immediate reading. - Standard_EXPORT TransferBRep_ShapeMapper(const TopoDS_Shape& akey); - - //! Returns the contained value - Standard_EXPORT const TopoDS_Shape& Value() const; - - //! Specific testof equallity : defined as False if has - //! not the same true Type, else contents are compared (by - //! C++ operator ==) - Standard_EXPORT Standard_Boolean Equates (const Handle(Transfer_Finder)& other) const Standard_OVERRIDE; - - //! Returns the Type of the Value. By default, returns the - //! DynamicType of , but can be redefined - Standard_EXPORT virtual Handle(Standard_Type) ValueType() const Standard_OVERRIDE; - - //! Returns the name of the Type of the Value. Default is name - //! of ValueType, unless it is for a non-handled object - Standard_EXPORT virtual Standard_CString ValueTypeName() const Standard_OVERRIDE; - - - + TransferBRep_ShapeMapper (const TopoDS_Shape &theShape) : myShape(theShape) {} - DEFINE_STANDARD_RTTI_INLINE(TransferBRep_ShapeMapper,Transfer_Finder) + const TopoDS_Shape & Shape () const { return myShape; } -protected: + Standard_EXPORT Standard_Integer GetHashCode (const Standard_Integer theUpper) const Standard_OVERRIDE; + Standard_EXPORT Standard_Boolean Equates (const Handle(Transfer_Finder)& theOther) const Standard_OVERRIDE; + Standard_EXPORT Standard_CString ValueTypeName () const Standard_OVERRIDE; + DEFINE_STANDARD_RTTIEXT(TransferBRep_ShapeMapper,Transfer_Finder) -private: - - - TopoDS_Shape theval; - + protected: + TopoDS_Shape myShape; }; - - - - - - #endif // _TransferBRep_ShapeMapper_HeaderFile diff --git a/src/TransferBRep/TransferBRep_ShapeMapper_0.cxx b/src/TransferBRep/TransferBRep_ShapeMapper_0.cxx deleted file mode 100644 index a7e4c00609..0000000000 --- a/src/TransferBRep/TransferBRep_ShapeMapper_0.cxx +++ /dev/null @@ -1,45 +0,0 @@ -// Created on: 1994-10-03 -// Created by: Christian CAILLET -// Copyright (c) 1994-1999 Matra Datavision -// Copyright (c) 1999-2014 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 - -#include - -#include -#include -#include -#include - - - - - - - - - - -#define TheKey TopoDS_Shape -#define TheKey_hxx -#define TheHasher TopTools_ShapeMapHasher -#define TheHasher_hxx -#define TheInfo TransferBRep_ShapeInfo -#define TheInfo_hxx -#define Transfer_Mapper TransferBRep_ShapeMapper -#define Transfer_Mapper_hxx -#define Handle_Transfer_Mapper Handle(TransferBRep_ShapeMapper) -#include - diff --git a/src/TransferBRep/TransferBRep_TransferResultInfo.cxx b/src/TransferBRep/TransferBRep_TransferResultInfo.cxx deleted file mode 100644 index 3ea04fe9e8..0000000000 --- a/src/TransferBRep/TransferBRep_TransferResultInfo.cxx +++ /dev/null @@ -1,41 +0,0 @@ -// Created on: 1999-08-11 -// Created by: Roman LYGIN -// Copyright (c) 1999-1999 Matra Datavision -// Copyright (c) 1999-2014 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 -#include - -IMPLEMENT_STANDARD_RTTIEXT(TransferBRep_TransferResultInfo,MMgt_TShared) - -//======================================================================= -//function : TransferBRep_TransferResultInfo -//purpose : -//======================================================================= -TransferBRep_TransferResultInfo::TransferBRep_TransferResultInfo() -{ - Clear(); -} - -//======================================================================= -//function : Clear -//purpose : -//======================================================================= - - void TransferBRep_TransferResultInfo::Clear () -{ - myNR = myNRW = myNRF = myNRWF = - myR = myRW = myRF = myRWF = 0; -} diff --git a/src/TransferBRep/TransferBRep_TransferResultInfo.hxx b/src/TransferBRep/TransferBRep_TransferResultInfo.hxx deleted file mode 100644 index 9cf69eae49..0000000000 --- a/src/TransferBRep/TransferBRep_TransferResultInfo.hxx +++ /dev/null @@ -1,100 +0,0 @@ -// Created on: 1999-08-11 -// Created by: Roman LYGIN -// Copyright (c) 1999 Matra Datavision -// Copyright (c) 1999-2014 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 _TransferBRep_TransferResultInfo_HeaderFile -#define _TransferBRep_TransferResultInfo_HeaderFile - -#include -#include - -#include -#include - - -class TransferBRep_TransferResultInfo; -DEFINE_STANDARD_HANDLE(TransferBRep_TransferResultInfo, MMgt_TShared) - -//! Data structure for storing information on transfer result. -//! At the moment it dispatches information for the following types: -//! - result, -//! - result + warning(s), -//! - result + fail(s), -//! - result + warning(s) + fail(s) -//! - no result, -//! - no result + warning(s), -//! - no result + fail(s), -//! - no result + warning(s) + fail(s), -class TransferBRep_TransferResultInfo : public MMgt_TShared -{ - -public: - - - //! Creates object with all fields nullified. - Standard_EXPORT TransferBRep_TransferResultInfo(); - - //! Resets all the fields. - Standard_EXPORT void Clear(); - - Standard_Integer& Result(); - - Standard_Integer& ResultWarning(); - - Standard_Integer& ResultFail(); - - Standard_Integer& ResultWarningFail(); - - Standard_Integer& NoResult(); - - Standard_Integer& NoResultWarning(); - - Standard_Integer& NoResultFail(); - - Standard_Integer& NoResultWarningFail(); - - - - - DEFINE_STANDARD_RTTIEXT(TransferBRep_TransferResultInfo,MMgt_TShared) - -protected: - - - - -private: - - - Standard_Integer myR; - Standard_Integer myRW; - Standard_Integer myRF; - Standard_Integer myRWF; - Standard_Integer myNR; - Standard_Integer myNRW; - Standard_Integer myNRF; - Standard_Integer myNRWF; - - -}; - - -#include - - - - - -#endif // _TransferBRep_TransferResultInfo_HeaderFile diff --git a/src/TransferBRep/TransferBRep_TransferResultInfo.lxx b/src/TransferBRep/TransferBRep_TransferResultInfo.lxx deleted file mode 100644 index 94c6e203da..0000000000 --- a/src/TransferBRep/TransferBRep_TransferResultInfo.lxx +++ /dev/null @@ -1,96 +0,0 @@ -// Created on: 1999-08-11 -// Created by: Roman LYGIN -// Copyright (c) 1999-1999 Matra Datavision -// Copyright (c) 1999-2014 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. - -//======================================================================= -//function : Result -//purpose : -//======================================================================= - -inline Standard_Integer& TransferBRep_TransferResultInfo::Result() -{ - return myR; -} - -//======================================================================= -//function : ResultWarning -//purpose : -//======================================================================= - -inline Standard_Integer& TransferBRep_TransferResultInfo::ResultWarning() -{ - return myRW; -} - -//======================================================================= -//function : ResultFail -//purpose : -//======================================================================= - -inline Standard_Integer& TransferBRep_TransferResultInfo::ResultFail() -{ - return myRF; -} - -//======================================================================= -//function : ResultWarningFail -//purpose : -//======================================================================= - -inline Standard_Integer& TransferBRep_TransferResultInfo::ResultWarningFail() -{ - return myRWF; -} - -//======================================================================= -//function : NoResult -//purpose : -//======================================================================= - -inline Standard_Integer& TransferBRep_TransferResultInfo::NoResult() -{ - return myNR; -} - -//======================================================================= -//function : NoResultWarning -//purpose : -//======================================================================= - -inline Standard_Integer& TransferBRep_TransferResultInfo::NoResultWarning() -{ - return myNRW; -} - -//======================================================================= -//function : NoResultFail -//purpose : -//======================================================================= - -inline Standard_Integer& TransferBRep_TransferResultInfo::NoResultFail() -{ - return myNRF; -} - -//======================================================================= -//function : NoResultWarningFail -//purpose : -//======================================================================= - -inline Standard_Integer& TransferBRep_TransferResultInfo::NoResultWarningFail() -{ - return myNRWF; -} - diff --git a/src/XSAlgo/XSAlgo_AlgoContainer.cxx b/src/XSAlgo/XSAlgo_AlgoContainer.cxx index edd5a75ca5..07beb3063f 100644 --- a/src/XSAlgo/XSAlgo_AlgoContainer.cxx +++ b/src/XSAlgo/XSAlgo_AlgoContainer.cxx @@ -527,17 +527,15 @@ void XSAlgo_AlgoContainer::MergeTransferInfo(const Handle(Transfer_FinderProcess TransientListBinder->AddResult(tr); sub = it.Value(); } - if ( TransientListBinder->NbTransients() == 1 ) resBinder = new TransferBRep_ShapeBinder(sub); - else if ( TransientListBinder->NbTransients() > 1 ) { + if ( TransientListBinder->Result().Length() == 1 ) resBinder = new TransferBRep_ShapeBinder(sub); + else if ( TransientListBinder->Result().Length() > 1 ) { resBinder->AddResult(TransientListBinder); -// resBinder->SetNext(TransientListBinder, Standard_True); #ifdef OCCT_DEBUG cout<<"Info: TransientListBinder created for splitted shape"<NbMapped() = "<NbMapped()< #include -#include +#include #include -Handle(XSControl_WorkSession) XSControl::Session - (const Handle(IFSelect_SessionPilot)& pilot) - { return Handle(XSControl_WorkSession)::DownCast(pilot->Session()); } - - - Handle(XSControl_Vars) XSControl::Vars - (const Handle(IFSelect_SessionPilot)& pilot) -{ - Handle(XSControl_Vars) avars; - Handle(XSControl_WorkSession) WS = XSControl::Session(pilot); - if (!WS.IsNull()) avars = WS->Vars(); - return avars; -} +Handle(XSControl_WorkSession) XSControl::Session (const Handle(IFSelect_SessionPilot)& pilot) +{ return Handle(XSControl_WorkSession)::DownCast(pilot->Session()); } diff --git a/src/XSControl/XSControl.hxx b/src/XSControl/XSControl.hxx index c3fc14187a..b77d81723d 100644 --- a/src/XSControl/XSControl.hxx +++ b/src/XSControl/XSControl.hxx @@ -18,78 +18,20 @@ #define _XSControl_HeaderFile #include -#include #include class XSControl_WorkSession; class IFSelect_SessionPilot; -class XSControl_Vars; -class XSControl_Controller; -class XSControl_TransferReader; -class XSControl_TransferWriter; -class XSControl_WorkSession; -class XSControl_SelectForTransfer; -class XSControl_SignTransferStatus; -class XSControl_ConnectedShapes; -class XSControl_Reader; -class XSControl_Writer; -class XSControl_Functions; -class XSControl_FuncShape; -class XSControl_Utils; -class XSControl_Vars; - //! This package provides complements to IFSelect & Co for //! control of a session class XSControl { -public: - - DEFINE_STANDARD_ALLOC + public: - //! Returns the WorkSession of a SessionPilot, but casts it as //! from XSControl : it then gives access to Control & Transfers Standard_EXPORT static Handle(XSControl_WorkSession) Session (const Handle(IFSelect_SessionPilot)& pilot); - - //! Returns the Vars of a SessionPilot, it is brought by Session - //! it provides access to external variables - Standard_EXPORT static Handle(XSControl_Vars) Vars (const Handle(IFSelect_SessionPilot)& pilot); - - - - -protected: - - - - - -private: - - - - -friend class XSControl_Controller; -friend class XSControl_TransferReader; -friend class XSControl_TransferWriter; -friend class XSControl_WorkSession; -friend class XSControl_SelectForTransfer; -friend class XSControl_SignTransferStatus; -friend class XSControl_ConnectedShapes; -friend class XSControl_Reader; -friend class XSControl_Writer; -friend class XSControl_Functions; -friend class XSControl_FuncShape; -friend class XSControl_Utils; -friend class XSControl_Vars; - }; - - - - - - #endif // _XSControl_HeaderFile diff --git a/src/XSControl/XSControl_Controller.cxx b/src/XSControl/XSControl_Controller.cxx index 0eae54e9f1..74f3f5b29d 100644 --- a/src/XSControl/XSControl_Controller.cxx +++ b/src/XSControl/XSControl_Controller.cxx @@ -56,7 +56,6 @@ #include #include #include -#include #include #include #include @@ -249,46 +248,33 @@ Standard_CString XSControl_Controller::ModeWriteHelp return str->ToCString(); } - // ########################### // Transfer : on fait ce qu il faut par defaut (avec ActorWrite) // peut etre redefini ... //======================================================================= -//function : RecognizeWriteTransient +//function : TransferWriteShape //purpose : //======================================================================= -Standard_Boolean XSControl_Controller::RecognizeWriteTransient - (const Handle(Standard_Transient)& obj, +IFSelect_ReturnStatus XSControl_Controller::TransferWriteShape + (const TopoDS_Shape& shape, + const Handle(Transfer_FinderProcess)& FP, + const Handle(Interface_InterfaceModel)& model, const Standard_Integer modetrans) const { - if (myAdaptorWrite.IsNull()) return Standard_False; - myAdaptorWrite->ModeTrans() = modetrans; - return myAdaptorWrite->Recognize (new Transfer_TransientMapper(obj)); -} - -//======================================================================= -//function : TransferFinder -//purpose : internal function -//======================================================================= + if (shape.IsNull()) return IFSelect_RetVoid; + if (myAdaptorWrite.IsNull()) return IFSelect_RetError; + if (model.IsNull()) return IFSelect_RetError; -static IFSelect_ReturnStatus TransferFinder - (const Handle(Transfer_ActorOfFinderProcess)& theActor, - const Handle(Transfer_Finder)& theMapper, - const Handle(Transfer_FinderProcess)& theFP, - const Handle(Interface_InterfaceModel)& theModel, - const Standard_Integer theModeTrans) -{ - if (theActor.IsNull()) return IFSelect_RetError; - if (theModel.IsNull()) return IFSelect_RetError; - theActor->ModeTrans() = theModeTrans; - theFP->SetModel (theModel); - theFP->SetActor (theActor); - theFP->Transfer (theMapper); + Handle(Transfer_Finder) aMapper = new TransferBRep_ShapeMapper(shape); + myAdaptorWrite->SetTransferMode(modetrans); + FP->SetModel (model); + FP->SetActor (myAdaptorWrite); + FP->Transfer (aMapper); IFSelect_ReturnStatus stat = IFSelect_RetFail; - Handle(Transfer_Binder) binder = theFP->Find (theMapper); + Handle(Transfer_Binder) binder = FP->Find (aMapper); Handle(Transfer_SimpleBinderOfTransient) bindtr; while (!binder.IsNull()) { bindtr = Handle(Transfer_SimpleBinderOfTransient)::DownCast (binder); @@ -296,7 +282,7 @@ static IFSelect_ReturnStatus TransferFinder Handle(Standard_Transient) ent = bindtr->Result(); if (!ent.IsNull()) { stat = IFSelect_RetDone; - theModel->AddWithRefs (ent); + model->AddWithRefs (ent); } } binder = binder->NextResult(); @@ -304,54 +290,6 @@ static IFSelect_ReturnStatus TransferFinder return stat; } -//======================================================================= -//function : TransferWriteTransient -//purpose : -//======================================================================= - -IFSelect_ReturnStatus XSControl_Controller::TransferWriteTransient - (const Handle(Standard_Transient)& theObj, - const Handle(Transfer_FinderProcess)& theFP, - const Handle(Interface_InterfaceModel)& theModel, - const Standard_Integer theModeTrans) const -{ - if (theObj.IsNull()) return IFSelect_RetVoid; - return TransferFinder - (myAdaptorWrite,new Transfer_TransientMapper(theObj),theFP,theModel,theModeTrans); -} - -//======================================================================= -//function : RecognizeWriteShape -//purpose : -//======================================================================= - -Standard_Boolean XSControl_Controller::RecognizeWriteShape - (const TopoDS_Shape& shape, - const Standard_Integer modetrans) const -{ - if (myAdaptorWrite.IsNull()) return Standard_False; - myAdaptorWrite->ModeTrans() = modetrans; - return myAdaptorWrite->Recognize (new TransferBRep_ShapeMapper(shape)); -} - -//======================================================================= -//function : TransferWriteShape -//purpose : -//======================================================================= - -IFSelect_ReturnStatus XSControl_Controller::TransferWriteShape - (const TopoDS_Shape& shape, - const Handle(Transfer_FinderProcess)& FP, - const Handle(Interface_InterfaceModel)& model, - const Standard_Integer modetrans) const -{ - if (shape.IsNull()) return IFSelect_RetVoid; - - IFSelect_ReturnStatus theReturnStat = TransferFinder - (myAdaptorWrite,new TransferBRep_ShapeMapper(shape),FP,model,modetrans); - return theReturnStat; -} - // ########################### // Cutomisation ! On enregistre des Items pour une WorkSession // (annule et remplace) diff --git a/src/XSControl/XSControl_Controller.hxx b/src/XSControl/XSControl_Controller.hxx index 1c10778dda..95d8d5df00 100644 --- a/src/XSControl/XSControl_Controller.hxx +++ b/src/XSControl/XSControl_Controller.hxx @@ -28,11 +28,11 @@ #include #include #include +#include +#include class IFSelect_WorkLibrary; class Interface_Protocol; class IFSelect_Signature; -class Transfer_ActorOfTransientProcess; -class Transfer_ActorOfFinderProcess; class Dico_DictionaryOfTransient; class Standard_DomainError; class XSControl_WorkSession; @@ -140,28 +140,6 @@ class XSControl_Controller : public MMgt_TShared //! empty if help not defined or not within bounds or if values are free Standard_EXPORT Standard_CString ModeWriteHelp (const Standard_Integer modetrans, const Standard_Boolean shape = Standard_True) const; - //! Tells if (an application object) is a valid candidate - //! for a transfer to a Model. - //! By default, asks the ActorWrite if known (through a - //! TransientMapper). Can be redefined - Standard_EXPORT virtual Standard_Boolean RecognizeWriteTransient (const Handle(Standard_Transient)& obj, const Standard_Integer modetrans = 0) const; - - //! Takes one Transient Object and transfers it to an - //! InterfaceModel (already created, e.g. by NewModel) - //! (result is recorded in the model by AddWithRefs) - //! FP records produced results and checks - //! - //! Default uses ActorWrite; can be redefined as necessary - //! Returned value is a status, as follows : - //! 0 OK , 1 No Result , 2 Fail (e.g. exception raised) - //! -1 bad conditions , -2 bad model or null model - //! For type of object not recognized : should return 1 - Standard_EXPORT virtual IFSelect_ReturnStatus TransferWriteTransient (const Handle(Standard_Transient)& obj, const Handle(Transfer_FinderProcess)& FP, const Handle(Interface_InterfaceModel)& model, const Standard_Integer modetrans = 0) const; - - //! Tells if a shape is valid for a transfer to a model - //! Asks the ActorWrite (through a ShapeMapper) - Standard_EXPORT virtual Standard_Boolean RecognizeWriteShape (const TopoDS_Shape& shape, const Standard_Integer modetrans = 0) const; - //! Takes one Shape and transfers it to an //! InterfaceModel (already created, e.g. by NewModel) //! Default uses ActorWrite; can be redefined as necessary @@ -206,7 +184,6 @@ class XSControl_Controller : public MMgt_TShared TCollection_AsciiString myLongName; Handle(IFSelect_WorkLibrary) myAdaptorLibrary; Handle(Interface_Protocol) myAdaptorProtocol; - //szv:Handle(IFSelect_Signature) mySignType; Handle(Transfer_ActorOfTransientProcess) myAdaptorRead; Handle(Transfer_ActorOfFinderProcess) myAdaptorWrite; Handle(Dico_DictionaryOfTransient) myAdaptorSession; diff --git a/src/XSControl/XSControl_FuncShape.cxx b/src/XSControl/XSControl_FuncShape.cxx index 9b1b913b26..f0e9d98987 100644 --- a/src/XSControl/XSControl_FuncShape.cxx +++ b/src/XSControl/XSControl_FuncShape.cxx @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include @@ -57,12 +56,24 @@ #include #include -//#include + +//======================================================================= +//function : XSControl_tpdraw +//purpose : +//======================================================================= +static Handle(XSControl_Vars) GetXSControlVars (const Handle(IFSelect_SessionPilot)& pilot) +{ + static const Handle(XSControl_Vars) avars; + Handle(XSControl_WorkSession) WS = XSControl::Session(pilot); + return (WS.IsNull()? avars : WS->Vars()); +} + // ###################################################################### // #### #### // #### COMMANDS #### // #### #### // ###################################################################### + //======================================================================= //function : XSControl_tpdraw //purpose : @@ -174,25 +185,25 @@ static IFSelect_ReturnStatus XSControl_tpdraw else sprintf (nomvar,"tp_%d",i); } sout<<" -> 1 DRAW Shape: "<SetShape(nomvar,sh); + GetXSControlVars(pilot)->SetShape(nomvar,sh); continue; } DeclareAndCast(TransferBRep_ShapeListBinder,slb,binder); if (!slb.IsNull()) { - Standard_Integer nbs = slb->NbShapes(); + const Standard_Integer nbs = slb->Result().Length(); if (tout) sout<<"[ "< "<Shape(j); if (nbvar < 0) nbvar = 0; nbvar ++; - if (sh.IsNull()) { sout<<" (no Shape recorded)"< 3 && mode > 0) sprintf (nomvar,"%s_%d",arg3,nbvar); - else if (argc > 2 && mode == 0) sprintf (nomvar,"%s_%d",arg2,nbvar); - else sprintf (nomvar,"tp_%d_%d",i,nbvar); - sout<<" "<SetShape(nomvar,sh); + sh = slb->Result().Value(j); if (nbvar < 0) nbvar = 0; nbvar ++; + if (sh.IsNull()) { sout<<" (no Shape recorded)"< 3 && mode > 0) sprintf (nomvar,"%s_%d",arg3,nbvar); + else if (argc > 2 && mode == 0) sprintf (nomvar,"%s_%d",arg2,nbvar); + else sprintf (nomvar,"tp_%d_%d",i,nbvar); + sout<<" "<SetShape(nomvar,sh); } sout<Set (nomv,geom); + GetXSControlVars(pilot)->Set (nomv,geom); sout<<" -> DRAW Geom : "<Value(i)); - XSControl::Vars(pilot)->SetShape (arg1,C); + GetXSControlVars(pilot)->SetShape (arg1,C); return IFSelect_RetDone; } @@ -309,12 +320,12 @@ static IFSelect_ReturnStatus XSControl_traccess else if ( (i%10) == 0) sout<<"0"; else sout<<"."; if (list->Value(i).IsNull()) continue; - if (!cascomp && !cassave) XSControl::Vars(pilot)->SetShape(noms,list->Value(i)); + if (!cascomp && !cassave) GetXSControlVars(pilot)->SetShape(noms,list->Value(i)); else if (!cascomp && cassave) BRepTools::Write (list->Value(i),noms); else if (cascomp) B.Add (C,list->Value(i)); } sout<SetShape(nomsh,C); + if (cascomp && !cassave) GetXSControlVars(pilot)->SetShape(nomsh,C); else if (cascomp && cassave) BRepTools::Write (C,nomsh); } else { if (num < 1 || num > mdl->NbEntities()) { sout<<" incorrect:"< 2) sprintf (nomsh,"%s",arg2); else sprintf (nomsh,"TREAD_%d",num); - if (!cascomp && !cassave) XSControl::Vars(pilot)->SetShape(nomsh,sh); + if (!cascomp && !cassave) GetXSControlVars(pilot)->SetShape(nomsh,sh); else if (!cascomp && cassave) BRepTools::Write (sh,nomsh); else sout<<"Option non comprise"<GetShape(a1); + TopoDS_Shape Shape = GetXSControlVars(pilot)->GetShape(a1); if (Shape.IsNull()) { sout<<"Not a DRAW Shape:"<Find ( fnd ); if ( ! bnd.IsNull() ) { Handle(Transfer_TransientListBinder) TransientListBinder = - //Handle(Transfer_TransientListBinder)::DownCast( bnd->Next(Standard_True) ); //skl Handle(Transfer_TransientListBinder)::DownCast( bnd ); //skl if (! TransientListBinder.IsNull() ) { - Standard_Integer i = 1, nb = TransientListBinder->NbTransients(); + Standard_Integer i = 1, nb = TransientListBinder->Result().Length(); if (nb > 0) sout<<"Shape "<Model()->Print( TransientListBinder->Transient(i), sout ); + XSControl::Session(pilot)->Model()->Print( TransientListBinder->Result().Value(i), sout ); if (i < nb) sout<<", "; } if (nb > 0) { @@ -492,24 +502,6 @@ static IFSelect_ReturnStatus XSControl_fromshape sout<FindTransient (cfnd); - if ( cent.IsNull() ) continue; - if ( start ) - sout<<"Shape "<Model()->Print(cent,sout); - } - if ( ! start ) sout<GetShape(a1); + TopoDS_Shape Shape = GetXSControlVars(pilot)->GetShape(a1); if (Shape.IsNull()) { sout<<"Not a DRAW Shape:"<SetShape(nomsh,sh); + GetXSControlVars(pilot)->SetShape(nomsh,sh); } } if (nbs == 0) sout<<"No Shape produced"<SetShape(rnom.ToCString(),sh); + GetXSControlVars(pilot)->SetShape(rnom.ToCString(),sh); } else if (iscomp) { sout<<"One compound made of "<SetShape(rnom.ToCString(),C); + GetXSControlVars(pilot)->SetShape(rnom.ToCString(),C); } else { // several individual shapes sout<Arg(i); - TopoDS_Shape Shape = XSControl::Vars(pilot)->GetShape(ai); + TopoDS_Shape Shape = GetXSControlVars(pilot)->GetShape(ai); if (Shape.IsNull()) { sout<<"pas un nom de shape draw:"<TransferWriteShape (XSControl::Session(pilot)->Model(),Shape); diff --git a/src/XSControl/XSControl_Functions.cxx b/src/XSControl/XSControl_Functions.cxx index 58189c2bd8..f6a61c0afe 100644 --- a/src/XSControl/XSControl_Functions.cxx +++ b/src/XSControl/XSControl_Functions.cxx @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -196,7 +195,6 @@ static IFSelect_ReturnStatus XSControl_tpstat(const Handle(IFSelect_SessionPilot Handle(TColStd_HSequenceOfTransient) list = IFSelect_Functions::GiveList(pilot->Session(),pilot->CommandPart(2)); XSControl_TransferReader::PrintStatsOnList (TP,list,mod1,mod2); -// TP->PrintStats (1,sout); } else sout<<"TransferRead : not defined"<NbWords(); - //const Standard_CString arg1 = pilot->Arg(1); - //const Standard_CString arg2 = pilot->Arg(2); const Handle(Transfer_FinderProcess) &FP = XSControl::Session(pilot)->TransferWriter()->FinderProcess(); // **** twstat **** // Pour Write Handle(Message_Messenger) sout = Message::DefaultMessenger(); if (!FP.IsNull()) { sout<<"TransferWrite:"; - // XSControl_TransferWriter::PrintStatsProcess (FP,mod1,mod2); - FP->PrintStats (1,sout); + FP->PrintStats (sout); } else sout<<"TransferWrite: not defined"< #include -//#include -//#include -//#include //======================================================================= //function : XSControl_Reader //purpose : //======================================================================= + XSControl_Reader::XSControl_Reader () { SetWS (new XSControl_WorkSession); } -//======================================================================= -//function : XSControl_Reader -//purpose : -//======================================================================= - -XSControl_Reader::XSControl_Reader (const Standard_CString norm) -{ - SetNorm (norm); -} - - -//======================================================================= -//function : XSControl_Reader -//purpose : -//======================================================================= - -XSControl_Reader::XSControl_Reader(const Handle(XSControl_WorkSession)& WS, - const Standard_Boolean scratch) -{ - SetWS (WS,scratch); -} - - //======================================================================= //function : SetNorm //purpose : @@ -91,8 +66,7 @@ Standard_Boolean XSControl_Reader::SetNorm (const Standard_CString norm) //purpose : //======================================================================= -void XSControl_Reader::SetWS(const Handle(XSControl_WorkSession)& WS, - const Standard_Boolean scratch) +void XSControl_Reader::SetWS(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch) { therootsta = Standard_False; theroots.Clear(); @@ -106,24 +80,12 @@ void XSControl_Reader::SetWS(const Handle(XSControl_WorkSession)& WS, } -//======================================================================= -//function : WS -//purpose : -//======================================================================= - -Handle(XSControl_WorkSession) XSControl_Reader::WS () const -{ - return thesession; -} - - //======================================================================= //function : ReadFile //purpose : //======================================================================= -IFSelect_ReturnStatus XSControl_Reader::ReadFile - (const Standard_CString filename) +IFSelect_ReturnStatus XSControl_Reader::ReadFile (const Standard_CString filename) { IFSelect_ReturnStatus stat = thesession->ReadFile(filename); thesession->InitTransferReader(4); @@ -131,6 +93,11 @@ IFSelect_ReturnStatus XSControl_Reader::ReadFile } +//======================================================================= +//function : Model +//purpose : +//======================================================================= + Handle(Interface_InterfaceModel) XSControl_Reader::Model () const { return thesession->Model(); @@ -233,8 +200,7 @@ Standard_Boolean XSControl_Reader::TransferOne(const Standard_Integer num) //purpose : //======================================================================= -Standard_Boolean XSControl_Reader::TransferEntity - (const Handle(Standard_Transient)& start) +Standard_Boolean XSControl_Reader::TransferEntity (const Handle(Standard_Transient)& start) { if (start.IsNull()) return Standard_False; const Handle(XSControl_TransferReader) &TR = thesession->TransferReader(); @@ -254,8 +220,7 @@ Standard_Boolean XSControl_Reader::TransferEntity //purpose : //======================================================================= -Standard_Integer XSControl_Reader::TransferList - (const Handle(TColStd_HSequenceOfTransient)& list) +Standard_Integer XSControl_Reader::TransferList (const Handle(TColStd_HSequenceOfTransient)& list) { if (list.IsNull()) return 0; Standard_Integer nbt = 0; @@ -305,50 +270,6 @@ Standard_Integer XSControl_Reader::TransferRoots () } -//======================================================================= -//function : ClearShapes -//purpose : -//======================================================================= - -void XSControl_Reader::ClearShapes () -{ - theshapes.Clear(); -} - - -//======================================================================= -//function : NbShapes -//purpose : -//======================================================================= - -Standard_Integer XSControl_Reader::NbShapes () const -{ - return theshapes.Length(); -} - - -//======================================================================= -//function : Shapes -//purpose : -//======================================================================= - -TopTools_SequenceOfShape& XSControl_Reader::Shapes() -{ - return theshapes; -} - - -//======================================================================= -//function : Shape -//purpose : -//======================================================================= - -TopoDS_Shape XSControl_Reader::Shape (const Standard_Integer num) const -{ - return theshapes.Value(num); -} - - //======================================================================= //function : OneShape //purpose : @@ -367,75 +288,3 @@ TopoDS_Shape XSControl_Reader::OneShape () const for (i = 1; i <= nb; i ++) B.Add (C,theshapes.Value(i)); return C; } - - -//======================================================================= -//function : PrintCheckLoad -//purpose : -//======================================================================= - -void XSControl_Reader::PrintCheckLoad (const Standard_Boolean failsonly, - const IFSelect_PrintCount mode) const -{ - thesession->PrintCheckList (thesession->ModelCheckList(),failsonly, mode); -} - - -//======================================================================= -//function : PrintCheckTransfer -//purpose : -//======================================================================= - -void XSControl_Reader::PrintCheckTransfer(const Standard_Boolean failsonly, - const IFSelect_PrintCount mode) const -{ - thesession->PrintCheckList (thesession->TransferReader()->LastCheckList(),failsonly, mode); -} - - -//======================================================================= -//function : PrintStatsTransfer -//purpose : -//======================================================================= - -void XSControl_Reader::PrintStatsTransfer (const Standard_Integer what, - const Standard_Integer mode) const -{ - thesession->TransferReader()->PrintStats (what,mode); -} - - -//======================================================================= -//function : GetStatsTransfer -//purpose : -//======================================================================= - -void XSControl_Reader::GetStatsTransfer (const Handle(TColStd_HSequenceOfTransient)& list, - Standard_Integer& nbMapped, - Standard_Integer& nbWithResult, - Standard_Integer& nbWithFail) const -{ - const Handle(Transfer_TransientProcess) &TP = thesession->TransferReader()->TransientProcess(); - Transfer_IteratorOfProcessForTransient itrp(Standard_True); - itrp = TP->CompleteResult(Standard_True); - if(!list.IsNull()) itrp.Filter (list); - nbMapped = nbWithFail = nbWithResult = 0; - - for (itrp.Start(); itrp.More(); itrp.Next()) { - Handle(Transfer_Binder) binder = itrp.Value(); - Handle(Standard_Transient) ent = itrp.Starting(); - nbMapped++; - if (binder.IsNull()) nbWithFail++; - else - if(!binder->HasResult()) nbWithFail++; - else - { - Interface_CheckStatus cst = binder->Check()->Status(); - if ((cst == Interface_CheckOK)||(cst == Interface_CheckWarning)) - nbWithResult++; - else - nbWithFail++; - } - } -} - diff --git a/src/XSControl/XSControl_Reader.hxx b/src/XSControl/XSControl_Reader.hxx index ebd3ad079c..3d6b64c3c2 100644 --- a/src/XSControl/XSControl_Reader.hxx +++ b/src/XSControl/XSControl_Reader.hxx @@ -21,20 +21,12 @@ #include #include -#include #include +#include #include -#include #include -#include -#include -#include class XSControl_WorkSession; class Interface_InterfaceModel; -class Standard_Transient; -class TopoDS_Shape; - - //! A groundwork to convert a shape to data which complies //! with a particular norm. This data can be that of a whole @@ -72,7 +64,6 @@ class XSControl_Reader public: DEFINE_STANDARD_ALLOC - //! Creates a Reader from scratch (creates an empty WorkSession) //! A WorkSession or a Controller must be provided before running @@ -80,13 +71,14 @@ public: //! Creates a Reader from scratch, with a norm name which //! identifies a Controller - Standard_EXPORT XSControl_Reader(const Standard_CString norm); + XSControl_Reader(const Standard_CString norm) { SetNorm (norm); } //! Creates a Reader from an already existing Session, with a //! Controller already set //! Virtual destructor - Standard_EXPORT XSControl_Reader(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True); -Standard_EXPORT virtual ~XSControl_Reader() {} + XSControl_Reader(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True) { SetWS (WS,scratch); } + + Standard_EXPORT virtual ~XSControl_Reader() {} //! Sets a specific norm to //! Returns True if done, False if is not available @@ -96,7 +88,7 @@ Standard_EXPORT virtual ~XSControl_Reader() {} Standard_EXPORT void SetWS (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True); //! Returns the session used in - Standard_EXPORT Handle(XSControl_WorkSession) WS() const; + const Handle(XSControl_WorkSession) & WS() const { return thesession; } //! Loads a file and returns the read status //! Zero for a Model which compies with the Controller @@ -176,16 +168,16 @@ Standard_EXPORT virtual ~XSControl_Reader() {} //! Clears the list of shapes that //! may have accumulated in calls to TransferOne or TransferRoot.C - Standard_EXPORT void ClearShapes(); + void ClearShapes() { theshapes.Clear(); } //! Returns the number of shapes produced by translation. - Standard_EXPORT Standard_Integer NbShapes() const; + Standard_Integer NbShapes() const { return theshapes.Length(); } //! Returns the shape resulting //! from a translation and identified by the rank num. //! num equals 1 by default. In other words, the first shape //! resulting from the translation is returned. - Standard_EXPORT TopoDS_Shape Shape (const Standard_Integer num = 1) const; + const TopoDS_Shape & Shape (const Standard_Integer num = 1) const { return theshapes.Value(num); } //! Returns all of the results in //! a single shape which is: @@ -193,83 +185,19 @@ Standard_EXPORT virtual ~XSControl_Reader() {} //! - a shape if there is one result, //! - a compound containing the resulting shapes if there are more than one. Standard_EXPORT TopoDS_Shape OneShape() const; - - //! Prints the check list attached to loaded data, on the Standard - //! Trace File (starts at cout) - //! All messages or fails only, according to - //! mode = 0 : per entity, prints messages - //! mode = 1 : per message, just gives count of entities per check - //! mode = 2 : also gives entity numbers - Standard_EXPORT void PrintCheckLoad (const Standard_Boolean failsonly, const IFSelect_PrintCount mode) const; - - //! Displays check results for the - //! last translation of IGES or STEP entities to Open CASCADE - //! entities. Only fail messages are displayed if failsonly is - //! true. All messages are displayed if failsonly is - //! false. mode determines the contents and the order of the - //! messages according to the terms of the IFSelect_PrintCount enumeration. - Standard_EXPORT void PrintCheckTransfer (const Standard_Boolean failsonly, const IFSelect_PrintCount mode) const; - - //! Displays the statistics for - //! the last translation. what defines the kind of - //! statistics that are displayed as follows: - //! - 0 gives general statistics (number of translated roots, - //! number of warnings, number of fail messages), - //! - 1 gives root results, - //! - 2 gives statistics for all checked entities, - //! - 3 gives the list of translated entities, - //! - 4 gives warning and fail messages, - //! - 5 gives fail messages only. - //! The use of mode depends on the value of what. If what is 0, - //! mode is ignored. If what is 1, 2 or 3, mode defines the following: - //! - 0 lists the numbers of IGES or STEP entities in the respective model - //! - 1 gives the number, identifier, type and result - //! type for each IGES or STEP entity and/or its status - //! (fail, warning, etc.) - //! - 2 gives maximum information for each IGES or STEP entity (i.e. checks) - //! - 3 gives the number of entities per type of IGES or STEP entity - //! - 4 gives the number of IGES or STEP entities per result type and/or status - //! - 5 gives the number of pairs (IGES or STEP or result type and status) - //! - 6 gives the number of pairs (IGES or STEP or result type - //! and status) AND the list of entity numbers in the IGES or STEP model. - //! If what is 4 or 5, mode defines the warning and fail - //! messages as follows: - //! - if mode is 0 all warnings and checks per entity are returned - //! - if mode is 2 the list of entities per warning is returned. - //! If mode is not set, only the list of all entities per warning is given. - Standard_EXPORT void PrintStatsTransfer (const Standard_Integer what, const Standard_Integer mode = 0) const; - - //! Gives statistics about Transfer - Standard_EXPORT void GetStatsTransfer (const Handle(TColStd_HSequenceOfTransient)& list, Standard_Integer& nbMapped, Standard_Integer& nbWithResult, Standard_Integer& nbWithFail) const; - - - - -protected: + protected: //! Returns a sequence of produced shapes - Standard_EXPORT TopTools_SequenceOfShape& Shapes(); - + //szv:TopTools_SequenceOfShape& Shapes() { return theshapes; } + TopTools_SequenceOfShape theshapes; Standard_Boolean therootsta; TColStd_SequenceOfTransient theroots; - -private: - - + private: Handle(XSControl_WorkSession) thesession; - TopTools_SequenceOfShape theshapes; - - }; - - - - - - #endif // _XSControl_Reader_HeaderFile diff --git a/src/XSControl/XSControl_TransferReader.cxx b/src/XSControl/XSControl_TransferReader.cxx index 36b0cfedca..760143a91f 100644 --- a/src/XSControl/XSControl_TransferReader.cxx +++ b/src/XSControl/XSControl_TransferReader.cxx @@ -12,9 +12,7 @@ // commercial license or contractual agreement. //: abv 09.04.99: S4136: remove parameter lastpreci -// szv#11:CASCADE30:01Feb00 BRepBuilderAPI::Precision(p) removed -#include #include #include #include @@ -29,12 +27,11 @@ #include #include #include +#include #include #include #include #include -#include -#include #include #include #include @@ -45,10 +42,8 @@ #include #include #include -#include #include #include -#include #include #include #include @@ -754,7 +749,6 @@ Standard_Boolean XSControl_TransferReader::BeginTransfer () myTP->SetActor (actor); // -> RAZ actor = Actor(); myTP->SetActor (actor); // Set proprement dit - myTP->SetErrorHandle (Standard_True); myTP->Context() = myContext; return Standard_True; } @@ -783,13 +777,11 @@ Standard_Integer XSControl_TransferReader::TransferOne { if (myActor.IsNull() || myModel.IsNull()) return 0; - if (myTP.IsNull()) { if (!BeginTransfer()) return 0; } + if (myTP.IsNull()) { if (!BeginTransfer()) return 0; } - Handle(Message_Messenger) sout = myTP->Messenger(); + const Handle(Message_Messenger) &sout = myTP->Messenger(); Standard_Integer level = myTP->TraceLevel(); - - Transfer_TransferOutput TP (myTP,myModel); if (myGraph.IsNull()) myTP->SetModel(myModel); else myTP->SetGraph(myGraph); @@ -811,14 +803,16 @@ Standard_Integer XSControl_TransferReader::TransferOne // seule difference entre TransferRoots et TransferOne Standard_Integer res = 0; - Handle(Standard_Transient) obj = ent; - TP.Transfer (obj); - myTP->SetRoot (obj); + // Check if the entity belongs to the model + if (myModel->Number(ent) == 0) + return 0; + myTP->Transfer (ent); + myTP->SetRoot (ent); // Resultat ... - Handle(Transfer_Binder) binder = myTP->Find (obj); + Handle(Transfer_Binder) binder = myTP->Find (ent); if (binder.IsNull()) return res; - if (rec) RecordResult (obj); + if (rec) RecordResult (ent); if (!binder->HasResult()) return res; res ++; @@ -842,7 +836,6 @@ Standard_Integer XSControl_TransferReader::TransferList Handle(Message_Messenger) sout = myTP->Messenger(); Standard_Integer level = myTP->TraceLevel(); - Transfer_TransferOutput TP (myTP,myModel); if (myGraph.IsNull()) myTP->SetModel(myModel); else myTP->SetGraph(myGraph); @@ -865,17 +858,20 @@ Standard_Integer XSControl_TransferReader::TransferList // seule difference entre TransferRoots et TransferOne Standard_Integer res = 0; nb = list->Length(); - Handle(Standard_Transient) obj; - for (i = 1; i <= nb; i ++) { - obj = list->Value(i); - TP.Transfer (obj); - myTP->SetRoot (obj); + for (i = 1; i <= nb; i ++) + { + const Handle(Standard_Transient) &ent = list->Value(i); + // Check if the entity belongs to the model + if (myModel->Number(ent) == 0) + continue; + myTP->Transfer (ent); + myTP->SetRoot (ent); // Resultat ... - Handle(Transfer_Binder) binder = myTP->Find (obj); + Handle(Transfer_Binder) binder = myTP->Find (ent); if (binder.IsNull()) continue; - if (rec) RecordResult (obj); + if (rec) RecordResult (ent); if (!binder->HasResult()) continue; res ++; @@ -899,7 +895,6 @@ Standard_Integer XSControl_TransferReader::TransferRoots(const Interface_Graph& Handle(Message_Messenger) sout = myTP->Messenger(); Standard_Integer level = myTP->TraceLevel(); - Transfer_TransferOutput TP (myTP,myModel); if (myGraph.IsNull()) myTP->SetModel(myModel); else myTP->SetGraph(myGraph); @@ -918,7 +913,14 @@ Standard_Integer XSControl_TransferReader::TransferRoots(const Interface_Graph& sout<<"\n*******************************************************************\n"; } - TP.TransferRoots (G); + myTP->SetRootManagement (Standard_False); + Interface_ShareFlags tool(G); + myTP->SetModel (G.Model()); + Interface_EntityIterator list = tool.RootEntities(); + for (list.Start(); list.More(); list.Next()) { + const Handle(Standard_Transient) &ent = list.Value(); + if (myTP->Transfer(ent)) myTP->SetRoot(ent); + } // Les entites transferees sont notees "asmain" Standard_Integer i,n = myTP->NbMapped(); @@ -937,23 +939,6 @@ Standard_Integer XSControl_TransferReader::TransferRoots(const Interface_Graph& } -//======================================================================= -//function : TransferClear -//purpose : -//======================================================================= - -void XSControl_TransferReader::TransferClear(const Handle(Standard_Transient)& ent, - const Standard_Integer level) -{ - if (myTP.IsNull()) return; - if (ent == myModel) { myTP->Clear(); return; } - - myTP->RemoveResult (ent,level); - ClearResult (ent,-1); - -} - - //======================================================================= //function : PrintStats //purpose : @@ -1143,7 +1128,7 @@ void XSControl_TransferReader::PrintStatsOnList(const Handle(Transfer_TransientP Handle(Message_Messenger) sout = TP->Messenger(); char mess[250]; if (TP.IsNull()) return; - if (what == 0) { TP->PrintStats(0,sout); return; } + if (what == 0) { TP->PrintStats(sout); return; } sout<<"\n*******************************************************************\n"; sout << "****** Statistics on Transfer Process (Read) ******"<Model(); if (what >= 1 && what <= 3) { @@ -1192,7 +1177,7 @@ void XSControl_TransferReader::PrintStatsOnList(const Handle(Transfer_TransientP for (itrp.Start(); itrp.More(); itrp.Next()) { nbi ++; Handle(Transfer_Binder) binder = itrp.Value(); - Handle(Standard_Transient) ent = itrp.Starting(); + const Handle(Standard_Transient) &ent = itrp.SourceObject(); if (binder.IsNull()) { nbnr ++; if (notrec) counter->Add(ent,"(not recorded)"); diff --git a/src/XSControl/XSControl_TransferReader.hxx b/src/XSControl/XSControl_TransferReader.hxx index 0ff7c7ff71..4311cbf1c0 100644 --- a/src/XSControl/XSControl_TransferReader.hxx +++ b/src/XSControl/XSControl_TransferReader.hxx @@ -281,10 +281,6 @@ class XSControl_TransferReader : public MMgt_TShared //! or -1 if no actor is defined Standard_EXPORT Standard_Integer TransferRoots (const Interface_Graph &theGraph); - //! Clears the results attached to an entity - //! if equates the starting model, clears all results - Standard_EXPORT void TransferClear (const Handle(Standard_Transient)& theEnt, const Standard_Integer theLevel = 0); - //! Prints statistics on current Trace File, according and //! . See PrintStatsProcess for details Standard_EXPORT void PrintStats (const Standard_Integer theWhat, const Standard_Integer theMode = 0) const; diff --git a/src/XSControl/XSControl_TransferWriter.cxx b/src/XSControl/XSControl_TransferWriter.cxx index 46b0edb677..d8606952c3 100644 --- a/src/XSControl/XSControl_TransferWriter.cxx +++ b/src/XSControl/XSControl_TransferWriter.cxx @@ -12,20 +12,15 @@ // commercial license or contractual agreement. -#include -#include #include #include #include #include #include -#include -#include #include #include #include #include -#include #include #include #include @@ -40,93 +35,13 @@ IMPLEMENT_STANDARD_RTTIEXT(XSControl_TransferWriter,MMgt_TShared) void XSControl_TransferWriter::Clear (const Standard_Integer mode) { - if (mode < 0 || myTransferWriter.IsNull()) - myTransferWriter = new Transfer_FinderProcess; - else myTransferWriter->Clear(); + if (mode < 0 || myProcess.IsNull()) + myProcess = new Transfer_FinderProcess; + else myProcess->Clear(); } -//======================================================================= -//function : PrintStats -//purpose : -//======================================================================= - -void XSControl_TransferWriter::PrintStats (const Standard_Integer , const Standard_Integer ) const -{ - Handle(Message_Messenger) sout = myTransferWriter->Messenger(); -// A ameliorer ... ! - sout<<"\n*******************************************************************\n"; - sout << "****** Statistics on Transfer (Write) ******"<RecognizeWriteTransient (obj,myTransferMode); -} - -//======================================================================= -//function : TransferWriteTransient -//purpose : -//======================================================================= - -IFSelect_ReturnStatus XSControl_TransferWriter::TransferWriteTransient - (const Handle(Interface_InterfaceModel)& model, - const Handle(Standard_Transient)& obj) -{ - IFSelect_ReturnStatus status = IFSelect_RetVoid; - if (myController.IsNull()) return IFSelect_RetError; - if (model.IsNull()) return IFSelect_RetVoid; - - if (myTransferWriter.IsNull()) myTransferWriter = new Transfer_FinderProcess; - Handle(Transfer_ActorOfFinderProcess) nulact; - myTransferWriter->SetActor (nulact); - Handle(Standard_Transient) resultat; - Handle(Message_Messenger) sout = myTransferWriter->Messenger(); - try { - OCC_CATCH_SIGNALS - PrintStats(myTransferMode); - sout << "****** Transferring Transient, CDL Type = "; - sout<DynamicType()->Name()<<" ******"<TransferWriteTransient - (obj,myTransferWriter,model,myTransferMode); - } - catch(Standard_Failure) { - sout<<"**** **** TransferWriteShape, EXCEPTION : "; - sout<GetMessageString(); - sout<RecognizeWriteShape (shape,myTransferMode); -} - //======================================================================= //function : TransferWriteShape //purpose : @@ -136,23 +51,28 @@ IFSelect_ReturnStatus XSControl_TransferWriter::TransferWriteShape (const Handle(Interface_InterfaceModel)& model, const TopoDS_Shape& shape) { - IFSelect_ReturnStatus status = IFSelect_RetVoid; if (myController.IsNull()) return IFSelect_RetError; if (model.IsNull()) return IFSelect_RetVoid; - if (myTransferWriter.IsNull()) myTransferWriter = new Transfer_FinderProcess; + IFSelect_ReturnStatus status = IFSelect_RetVoid; + if (myProcess.IsNull()) myProcess = new Transfer_FinderProcess; // effacer l actor : Controller s en charge - Handle(Transfer_ActorOfFinderProcess) nulact; - myTransferWriter->SetActor (nulact); - Handle(Standard_Transient) resultat; - Handle(Message_Messenger) sout = myTransferWriter->Messenger(); + const Handle(Transfer_ActorOfFinderProcess) nulact; + myProcess->SetActor (nulact); + const Handle(Message_Messenger) &sout = myProcess->Messenger(); try { OCC_CATCH_SIGNALS - PrintStats(myTransferMode); + // A ameliorer ... ! + sout<<"\n*******************************************************************\n"; + sout << "****** Statistics on Transfer (Write) ******"<TransferWriteShape - (shape,myTransferWriter,model,myTransferMode); + status = myController->TransferWriteShape (shape,myProcess,model,myTransferMode); } catch(Standard_Failure) { sout<<"**** **** TransferWriteShape, EXCEPTION : "; @@ -162,49 +82,3 @@ IFSelect_ReturnStatus XSControl_TransferWriter::TransferWriteShape } return status; } - -//======================================================================= -//function : CheckList -//purpose : -//======================================================================= - -Interface_CheckIterator XSControl_TransferWriter::CheckList () const -{ - Interface_CheckIterator chl; - if (myTransferWriter.IsNull()) return chl; - Standard_Integer i, nb = myTransferWriter->NbMapped(); - for (i = 1; i <= nb; i ++) { - DeclareAndCast(Transfer_SimpleBinderOfTransient,tb,myTransferWriter->MapItem(i)); - if (tb.IsNull()) continue; - Handle(Interface_Check) ach = tb->Check(); - if (ach->NbFails() == 0 || ach->NbWarnings() == 0) continue; - DeclareAndCast(Transfer_TransientMapper,tm,myTransferWriter->Mapped(i)); - if (tm.IsNull()) ach->GetEntity (myTransferWriter->Mapped(i)); - else ach->GetEntity (tm->Value()); - chl.Add(ach); - } - return chl; -} - -//======================================================================= -//function : ResultCheckList -//purpose : -//======================================================================= - -Interface_CheckIterator XSControl_TransferWriter::ResultCheckList - (const Handle(Interface_InterfaceModel)& model) const -{ - Interface_CheckIterator chl; - if (myTransferWriter.IsNull()) return chl; - Standard_Integer i, nb = myTransferWriter->NbMapped(); - for (i = 1; i <= nb; i ++) { - DeclareAndCast(Transfer_SimpleBinderOfTransient,tb,myTransferWriter->MapItem(i)); - if (tb.IsNull()) continue; - const Handle(Interface_Check) ach = tb->Check(); - if (ach->NbFails() == 0 || ach->NbWarnings() == 0) continue; - Handle(Standard_Transient) ent = tb->Result(); - if (!ent.IsNull() && !model.IsNull()) chl.Add(ach,model->Number(ent)); - else chl.Add(ach,0); - } - return chl; -} diff --git a/src/XSControl/XSControl_TransferWriter.hxx b/src/XSControl/XSControl_TransferWriter.hxx index 4561e4c1f3..ad18d5b203 100644 --- a/src/XSControl/XSControl_TransferWriter.hxx +++ b/src/XSControl/XSControl_TransferWriter.hxx @@ -46,21 +46,18 @@ class XSControl_TransferWriter : public MMgt_TShared //! Creates a TransferWriter, empty, ready to run //! with an empty FinderProcess (but no controller, etc) XSControl_TransferWriter() - : myTransferWriter(new Transfer_FinderProcess), + : myProcess(new Transfer_FinderProcess), myTransferMode(0) {} //! Returns the FinderProcess itself - const Handle(Transfer_FinderProcess) & FinderProcess() const - { return myTransferWriter; } + const Handle(Transfer_FinderProcess) & FinderProcess() const { return myProcess; } //! Sets a new FinderProcess and forgets the former one - void SetFinderProcess (const Handle(Transfer_FinderProcess)& theFP) - { myTransferWriter = theFP; } + void SetFinderProcess (const Handle(Transfer_FinderProcess)& theFP) { myProcess = theFP; } //! Returns the currently used Controller - const Handle(XSControl_Controller) & Controller() const - { return myController; } + const Handle(XSControl_Controller) & Controller() const { return myController; } //! Sets a new Controller, also sets a new FinderProcess Standard_EXPORT void SetController (const Handle(XSControl_Controller)& theCtl) @@ -78,33 +75,10 @@ class XSControl_TransferWriter : public MMgt_TShared //! It will be interpreted by the Controller to run Transfers //! This call form could be later replaced by more specific ones //! (parameters suited for each norm / transfer case) - Standard_Integer TransferMode() const - { return myTransferMode; } + Standard_Integer TransferMode() const { return myTransferMode; } //! Changes the Transfer Mode - void SetTransferMode (const Standard_Integer theMode) - { myTransferMode = theMode; } - - //! Prints statistics on current Trace File, according what,mode - //! See PrintStatsProcess for details - Standard_EXPORT void PrintStats (const Standard_Integer theWhat, const Standard_Integer theMode = 0) const; - - //! Tells if a transient object (from an application) is a valid - //! candidate for a transfer to a model - //! Asks the Controller (RecognizeWriteTransient) - //! If is a HShape, calls RecognizeShape - Standard_EXPORT Standard_Boolean RecognizeTransient (const Handle(Standard_Transient)& theObj); - - //! Transfers a Transient object (from an application) to a model - //! of current norm, according to the last call to SetTransferMode - //! Works by calling the Controller - //! Returns status : =0 if OK, >0 if error during transfer, <0 if - //! transfer badly initialised - Standard_EXPORT IFSelect_ReturnStatus TransferWriteTransient (const Handle(Interface_InterfaceModel)& theModel, const Handle(Standard_Transient)& theObj); - - //! Tells if a Shape is valid for a transfer to a model - //! Asks the Controller (RecognizeWriteShape) - Standard_EXPORT Standard_Boolean RecognizeShape (const TopoDS_Shape& theShape); + void SetTransferMode (const Standard_Integer theMode) { myTransferMode = theMode; } //! Transfers a Shape from CasCade to a model of current norm, //! according to the last call to SetTransferMode @@ -112,22 +86,13 @@ class XSControl_TransferWriter : public MMgt_TShared //! Returns status : =0 if OK, >0 if error during transfer, <0 if //! transfer badly initialised Standard_EXPORT IFSelect_ReturnStatus TransferWriteShape (const Handle(Interface_InterfaceModel)& theModel, const TopoDS_Shape& theShape); - - //! Returns the check-list of last transfer (write), i.e. the - //! check-list currently recorded in the FinderProcess - Standard_EXPORT Interface_CheckIterator CheckList() const; - - //! Returns the check-list of last transfer (write), but tries - //! to bind to each check, the resulting entity in the model - //! instead of keeping the original Mapper, whenever known - Standard_EXPORT Interface_CheckIterator ResultCheckList (const Handle(Interface_InterfaceModel)& theModel) const; DEFINE_STANDARD_RTTIEXT(XSControl_TransferWriter,MMgt_TShared) private: Handle(XSControl_Controller) myController; - Handle(Transfer_FinderProcess) myTransferWriter; + Handle(Transfer_FinderProcess) myProcess; Standard_Integer myTransferMode; }; diff --git a/src/XSControl/XSControl_Utils.cxx b/src/XSControl/XSControl_Utils.cxx index 645ef09467..65b9209810 100644 --- a/src/XSControl/XSControl_Utils.cxx +++ b/src/XSControl/XSControl_Utils.cxx @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include @@ -506,7 +505,7 @@ static const Standard_ExtString voidext = { 0 }; DeclareAndCast(Transfer_Binder,sb,tr); if (!sb.IsNull()) return TransferBRep::ShapeResult(sb); DeclareAndCast(TransferBRep_ShapeMapper,sm,tr); - if (!sm.IsNull()) return sm->Value(); + if (!sm.IsNull()) return sm->Shape(); DeclareAndCast(TopoDS_HShape,hs,tr); if (!hs.IsNull()) return hs->Shape(); return sh; diff --git a/src/XSControl/XSControl_WorkSession.cxx b/src/XSControl/XSControl_WorkSession.cxx index 8c3f8fc776..e4fdb1be76 100644 --- a/src/XSControl/XSControl_WorkSession.cxx +++ b/src/XSControl/XSControl_WorkSession.cxx @@ -181,15 +181,13 @@ Standard_Boolean XSControl_WorkSession::PrintTransferStatus(const Standard_Inte const Standard_Boolean wri, const Handle(Message_Messenger)& S) const { - const Handle(Transfer_FinderProcess) &FP = myTransferWriter->FinderProcess(); - Handle(Transfer_TransientProcess) TP = myTransferReader->TransientProcess(); - Handle(Transfer_Binder) binder; - Handle(Transfer_Finder) finder; + Handle(Standard_Transient) finder; Handle(Standard_Transient) ent; // *** WRITE *** if (wri) { + const Handle(Transfer_FinderProcess) &FP = myTransferWriter->FinderProcess(); if (FP.IsNull()) return Standard_False; if (num == 0 ) return Standard_False; @@ -215,13 +213,14 @@ Standard_Boolean XSControl_WorkSession::PrintTransferStatus(const Standard_Inte S<<" ** Resultat Transient, type "<DynamicType()->Name(); const Handle(Interface_InterfaceModel) &model = Model(); if (!model.IsNull()) - { S<<" In output Model, Entity "; model->Print(ent,S); } + { S<<" In output Model, Entity "; model->Print(ent,S); } S<TransientProcess(); if (TP.IsNull()) return Standard_False; Handle(Interface_InterfaceModel) model = TP->Model(); if (model.IsNull()) cout<<"No Model"<MapItem (ne); S<StartTrace (binder,ent,0,0); - } // *** CHECK (commun READ+WRITE) *** if (!binder.IsNull()) { const Handle(Interface_Check) ch = binder->Check(); - Standard_Integer i,nbw = ch->NbWarnings(), nbf = ch->NbFails(); + Standard_Integer i, nbw = ch->NbWarnings(), nbf = ch->NbFails(); if (nbw > 0) { S<<" - Warnings : "<CWarning(i)<NbEntities() + 100); TP->SetGraph (HGraph()); - TP->SetErrorHandle(Standard_True); TR->SetTransientProcess(TP); } @@ -464,17 +461,6 @@ IFSelect_ReturnStatus XSControl_WorkSession::TransferWriteShape (const TopoDS_Sh } -//======================================================================= -//function : TransferWriteCheckList -//purpose : -//======================================================================= - -Interface_CheckIterator XSControl_WorkSession::TransferWriteCheckList () const -{ - return myTransferWriter->ResultCheckList (Model()); -} - - //======================================================================= //function : ClearBinders //purpose : diff --git a/src/XSControl/XSControl_WorkSession.hxx b/src/XSControl/XSControl_WorkSession.hxx index 6779456c0e..7a284638de 100644 --- a/src/XSControl/XSControl_WorkSession.hxx +++ b/src/XSControl/XSControl_WorkSession.hxx @@ -176,12 +176,6 @@ class XSControl_WorkSession : public IFSelect_WorkSession //! Error if transfer badly initialised Standard_EXPORT IFSelect_ReturnStatus TransferWriteShape (const TopoDS_Shape& theShape, const Standard_Boolean theCompGraph = Standard_True); - //! Returns the check-list of last transfer (write) - //! It is recorded in the FinderProcess, but it must be bound with - //! resulting entities (in the resulting file model) rather than - //! with original objects (in fact, their mappers) - Standard_EXPORT Interface_CheckIterator TransferWriteCheckList() const; - const Handle(XSControl_Vars) & Vars() const { return myVars; } diff --git a/src/XSControl/XSControl_Writer.cxx b/src/XSControl/XSControl_Writer.cxx index e96bd09898..ecad016a49 100644 --- a/src/XSControl/XSControl_Writer.cxx +++ b/src/XSControl/XSControl_Writer.cxx @@ -26,18 +26,7 @@ XSControl_Writer::XSControl_Writer () SetWS (new XSControl_WorkSession); } - XSControl_Writer::XSControl_Writer (const Standard_CString norm) -{ - SetNorm (norm); -} - - XSControl_Writer::XSControl_Writer - (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch) -{ - SetWS (WS,scratch); -} - - Standard_Boolean XSControl_Writer::SetNorm (const Standard_CString norm) +Standard_Boolean XSControl_Writer::SetNorm (const Standard_CString norm) { if (thesession.IsNull()) SetWS (new XSControl_WorkSession); Standard_Boolean sess = thesession->SelectNorm (norm); @@ -45,8 +34,7 @@ XSControl_Writer::XSControl_Writer () return sess; } - void XSControl_Writer::SetWS - (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch) +void XSControl_Writer::SetWS (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch) { thesession = WS; // Un controller doit etre defini ... @@ -54,28 +42,20 @@ XSControl_Writer::XSControl_Writer () Handle(Interface_InterfaceModel) model = Model (scratch); } - Handle(XSControl_WorkSession) XSControl_Writer::WS () const - { return thesession; } - - Handle(Interface_InterfaceModel) XSControl_Writer::Model - (const Standard_Boolean newone) +Handle(Interface_InterfaceModel) XSControl_Writer::Model (const Standard_Boolean newone) { Handle(Interface_InterfaceModel) model = thesession->Model(); if (newone || model.IsNull()) model = thesession->NewModel(); return model; } - IFSelect_ReturnStatus XSControl_Writer::TransferShape - (const TopoDS_Shape& sh, const Standard_Integer mode) +IFSelect_ReturnStatus XSControl_Writer::TransferShape (const TopoDS_Shape& sh, const Standard_Integer mode) { thesession->TransferWriter()->SetTransferMode (mode); return thesession->TransferWriteShape (sh); } - IFSelect_ReturnStatus XSControl_Writer::WriteFile - (const Standard_CString filename) - { return thesession->SendAll(filename); } - - void XSControl_Writer::PrintStatsTransfer - (const Standard_Integer what, const Standard_Integer mode) const - { thesession->TransferWriter()->PrintStats (what,mode); } +IFSelect_ReturnStatus XSControl_Writer::WriteFile (const Standard_CString filename) +{ + return thesession->SendAll(filename); +} diff --git a/src/XSControl/XSControl_Writer.hxx b/src/XSControl/XSControl_Writer.hxx index 09f5f36cb3..0910e03dc2 100644 --- a/src/XSControl/XSControl_Writer.hxx +++ b/src/XSControl/XSControl_Writer.hxx @@ -21,10 +21,7 @@ #include #include -#include -#include #include -#include class XSControl_WorkSession; class Interface_InterfaceModel; class TopoDS_Shape; @@ -35,21 +32,20 @@ class TopoDS_Shape; //! The model can then be edited by tools by other appropriate tools class XSControl_Writer { -public: + public: DEFINE_STANDARD_ALLOC - //! Creates a Writer from scratch Standard_EXPORT XSControl_Writer(); //! Creates a Writer from scratch, with a norm name which //! identifie a Controller - Standard_EXPORT XSControl_Writer(const Standard_CString norm); + XSControl_Writer(const Standard_CString norm) { SetNorm (norm); } //! Creates a Writer from an already existing Session //! If is True (D), clears already recorded data - Standard_EXPORT XSControl_Writer(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True); + XSControl_Writer(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True) { SetWS (WS,scratch); } //! Sets a specific norm to //! Returns True if done, False if is not available @@ -59,7 +55,7 @@ public: Standard_EXPORT void SetWS (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True); //! Returns the session used in - Standard_EXPORT Handle(XSControl_WorkSession) WS() const; + const Handle(XSControl_WorkSession) & WS() const { return thesession; } //! Returns the produced model. Produces a new one if not yet done //! or if is True @@ -72,32 +68,10 @@ public: //! Writes the produced model Standard_EXPORT IFSelect_ReturnStatus WriteFile (const Standard_CString filename); - - //! Prints Statistics about Transfer - Standard_EXPORT void PrintStatsTransfer (const Standard_Integer what, const Standard_Integer mode = 0) const; - - - - -protected: - - - - - -private: - + private: Handle(XSControl_WorkSession) thesession; - - }; - - - - - - #endif // _XSControl_Writer_HeaderFile diff --git a/src/XSDRAW/XSDRAW.cxx b/src/XSDRAW/XSDRAW.cxx index 580d08a80e..735954bb15 100644 --- a/src/XSDRAW/XSDRAW.cxx +++ b/src/XSDRAW/XSDRAW.cxx @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include diff --git a/src/XSDRAWIGES/XSDRAWIGES.cxx b/src/XSDRAWIGES/XSDRAWIGES.cxx index 38a73fa693..d4137a6013 100644 --- a/src/XSDRAWIGES/XSDRAWIGES.cxx +++ b/src/XSDRAWIGES/XSDRAWIGES.cxx @@ -55,7 +55,6 @@ #include #include #include -#include #include #include #include @@ -518,7 +517,6 @@ static Standard_Integer XSDRAWIGES_tplosttrim (Draw_Interpretor& di, Standard_In { Handle(IFSelect_SessionPilot) pilot = XSDRAW::Pilot(); -// Standard_Integer narg = pilot->NbWords(); Standard_Integer narg = n; const Handle(Transfer_TransientProcess) &TP = XSControl::Session(pilot)->TransferReader()->TransientProcess(); @@ -536,7 +534,6 @@ static Standard_Integer XSDRAWIGES_tplosttrim (Draw_Interpretor& di, Standard_In Transfer_IteratorOfProcessForTransient itrp = TP->AbnormalResult(); Standard_Integer k=0; if(narg > 1) { -// TCollection_AsciiString Arg = pilot->Word(1); TCollection_AsciiString Arg(a[1]); for(k=1 ; k<=3;k++ ) { if(typarg.Value(k).Location(Arg,1,typarg.Value(k).Length()) != 0) break; @@ -553,7 +550,7 @@ static Standard_Integer XSDRAWIGES_tplosttrim (Draw_Interpretor& di, Standard_In return 0; } for (itrp.Start(); itrp.More(); itrp.Next()) { - Handle(Standard_Transient) ent = itrp.Starting(); + const Handle(Standard_Transient) &ent = itrp.SourceObject(); Handle(TColStd_HSequenceOfTransient) super = WS->Sharings (ent); if (!super.IsNull()) { Standard_Integer nb = super->Length(); diff --git a/src/XSDRAWSTEP/XSDRAWSTEP.cxx b/src/XSDRAWSTEP/XSDRAWSTEP.cxx index 07d260b934..0be8053d39 100644 --- a/src/XSDRAWSTEP/XSDRAWSTEP.cxx +++ b/src/XSDRAWSTEP/XSDRAWSTEP.cxx @@ -45,7 +45,6 @@ #include #include #include -#include #include #include #include