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-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 
46 
47 
48 
49 
50 
51  operator bool() const;
52 
55  bool IsValid() const;
57 
59  void Apply(EntityVisitor& v);
60  void Apply(EntityViewVisitor& v);
61 
63 
64 
65 
66 
67 
68 
69 
70 
71  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