atom_iterable_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 
00023 
00024 #ifndef BTK_CONCEPTS_ATOM_ITERABLE_CONCEPT_HPP
00025 #define BTK_CONCEPTS_ATOM_ITERABLE_CONCEPT_HPP
00026 
00202 
00203 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00204 
00205 #include <boost/concept_check.hpp>
00206 
00207 #include <btk/core/concepts/atom_iterator_concept.hpp>
00208 
00209 namespace BTK {
00210 namespace CONCEPTS {
00211 
00212 template <typename T>
00213 struct AtomIterableConcept
00214 {
00215   typedef typename T::size_type st;
00216   typedef typename T::const_atom_iterator const_atom_it;
00217   typedef typename T::const_reverse_atom_iterator const_rev_atom_it;
00218   typedef typename T::atom_iterator atom_it;
00219   typedef typename T::reverse_atom_iterator rev_atom_it;
00220 
00221   void constraints() {
00222     boost::function_requires<AtomIterableConcept<T> >();
00223     boost::function_requires<MutableAtomIteratorConcept<atom_it> >();
00224     boost::function_requires<MutableAtomIteratorConcept<rev_atom_it> >();
00225 
00226     ai = obj.structure_begin();
00227     ai = obj.structure_end();
00228     rai = obj.structure_rbegin();
00229     rai = obj.structure_rend();
00230 
00231     const_constraints(obj);
00232   };
00233 
00234   void const_constraints(T const & ac) {
00235     boost::function_requires<AtomIteratorConcept<const_atom_it> >();
00236     boost::function_requires<AtomIteratorConcept<const_rev_atom_it> >();
00237 
00238     size = ac.num_atoms();
00239 
00240     cai = ac.structure_begin();
00241     cai = ac.structure_end();
00242     crai = ac.structure_rbegin();
00243     crai = ac.structure_rend();  
00244   }
00245 
00246   T obj;
00247   st size;
00248   const_atom_it cai;
00249   const_rev_atom_it crai;
00250   atom_it ai;
00251   rev_atom_it rai;  
00252 };
00253 
00254 } // namespace CONCEPTS
00255 } // namespace BTK
00256 #endif // DOXYGEN_SHOULD_SKIP_THIS
00257 
00258 #endif // BTK_CONCEPTS_ATOM_ITERABLE_CONCEPT_HPP

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