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_CHAIN_ITERABLE_CONCEPT_HPP 00022 #define BTK_CONCEPTS_CHAIN_ITERABLE_CONCEPT_HPP 00023 00024 #include <boost/concept_check.hpp> 00025 00026 #include <btk/core/concepts/chain_iterator_concept.hpp> 00027 00028 namespace BTK { 00029 namespace CONCEPTS { 00030 00031 template <typename T> 00032 struct ChainIterableConcept 00033 { 00034 typedef typename T::size_type st; 00035 typedef typename T::const_chain_iterator const_chain_it; 00036 typedef typename T::const_reverse_chain_iterator const_rev_chain_it; 00037 00038 void constraints() 00039 { 00040 boost::function_requires<ChainIteratorConcept<const_chain_it> >(); 00041 boost::function_requires<ChainIteratorConcept<const_rev_chain_it> >(); 00042 00043 const_constraints(obj); 00044 } 00045 00046 void const_constraints(T const & c_obj) 00047 { 00048 size = c_obj.num_chains(); 00049 00050 cci = c_obj.system_begin(); 00051 cci = c_obj.system_end(); 00052 00053 crci = c_obj.system_rbegin(); 00054 crci = c_obj.system_rend(); 00055 } 00056 00057 T obj; 00058 st size; 00059 const_chain_it cci; 00060 const_rev_chain_it crci; 00061 }; 00062 00063 template <typename T> 00064 struct MutableChainIterableConcept 00065 { 00066 typedef typename T::chain_iterator chain_it; 00067 typedef typename T::reverse_chain_iterator rev_chain_it; 00068 00069 void constraints() 00070 { 00071 boost::function_requires<ChainIterableConcept<T> >(); 00072 boost::function_requires<MutableChainIteratorConcept<chain_it> >(); 00073 boost::function_requires<MutableChainIteratorConcept<rev_chain_it> >(); 00074 00075 ci = obj.system_begin(); 00076 ci = obj.system_end(); 00077 00078 rci = obj.system_rbegin(); 00079 rci = obj.system_rend(); 00080 } 00081 00082 T obj; 00083 chain_it ci; 00084 rev_chain_it rci; 00085 }; 00086 00087 } // CONCEPTS 00088 } // BTK 00089 00090 #endif