1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File: NMTDS_.InterfPoolcxx
23 // Created: Wed Feb 21 10:35:35 2007
24 // Author: Peter KURNEV
27 #include <NMTDS_InterfPool.ixx>
28 #include <NMTDS_PassKeyBoolean.hxx>
29 #include <NMTDS_ListOfPassKeyBoolean.hxx>
30 #include <NMTDS_MapIteratorOfMapOfPassKeyBoolean.hxx>
31 #include <NMTDS_ListIteratorOfListOfPassKeyBoolean.hxx>
34 Standard_Integer TypeToInteger(const NMTDS_InterfType aType);
36 //=======================================================================
39 //=======================================================================
40 NMTDS_InterfPool::NMTDS_InterfPool()
44 //=======================================================================
47 //=======================================================================
48 NMTDS_InterfPool::~NMTDS_InterfPool()
51 //=======================================================================
54 //=======================================================================
55 Standard_Boolean NMTDS_InterfPool::Add (const NMTDS_PassKeyBoolean& aPKB,
56 const NMTDS_InterfType aType)
58 Standard_Boolean bRet;
59 Standard_Integer iType;
63 iType=TypeToInteger(aType);
64 if (iType>-1 && iType<myMaxInd) {
65 bRet=myTable[iType].Add(aPKB);
69 //=======================================================================
72 //=======================================================================
73 Standard_Boolean NMTDS_InterfPool::Add (const Standard_Integer aInd1,
74 const Standard_Integer aInd2,
75 const NMTDS_InterfType aType)
77 NMTDS_PassKeyBoolean aPKB;
79 aPKB.SetIds(aInd1, aInd2);
80 return Add(aPKB, aType);
82 //=======================================================================
85 //=======================================================================
86 Standard_Boolean NMTDS_InterfPool::Add (const Standard_Integer aInd1,
87 const Standard_Integer aInd2,
88 const Standard_Boolean bFlag,
89 const NMTDS_InterfType aType)
91 NMTDS_PassKeyBoolean aPKB;
93 aPKB.SetIds(aInd1, aInd2);
95 return Add(aPKB, aType);
97 //=======================================================================
100 //=======================================================================
101 Standard_Boolean NMTDS_InterfPool::Contains(const NMTDS_PassKeyBoolean& aPKB)const
103 Standard_Boolean bRet;
106 for (i=0; i<myMaxInd; ++i) {
107 bRet=myTable[i].Contains(aPKB);
114 //=======================================================================
115 //function : Contains
117 //=======================================================================
118 Standard_Boolean NMTDS_InterfPool::Contains(const Standard_Integer aInd1,
119 const Standard_Integer aInd2)const
121 NMTDS_PassKeyBoolean aPKB;
123 aPKB.SetIds(aInd1, aInd2);
124 return Contains(aPKB);
126 //=======================================================================
129 //=======================================================================
130 const NMTDS_ListOfPassKeyBoolean& NMTDS_InterfPool::Get()const
133 NMTDS_ListOfPassKeyBoolean* pL;
135 pL=(NMTDS_ListOfPassKeyBoolean*)&myList;
138 for (i=0; i<myMaxInd; ++i) {
139 NMTDS_MapIteratorOfMapOfPassKeyBoolean aIt;
141 aIt.Initialize(myTable[i]);
142 for(; aIt.More(); aIt.Next()) {
143 const NMTDS_PassKeyBoolean& aPKB=aIt.Key();
149 //=======================================================================
152 //=======================================================================
153 const NMTDS_ListOfPassKeyBoolean& NMTDS_InterfPool::Get(const Standard_Integer aInd)const
155 Standard_Integer i, n1, n2;
156 NMTDS_ListOfPassKeyBoolean* pL;
158 pL=(NMTDS_ListOfPassKeyBoolean*)&myList;
161 for (i=0; i<myMaxInd; ++i) {
162 NMTDS_MapIteratorOfMapOfPassKeyBoolean aIt;
164 aIt.Initialize(myTable[i]);
165 for(; aIt.More(); aIt.Next()) {
166 const NMTDS_PassKeyBoolean& aPKB=aIt.Key();
168 if(n1==aInd || n2==aInd) {
175 //=======================================================================
178 //=======================================================================
179 const NMTDS_ListOfPassKeyBoolean& NMTDS_InterfPool::Get(const NMTDS_InterfType aType)const
181 Standard_Integer iType;
182 NMTDS_ListOfPassKeyBoolean* pL;
184 pL=(NMTDS_ListOfPassKeyBoolean*)&myList;
187 iType=TypeToInteger(aType);
188 if (iType>-1 && iType<myMaxInd) {
189 NMTDS_MapIteratorOfMapOfPassKeyBoolean aIt;
191 aIt.Initialize(myTable[iType]);
192 for(; aIt.More(); aIt.Next()) {
193 const NMTDS_PassKeyBoolean& aPKB=aIt.Key();
199 //=======================================================================
202 //=======================================================================
203 const NMTDS_ListOfPassKeyBoolean& NMTDS_InterfPool::Get(const Standard_Integer aInd,
204 const NMTDS_InterfType aType)const
206 Standard_Integer n1, n2;
207 NMTDS_ListOfPassKeyBoolean *pL, aLPKB;
208 NMTDS_ListIteratorOfListOfPassKeyBoolean aIt;
212 pL=(NMTDS_ListOfPassKeyBoolean*)&myList;
215 aIt.Initialize (aLPKB);
216 for (; aIt.More(); aIt.Next()) {
217 const NMTDS_PassKeyBoolean& aPKB=aIt.Value();
219 if(n1==aInd || n2==aInd) {
226 //===========================================================================
227 //function : SSInterferences
229 //===========================================================================
230 BOPTools_CArray1OfSSInterference& NMTDS_InterfPool::SSInterferences()
232 return mySSInterferences;
234 //===========================================================================
235 //function : ESInterferences
237 //===========================================================================
238 BOPTools_CArray1OfESInterference& NMTDS_InterfPool::ESInterferences()
240 return myESInterferences;
242 //===========================================================================
243 //function : VSInterferences
245 //===========================================================================
246 BOPTools_CArray1OfVSInterference& NMTDS_InterfPool::VSInterferences()
248 return myVSInterferences;
250 //===========================================================================
251 //function : EEInterferences
253 //===========================================================================
254 BOPTools_CArray1OfEEInterference& NMTDS_InterfPool::EEInterferences()
256 return myEEInterferences;
258 //===========================================================================
259 //function : VEInterferences
261 //===========================================================================
262 BOPTools_CArray1OfVEInterference& NMTDS_InterfPool::VEInterferences()
264 return myVEInterferences;
266 //===========================================================================
267 //function : VVInterferences
269 //===========================================================================
270 BOPTools_CArray1OfVVInterference& NMTDS_InterfPool::VVInterferences()
272 return myVVInterferences;
275 //=======================================================================
276 //function : TypeToInteger
278 //=======================================================================
279 Standard_Integer TypeToInteger(const NMTDS_InterfType aType)
281 return (Standard_Integer)aType;