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-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_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 
80  AtomHandle GetOther(const AtomHandle& a) const;
82 
84  geom::Vec3 GetPos() const;
85 
87  geom::Vec3 GetOriginalPos() const;
88 
90  Real GetLength() const;
91 
94  unsigned char GetBondOrder() const;
95 
98  void SetBondOrder(unsigned char bo);
99 
101  unsigned long GetHashCode() const;
102 
103  bool operator==(const BondHandle& rhs) const;
104  bool operator!=(const BondHandle& rhs) const;
105 
106  const impl::ConnectorImplP& Impl() const {
107  return impl_;
108  }
109 
111  return impl_;
112  }
113 
114 protected:
115 
116  GenericPropContainerImpl* GpImpl();
117 
118  const GenericPropContainerImpl* GpImpl() const;
119  void CheckValidity() const;
120 private:
121  impl::ConnectorImplP impl_;
122 };
123 
133 bool DLLEXPORT_OST_MOL BondExists(const AtomHandle& a, const AtomHandle& b);
134 
135 typedef std::vector<BondHandle> BondHandeList;
136 
137 DLLEXPORT_OST_MOL std::ostream& operator<<(std::ostream& os,
138  const BondHandle& bond);
139 
140 
141 }} // ns
142 
143 #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:106
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:110
Three dimensional vector class, using Real precision.
Definition: vec3.hh:42
#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:135
base class for the handler classes