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_ATOM_BASE_HH 00020 #define OST_ATOM_BASE_HH 00021 00022 #include <ost/geom/vec3.hh> 00023 00024 #include <ost/mol/module_config.hh> 00025 #include <ost/mol/impl/atom_impl_fw.hh> 00026 #include <ost/generic_property.hh> 00027 00028 #include "property_id.hh" 00029 00030 namespace ost { namespace mol { 00031 00044 class DLLEXPORT_OST_MOL AtomBase: public GenericPropContainer<AtomBase> { 00045 public: 00046 AtomBase(); 00047 AtomBase(const impl::AtomImplPtr& impl); 00048 public: 00050 00051 00052 00053 00054 00055 00056 00057 operator bool() const { return this->IsValid(); } 00060 bool IsValid() const { return Impl().get()!=0; } 00062 friend class ConstGenericPropContainer<AtomBase>; 00066 const String& GetName() const; 00067 00077 void SetName(const String& atom_name); 00078 00080 const geom::Vec3& GetPos() const; 00081 00083 const geom::Vec3& GetOriginalPos() const; 00085 geom::Vec3 GetAltPos(const String& alt_group) const; 00086 Real GetAltBFactor(const String& alt_group) const; 00087 Real GetAltOcc(const String& alt_group) const; 00088 00089 std::vector<String> GetAltGroupNames() const; 00090 00092 00098 String GetQualifiedName() const; 00099 00101 String GetStringProperty(Prop::ID prop_id) const; 00102 00104 Real GetFloatProperty(Prop::ID prop_id) const; 00105 00107 int GetIntProperty(Prop::ID prop_id) const; 00108 00110 unsigned long GetIndex() const; 00111 00113 Real GetRadius() const; 00114 00116 const String& GetElement() const; 00117 00119 bool IsHetAtom() const; 00120 00124 Real GetBFactor() const; 00125 00126 00127 void SetBFactor(Real factor); 00128 00129 void SetOccupancy(Real occ); 00130 00131 00132 void SetCharge(Real charge); 00133 00134 void SetMass(Real mass); 00135 00136 void SetHetAtom(bool het); 00137 00138 void SetRadius(Real radius); 00139 00140 void SetIndex (const unsigned long index); 00141 00142 const geom::Mat3& GetAnisou() const; 00143 00144 void SetAnisou(const geom::Mat3& anisou); 00148 Real GetMass() const; 00149 00151 Real GetCharge() const; 00152 00154 Real GetOccupancy() const; 00155 00159 const impl::AtomImplPtr& Impl() const; 00160 00162 impl::AtomImplPtr& Impl(); 00163 00164 00165 void SetElement(const String& element); 00166 protected: 00167 00168 GenericPropContainerImpl* GpImpl(); 00169 00170 const GenericPropContainerImpl* GpImpl() const; 00171 00172 void CheckValidity() const; 00173 impl::AtomImplPtr impl_; 00174 }; 00175 00176 DLLEXPORT_OST_MOL std::ostream& operator<<(std::ostream& os, 00177 const AtomBase& atom); 00178 }} // ns 00179 00180 #endif // OST_ATOM_BASE_HH 00181