Tulip  5.4.0
Large graphs analysis and drawing
Face.h
1 /*
2  *
3  * This file is part of Tulip (http://tulip.labri.fr)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 #ifndef Tulip_FACE_H
22 #define Tulip_FACE_H
23 
24 #include <climits>
25 #include <functional>
26 
27 namespace tlp {
28 
29 struct Face {
30  unsigned int id;
31  Face() : id(UINT_MAX) {}
32  explicit Face(unsigned int j) : id(j) {}
33  bool operator!=(const Face f) const {
34  return id != f.id;
35  }
36  bool operator==(const Face f) const {
37  return id == f.id;
38  }
39  bool isValid() const {
40  return id != UINT_MAX;
41  }
42 };
43 } // namespace tlp
44 
45 namespace std {
46 template <>
47 struct hash<tlp::Face> {
48  size_t operator()(const tlp::Face f) const {
49  return f.id;
50  }
51 };
52 template <>
53 struct equal_to<tlp::Face> {
54  size_t operator()(const tlp::Face f, const tlp::Face f2) const {
55  return f.id == f2.id;
56  }
57 };
58 template <>
59 struct less<tlp::Face> {
60  size_t operator()(const tlp::Face f, const tlp::Face f2) const {
61  return f.id < f2.id;
62  }
63 };
64 } // namespace std
65 
66 #endif
67 ///@endcond
Definition: TlpTools.h:48