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

pdb_atom_decorator.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 
00025 #ifndef BTK_PDB_ATOM_DECORATOR_H
00026 #define BTK_PDB_ATOM_DECORATOR_H
00027 
00028 #include "atom.h"
00029 
00030 #include <boost/concept_check.hpp>
00031 
00032 #include <string>
00033 
00034 namespace BTK {
00035 
00036   template <class AtomBase>
00037   class PDBAtomDecorator : public AtomBase {
00038     BOOST_CLASS_REQUIRE2(AtomBase,Atom,boost,ConvertibleConcept);
00039 
00040     typedef AtomBase base_type;
00041     typedef PDBAtomDecorator<base_type> self_type;
00042   public:
00043     
00044     PDBAtomDecorator() : 
00045       base_type(),_atom_name(),_group_name3(),_group_num(),_chain_id(' '),_alt_loc(' '),
00046       _insert_code(' '),_occupancy(1),_b_factor(1) {}
00047 
00048     PDBAtomDecorator(const base_type& a) : 
00049       base_type(a),_atom_name(base_type::atom_name()),_group_name3(base_type::group_name3()), 
00050       _group_num(base_type::group_num()),_chain_id(' '),_alt_loc(' '),
00051       _insert_code(' '),_occupancy(1),_b_factor(1) {}
00052 
00053     ~PDBAtomDecorator() {}
00054 
00055     self_type& operator=(const base_type& rhs){
00056       base_type::operator=(rhs);
00057       _atom_name = base_type::atom_name();
00058       _group_name3 = base_type::group_name3();
00059       _group_num = base_type::group_num();
00060       _chain_id = ' ';
00061       _alt_loc = ' ';
00062       _insert_code = ' ';
00063       _occupancy = 1;
00064       _b_factor = 1;
00065       return *this;
00066     }
00067 
00068     virtual const std::string& atom_name() const { 
00069       if( _atom_name == std::string() ){
00070         return base_type::atom_name();
00071       } else {
00072         return _atom_name;
00073       }
00074     }
00075     void set_atom_name(const std::string& name) { 
00076       _atom_name = name;  
00077       this->set_atom_index(ATOM::pdbname_to_atom_index(_atom_name));
00078     }
00079 
00080     int atom_num() const { return _atom_num; }
00081     void set_atom_num(int atom_num) { _atom_num = atom_num; }
00082 
00083     // why virtual? -TAR
00084     virtual std::string const & group_name3() const { return _group_name3; }
00085     void set_group_name3(std::string const & name) {
00086       _group_name3 = name;
00087     }
00088 
00089     virtual std::string const & res_name() const { return _group_name3; }
00090     void set_res_name(std::string const & name) { _group_name3 = name; }
00091 
00092     virtual int group_num() const { return _group_num; }
00093     void set_group_num(int group_num) { _group_num = group_num; }
00094 
00095     virtual int res_num() const { return _group_num; }
00096     void set_res_num(int num) { _group_num = num; }
00097 
00098     char chain_id() const { return _chain_id; }
00099     void set_chain_id(char id) { _chain_id = id; }
00100 
00101     char alt_loc() const { return _alt_loc; }
00102     void set_alt_loc(char altloc) { _alt_loc = altloc; }
00103 
00104     char insert_code() const { return _insert_code; }
00105     void set_insert_code(char code) { _insert_code = code; }
00106 
00107     double occupancy() const { return  _occupancy; }
00108     void set_occupancy(double occ) { _occupancy = occ; }
00109 
00110     double b_factor() const { return _b_factor; }  
00111     void set_b_factor(double bfactor) { _b_factor = bfactor; }
00112 
00113   private:
00114     std::string _atom_name;
00115     int _atom_num;
00116     std::string _group_name3;
00117     int _group_num;
00118     char _chain_id;
00119     char _alt_loc;
00120     char _insert_code;
00121     double _occupancy;
00122     double _b_factor;  
00123   };
00124 
00125 } // namespace BTK
00126 
00127 #endif 

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