type_system_concept.hpp

Go to the documentation of this file.
00001 // -*- mode: c++; indent-tabs-mode: nil; -*-
00002 //
00003 //The Biomolecule Toolkit (BTK) is a C++ library for use in the
00004 //modeling, analysis, and design of biological macromolecules.
00005 //Copyright (C) 2006, Tim Robertson <kid50@users.sourceforge.net>
00006 //
00007 //This program is free software; you can redistribute it and/or modify
00008 //it under the terms of the GNU Lesser General Public License as published
00009 //by the Free Software Foundation; either version 2.1 of the License, or (at
00010 //your option) any later version.
00011 //
00012 //This program is distributed in the hope that it will be useful,  but
00013 //WITHOUT ANY WARRANTY; without even the implied warranty of
00014 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 //Lesser General Public License for more details.
00016 //
00017 //You should have received a copy of the GNU Lesser General Public License
00018 //along with this program; if not, write to the Free Software Foundation,
00019 //Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00020 
00021 #ifndef BTK_CONCEPTS_TYPE_SYSTEM_CONCEPT_HPP
00022 #define BTK_CONCEPTS_TYPE_SYSTEM_CONCEPT_HPP
00023 
00024 #include <boost/concept_check.hpp>
00025 
00026 namespace BTK {
00027 namespace CONCEPTS {
00028 
00029 template <class T>
00030 struct TypeSystemConcept
00031 {
00032   typedef typename T::element_dictionary edt;
00033   typedef typename T::atom_dictionary adt;
00034   typedef typename T::monomer_dictionary mdt;
00035   typedef typename T::structure_dictionary sdt;
00036   
00037   typedef typename T::element_id_type eid;
00038   typedef typename T::atom_id_type aid;
00039   typedef typename T::monomer_id_type mid;
00040   typedef typename T::structure_id_type sid;
00041 
00042   // a way to avoid annoying "unused variable" warnings.
00043   template<class U> inline void unused_variable(const U&) {}
00044 
00045   void constraints() {
00046     boost::function_requires<boost::DefaultConstructibleConcept<T> >();
00047     boost::function_requires<boost::CopyConstructibleConcept<T> >();
00048     boost::function_requires<boost::AssignableConcept<T> >();
00049     
00050     edt & e = type_system.get_element_dictionary();
00051     adt & a = type_system.get_atom_dictionary();
00052     mdt & m = type_system.get_monomer_dictionary();
00053     sdt & s = type_system.get_structure_dictionary();
00054 
00055     unused_variable(e);
00056     unused_variable(a);
00057     unused_variable(m);
00058     unused_variable(s);
00059 
00060     const_constraints(type_system);
00061   }
00062 
00063   void const_constraints(T const & ts) {
00064     
00065     edt const & e = ts.get_element_dictionary();
00066     adt const & a = ts.get_atom_dictionary();
00067     mdt const & m = ts.get_monomer_dictionary();
00068     sdt const & s = ts.get_structure_dictionary();
00069 
00070     unused_variable(e);
00071     unused_variable(a);
00072     unused_variable(m);
00073     unused_variable(s);
00074   }
00075 
00076   T type_system;
00077 };
00078 
00079 } // namespace CONCEPTS
00080 } // namespace BTK
00081 
00082 #endif 

Generated on Sun Jul 15 20:46:27 2007 for BTK Core by  doxygen 1.5.1