DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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)
36 
37 #define ConceptUtils_RECURSES
38 
39 #if !defined ConceptUtils_h
40 
41 #define ConceptUtils_h
42 
44 // Inclusions
45 #include <iostream>
46 #include "DGtal/base/Common.h"
48 
49 namespace DGtal
50 {
54  struct TagFalse{};
55 
59  struct TagTrue{};
60 
64  struct TagUnknown{};
65 
70  template<typename T>
71  struct Negate
72  { typedef TagUnknown type; };
73  template<>
74  struct Negate<TagTrue>
75  { typedef TagFalse type; };
76  template<>
77  struct Negate<TagFalse>
78  { typedef TagTrue type; };
79 
86  template <class T>
87  struct DummyObject : public boost::static_object<T>
88  {};
89 
91 // Namespace ConceptUtils
98 namespace ConceptUtils
99 {
104  template<typename T1, typename T2>
105  struct SameType
106  { static const bool value = false; };
107 
108  template<typename T>
109  struct SameType<T,T>
110  { static const bool value = true; };
111 
118  template <typename T>
119  void sameType( const T & t1, const T & t2 );
120 
124  template<typename T>
125  struct CheckTrue
126  { static const bool value = false; };
127  template<>
129  { static const bool value = true; };
130 
134  template<typename T>
135  struct CheckFalse
136  { static const bool value = !CheckTrue<T>::value; };
137 
141  template<typename T>
143  { static const bool value = false; };
144  template<>
146  { static const bool value = true; };
147 
151  template<typename T>
153  { static const bool value = CheckTrue<T>::value||CheckFalse<T>::value; };
154 
158  template<typename T>
159  struct CheckTag
160  { static const bool value = CheckTrueOrFalse<T>::value||CheckUnknown<T>::value; };
161 
166  void checkTrue( const TagTrue & tag );
167 
172  void checkFalse( const TagFalse & tag );
173 
178  void checkUnknown( const TagUnknown & tag );
179 
184  void checkTag( const TagUnknown & tag );
185 
190  void checkTag( const TagTrue & tag );
191 
196  void checkTag( const TagFalse & tag );
197 
202  void checkTrueOrFalse( const TagFalse & tag );
203 
208  void checkTrueOrFalse( const TagTrue & tag );
209 
210 
211 } // end of namespace ConceptUtils
212 
213 } // namespace DGtal
214 
215 // //
217 
218 #endif // !defined ConceptUtils_h
219 
220 #undef ConceptUtils_RECURSES
221 #endif // else defined(ConceptUtils_RECURSES)