0027349: XtControl_Reader is not thread-safe
[occt.git] / src / XSControl / XSControl_Reader.cxx
index b5c4db9..ea17e5c 100644 (file)
@@ -2,8 +2,8 @@
 //
 // 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 version 2.1 as published
+// 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.
 
 // pdn 26.02.99 added initializing of compound in function OneShape
 //:   gka 14.04.99: S4136: apply scaling
-#include <XSControl_Reader.ixx>
-#include <XSControl_Controller.hxx>
-#include <XSControl_TransferReader.hxx>
-#include <Interface_ShareFlags.hxx>
-#include <IFSelect_Functions.hxx>
 
+#include <BRep_Builder.hxx>
+#include <IFSelect_Functions.hxx>
+#include <Interface_Check.hxx>
+#include <Interface_InterfaceModel.hxx>
+#include <Interface_ShareFlags.hxx>
+#include <Interface_Static.hxx>
+#include <Message_ProgressSentry.hxx>
 #include <ShapeExtend_Explorer.hxx>
+#include <Standard_Transient.hxx>
 #include <TopoDS_Compound.hxx>
-#include <BRep_Builder.hxx>
+#include <TopoDS_Shape.hxx>
+#include <Transfer_Binder.hxx>
 #include <Transfer_IteratorOfProcessForTransient.hxx>
 #include <Transfer_TransientProcess.hxx>
-#include <Transfer_Binder.hxx>
-//#include <ShapeCustom.hxx>
-#include <Interface_Static.hxx>
-#include <Interface_Check.hxx>
-#include <Message_ProgressSentry.hxx>
-
+#include <XSControl_Controller.hxx>
+#include <XSControl_Reader.hxx>
+#include <XSControl_TransferReader.hxx>
+#include <XSControl_WorkSession.hxx>
 
+//#include <ShapeCustom.hxx>
 //#include <ShapeAlgo.hxx>
 //#include <ShapeAlgo_AlgoContainer.hxx>
-
-
 //=======================================================================
 //function : XSControl_Reader
 //purpose  : 
 //=======================================================================
-
 XSControl_Reader::XSControl_Reader ()
 {
   SetWS (new XSControl_WorkSession);
@@ -237,7 +237,7 @@ Standard_Boolean  XSControl_Reader::TransferEntity
   (const Handle(Standard_Transient)& start)
 {
   if (start.IsNull()) return Standard_False;
-  Handle(XSControl_TransferReader) TR = thesession->TransferReader();
+  const Handle(XSControl_TransferReader) &TR = thesession->TransferReader();
   TR->BeginTransfer();
   if (TR->TransferOne (start) == 0) return Standard_False;
   TopoDS_Shape sh = TR->ShapeResult(start);
@@ -260,7 +260,7 @@ Standard_Integer  XSControl_Reader::TransferList
   if (list.IsNull()) return 0;
   Standard_Integer nbt = 0;
   Standard_Integer i, nb = list->Length();
-  Handle(XSControl_TransferReader) TR = thesession->TransferReader();
+  const Handle(XSControl_TransferReader) &TR = thesession->TransferReader();
   TR->BeginTransfer();
   ClearShapes();
   ShapeExtend_Explorer STU;
@@ -286,12 +286,12 @@ Standard_Integer  XSControl_Reader::TransferRoots ()
   NbRootsForTransfer();
   Standard_Integer nbt = 0;
   Standard_Integer i, nb = theroots.Length();
-  Handle(XSControl_TransferReader) TR = thesession->TransferReader();
+  const Handle(XSControl_TransferReader) &TR = thesession->TransferReader();
    
   TR->BeginTransfer();
   ClearShapes();
   ShapeExtend_Explorer STU;
-  Handle(Transfer_TransientProcess) proc = thesession->MapReader();
+  const Handle(Transfer_TransientProcess) &proc = thesession->TransferReader()->TransientProcess();
   Message_ProgressSentry PS ( proc->GetProgress(), "Root", 0, nb, 1 );
   for (i = 1; i <= nb && PS.More(); i ++,PS.Next()) {
     Handle(Standard_Transient) start = theroots.Value(i);
@@ -415,7 +415,7 @@ void XSControl_Reader::GetStatsTransfer (const Handle(TColStd_HSequenceOfTransie
                                         Standard_Integer& nbWithResult,
                                         Standard_Integer& nbWithFail) const
 {
-  Handle(Transfer_TransientProcess) TP = thesession->MapReader();
+  const Handle(Transfer_TransientProcess) &TP = thesession->TransferReader()->TransientProcess();
   Transfer_IteratorOfProcessForTransient itrp(Standard_True);
   itrp = TP->CompleteResult(Standard_True);
   if(!list.IsNull()) itrp.Filter (list);