OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
129  AtomView FindAtom(const AtomHandle& atom) const;
130 
131  AtomView ViewForHandle(const AtomHandle& atom) const;
132  AtomView FindAtom(const ResNum& num, const String& name) const;
134  ResidueView ViewForHandle(const ResidueHandle& handle) const;
135 
136  ResidueView FindResidue(const ResidueHandle& handle) const;
138  bool IsResidueIncluded(const ResidueHandle& handle) const;
139 
141  ChainHandle GetHandle() const;
142 
147  const ResidueViewList& GetResidueList() const;
148 
150  void RemoveResidue(ResidueView view);
151 
152  int GetResidueIndex(const ResNum& number) const;
153 
157  ResidueView GetResidueByIndex(int index) const;
158 
159 
161  Real GetMass() const;
162 
164  geom::Vec3 GetCenterOfMass() const;
165 
170  geom::Vec3 GetCenterOfAtoms() const;
171 
173  geom::AlignedCuboid GetBounds() const;
174 
176  void RemoveResidues();
178 
179 
181  return data_;
182  }
183 
185  const ChainViewDataPtr& ViewData() const {
186  return data_;
187  }
190  bool InSequence() const;
191 
194  EntityView Select(const Query& q, QueryFlags flags=0) const;
195 
198  EntityView Select(const String& query_string, QueryFlags flags=0) const;
199 
200  bool operator==(const ChainView& rhs) const;
201  bool operator!=(const ChainView& rhs) const;
202  bool HasAtoms() const;
204 private:
205  ChainViewDataPtr data_;
206 };
207 
208 }} // ns
209 #endif // OST_CHAIN_VIEW_HH
210