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

monomer.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) 2003, 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 
00025 
00026 
00027 #ifndef BTK_MONOMER_H
00028 #define BTK_MONOMER_H
00029 
00030 #include "atom_container.h"
00031 #include "atom.h"
00032 
00033 #include <boost/concept_check.hpp>
00034 
00035 #include <string>
00036 
00037 namespace BTK {
00038 
00039   // user typedefs
00040   template <typename AtomType> class Monomer;
00041   typedef Monomer<Atom> basic_monomer;
00042 
00045 template <typename AtomType> 
00046 class Monomer : public AtomContainer<AtomType>{
00047   typedef AtomContainer<AtomType> base_type;
00048   typedef Monomer<AtomType> self_type;
00049 public:
00050 
00052 
00053   typedef typename base_type::value_type value_type;
00054   typedef typename base_type::reference reference;
00055   typedef typename base_type::const_reference const_reference;
00056   typedef typename base_type::pointer pointer;
00057   typedef typename base_type::const_pointer const_pointer;
00058   typedef typename base_type::size_type size_type;
00059   typedef typename base_type::iterator iterator;
00060   typedef typename base_type::const_iterator const_iterator;
00062 
00064 
00065   typedef value_type atom_type;
00066   typedef iterator atom_iterator;
00067   typedef const_iterator const_atom_iterator;
00069 
00070 
00074   Monomer(size_type s = 0) 
00075     : base_type(s), 
00076       _group_num(0) {}
00077 
00080   template <typename AtomIterator>
00081   Monomer(AtomIterator first, 
00082           AtomIterator last,
00083           self_type* prev_monomer = 0,
00084           self_type* next_monomer = 0,
00085           const AtomGroupConcept::group_variant_container_t& modifiers = group_variant_container_t()) 
00086     : base_type(first,last), 
00087       _group_num(first->group_num()), 
00088       _group_name3(first->group_name3()) 
00089   {
00090     // these parameters are actually placeholders -- touch them so they look used
00091     prev_monomer += 1;
00092     next_monomer += 1;
00093     modifiers.size();
00094   }
00095 
00096   template <typename T2>
00097   Monomer(const Monomer<T2>& source) 
00098     : base_type(source), 
00099       _group_num(source.group_num()), 
00100       _group_name3(source.group_name3()) {}
00101 
00102   ~Monomer() {}
00103 
00104 
00106   template <typename T2>
00107   self_type& 
00108   operator=(const Monomer<T2>& rhs) 
00109   {
00110     base_type::operator=(rhs);  
00111     _group_num = rhs.group_num();
00112     _group_name3 = rhs.group_name3();
00113     return *this;
00114   }
00115 
00117   // update atom group interface
00118   virtual GROUP::index_t group_index() const { return GROUP::MONOMER; }
00119 
00120   virtual int group_num() const { return _group_num; }
00121   void set_group_num(int x) { _group_num = x; }
00122 
00123   virtual const std::string& group_name3() const { return _group_name3; }
00124 
00125 
00127   virtual char group_name1() const { return 'X'; }
00128 
00129 private:
00130   int _group_num;
00131   std::string _group_name3;
00132 };
00133 
00134 } // namespace BTK
00135 
00136 #endif

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