00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00023
00024 #ifndef BTK_CONCEPTS_CHEMICALLY_TYPED_CONCEPT_HPP
00025 #define BTK_CONCEPTS_CHEMICALLY_TYPED_CONCEPT_HPP
00026
00147
00148 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00149
00150 #include <string>
00151 #include <boost/concept_check.hpp>
00152 #include <btk/core/concepts/type_system_concept.hpp>
00153 #include <btk/core/concepts/type_id_concept.hpp>
00154
00155 namespace BTK {
00156 namespace CONCEPTS {
00157
00158 template <typename T>
00159 struct StrictlyChemicallyTypedConcept
00160 {
00161 typedef typename T::chemical_type_system ts_t;
00162 typedef typename T::dictionary dict_t;
00163 typedef typename T::id_type id_t;
00164
00165 void constraints() {
00166 boost::function_requires<TypeSystemConcept<ts_t> >();
00167 boost::function_requires<TypeIDConcept<id_t> >();
00168
00169 const_constraints(obj);
00170 }
00171
00172 void const_constraints(T const & t) {
00173 id = obj.type();
00174 name = obj.name();
00175 ts_t const & ctsr = obj.get_chemical_type_system();
00176 dict_t const & dr = obj.get_dictionary();
00177
00178 boost::ignore_unused_variable_warning(ctsr);
00179 boost::ignore_unused_variable_warning(dr);
00180 }
00181
00182 T obj;
00183 id_t id;
00184 std::string name;
00185 };
00186
00187 }
00188 }
00189
00190 #endif // DOXYGEN_SHOULD_SKIP_THIS
00191
00288
00289 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00290
00291 namespace BTK {
00292 namespace CONCEPTS {
00293
00294 template <typename T>
00295 struct ChemicallyTypedConcept
00296 {
00297 typedef typename T::chemical_type_system ts_t;
00298 typedef typename T::dictionary dict_t;
00299 typedef typename T::id_type id_t;
00300
00301 void constraints() {
00302 boost::function_requires<StrictlyChemicallyTypedConcept<T> >();
00303
00304 dict_t & d = obj.get_dictionary();
00305 ts_t & t = obj.get_chemical_type_system();
00306
00307 obj.set_type(id);
00308 obj.set_chemical_type_system(cts);
00309
00310 boost::ignore_unused_variable_warning(d);
00311 boost::ignore_unused_variable_warning(t);
00312 }
00313
00314 T obj;
00315 id_t id;
00316 ts_t cts;
00317 };
00318
00319 }
00320 }
00321
00322 #endif // DOXYGEN_SHOULD_SKIP_THIS
00323
00324 #endif // BTK_CONCEPTS_CHEMICALLY_TYPED_CONCEPT_HPP