00001 //------------------------------------------------------------------------------ 00002 // This file is part of the OpenStructure project <www.openstructure.org> 00003 // 00004 // Copyright (C) 2008-2011 by the OpenStructure authors 00005 // 00006 // This library is free software; you can redistribute it and/or modify it under 00007 // the terms of the GNU Lesser General Public License as published by the Free 00008 // Software Foundation; either version 3.0 of the License, or (at your option) 00009 // any later version. 00010 // This library is distributed in the hope that it will be useful, but WITHOUT 00011 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00012 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00013 // details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with this library; if not, write to the Free Software Foundation, Inc., 00017 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 //------------------------------------------------------------------------------ 00019 #ifndef OST_BOND_HANDLE_HE 00020 #define OST_BOND_HANDLE_HE 00021 00022 #include <ost/mol/impl/connector_impl_fw.hh> 00023 #include <ost/mol/atom_handle.hh> 00024 #include <ost/generic_property.hh> 00025 00026 #include <ost/mol/entity_visitor_fw.hh> 00027 00028 namespace ost { namespace mol { 00029 00034 class DLLEXPORT_OST_MOL BondHandle: 00035 public GenericPropContainer<BondHandle> { 00036 public: 00037 friend class ConstGenericPropContainer<BondHandle>; 00039 BondHandle(); 00041 BondHandle(const impl::ConnectorImplP& im); 00042 00044 00045 00046 00047 00048 00049 00050 00051 operator bool() const; 00052 00055 bool IsValid() const; 00057 00059 void Apply(EntityVisitor& v); 00060 void Apply(EntityViewVisitor& v); 00061 00063 00064 00065 00066 00067 00068 00069 00070 00071 AtomHandle GetFirst() const; 00072 00075 AtomHandle GetSecond() const; 00076 00080 AtomHandle GetOther(const AtomHandle& a) const; 00082 00084 geom::Vec3 GetPos() const; 00085 00087 geom::Vec3 GetOriginalPos() const; 00088 00090 Real GetLength() const; 00091 00094 unsigned char GetBondOrder() const; 00095 00098 void SetBondOrder(unsigned char bo); 00099 00101 unsigned long GetHashCode() const; 00102 00103 bool operator==(const BondHandle& rhs) const; 00104 bool operator!=(const BondHandle& rhs) const; 00105 00106 const impl::ConnectorImplP& Impl() const { 00107 return impl_; 00108 } 00109 00110 impl::ConnectorImplP& Impl() { 00111 return impl_; 00112 } 00113 00114 protected: 00115 00116 GenericPropContainerImpl* GpImpl(); 00117 00118 const GenericPropContainerImpl* GpImpl() const; 00119 void CheckValidity() const; 00120 private: 00121 impl::ConnectorImplP impl_; 00122 }; 00123 00133 bool DLLEXPORT_OST_MOL BondExists(const AtomHandle& a, const AtomHandle& b); 00134 00135 typedef std::vector<BondHandle> BondHandeList; 00136 00137 DLLEXPORT_OST_MOL std::ostream& operator<<(std::ostream& os, 00138 const BondHandle& bond); 00139 00140 00141 }} // ns 00142 00143 #endif