1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // 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
26 #include <NMTDS_InterfPool.ixx>
27 #include <NMTDS_PassKeyBoolean.hxx>
28 #include <NMTDS_ListOfPassKeyBoolean.hxx>
29 #include <NMTDS_MapIteratorOfMapOfPassKeyBoolean.hxx>
30 #include <NMTDS_ListIteratorOfListOfPassKeyBoolean.hxx>
33 Standard_Integer TypeToInteger(const NMTDS_InterfType aType);
35 //=======================================================================
38 //=======================================================================
39 NMTDS_InterfPool::NMTDS_InterfPool()
43 //=======================================================================
46 //=======================================================================
47 NMTDS_InterfPool::~NMTDS_InterfPool()
50 //=======================================================================
53 //=======================================================================
54 Standard_Boolean NMTDS_InterfPool::Add (const NMTDS_PassKeyBoolean& aPKB,
55 const NMTDS_InterfType aType)
57 Standard_Boolean bRet;
58 Standard_Integer iType;
62 iType=TypeToInteger(aType);
63 if (iType>-1 && iType<myMaxInd) {
64 bRet=myTable[iType].Add(aPKB);
68 //=======================================================================
71 //=======================================================================
72 Standard_Boolean NMTDS_InterfPool::Add (const Standard_Integer aInd1,
73 const Standard_Integer aInd2,
74 const NMTDS_InterfType aType)
76 NMTDS_PassKeyBoolean aPKB;
78 aPKB.SetIds(aInd1, aInd2);
79 return Add(aPKB, aType);
81 //=======================================================================
84 //=======================================================================
85 Standard_Boolean NMTDS_InterfPool::Add (const Standard_Integer aInd1,
86 const Standard_Integer aInd2,
87 const Standard_Boolean bFlag,
88 const NMTDS_InterfType aType)
90 NMTDS_PassKeyBoolean aPKB;
92 aPKB.SetIds(aInd1, aInd2);
94 return Add(aPKB, aType);
96 //=======================================================================
99 //=======================================================================
100 Standard_Boolean NMTDS_InterfPool::Contains(const NMTDS_PassKeyBoolean& aPKB)const
102 Standard_Boolean bRet;
105 for (i=0; i<myMaxInd; ++i) {
106 bRet=myTable[i].Contains(aPKB);
113 //=======================================================================
114 //function : Contains
116 //=======================================================================
117 Standard_Boolean NMTDS_InterfPool::Contains(const Standard_Integer aInd1,
118 const Standard_Integer aInd2)const
120 NMTDS_PassKeyBoolean aPKB;
122 aPKB.SetIds(aInd1, aInd2);
123 return Contains(aPKB);
125 //=======================================================================
128 //=======================================================================
129 const NMTDS_ListOfPassKeyBoolean& NMTDS_InterfPool::Get()const
132 NMTDS_ListOfPassKeyBoolean* pL;
134 pL=(NMTDS_ListOfPassKeyBoolean*)&myList;
137 for (i=0; i<myMaxInd; ++i) {
138 NMTDS_MapIteratorOfMapOfPassKeyBoolean aIt;
140 aIt.Initialize(myTable[i]);
141 for(; aIt.More(); aIt.Next()) {
142 const NMTDS_PassKeyBoolean& aPKB=aIt.Key();
148 //=======================================================================
151 //=======================================================================
152 const NMTDS_ListOfPassKeyBoolean& NMTDS_InterfPool::Get(const Standard_Integer aInd)const
154 Standard_Integer i, n1, n2;
155 NMTDS_ListOfPassKeyBoolean* pL;
157 pL=(NMTDS_ListOfPassKeyBoolean*)&myList;
160 for (i=0; i<myMaxInd; ++i) {
161 NMTDS_MapIteratorOfMapOfPassKeyBoolean aIt;
163 aIt.Initialize(myTable[i]);
164 for(; aIt.More(); aIt.Next()) {
165 const NMTDS_PassKeyBoolean& aPKB=aIt.Key();
167 if(n1==aInd || n2==aInd) {
174 //=======================================================================
177 //=======================================================================
178 const NMTDS_ListOfPassKeyBoolean& NMTDS_InterfPool::Get(const NMTDS_InterfType aType)const
180 Standard_Integer iType;
181 NMTDS_ListOfPassKeyBoolean* pL;
183 pL=(NMTDS_ListOfPassKeyBoolean*)&myList;
186 iType=TypeToInteger(aType);
187 if (iType>-1 && iType<myMaxInd) {
188 NMTDS_MapIteratorOfMapOfPassKeyBoolean aIt;
190 aIt.Initialize(myTable[iType]);
191 for(; aIt.More(); aIt.Next()) {
192 const NMTDS_PassKeyBoolean& aPKB=aIt.Key();
198 //=======================================================================
201 //=======================================================================
202 const NMTDS_ListOfPassKeyBoolean& NMTDS_InterfPool::Get(const Standard_Integer aInd,
203 const NMTDS_InterfType aType)const
205 Standard_Integer n1, n2;
206 NMTDS_ListOfPassKeyBoolean *pL, aLPKB;
207 NMTDS_ListIteratorOfListOfPassKeyBoolean aIt;
211 pL=(NMTDS_ListOfPassKeyBoolean*)&myList;
214 aIt.Initialize (aLPKB);
215 for (; aIt.More(); aIt.Next()) {
216 const NMTDS_PassKeyBoolean& aPKB=aIt.Value();
218 if(n1==aInd || n2==aInd) {
225 //===========================================================================
226 //function : SSInterferences
228 //===========================================================================
229 BOPTools_CArray1OfSSInterference& NMTDS_InterfPool::SSInterferences()
231 return mySSInterferences;
233 //===========================================================================
234 //function : ESInterferences
236 //===========================================================================
237 BOPTools_CArray1OfESInterference& NMTDS_InterfPool::ESInterferences()
239 return myESInterferences;
241 //===========================================================================
242 //function : VSInterferences
244 //===========================================================================
245 BOPTools_CArray1OfVSInterference& NMTDS_InterfPool::VSInterferences()
247 return myVSInterferences;
249 //===========================================================================
250 //function : EEInterferences
252 //===========================================================================
253 BOPTools_CArray1OfEEInterference& NMTDS_InterfPool::EEInterferences()
255 return myEEInterferences;
257 //===========================================================================
258 //function : VEInterferences
260 //===========================================================================
261 BOPTools_CArray1OfVEInterference& NMTDS_InterfPool::VEInterferences()
263 return myVEInterferences;
265 //===========================================================================
266 //function : VVInterferences
268 //===========================================================================
269 BOPTools_CArray1OfVVInterference& NMTDS_InterfPool::VVInterferences()
271 return myVVInterferences;
274 //=======================================================================
275 //function : TypeToInteger
277 //=======================================================================
278 Standard_Integer TypeToInteger(const NMTDS_InterfType aType)
280 return (Standard_Integer)aType;