1 // Copyright (C) 2007-2024 CEA, EDF, 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, or (at your option) any later version.
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 // SALOME Basics : general SALOME definitions and tools (C++ part - no CORBA)
21 // File : smIdType.hxx
23 #ifndef _SMIDTYPE_HXX_
24 #define _SMIDTYPE_HXX_
26 #cmakedefine SALOME_USE_64BIT_IDS
28 #include "Basics_OCCTVersion.hxx"
34 #ifndef SALOME_USE_64BIT_IDS
35 typedef std::int32_t smIdType;
37 typedef std::int64_t smIdType;
42 #if OCC_VERSION_LARGE < 0x07080000
43 static int HashCode(const smIdType theValue, const int theUpperBound)
45 return static_cast<int> ((theValue & std::numeric_limits<smIdType>::max()) % theUpperBound + 1);
48 static bool IsEqual( const smIdType& id1, const smIdType& id2 )
53 size_t operator()(const smIdType theValue) const
55 return static_cast<size_t> (theValue & std::numeric_limits<smIdType>::max());
57 bool operator()(const smIdType& theValue1, const smIdType& theValue2) const
59 return theValue1 == theValue2;
64 template <class T> inline smIdType ToSmIdType(T val)
66 return static_cast<smIdType>(val);
68 template <class T> inline T FromSmIdType(smIdType val)
70 return static_cast<T>(val);
73 #endif //_SMIDTYPE_HXX_