DGtal  1.2.0
ConceptUtils.h
1 
17 #pragma once
18 
33 #if defined(ConceptUtils_RECURSES)
34 #error Recursive header files inclusion detected in ConceptUtils.h
35 #else // defined(ConceptUtils_RECURSES)
37 #define ConceptUtils_RECURSES
38 
39 #if !defined ConceptUtils_h
41 #define ConceptUtils_h
42 
44 // Inclusions
45 #include <iostream>
47 
48 namespace DGtal
49 {
53  struct TagFalse{};
54 
58  struct TagTrue{};
59 
63  struct TagUnknown{};
64 
69  template<typename T>
70  struct Negate
71  { typedef TagUnknown type; };
72  template<>
73  struct Negate<TagTrue>
74  { typedef TagFalse type; };
75  template<>
76  struct Negate<TagFalse>
77  { typedef TagTrue type; };
78 
85  template <class T>
86  struct DummyObject : public boost::static_object<T>
87  {};
88 
90 // Namespace ConceptUtils
97  namespace concepts
98  {
99 namespace ConceptUtils
100 {
105  template<typename T1, typename T2>
106  struct SameType
107  { static const bool value = false; };
108 
109  template<typename T>
110  struct SameType<T,T>
111  { static const bool value = true; };
112 
116  template <typename T>
117  void sameType( const T & /* t1 */, const T & /* t2 */ ) {}
118 
122  template<typename T>
123  struct CheckTrue
124  { static const bool value = false; };
125  template<>
127  { static const bool value = true; };
128 
132  template<typename T>
133  struct CheckFalse
134  { static const bool value = !CheckTrue<T>::value; };
135 
139  template<typename T>
141  { static const bool value = false; };
142  template<>
144  { static const bool value = true; };
145 
149  template<typename T>
151  { static const bool value = CheckTrue<T>::value||CheckFalse<T>::value; };
152 
156  template<typename T>
157  struct CheckTag
158  { static const bool value = CheckTrueOrFalse<T>::value||CheckUnknown<T>::value; };
159 
164  void checkTrue( const TagTrue & tag );
165 
170  void checkFalse( const TagFalse & tag );
171 
176  void checkUnknown( const TagUnknown & tag );
177 
182  void checkTag( const TagUnknown & tag );
183 
188  void checkTag( const TagTrue & tag );
189 
194  void checkTag( const TagFalse & tag );
195 
200  void checkTrueOrFalse( const TagFalse & tag );
201 
206  void checkTrueOrFalse( const TagTrue & tag );
207 
208 
209 } // end of namespace ConceptUtils
210  } //end of namespace concepts.
211 } // namespace DGtal
212 
213 // //
215 
216 #endif // !defined ConceptUtils_h
217 
218 #undef ConceptUtils_RECURSES
219 #endif // else defined(ConceptUtils_RECURSES)
void checkUnknown(const TagUnknown &tag)
void checkFalse(const TagFalse &tag)
void checkTag(const TagUnknown &tag)
void sameType(const T &, const T &)
Definition: ConceptUtils.h:117
void checkTrue(const TagTrue &tag)
void checkTrueOrFalse(const TagFalse &tag)
DGtal is the top-level namespace which contains all DGtal functions and types.
TagUnknown type
Definition: ConceptUtils.h:71