DGtal  1.3.beta
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>
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)
DGtal::concepts::ConceptUtils::checkTrue
void checkTrue(const TagTrue &tag)
DGtal::DummyObject
Definition: ConceptUtils.h:86
DGtal::TagFalse
Definition: ConceptUtils.h:53
DGtal::concepts::ConceptUtils::CheckTrueOrFalse
Definition: ConceptUtils.h:150
DGtal::Negate< TagTrue >::type
TagFalse type
Definition: ConceptUtils.h:74
DGtal::concepts::ConceptUtils::CheckTag
Definition: ConceptUtils.h:157
DGtal::concepts::ConceptUtils::CheckTrue
Definition: ConceptUtils.h:123
DGtal::Negate< TagFalse >::type
TagTrue type
Definition: ConceptUtils.h:77
DGtal::TagUnknown
Definition: ConceptUtils.h:63
DGtal::concepts::ConceptUtils::CheckUnknown
Definition: ConceptUtils.h:140
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::concepts::ConceptUtils::CheckFalse
Definition: ConceptUtils.h:133
DGtal::concepts::ConceptUtils::sameType
void sameType(const T &, const T &)
Definition: ConceptUtils.h:117
DGtal::concepts::ConceptUtils::SameType
Definition: ConceptUtils.h:106
DGtal::Negate::type
TagUnknown type
Definition: ConceptUtils.h:71
DGtal::TagTrue
Definition: ConceptUtils.h:58
DGtal::concepts::ConceptUtils::checkUnknown
void checkUnknown(const TagUnknown &tag)
DGtal::concepts::ConceptUtils::checkFalse
void checkFalse(const TagFalse &tag)
DGtal::Negate
Definition: ConceptUtils.h:70
DGtal::concepts::ConceptUtils::checkTrueOrFalse
void checkTrueOrFalse(const TagFalse &tag)
DGtal::concepts::ConceptUtils::checkTag
void checkTag(const TagUnknown &tag)