Tulip  5.1.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 #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 
45 }
46 
47 TLP_BEGIN_HASH_NAMESPACE {
48  template<> struct hash<tlp::Face> {
49  size_t operator()(const tlp::Face f) const {return f.id;}
50  };
51 }
52 TLP_END_HASH_NAMESPACE
53 
54 namespace std {
55 template<> struct equal_to<tlp::Face> {
56  size_t operator()(const tlp::Face f,const tlp::Face f2) const {
57  return f.id == f2.id;
58  }
59 };
60 template<> struct less<tlp::Face> {
61  size_t operator()(const tlp::Face f,const tlp::Face f2) const {
62  return f.id < f2.id;
63  }
64 };
65 }
66 
67 #endif
68 ///@endcond