OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  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 
Handle to atom datatype.
Definition: atom_handle.hh:37
bool DLLEXPORT_OST_GEOM operator==(const Line2 &l1, const Line2 &l2)
DLLEXPORT_OST_IMG_BASE bool operator!=(const ImageHandle &lhs, const ConstImageHandle &rhs)
EntityVisitor interface.
base class for AtomHandle and AtomView
Definition: atom_base.hh:44
#define DLLEXPORT_OST_MOL
bool IsValid() const
check validity of handle
Definition: atom_view.hh:50
std::vector< AtomView > AtomViewList
Definition: view_type_fw.hh:31
std::vector< BondHandle > BondHandleList
definition of AtomView
Definition: atom_view.hh:34
chemical bond
Definition: bond_handle.hh:34
EntityViewVisitor interface.
definition of EntityView
Definition: entity_view.hh:86
boost::shared_ptr< AtomViewData > AtomViewDataPtr
Definition: view_type_fw.hh:28