monomer_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) 2004, 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_MONOMER_CONCEPT_HPP
00022 #define BTK_CONCEPTS_MONOMER_CONCEPT_HPP
00023 
00024 #include <string>
00025 #include <vector>
00026 
00027 #include <boost/concept_check.hpp>
00028 
00029 #include <btk/core/concepts/atomic_structure_concept.hpp>
00030 
00031 namespace BTK {
00032 namespace CONCEPTS {
00033 
00034 template <class T>
00035 struct MonomerConcept
00036 {
00037   typedef typename T::atom_type at;
00038   typedef typename T::atom_iterator atom_it;
00039   typedef typename T::const_atom_iterator const_atom_it;
00040   typedef typename T::reverse_atom_iterator rev_atom_it;
00041   typedef typename T::const_reverse_atom_iterator const_rev_atom_it;
00042   typedef typename T::monomer_id_type monomer_id_type;
00043 
00044   void constraints() {
00045     boost::function_requires<AtomicStructureConcept<T> >();
00046     boost::function_requires<boost::DefaultConstructibleConcept<T> >();
00047 
00048     // constructors
00049     {
00050       // construct from arbitrary atom iterators
00051       T m1(first,last,type,num);
00052 
00053       // construct from atom iterators
00054       T m2(begin,end,type,num);
00055     }
00056 
00057     monomer.set_number(num);
00058 
00059     ai = monomer.monomer_begin();
00060     ai = monomer.monomer_end();
00061     rai = monomer.monomer_rbegin();
00062     rai = monomer.monomer_rend();
00063 
00064     const_constraints(monomer);
00065   }
00066 
00067   void const_constraints(T const & monomer) {
00068     num = monomer.number();
00069 
00070     cai = monomer.monomer_begin();
00071     cai = monomer.monomer_end();
00072     crai = monomer.monomer_rbegin();
00073     crai = monomer.monomer_rend();
00074   }
00075 
00076   T monomer;
00077   monomer_id_type type;
00078   typename std::vector<at>::iterator first,last;
00079   atom_it begin,end,ai;
00080   const_atom_it cai;
00081   rev_atom_it rai;
00082   const_rev_atom_it crai;
00083   int num;
00084 };
00085 
00086 } // namespace CONCEPTS
00087 } // namespace BTK
00088 
00089 #endif

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