OpenStructure
chain_view.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_CHAIN_VIEW_HH
20 #define OST_CHAIN_VIEW_HH
21 
22 #include <ost/mol/module_config.hh>
23 #include <ost/geom/geom.hh>
24 
25 #include <ost/mol/query.hh>
26 #include <ost/mol/chain_base.hh>
29 #include <ost/mol/view_type_fw.hh>
32 #include <ost/mol/residue_prop.hh>
33 
34 namespace ost { namespace mol {
35 
38 public:
39  ChainView();
40 
42  impl::ChainImplPtr impl);
43 
44  ChainView(const EntityView& entity,
45  const ChainHandle& chain);
46 public:
47 
49 
50 
51 
52 
53 
54 
55 
56  operator bool() const { return this->IsValid(); }
59  bool IsValid() const { return data_.get()!=0; }
61 
63  EntityView GetEntity() const;
64 
65  void Apply(EntityVisitor& visitor);
66  void Apply(EntityViewVisitor& visitor);
67 
69  int GetResidueCount() const;
70 
72  int GetAtomCount() const;
73 
80  int GetBondCount() const;
81 
82 public:
94  ResidueView AddResidue(const ResidueHandle& residue_handle,
95  ViewAddFlags flags=0);
96 
111  ResidueView AddResidue(const ResidueView& residue_view,
112  ViewAddFlags flags=0);
121  AtomView AddAtom(const AtomHandle& atom_handle,
122  ViewAddFlags flags=0);
123 
125  ResidueView FindResidue(const ResNum& number) const;
126 
128  AtomView FindAtom(const AtomHandle& atom) const;
129 
130  AtomView FindAtom(const ResNum& num, const String& name) const;
132  ResidueView FindResidue(const ResidueHandle& handle) const;
133 
135  bool IsResidueIncluded(const ResidueHandle& handle) const;
136 
138  ChainHandle GetHandle() const;
139 
144  const ResidueViewList& GetResidueList() const;
145 
147  void RemoveResidue(ResidueView view);
148 
149  int GetResidueIndex(const ResNum& number) const;
150 
154  ResidueView GetResidueByIndex(int index) const;
155 
156 
158  Real GetMass() const;
159 
161  geom::Vec3 GetCenterOfMass() const;
162 
167  geom::Vec3 GetCenterOfAtoms() const;
168 
170  geom::AlignedCuboid GetBounds() const;
171 
173  void RemoveResidues();
175 
176 
178  return data_;
179  }
180 
182  const ChainViewDataPtr& ViewData() const {
183  return data_;
184  }
187  bool InSequence() const;
188 
191  EntityView Select(const Query& q, QueryFlags flags=0) const;
192 
195  EntityView Select(const String& query_string, QueryFlags flags=0) const;
196 
197  bool operator==(const ChainView& rhs) const;
198  bool operator!=(const ChainView& rhs) const;
200 private:
201  ChainViewDataPtr data_;
202 };
203 
204 }} // ns
205 #endif // OST_CHAIN_VIEW_HH
206