OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
query.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_HF
20 #define OST_QUERY_HF
21 
22 /*
23  Author: Marco Biasini
24  */
25 
26 #include <string>
27 #include <vector>
28 #include <set>
29 
30 #include <boost/variant.hpp>
31 #include <boost/logic/tribool.hpp>
32 
33 #include <ost/range.hh>
34 
35 #include <ost/mol/module_config.hh>
37 #include <ost/mol/query_error.hh>
38 #include <ost/mol/atom_handle.hh>
39 #include <ost/mol/query_state.hh>
40 
41 namespace ost { namespace mol {
42 
62  typedef enum {
63  EXCLUSIVE_BONDS=1,
64  NO_BONDS=2,
65  MATCH_RESIDUES=4
66  } Flag;
67 };
68 
69 typedef uint QueryFlags;
70 
75 public:
77  Query(const String& query_string="");
78 
80  Query(const impl::QueryImplP& impl);
81 
83  bool IsAtomSelected(const AtomHandle& ah) const;
84 
89  bool IsChainSelected(const ChainHandle& chain) const;
90 
95  bool IsResidueSelected(const ResidueHandle& residue) const;
96 
98  const String& GetQueryString() const;
99 
100  const QueryErrorDesc& GetErrorDescription() const;
101 
103  QueryState CreateQueryState(const EntityView& view) const;
104 
106  QueryState CreateQueryState(const EntityHandle& view) const;
107 
108  // only valid if parsed without error
109  bool IsValid() const;
110  // an empty query String defaults to matching everything
111  bool MatchAll() const;
112 
113  // for internal use only
114  impl::QueryImplP Impl();
115  const impl::QueryImplP& Impl() const;
116 private:
117  impl::QueryImplP impl_;
118 };
119 
120 }} // ns
121 
122 #endif
123 
std::string String
Definition: base.hh:54
Handle to atom datatype.
Definition: atom_handle.hh:37
boost::shared_ptr< QueryImpl > QueryImplP
Protein or molecule.
Selection Query.
Definition: query.hh:74
uint QueryFlags
Definition: query.hh:69
linear chain of residues
Definition: chain_handle.hh:52
Holds state used during query evaluation.
Definition: query_state.hh:50
#define DLLEXPORT_OST_MOL
definition of EntityView
Definition: entity_view.hh:86
query flags
Definition: query.hh:61
unsigned int uint
Definition: base.hh:29