Tulip  5.2.1
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 #include <tulip/tulipconf.h>
24 #include <tulip/tuliphash.h>
25 
26 #include <climits>
27 
28 namespace tlp {
29 
30 struct Face {
31  unsigned int id;
32  Face() : id(UINT_MAX) {}
33  explicit Face(unsigned int j) : id(j) {}
34  bool operator!=(const Face f) const {
35  return id != f.id;
36  }
37  bool operator==(const Face f) const {
38  return id == f.id;
39  }
40  bool isValid() const {
41  return id != UINT_MAX;
42  }
43 };
44 } // namespace tlp
45 
46 TLP_BEGIN_HASH_NAMESPACE {
47  template <>
48  struct hash<tlp::Face> {
49  size_t operator()(const tlp::Face f) const {
50  return f.id;
51  }
52  };
53 }
54 TLP_END_HASH_NAMESPACE
55 
56 namespace std {
57 template <>
58 struct equal_to<tlp::Face> {
59  size_t operator()(const tlp::Face f, const tlp::Face f2) const {
60  return f.id == f2.id;
61  }
62 };
63 template <>
64 struct less<tlp::Face> {
65  size_t operator()(const tlp::Face f, const tlp::Face f2) const {
66  return f.id < f2.id;
67  }
68 };
69 } // namespace std
70 
71 #endif
72 ///@endcond