0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / MeshVS / MeshVS_TwoNodes.hxx
CommitLineData
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//!
27struct 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
2b2be3fb 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]
39inline Standard_Integer HashCode (const MeshVS_TwoNodes& theTwoNodes, const Standard_Integer theUpperBound)
7fd59977 40{
2b2be3fb 41 // symmetrical with respect to theTwoNodes.First and theTwoNodes.Second
42 const Standard_Integer aKey = theTwoNodes.First + theTwoNodes.Second;
43 return HashCode (aKey, theUpperBound);
7fd59977 44}
45
46//================================================================
47// Function : operator ==
48// Purpose :
49//================================================================
50
51inline Standard_Boolean operator==( const MeshVS_TwoNodes& obj1,
52 const MeshVS_TwoNodes& obj2 )
53{
54 return ( ( obj1.First == obj2.First ) && ( obj1.Second == obj2.Second ) ) ||
55 ( ( obj1.First == obj2.Second ) && ( obj1.Second == obj2.First ) );
56}
57
58#endif