OpenStructure
atom_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_ATOM_VIEW_HH
20 #define OST_ATOM_VIEW_HH
21 
22 /*
23  Author: Marco Biasini
24  */
25 #include <ost/mol/module_config.hh>
26 #include <ost/mol/atom_base.hh>
28 #include <ost/mol/view_type_fw.hh>
30 
31 namespace ost { namespace mol {
32 
35 
36  friend class EntityView;
37 public:
38 
40 
41 
42 
43 
44 
45 
46 
47  operator bool() const { return this->IsValid(); }
50  bool IsValid() const { return data_.get()!=0; }
52  // constructors
53  AtomView();
54  AtomView(const ResidueView& residue_view,
55  const AtomHandle& atom);
56 
58  ResidueView GetResidue() const;
59 
61  EntityView GetEntity() const;
62 
64  AtomHandle GetHandle() const;
65 
69  BondHandleList GetBondList() const;
70 
74  int GetBondCount() const;
75 
77  AtomViewList GetBondPartners() const;
78 
80  void RemoveBonds();
81 
83  void Apply(EntityVisitor& visitor);
84  void Apply(EntityViewVisitor& visitor);
85 
90  long GetHashCode() const;
91  bool operator==(const AtomView& rhs) const;
92  bool operator!=(const AtomView& rhs) const;
93 protected:
99  bool AddBond(const BondHandle& bond);
100 
101  void RemoveBondInternal(const BondHandle& bond);
102 private:
103  AtomViewDataPtr data_;
104 };
105 
106 }} // ns
107 
108 #endif // OST_ATOM_VIEW_HH
109