1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File: NMTDS_.InterfPoolcxx
21 // Created: Wed Feb 21 10:35:35 2007
22 // Author: Peter KURNEV
25 #include <NMTDS_InterfPool.ixx>
26 #include <NMTDS_PassKeyBoolean.hxx>
27 #include <NMTDS_ListOfPassKeyBoolean.hxx>
28 #include <NMTDS_MapIteratorOfMapOfPassKeyBoolean.hxx>
29 #include <NMTDS_ListIteratorOfListOfPassKeyBoolean.hxx>
32 Standard_Integer TypeToInteger(const NMTDS_InterfType aType);
34 //=======================================================================
37 //=======================================================================
38 NMTDS_InterfPool::NMTDS_InterfPool()
42 //=======================================================================
45 //=======================================================================
46 NMTDS_InterfPool::~NMTDS_InterfPool()
49 //=======================================================================
52 //=======================================================================
53 Standard_Boolean NMTDS_InterfPool::Add (const NMTDS_PassKeyBoolean& aPKB,
54 const NMTDS_InterfType aType)
56 Standard_Boolean bRet;
57 Standard_Integer iType;
61 iType=TypeToInteger(aType);
62 if (iType>-1 && iType<myMaxInd) {
63 bRet=myTable[iType].Add(aPKB);
67 //=======================================================================
70 //=======================================================================
71 Standard_Boolean NMTDS_InterfPool::Add (const Standard_Integer aInd1,
72 const Standard_Integer aInd2,
73 const NMTDS_InterfType aType)
75 NMTDS_PassKeyBoolean aPKB;
77 aPKB.SetIds(aInd1, aInd2);
78 return Add(aPKB, aType);
80 //=======================================================================
83 //=======================================================================
84 Standard_Boolean NMTDS_InterfPool::Add (const Standard_Integer aInd1,
85 const Standard_Integer aInd2,
86 const Standard_Boolean bFlag,
87 const NMTDS_InterfType aType)
89 NMTDS_PassKeyBoolean aPKB;
91 aPKB.SetIds(aInd1, aInd2);
93 return Add(aPKB, aType);
95 //=======================================================================
98 //=======================================================================
99 Standard_Boolean NMTDS_InterfPool::Contains(const NMTDS_PassKeyBoolean& aPKB)const
101 Standard_Boolean bRet;
104 for (i=0; i<myMaxInd; ++i) {
105 bRet=myTable[i].Contains(aPKB);
112 //=======================================================================
113 //function : Contains
115 //=======================================================================
116 Standard_Boolean NMTDS_InterfPool::Contains(const Standard_Integer aInd1,
117 const Standard_Integer aInd2)const
119 NMTDS_PassKeyBoolean aPKB;
121 aPKB.SetIds(aInd1, aInd2);
122 return Contains(aPKB);
124 //=======================================================================
127 //=======================================================================
128 const NMTDS_ListOfPassKeyBoolean& NMTDS_InterfPool::Get()const
131 NMTDS_ListOfPassKeyBoolean* pL;
133 pL=(NMTDS_ListOfPassKeyBoolean*)&myList;
136 for (i=0; i<myMaxInd; ++i) {
137 NMTDS_MapIteratorOfMapOfPassKeyBoolean aIt;
139 aIt.Initialize(myTable[i]);
140 for(; aIt.More(); aIt.Next()) {
141 const NMTDS_PassKeyBoolean& aPKB=aIt.Key();
147 //=======================================================================
150 //=======================================================================
151 const NMTDS_ListOfPassKeyBoolean& NMTDS_InterfPool::Get(const Standard_Integer aInd)const
153 Standard_Integer i, n1, n2;
154 NMTDS_ListOfPassKeyBoolean* pL;
156 pL=(NMTDS_ListOfPassKeyBoolean*)&myList;
159 for (i=0; i<myMaxInd; ++i) {
160 NMTDS_MapIteratorOfMapOfPassKeyBoolean aIt;
162 aIt.Initialize(myTable[i]);
163 for(; aIt.More(); aIt.Next()) {
164 const NMTDS_PassKeyBoolean& aPKB=aIt.Key();
166 if(n1==aInd || n2==aInd) {
173 //=======================================================================
176 //=======================================================================
177 const NMTDS_ListOfPassKeyBoolean& NMTDS_InterfPool::Get(const NMTDS_InterfType aType)const
179 Standard_Integer iType;
180 NMTDS_ListOfPassKeyBoolean* pL;
182 pL=(NMTDS_ListOfPassKeyBoolean*)&myList;
185 iType=TypeToInteger(aType);
186 if (iType>-1 && iType<myMaxInd) {
187 NMTDS_MapIteratorOfMapOfPassKeyBoolean aIt;
189 aIt.Initialize(myTable[iType]);
190 for(; aIt.More(); aIt.Next()) {
191 const NMTDS_PassKeyBoolean& aPKB=aIt.Key();
197 //=======================================================================
200 //=======================================================================
201 const NMTDS_ListOfPassKeyBoolean& NMTDS_InterfPool::Get(const Standard_Integer aInd,
202 const NMTDS_InterfType aType)const
204 Standard_Integer n1, n2;
205 NMTDS_ListOfPassKeyBoolean *pL, aLPKB;
206 NMTDS_ListIteratorOfListOfPassKeyBoolean aIt;
210 pL=(NMTDS_ListOfPassKeyBoolean*)&myList;
213 aIt.Initialize (aLPKB);
214 for (; aIt.More(); aIt.Next()) {
215 const NMTDS_PassKeyBoolean& aPKB=aIt.Value();
217 if(n1==aInd || n2==aInd) {
224 //===========================================================================
225 //function : SSInterferences
227 //===========================================================================
228 BOPTools_CArray1OfSSInterference& NMTDS_InterfPool::SSInterferences()
230 return mySSInterferences;
232 //===========================================================================
233 //function : ESInterferences
235 //===========================================================================
236 BOPTools_CArray1OfESInterference& NMTDS_InterfPool::ESInterferences()
238 return myESInterferences;
240 //===========================================================================
241 //function : VSInterferences
243 //===========================================================================
244 BOPTools_CArray1OfVSInterference& NMTDS_InterfPool::VSInterferences()
246 return myVSInterferences;
248 //===========================================================================
249 //function : EEInterferences
251 //===========================================================================
252 BOPTools_CArray1OfEEInterference& NMTDS_InterfPool::EEInterferences()
254 return myEEInterferences;
256 //===========================================================================
257 //function : VEInterferences
259 //===========================================================================
260 BOPTools_CArray1OfVEInterference& NMTDS_InterfPool::VEInterferences()
262 return myVEInterferences;
264 //===========================================================================
265 //function : VVInterferences
267 //===========================================================================
268 BOPTools_CArray1OfVVInterference& NMTDS_InterfPool::VVInterferences()
270 return myVVInterferences;
273 //=======================================================================
274 //function : TypeToInteger
276 //=======================================================================
277 Standard_Integer TypeToInteger(const NMTDS_InterfType aType)
279 return (Standard_Integer)aType;