1 // Created by: Peter KURNEV
2 // Copyright (c) 1999-2012 OPEN CASCADE SAS
4 // The content of this file is subject to the Open CASCADE Technology Public
5 // License Version 6.5 (the "License"). You may not use the content of this file
6 // except in compliance with the License. Please obtain a copy of the License
7 // at http://www.opencascade.org and read it completely before using this file.
9 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
10 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12 // The Original Code and all software distributed under the License is
13 // distributed on an "AS IS" basis, without warranty of any kind, and the
14 // Initial Developer hereby disclaims all such warranties, including without
15 // limitation, any warranties of merchantability, fitness for a particular
16 // purpose or non-infringement. Please see the License for the specific terms
17 // and conditions governing the rights and limitations under the License.
20 #include <BOPTest_Objects.ixx>
22 #include <NCollection_BaseAllocator.hxx>
23 #include <NCollection_IncAllocator.hxx>
25 static Handle(NCollection_BaseAllocator)& Allocator1();
27 //=======================================================================
28 //function : BOPTest_Session
30 //=======================================================================
31 class BOPTest_Session {
44 Handle(NCollection_BaseAllocator) pA1, pA2;
46 pA1=new NCollection_IncAllocator;
47 pA2=new NCollection_IncAllocator;
49 myPaveFiller=new BOPAlgo_PaveFiller(pA1);
50 myBuilderDefault=new BOPAlgo_Builder(pA2);
52 myBuilder=myBuilderDefault;
62 if (myBuilderDefault) {
63 delete myBuilderDefault;
64 myBuilderDefault=NULL;
69 Standard_Boolean IsValid() const {
70 return (myPaveFiller!=NULL);
73 BOPAlgo_PaveFiller& PaveFiller() {
78 BOPAlgo_Builder& Builder() {
83 void SetBuilder(BOPAlgo_Builder* pBuilder) {
88 void SetBuilderDefault() {
89 myBuilder=myBuilderDefault;
94 BOPAlgo_PaveFiller* myPaveFiller;
95 BOPAlgo_Builder* myBuilder;
96 BOPAlgo_Builder* myBuilderDefault;
99 //=======================================================================
100 //function : GetSession
102 //=======================================================================
103 static BOPTest_Session& GetSession()
105 static BOPTest_Session* pSession=new BOPTest_Session;
107 if (!pSession->IsValid()) {
113 //=======================================================================
116 //=======================================================================
117 void BOPTest_Objects::Init()
121 //=======================================================================
124 //=======================================================================
125 void BOPTest_Objects::Clear()
127 GetSession().Clear();
129 //=======================================================================
130 //function : PaveFiller
132 //=======================================================================
133 BOPAlgo_PaveFiller& BOPTest_Objects::PaveFiller()
135 return GetSession().PaveFiller();
137 //=======================================================================
140 //=======================================================================
141 BOPDS_PDS BOPTest_Objects::PDS()
143 return BOPTest_Objects::PaveFiller().PDS();
145 //=======================================================================
148 //=======================================================================
149 BOPAlgo_Builder& BOPTest_Objects::Builder()
151 return GetSession().Builder();
153 //=======================================================================
154 //function : SetBuilder
156 //=======================================================================
157 void BOPTest_Objects::SetBuilder(const BOPAlgo_PBuilder& theBuilder)
161 pB=(BOPAlgo_Builder*)theBuilder;
162 GetSession().SetBuilder(pB);
164 //=======================================================================
165 //function : SetBuilderDefault
167 //=======================================================================
168 void BOPTest_Objects::SetBuilderDefault()
170 GetSession().SetBuilderDefault();
172 //=======================================================================
175 //=======================================================================
176 BOPAlgo_BOP& BOPTest_Objects::BOP()
178 static BOPAlgo_BOP sBOP(Allocator1());
181 //=======================================================================
184 //=======================================================================
185 BOPCol_ListOfShape& BOPTest_Objects::Shapes()
187 static BOPCol_ListOfShape s_Shapes;
190 //=======================================================================
193 //=======================================================================
194 BOPCol_ListOfShape& BOPTest_Objects::Tools()
196 static BOPCol_ListOfShape s_Tools;
199 //=======================================================================
200 //function : Allocator1
202 //=======================================================================
203 Handle(NCollection_BaseAllocator)& Allocator1()
205 static Handle(NCollection_BaseAllocator) sAL1=
206 new NCollection_IncAllocator;