Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

molecule.h

Go to the documentation of this file.
00001 // -*- mode: c++; -*-
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) 2001, Eric Alm <ealm3141@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 
00025 
00026 
00027 #ifndef BTK_MOLECULE_H
00028 #define BTK_MOLECULE_H
00029 
00030 
00031 #include "atom_container.h"
00032 
00033 #include <iosfwd>
00034 #include <string>
00035 #include <vector>
00036 
00037 
00038 namespace BTK {
00039 
00040 
00041   // user typedefs
00042   template <typename AtomType> class Molecule;
00043   typedef Molecule<Atom> basic_molecule;
00044 
00045 
00055 template <typename AtomType>
00056 class Molecule : public AtomContainer<AtomType> {
00057   typedef AtomContainer<AtomType> base_type;
00058  public:
00059   typedef Molecule<AtomType> self_type;
00060 
00062 
00063   typedef typename base_type::value_type value_type;
00064   typedef typename base_type::reference reference;
00065   typedef typename base_type::const_reference const_reference;
00066   typedef typename base_type::pointer pointer;
00067   typedef typename base_type::const_pointer const_pointer;
00068   typedef typename base_type::size_type size_type;
00069   typedef typename base_type::iterator iterator;
00070   typedef typename base_type::const_iterator const_iterator;
00072 
00074 
00075   typedef value_type atom_type;
00076   typedef iterator atom_iterator;
00077   typedef const_iterator const_atom_iterator;
00079 
00081 
00084   Molecule(size_type s = 0)
00085     : base_type(s), _chain_id('A'), _name(""){}
00086 
00090   template <typename AtomIterator>
00091   Molecule(AtomIterator first,
00092            AtomIterator last) 
00093     : base_type(first,last), _chain_id('A'), _name("") {}
00094 
00095   Molecule(const self_type& source) 
00096     : base_type(source), _chain_id(source._chain_id), _name(source._name) {}
00097 
00098   template <typename T2>
00099   Molecule(const Molecule<T2>& source) 
00100     : base_type(source), _chain_id(source.chain_id()), _name(source.name()) {}
00101   
00102   ~Molecule() {}
00103 
00105   self_type& operator=(const self_type& rhs);
00106 
00107   template <typename T2>
00108   self_type& operator=(const Molecule<T2>& rhs);
00109 
00110 
00112   // update atomgroup interface
00113   virtual GROUP::index_t group_index() const { return GROUP::MOLECULE; }
00114 
00115 
00117   const std::string& name() const { return _name; }
00118   void set_name(const std::string& name) { _name = name; }
00119 
00120   char chain_id() const { return _chain_id; } 
00121   void set_chain_id(char chain_id) { _chain_id = chain_id; }
00122 
00123   // molecule is not a combined container class (like polymer), so it's safe to
00124   // pull protected members public
00125   using base_type::clear;
00126   using base_type::erase;
00127   using base_type::push_back;
00128   using base_type::insert;
00129   using base_type::shallow_push_back;
00130   using base_type::shallow_insert;
00131   using base_type::shallow_copy;
00132         
00133 private:
00134   char _chain_id;
00135   std::string _name;
00136 };
00137 
00138 } // namespace BTK
00139 
00140 template <typename AtomType>
00141 std::ostream& operator<<(std::ostream& os,
00142                          const BTK::Molecule<AtomType>& m);
00143 
00144 #include "molecule.hpp"
00145 
00146 #endif
00147 

Generated on Wed Apr 14 00:43:17 2004 for BTK by doxygen 1.3.6