OpenStructure
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:
42 
44 
45  operator bool() const;
52 
55  bool IsValid() const;
57 
59  void Apply(EntityVisitor& v);
61 
63 
64  AtomHandle GetFirst() const;
72 
76 
79  AtomHandle GetOther(const AtomHandle& a) const;
81 
83  geom::Vec3 GetPos() const;
84 
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 
116 
118  void CheckValidity() const;
119 private:
120  impl::ConnectorImplP impl_;
121 };
122 
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
Three dimensional vector class, using Real precision.
Definition: vec3.hh:48
base class for the handler classes
base class for the implementation
Handle to atom datatype.
Definition: atom_handle.hh:37
chemical bond
Definition: bond_handle.hh:35
const impl::ConnectorImplP & Impl() const
Definition: bond_handle.hh:105
geom::Vec3 GetOriginalPos() const
return midpoint between the two atoms (original coordinates)
geom::Vec3 GetPos() const
return midpoint between the two atoms (transformed coordinates)
void CheckValidity() const
Real GetLength() const
return the length of the bond
void SetBondOrder(unsigned char bo)
set the bond order ((1) single, (2) double, (3) triple, (4) aromatic)
AtomHandle GetOther(const AtomHandle &a) const
get other atom Returns one of the two atoms that does not match the given one.
unsigned char GetBondOrder() const
get the bond order ((1) single, (2) double, (3) triple, (4) aromatic)
bool DLLEXPORT_OST_MOL BondExists(const AtomHandle &a, const AtomHandle &b)
check whether a bond exists, that connects the two atom handles.
AtomHandle GetSecond() const
get second atom In python also available as the property second
bool operator!=(const BondHandle &rhs) const
unsigned long GetHashCode() const
unique bond id
GenericPropContainerImpl * GpImpl()
void Apply(EntityVisitor &v)
entry point for entity visitor
BondHandle(const impl::ConnectorImplP &im)
ctor for internal use, in public interface for convenience purposes
BondHandle()
necessary dummy ctor, creates invalid handle
bool operator==(const BondHandle &rhs) const
bool IsValid() const
check validity of handle
const GenericPropContainerImpl * GpImpl() const
void Apply(EntityViewVisitor &v)
impl::ConnectorImplP & Impl()
Definition: bond_handle.hh:109
EntityViewVisitor interface.
EntityVisitor interface.
float Real
Definition: base.hh:44
#define DLLEXPORT_OST_MOL
boost::shared_ptr< ConnectorImpl > ConnectorImplP
std::vector< BondHandle > BondHandeList
Definition: bond_handle.hh:134
DLLEXPORT_OST_MOL std::ostream & operator<<(std::ostream &os, const AtomBase &atom)
Definition: base.dox:1