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  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  ChainViewDataPtr& ViewData() {
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 
std::string String
Definition: base.hh:54
Handle to atom datatype.
Definition: atom_handle.hh:37
float Real
Definition: base.hh:44
axis-aligned cuboid
const ChainViewDataPtr & ViewData() const
Get view data.
Definition: chain_view.hh:185
base class for ChainHandle and ChainView
Definition: chain_base.hh:39
bool DLLEXPORT_OST_GEOM operator==(const Line2 &l1, const Line2 &l2)
bool IsValid() const
check validity of handle
Definition: chain_view.hh:59
bool DLLEXPORT_OST_MOL InSequence(const ResidueHandle &residue_one, const ResidueHandle &residue_two)
Test if two residues are in next in sequence.
DLLEXPORT_OST_IMG_BASE bool operator!=(const ImageHandle &lhs, const ConstImageHandle &rhs)
boost::shared_ptr< ChainImpl > ChainImplPtr
std::vector< ResidueView > ResidueViewList
Definition: view_type_fw.hh:37
EntityVisitor interface.
Selection Query.
Definition: query.hh:74
uint QueryFlags
Definition: query.hh:69
linear chain of residues
Definition: chain_handle.hh:52
definition of ChainView
Definition: chain_view.hh:37
int ViewAddFlags
Definition: view_type_fw.hh:71
Three dimensional vector class, using Real precision.
Definition: vec3.hh:42
#define DLLEXPORT_OST_MOL
boost::shared_ptr< ChainViewData > ChainViewDataPtr
Definition: view_type_fw.hh:40
definition of AtomView
Definition: atom_view.hh:34
EntityViewVisitor interface.
definition of EntityView
Definition: entity_view.hh:86