00001 //------------------------------------------------------------------------------ 00002 // This file is part of the OpenStructure project <www.openstructure.org> 00003 // 00004 // Copyright (C) 2008-2010 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_QUERY_STATE_HH 00020 #define OST_QUERY_STATE_HH 00021 00022 /* 00023 Author: Marco Biasini 00024 */ 00025 00026 #include <ost/mol/impl/query_impl_fw.hh> 00027 #include <ost/mol/impl/query_ast.hh> 00028 00029 #include <ost/mol/handle_type_fw.hh> 00030 #include <boost/logic/tribool.hpp> 00031 #include <ost/mol/impl/entity_impl_fw.hh> 00032 #include <ost/mol/impl/chain_impl_fw.hh> 00033 #include <ost/mol/impl/residue_impl_fw.hh> 00034 #include <ost/mol/impl/atom_impl_fw.hh> 00035 00036 #include "property_id.hh" 00037 00038 namespace ost { namespace mol { 00039 00040 00041 struct LazilyBoundData; 00042 struct LazilyBoundRef; 00043 00047 class DLLEXPORT_OST_MOL QueryState { 00048 friend class impl::QueryImpl; 00049 public: 00050 bool IsAtomSelected(const AtomHandle& atom); 00051 00052 bool IsResidueSelected(const ResidueHandle& residue); 00053 00054 bool IsChainSelected(const ChainHandle& chain); 00055 00057 boost::logic::tribool EvalChain(const impl::ChainImplPtr& c); 00058 00060 boost::logic::tribool EvalResidue(const impl::ResidueImplPtr& r); 00061 00063 boost::logic::tribool EvalAtom(const impl::AtomImplPtr& a); 00064 00065 void Reset(Prop::Level level); 00066 00067 ~QueryState(); 00068 protected: 00070 QueryState(const impl::QueryImpl& query, const EntityHandle& ref); 00071 QueryState(const impl::QueryImpl& query, const EntityView& ref); 00072 QueryState(); 00073 00074 const LazilyBoundRef& GetBoundObject(int i) const; 00076 boost::logic::tribool EvalStack(Prop::Level level); 00077 00078 private: 00079 bool do_within(const geom::Vec3& pos, const impl::WithinParam& p, 00080 impl::CompOP op); 00081 std::vector<boost::logic::tribool> s_; 00082 boost::shared_ptr<LazilyBoundData> r_; 00083 const impl::QueryImpl& q_; 00084 }; 00085 00086 }} //ns 00087 00088 #endif
1.5.8