OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
bond_handle.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_BOND_HANDLE_HE
20 #define OST_BOND_HANDLE_HE
21 
23 #include <ost/mol/atom_handle.hh>
24 #include <ost/generic_property.hh>
25 
27 
28 namespace ost { namespace mol {
29 
35  public GenericPropContainer<BondHandle> {
36 public:
39  BondHandle();
42 
44 
45  operator bool() const;
52 
55  bool IsValid() const;
57 
59  void Apply(EntityVisitor& v);
60  void Apply(EntityViewVisitor& v);
61 
63 
64  AtomHandle GetFirst() const;
72 
75  AtomHandle GetSecond() const;
76 
79  AtomHandle GetOther(const AtomHandle& a) const;
81 
83  geom::Vec3 GetPos() const;
84 
86  geom::Vec3 GetOriginalPos() const;
87 
89  Real GetLength() const;
90 
93  unsigned char GetBondOrder() const;
94 
97  void SetBondOrder(unsigned char bo);
98 
100  unsigned long GetHashCode() const;
101 
102  bool operator==(const BondHandle& rhs) const;
103  bool operator!=(const BondHandle& rhs) const;
104 
105  const impl::ConnectorImplP& Impl() const {
106  return impl_;
107  }
108 
110  return impl_;
111  }
112 
113 protected:
114 
115  GenericPropContainerImpl* GpImpl();
116 
117  const GenericPropContainerImpl* GpImpl() const;
118  void CheckValidity() const;
119 private:
120  impl::ConnectorImplP impl_;
121 };
122 
132 bool DLLEXPORT_OST_MOL BondExists(const AtomHandle& a, const AtomHandle& b);
133 
134 typedef std::vector<BondHandle> BondHandeList;
135 
136 DLLEXPORT_OST_MOL std::ostream& operator<<(std::ostream& os,
137  const BondHandle& bond);
138 
139 
140 }} // ns
141 
142 #endif
Handle to atom datatype.
Definition: atom_handle.hh:37
float Real
Definition: base.hh:44
const impl::ConnectorImplP & Impl() const
Definition: bond_handle.hh:105
boost::shared_ptr< ConnectorImpl > ConnectorImplP
bool DLLEXPORT_OST_GEOM operator==(const Line2 &l1, const Line2 &l2)
DLLEXPORT_OST_IMG_BASE bool operator!=(const ImageHandle &lhs, const ConstImageHandle &rhs)
DLLEXPORT_OST_MOL std::ostream & operator<<(std::ostream &os, const AtomBase &atom)
EntityVisitor interface.
impl::ConnectorImplP & Impl()
Definition: bond_handle.hh:109
Three dimensional vector class, using Real precision.
Definition: vec3.hh:43
#define DLLEXPORT_OST_MOL
chemical bond
Definition: bond_handle.hh:34
EntityViewVisitor interface.
base class for the implementation
std::vector< BondHandle > BondHandeList
Definition: bond_handle.hh:134
base class for the handler classes