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: GEOMAlgo_Algo.cxx
23 // Created: Sat Dec 04 12:39:47 2004
24 // Author: Peter KURNEV
27 #include <GEOMAlgo_PassKey.ixx>
31 #include <TColStd_ListIteratorOfListOfInteger.hxx>
32 #include <TColStd_ListOfInteger.hxx>
35 #pragma warning( disable : 4101)
39 Standard_Integer NormalizedId(const Standard_Integer aId,
40 const Standard_Integer aDiv);
42 //=======================================================================
45 //=======================================================================
46 GEOMAlgo_PassKey::GEOMAlgo_PassKey()
50 //=======================================================================
53 //=======================================================================
54 GEOMAlgo_PassKey::GEOMAlgo_PassKey(const GEOMAlgo_PassKey& aOther)
56 myNbIds=aOther.myNbIds;
60 //=======================================================================
63 //=======================================================================
64 GEOMAlgo_PassKey& GEOMAlgo_PassKey::Assign(const GEOMAlgo_PassKey& aOther)
66 myNbIds=aOther.myNbIds;
71 //=======================================================================
74 //=======================================================================
75 GEOMAlgo_PassKey::~GEOMAlgo_PassKey()
78 //=======================================================================
81 //=======================================================================
82 void GEOMAlgo_PassKey::Clear()
88 //=======================================================================
91 //=======================================================================
92 void GEOMAlgo_PassKey::SetIds(const Standard_Integer aId1)
98 mySum=NormalizedId(aId1, myNbIds);
100 //=======================================================================
103 //=======================================================================
104 void GEOMAlgo_PassKey::SetIds(const Standard_Integer aId1,
105 const Standard_Integer aId2)
107 TColStd_ListOfInteger aLI;
113 //=======================================================================
116 //=======================================================================
117 void GEOMAlgo_PassKey::SetIds(const Standard_Integer aId1,
118 const Standard_Integer aId2,
119 const Standard_Integer aId3)
121 TColStd_ListOfInteger aLI;
128 //=======================================================================
131 //=======================================================================
132 void GEOMAlgo_PassKey::SetIds(const Standard_Integer aId1,
133 const Standard_Integer aId2,
134 const Standard_Integer aId3,
135 const Standard_Integer aId4)
137 TColStd_ListOfInteger aLI;
145 //=======================================================================
148 //=======================================================================
149 void GEOMAlgo_PassKey::SetIds(const TColStd_ListOfInteger& aLI)
151 Standard_Integer i, aId, aIdN;
152 TColStd_ListIteratorOfListOfInteger aIt;
156 for (; aIt.More(); aIt.Next()) {
160 myNbIds=myMap.Extent();
161 for(i=1; i<=myNbIds; ++i) {
163 aIdN=NormalizedId(aId, myNbIds);
167 //=======================================================================
170 //=======================================================================
171 Standard_Integer GEOMAlgo_PassKey::NbIds()const
175 //=======================================================================
178 //=======================================================================
179 Standard_Integer GEOMAlgo_PassKey::Id(const Standard_Integer aIndex) const
181 if (aIndex<1 || aIndex>myNbIds) {
184 return myMap(aIndex);
186 //=======================================================================
189 //=======================================================================
190 Standard_Boolean GEOMAlgo_PassKey::IsEqual(const GEOMAlgo_PassKey& aOther) const
192 Standard_Boolean bRet;
193 Standard_Integer i, aId;
197 if (myNbIds!=aOther.myNbIds) {
200 for (i=1; i<=myNbIds; ++i) {
202 if (!aOther.myMap.Contains(aId)) {
208 //=======================================================================
209 //function : HashCode
211 //=======================================================================
212 Standard_Integer GEOMAlgo_PassKey::HashCode(const Standard_Integer aUpper) const
214 return ::HashCode(mySum, aUpper);
216 //=======================================================================
219 //=======================================================================
220 void GEOMAlgo_PassKey::Dump(const Standard_Integer )const
223 //=======================================================================
224 // function: NormalizedId
226 //=======================================================================
227 Standard_Integer NormalizedId(const Standard_Integer aId,
228 const Standard_Integer aDiv)
230 Standard_Integer aMax, aTresh, aIdRet;
233 aMax=::IntegerLast();