00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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
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
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
00124
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 }
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