1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #ifndef __TWO_NODES_STRUCT_HEADER__
15 #define __TWO_NODES_STRUCT_HEADER__
17 #ifndef _Standard_HeaderFile
18 #include <Standard.hxx>
20 #ifndef _Standard_Macro_HeaderFile
21 #include <Standard_Macro.hxx>
24 //! Structure containing two IDs (of nodes) for using as a key in a map
25 //! (as representation of a mesh link)
27 struct MeshVS_TwoNodes
29 Standard_Integer First, Second;
31 MeshVS_TwoNodes (Standard_Integer aFirst=0, Standard_Integer aSecond=0)
32 : First(aFirst), Second(aSecond) {}
35 //! Computes a hash code for two nodes, in the range [1, theUpperBound]
36 //! @param theTwoNodes the object of structure containing two IDs which hash code is to be computed
37 //! @param theUpperBound the upper bound of the range a computing hash code must be within
38 //! @return a computed hash code, in the range [1, theUpperBound]
39 inline Standard_Integer HashCode (const MeshVS_TwoNodes& theTwoNodes, const Standard_Integer theUpperBound)
41 // symmetrical with respect to theTwoNodes.First and theTwoNodes.Second
42 const Standard_Integer aKey = theTwoNodes.First + theTwoNodes.Second;
43 return HashCode (aKey, theUpperBound);
46 //================================================================
47 // Function : operator ==
49 //================================================================
51 inline Standard_Boolean operator==( const MeshVS_TwoNodes& obj1,
52 const MeshVS_TwoNodes& obj2 )
54 return ( ( obj1.First == obj2.First ) && ( obj1.Second == obj2.Second ) ) ||
55 ( ( obj1.First == obj2.Second ) && ( obj1.Second == obj2.First ) );