0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / BOPAlgo / BOPAlgo_Algo.cxx
CommitLineData
b311480e 1// Created by: Peter KURNEV
973c2be1 2// Copyright (c) 2010-2014 OPEN CASCADE SAS
4e57c75e 3// Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
4// Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
5// EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
b311480e 6//
973c2be1 7// This file is part of Open CASCADE Technology software library.
b311480e 8//
d5f74e42 9// This library is free software; you can redistribute it and/or modify it under
10// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 11// by the Free Software Foundation, with special exception defined in the file
12// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
13// distribution for complete text of the license and disclaimer of any warranty.
b311480e 14//
973c2be1 15// Alternatively, this file may be used under the terms of Open CASCADE
16// commercial license or contractual agreement.
7fd59977 17
4e57c75e 18
42cf5bc1 19#include <BOPAlgo_Algo.hxx>
20#include <Message_ProgressIndicator.hxx>
4e57c75e 21#include <NCollection_BaseAllocator.hxx>
36f4947b 22#include <Standard_NotImplemented.hxx>
42cf5bc1 23#include <Standard_ProgramError.hxx>
36f4947b 24
e322db46 25namespace
26{
27 Standard_Boolean myGlobalRunParallel = Standard_False;
28}
29
30//=======================================================================
31// function:
32// purpose:
33//=======================================================================
34void BOPAlgo_Algo::SetParallelMode(Standard_Boolean theNewMode)
35{
36 myGlobalRunParallel = theNewMode;
37}
38
39//=======================================================================
40// function:
41// purpose:
42//=======================================================================
43Standard_Boolean BOPAlgo_Algo::GetParallelMode()
44{
45 return myGlobalRunParallel;
46}
47
48
7fd59977 49//=======================================================================
4e57c75e 50// function:
7fd59977 51// purpose:
52//=======================================================================
db8e4b9a 53BOPAlgo_Algo::BOPAlgo_Algo()
7fd59977 54:
4e57c75e 55 myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()),
56 myErrorStatus(1),
db8e4b9a 57 myWarningStatus(0),
e322db46 58 myRunParallel(myGlobalRunParallel)
7fd59977 59{}
7fd59977 60//=======================================================================
4e57c75e 61// function:
7fd59977 62// purpose:
63//=======================================================================
db8e4b9a 64BOPAlgo_Algo::BOPAlgo_Algo
65 (const Handle(NCollection_BaseAllocator)& theAllocator)
4e57c75e 66:
67 myAllocator(theAllocator),
68 myErrorStatus(1),
db8e4b9a 69 myWarningStatus(0),
e322db46 70 myRunParallel(myGlobalRunParallel)
4e57c75e 71{}
7fd59977 72
73//=======================================================================
4e57c75e 74// function: ~
7fd59977 75// purpose:
76//=======================================================================
db8e4b9a 77BOPAlgo_Algo::~BOPAlgo_Algo()
7fd59977 78{
7fd59977 79}
80//=======================================================================
4e57c75e 81//function : Allocator
82//purpose :
7fd59977 83//=======================================================================
db8e4b9a 84const Handle(NCollection_BaseAllocator)& BOPAlgo_Algo::Allocator()const
7fd59977 85{
4e57c75e 86 return myAllocator;
7fd59977 87}
7fd59977 88//=======================================================================
4e57c75e 89// function: CheckData
7fd59977 90// purpose:
91//=======================================================================
db8e4b9a 92void BOPAlgo_Algo::CheckData()
7fd59977 93{
4e57c75e 94 myErrorStatus=0;
7fd59977 95}
7fd59977 96//=======================================================================
4e57c75e 97// function: CheckResult
7fd59977 98// purpose:
99//=======================================================================
db8e4b9a 100void BOPAlgo_Algo::CheckResult()
7fd59977 101{
4e57c75e 102 myErrorStatus=0;
7fd59977 103}
104//=======================================================================
4e57c75e 105// function: ErrorStatus
7fd59977 106// purpose:
107//=======================================================================
db8e4b9a 108Standard_Integer BOPAlgo_Algo::ErrorStatus()const
7fd59977 109{
4e57c75e 110 return myErrorStatus;
7fd59977 111}
7fd59977 112//=======================================================================
4e57c75e 113// function: WarningStatus
7fd59977 114// purpose:
115//=======================================================================
db8e4b9a 116Standard_Integer BOPAlgo_Algo::WarningStatus()const
7fd59977 117{
4e57c75e 118 return myWarningStatus;
7fd59977 119}
db8e4b9a 120//=======================================================================
121//function : SetRunParallel
122//purpose :
123//=======================================================================
124void BOPAlgo_Algo::SetRunParallel(const Standard_Boolean theFlag)
125{
126 myRunParallel=theFlag;
127}
128//=======================================================================
129//function : RunParallel
130//purpose :
131//=======================================================================
132Standard_Boolean BOPAlgo_Algo::RunParallel()const
133{
134 return myRunParallel;
135}
36f4947b 136//=======================================================================
137//function : SetProgressIndicator
138//purpose :
139//=======================================================================
140void BOPAlgo_Algo::SetProgressIndicator
141 (const Handle(Message_ProgressIndicator)& theObj)
142{
143 if (!theObj.IsNull()) {
144 myProgressIndicator=theObj;
145 }
146}
147//=======================================================================
148//function : UserBreak
149//purpose :
150//=======================================================================
151void BOPAlgo_Algo::UserBreak() const
152{
153 if (myProgressIndicator.IsNull()) {
154 return;
155 }
156 if (myProgressIndicator->UserBreak()) {
157 Standard_NotImplemented::Raise("");
158 }
159}
4e57c75e 160// myErrorStatus
161//
162// 1 - object is just initialized