973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
7fd59977 |
13 | |
14 | #ifndef __TWO_NODES_STRUCT_HEADER__ |
15 | #define __TWO_NODES_STRUCT_HEADER__ |
16 | |
17 | #ifndef _Standard_HeaderFile |
18 | #include <Standard.hxx> |
19 | #endif |
20 | #ifndef _Standard_Macro_HeaderFile |
21 | #include <Standard_Macro.hxx> |
22 | #endif |
23 | |
24 | //! Structure containing two IDs (of nodes) for using as a key in a map |
25 | //! (as representation of a mesh link) |
26 | //! |
27 | struct MeshVS_TwoNodes |
28 | { |
29 | Standard_Integer First, Second; |
30 | |
31 | MeshVS_TwoNodes (Standard_Integer aFirst=0, Standard_Integer aSecond=0) |
32 | : First(aFirst), Second(aSecond) {} |
33 | }; |
34 | |
35 | //================================================================ |
36 | // Function : HashCode |
37 | // Purpose : |
38 | //================================================================ |
39 | |
40 | inline Standard_Integer HashCode( const MeshVS_TwoNodes& obj, |
41 | const Standard_Integer Upper ) |
42 | { |
43 | // symmetrical with respect to obj.First and obj.Second |
44 | const Standard_Integer aKey = obj.First + obj.Second; |
45 | return HashCode (aKey, Upper); |
46 | } |
47 | |
48 | //================================================================ |
49 | // Function : operator == |
50 | // Purpose : |
51 | //================================================================ |
52 | |
53 | inline Standard_Boolean operator==( const MeshVS_TwoNodes& obj1, |
54 | const MeshVS_TwoNodes& obj2 ) |
55 | { |
56 | return ( ( obj1.First == obj2.First ) && ( obj1.Second == obj2.Second ) ) || |
57 | ( ( obj1.First == obj2.Second ) && ( obj1.Second == obj2.First ) ); |
58 | } |
59 | |
60 | #endif |