OpenStructure
query_view_wrapper.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-2020 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_VIEW_WRAPPER_HH
20 #define OST_QUERY_VIEW_WRAPPER_HH
21 
22 #include <ost/mol/view_type_fw.hh>
23 #include <ost/mol/module_config.hh>
24 #include <ost/mol/entity_view.hh>
25 #include <ost/mol/entity_handle.hh>
26 #include <ost/mol/query.hh>
27 
28 namespace ost { namespace mol {
29 
34 public:
35  explicit QueryViewWrapper(const EntityHandle& entity_handle);
36  explicit QueryViewWrapper(const EntityView& entity_view);
38  QueryViewWrapper(const Query& query, const EntityHandle& handle);
39  QueryViewWrapper(const Query& query, const EntityView& view = mol::EntityView());
40  QueryViewWrapper(const Query& query, QueryFlags flags, const EntityHandle& handle);
41  QueryViewWrapper(const Query& query, QueryFlags flags, const EntityView& view = mol::EntityView());
42 
44  bool DependsOnQuery() const;
45  bool IsDataValid() const;
46 
49 
51  void SetQuery(const Query& query);
53  const Query& GetQuery() const;
54 
56  void SetFlags(QueryFlags flags);
59 
61  EntityHandle GetEntity() const {return view_set_ ? entity_view_.GetHandle() : entity_handle_;}
62 
63 private:
64  bool view_set_;
65  EntityHandle entity_handle_;
66  EntityView entity_view_;
67  Query query_;
68  QueryFlags flags_;
69 };
70 
71 } } // ns
72 
73 #endif
Protein or molecule.
EntityHandle GetHandle() const
get this handle
definition of EntityView
Definition: entity_view.hh:86
Selection Query.
Definition: query.hh:74
EntityView GetEntityView() const
regenerates current view based on internal state
QueryViewWrapper(const Query &query, QueryFlags flags, const EntityHandle &handle)
QueryViewWrapper(const EntityHandle &entity_handle)
QueryFlags GetFlags() const
returns internally used query flags
const Query & GetQuery() const
retrieve current query
void SetQuery(const Query &query)
explicitely sets current query
QueryViewWrapper(const Query &query, const EntityHandle &handle)
EntityHandle GetEntity() const
return underlying handle
QueryViewWrapper(const EntityView &entity_view)
bool DependsOnQuery() const
returns true if view will be recalculated from query
QueryViewWrapper(const Query &query, const EntityView &view=mol::EntityView())
void SetFlags(QueryFlags flags)
set query flags to be used internally for the Select statement
QueryViewWrapper(const Query &query, QueryFlags flags, const EntityView &view=mol::EntityView())
#define DLLEXPORT_OST_MOL
uint QueryFlags
Definition: query.hh:69
Definition: base.dox:1