0027349: XtControl_Reader is not thread-safe
[occt.git] / src / STEPConstruct / STEPConstruct_Tool.cxx
CommitLineData
b311480e 1// Created on: 2000-09-29
2// Created by: Andrey BETENEV
973c2be1 3// Copyright (c) 2000-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
7fd59977 15
42cf5bc1 16
17#include <Interface_Graph.hxx>
18#include <Interface_HGraph.hxx>
19#include <Interface_InterfaceModel.hxx>
20#include <STEPConstruct_Tool.hxx>
21#include <Transfer_FinderProcess.hxx>
22#include <Transfer_TransientProcess.hxx>
7fd59977 23#include <XSControl_TransferReader.hxx>
24#include <XSControl_TransferWriter.hxx>
42cf5bc1 25#include <XSControl_WorkSession.hxx>
7fd59977 26
27//=======================================================================
28//function : STEPConstruct_Tool
29//purpose :
30//=======================================================================
7fd59977 31STEPConstruct_Tool::STEPConstruct_Tool ()
32{
33}
34
35//=======================================================================
36//function : STEPConstruct_Tool
37//purpose :
38//=======================================================================
39
40STEPConstruct_Tool::STEPConstruct_Tool (const Handle(XSControl_WorkSession) &WS)
41{
42 SetWS ( WS );
43}
44
45//=======================================================================
46//function : Init
47//purpose :
48//=======================================================================
49
50Standard_Boolean STEPConstruct_Tool::SetWS (const Handle(XSControl_WorkSession) &WS)
51{
52 myWS.Nullify();
53 myTransientProcess.Nullify();
54 myFinderProcess.Nullify();
55
56 if ( WS.IsNull() ) return Standard_False;
57 myWS = WS;
58 myHGraph = myWS->HGraph();
59
60 // collect data on reading process
7f56eba8 61 const Handle(XSControl_TransferReader) &TR = WS->TransferReader();
7fd59977 62 if ( ! TR.IsNull() ) myTransientProcess = TR->TransientProcess();
63
64 // collect data on writing process
7f56eba8 65 const Handle(XSControl_TransferWriter) &TW = myWS->TransferWriter();
7fd59977 66 if ( ! TW.IsNull() ) myFinderProcess = TW->FinderProcess();
67
68 return ! myTransientProcess.IsNull() && ! myFinderProcess.IsNull();
69}