molecule.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_MOLECULES_MOLECULE_HPP
00025 #define BTK_MOLECULES_MOLECULE_HPP
00026 
00027 #include <btk/core/molecules/chain.hpp>
00028 
00029 namespace BTK {
00030 namespace MOLECULES {
00031 
00044 template <typename AtomType,
00045           typename ChemicalTypeSystemType = 
00046             typename AtomType::chemical_type_system,
00047           typename DictionaryType = 
00048             typename ChemicalTypeSystemType::structure_dictionary,
00049           typename StorageStrategy = std::vector<AtomType> >
00050 class Molecule :
00051     public Chain<AtomType,
00052                  ChemicalTypeSystemType,
00053                  DictionaryType,
00054                  StorageStrategy>,
00055     public boost::less_than_comparable<Chain<AtomType,
00056                                              ChemicalTypeSystemType,
00057                                              DictionaryType,
00058                                              StorageStrategy> >
00059 {
00060   typedef Chain<AtomType,
00061                 ChemicalTypeSystemType,
00062                 DictionaryType,
00063                 StorageStrategy> base_type;
00064   typedef Molecule<AtomType,
00065                    ChemicalTypeSystemType,
00066                    DictionaryType,
00067                    StorageStrategy> self_type;
00068 
00069 public:
00070   IMPORT_ATOMIC_STRUCTURE_TYPES(base_type);
00071 
00072   Molecule(size_type n = 0, 
00073            const_reference t = atom_type(),
00074            id_type type = id_type(),
00075            char chain_id = ' ') :
00076     base_type(n,t,type,chain_id) {}
00077 
00078   template <typename AtomIterator>
00079   Molecule(AtomIterator i, AtomIterator j, 
00080            id_type type = id_type(), 
00081            char chain_id = ' ') :
00082     base_type(i,j,type,chain_id) {}
00083 
00084   Molecule(self_type const & source) : base_type(source) {}
00085 
00086   virtual ~Molecule() {}
00087 
00088   //
00089   // Bring the STL Sequence Concept methods into the public interface.
00090   // (It's OK to insert/delete individual atoms into a Molecule).
00091   //
00092   IMPORT_BTK_SEQUENCE_METHODS(base_type);
00093 
00094   using base_type::set_type;
00095   using base_type::set_chemical_type_system;
00096 
00097   virtual dictionary const & get_dictionary() const 
00098   {
00099     return base_type::get_chemical_type_system().get_structure_dictionary();
00100   }
00101 
00102   virtual dictionary & get_dictionary() 
00103   {
00104     return base_type::get_chemical_type_system().get_structure_dictionary();
00105   }
00106 
00107   void swap(self_type & b)
00108   {
00109     base_type::swap(b);
00110   }
00111 
00112   self_type const & operator=(self_type const & rhs)
00113   {
00114     if (this == &rhs) return *this;
00115     base_type::operator=(rhs);
00116     return *this;
00117   }
00118 
00119   bool operator==(self_type const & rhs) const
00120   {
00121     return base_type::operator==(rhs);
00122   }
00123 
00124   bool operator!=(self_type const & rhs) const
00125   {
00126     return base_type::operator!=(rhs);
00127   }
00128 
00129   bool operator<(self_type const & rhs) const
00130   {
00131     return base_type::operator<(rhs);
00132   }
00133 };
00134 
00135 } // namespace MOLECULES
00136 } // namespace BTK
00137 
00138 #endif

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