Tulip  4.7.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
Face.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
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 
22 #ifndef Tulip_FACE_H
23 #define Tulip_FACE_H
24 #include <tulip/tulipconf.h>
25 #include <tulip/tuliphash.h>
26 
27 #include <climits>
28 
29 namespace tlp {
30 
31 struct Face {
32  unsigned int id;
33  Face():id(UINT_MAX) {}
34  explicit Face(unsigned int j):id(j) {}
35  bool operator!=(const Face f) const {
36  return id!=f.id;
37  }
38  bool operator==(const Face f) const {
39  return id==f.id;
40  }
41  bool isValid() const {
42  return id!=UINT_MAX;
43  }
44 };
45 
46 }
47 
48 #ifndef DOXYGEN_NOTFOR_DEVEL
49 
50 TLP_BEGIN_HASH_NAMESPACE {
51  template<> struct hash<tlp::Face> {
52  size_t operator()(const tlp::Face f) const {return f.id;}
53  };
54 }
55 TLP_END_HASH_NAMESPACE
56 
57 namespace std {
58 template<> 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<> struct less<tlp::Face> {
64  size_t operator()(const tlp::Face f,const tlp::Face f2) const {
65  return f.id < f2.id;
66  }
67 };
68 }
69 #endif // DOXYGEN_NOTFOR_DEVEL
70 
71 #endif
72 ///@endcond