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_VIEW_HH 00020 #define OST_ATOM_VIEW_HH 00021 00022 /* 00023 Author: Marco Biasini 00024 */ 00025 #include <ost/mol/module_config.hh> 00026 #include <ost/mol/atom_base.hh> 00027 #include <ost/mol/entity_visitor_fw.hh> 00028 #include <ost/mol/view_type_fw.hh> 00029 #include <ost/mol/handle_type_fw.hh> 00030 00031 namespace ost { namespace mol { 00032 00034 class DLLEXPORT_OST_MOL AtomView : public AtomBase { 00035 00036 friend class EntityView; 00037 public: 00038 00040 00041 00042 00043 00044 00045 00046 00047 operator bool() const { return this->IsValid(); } 00050 bool IsValid() const { return data_.get()!=0; } 00052 // constructors 00053 AtomView(); 00054 AtomView(const ResidueView& residue_view, 00055 const AtomHandle& atom); 00056 00058 ResidueView GetResidue() const; 00059 00061 EntityView GetEntity() const; 00062 00064 AtomHandle GetHandle() const; 00065 00069 BondHandleList GetBondList() const; 00070 00074 int GetBondCount() const; 00075 00077 AtomViewList GetBondPartners() const; 00078 00080 void RemoveBonds(); 00081 00083 void Apply(EntityVisitor& visitor); 00084 void Apply(EntityViewVisitor& visitor); 00085 00090 long GetHashCode() const; 00091 bool operator==(const AtomView& rhs) const; 00092 bool operator!=(const AtomView& rhs) const; 00093 protected: 00099 bool AddBond(const BondHandle& bond); 00100 00101 void RemoveBondInternal(const BondHandle& bond); 00102 private: 00103 AtomViewDataPtr data_; 00104 }; 00105 00106 }} // ns 00107 00108 #endif // OST_ATOM_VIEW_HH 00109