0031789: Coding Rules - remove redundant Standard_EXPORT from TKMesh
[occt.git] / src / BRepMesh / BRepMesh_OrientedEdge.hxx
1 // Copyright (c) 2013 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
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.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14 #ifndef _BRepMesh_OrientedEdge_HeaderFile
15 #define _BRepMesh_OrientedEdge_HeaderFile
16
17 #include <Standard.hxx>
18 #include <Standard_DefineAlloc.hxx>
19 #include <Standard_Macro.hxx>
20 #include <BRepMesh_DegreeOfFreedom.hxx>
21
22 //! Light weighted structure representing simple link.
23 class BRepMesh_OrientedEdge
24 {
25 public:
26
27   DEFINE_STANDARD_ALLOC
28
29   //! Default constructor.
30   BRepMesh_OrientedEdge()
31     : myFirstNode(-1),
32       myLastNode(-1)
33   {
34   }
35
36   //! Constructs a link between two vertices.
37   BRepMesh_OrientedEdge(
38     const Standard_Integer theFirstNode,
39     const Standard_Integer theLastNode)
40     : myFirstNode(theFirstNode),
41       myLastNode(theLastNode)
42   {
43   }
44
45   //! Returns index of first node of the Link.
46   Standard_Integer FirstNode() const
47   {
48     return myFirstNode;
49   }
50
51   //! Returns index of last node of the Link.
52   Standard_Integer LastNode() const
53   {
54     return myLastNode;
55   }
56
57   //! Computes a hash code for this oriented edge, in the range [1, theUpperBound]
58   //! @param theUpperBound the upper bound of the range a computing hash code must be within
59   //! @return a computed hash code, in the range [1, theUpperBound]
60   Standard_Integer HashCode (const Standard_Integer theUpperBound) const
61   {
62     return ::HashCode (myFirstNode + myLastNode, theUpperBound);
63   }
64
65   //! Checks this and other edge for equality.
66   //! @param theOther edge to be checked against this one.
67   //! @retrun TRUE if edges have the same orientation, FALSE if not.
68   Standard_Boolean IsEqual(const BRepMesh_OrientedEdge& theOther) const
69   {
70     return (myFirstNode == theOther.myFirstNode && myLastNode == theOther.myLastNode);
71   }
72
73   //! Alias for IsEqual.
74   Standard_Boolean operator ==(const BRepMesh_OrientedEdge& Other) const
75   {
76     return IsEqual(Other);
77   }
78
79 private:
80
81   Standard_Integer myFirstNode;
82   Standard_Integer myLastNode;
83 };
84
85 //! Computes a hash code for the given oriented edge, in the range [1, theUpperBound]
86 //! @param theOrientedEdge the oriented edge which hash code is to be computed
87 //! @param theUpperBound the upper bound of the range a computing hash code must be within
88 //! @return a computed hash code, in the range [1, theUpperBound]
89 inline Standard_Integer HashCode (const BRepMesh_OrientedEdge& theOrientedEdge, const Standard_Integer theUpperBound)
90 {
91   return theOrientedEdge.HashCode (theUpperBound);
92 }
93
94 #endif