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-2020 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  operator bool() const { return this->IsValid(); }
50  bool IsValid() const;
52  // constructors
54  AtomView(const ResidueView& residue_view,
55  const AtomHandle& atom);
56 
59 
62 
65 
70 
74  int GetBondCount() const;
75 
78 
80  void RemoveBonds();
81 
83  void Apply(EntityVisitor& visitor);
84  void Apply(EntityViewVisitor& visitor);
85 
90  unsigned 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 
base class for AtomHandle and AtomView
Definition: atom_base.hh:44
Handle to atom datatype.
Definition: atom_handle.hh:37
definition of AtomView
Definition: atom_view.hh:34
void RemoveBondInternal(const BondHandle &bond)
void Apply(EntityViewVisitor &visitor)
AtomViewList GetBondPartners() const
Get all atoms this atom is bonded to.
EntityView GetEntity() const
Shortcut to entity.
ResidueView GetResidue() const
Get parent residue view.
bool operator!=(const AtomView &rhs) const
bool operator==(const AtomView &rhs) const
void Apply(EntityVisitor &visitor)
Apply entity visitor to this atom.
AtomView(const ResidueView &residue_view, const AtomHandle &atom)
unsigned long GetHashCode() const
get unique id
AtomHandle GetHandle() const
Get handle this view points to.
bool AddBond(const BondHandle &bond)
Add bond to atom. If the bond is already present, it will not be added again.
bool IsValid() const
check validity of handle
BondHandleList GetBondList() const
Get bond list Only bonds included in the view will be returned. To get all bonds of the the atom,...
int GetBondCount() const
Get bond count Only bonds included in the view will be counted. To count all bonds of the the atom,...
void RemoveBonds()
Remove all bonds this atom is involved in.
chemical bond
Definition: bond_handle.hh:35
definition of EntityView
Definition: entity_view.hh:86
EntityViewVisitor interface.
EntityVisitor interface.
#define DLLEXPORT_OST_MOL
std::vector< BondHandle > BondHandleList
std::vector< AtomView > AtomViewList
Definition: view_type_fw.hh:31
boost::shared_ptr< AtomViewData > AtomViewDataPtr
Definition: view_type_fw.hh:28
Definition: base.dox:1