OpenStructure
query_state.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_QUERY_STATE_HH
20 #define OST_QUERY_STATE_HH
21 
22 /*
23  Author: Marco Biasini
24  */
25 
28 
30 #include <boost/logic/tribool.hpp>
35 
36 #include "property_id.hh"
37 
38 namespace ost { namespace mol {
39 
40 
41 struct LazilyBoundData;
42 struct LazilyBoundRef;
43 
48  friend class impl::QueryImpl;
49 public:
50  bool IsAtomSelected(const AtomHandle& atom);
51 
52  bool IsResidueSelected(const ResidueHandle& residue);
53 
54  bool IsChainSelected(const ChainHandle& chain);
55 
57  boost::logic::tribool EvalChain(const impl::ChainImplPtr& c);
58 
60  boost::logic::tribool EvalResidue(const impl::ResidueImplPtr& r);
61 
63  boost::logic::tribool EvalAtom(const impl::AtomImplPtr& a);
64 
65  void Reset(Prop::Level level);
66 
67  ~QueryState();
68 protected:
70  QueryState(const impl::QueryImpl& query, const EntityHandle& ref);
71  QueryState(const impl::QueryImpl& query, const EntityView& ref);
72  QueryState();
73 
74  const LazilyBoundRef& GetBoundObject(int i) const;
76  boost::logic::tribool EvalStack(Prop::Level level);
77 
78 private:
79  bool do_within(const geom::Vec3& pos, const impl::WithinParam& p,
80  impl::CompOP op);
81  std::vector<boost::logic::tribool> s_;
82  boost::shared_ptr<LazilyBoundData> r_;
83  const impl::QueryImpl& q_;
84 };
85 
86 }} //ns
87 
88 #endif