1 // Created by: Peter KURNEV
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and / or modify it
7 // under the terms of the GNU Lesser General Public version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 #include <BOPTest_Objects.ixx>
17 #include <NCollection_BaseAllocator.hxx>
18 #include <NCollection_IncAllocator.hxx>
20 static Handle(NCollection_BaseAllocator)& Allocator1();
22 //=======================================================================
23 //function : BOPTest_Session
25 //=======================================================================
26 class BOPTest_Session {
39 Handle(NCollection_BaseAllocator) pA1, pA2;
41 pA1=new NCollection_IncAllocator;
42 pA2=new NCollection_IncAllocator;
44 myPaveFiller=new BOPAlgo_PaveFiller(pA1);
45 myBuilderDefault=new BOPAlgo_Builder(pA2);
47 myBuilder=myBuilderDefault;
57 if (myBuilderDefault) {
58 delete myBuilderDefault;
59 myBuilderDefault=NULL;
64 Standard_Boolean IsValid() const {
65 return (myPaveFiller!=NULL);
68 BOPAlgo_PaveFiller& PaveFiller() {
73 BOPAlgo_Builder& Builder() {
78 void SetBuilder(BOPAlgo_Builder* pBuilder) {
83 void SetBuilderDefault() {
84 myBuilder=myBuilderDefault;
89 BOPAlgo_PaveFiller* myPaveFiller;
90 BOPAlgo_Builder* myBuilder;
91 BOPAlgo_Builder* myBuilderDefault;
94 //=======================================================================
95 //function : GetSession
97 //=======================================================================
98 static BOPTest_Session& GetSession()
100 static BOPTest_Session* pSession=new BOPTest_Session;
102 if (!pSession->IsValid()) {
108 //=======================================================================
111 //=======================================================================
112 void BOPTest_Objects::Init()
116 //=======================================================================
119 //=======================================================================
120 void BOPTest_Objects::Clear()
122 GetSession().Clear();
124 //clear objects and tools
128 //=======================================================================
129 //function : PaveFiller
131 //=======================================================================
132 BOPAlgo_PaveFiller& BOPTest_Objects::PaveFiller()
134 return GetSession().PaveFiller();
136 //=======================================================================
139 //=======================================================================
140 BOPDS_PDS BOPTest_Objects::PDS()
142 return BOPTest_Objects::PaveFiller().PDS();
144 //=======================================================================
147 //=======================================================================
148 BOPAlgo_Builder& BOPTest_Objects::Builder()
150 return GetSession().Builder();
152 //=======================================================================
153 //function : SetBuilder
155 //=======================================================================
156 void BOPTest_Objects::SetBuilder(const BOPAlgo_PBuilder& theBuilder)
160 pB=(BOPAlgo_Builder*)theBuilder;
161 GetSession().SetBuilder(pB);
163 //=======================================================================
164 //function : SetBuilderDefault
166 //=======================================================================
167 void BOPTest_Objects::SetBuilderDefault()
169 GetSession().SetBuilderDefault();
171 //=======================================================================
174 //=======================================================================
175 BOPAlgo_BOP& BOPTest_Objects::BOP()
177 static BOPAlgo_BOP sBOP(Allocator1());
180 //=======================================================================
183 //=======================================================================
184 BOPCol_ListOfShape& BOPTest_Objects::Shapes()
186 static BOPCol_ListOfShape s_Shapes;
189 //=======================================================================
192 //=======================================================================
193 BOPCol_ListOfShape& BOPTest_Objects::Tools()
195 static BOPCol_ListOfShape s_Tools;
198 //=======================================================================
199 //function : Allocator1
201 //=======================================================================
202 Handle(NCollection_BaseAllocator)& Allocator1()
204 static Handle(NCollection_BaseAllocator) sAL1=
205 new NCollection_IncAllocator;