knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
QueryContext.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of KnowRob, please consult
3  * https://github.com/knowrob/knowrob for license details.
4  */
5 
6 #include "knowrob/queries/QueryContext.h"
7 #include "knowrob/integration/python/utils.h"
8 #include "knowrob/queries/QueryFlag.h"
9 
10 using namespace knowrob;
11 
12 namespace knowrob::py {
13  template<>
15  using namespace boost::python;
16 
17  enum_<QueryFlag>("QueryFlag")
18  .value("QUERY_FLAG_ALL_SOLUTIONS", QUERY_FLAG_ALL_SOLUTIONS)
19  .value("QUERY_FLAG_ONE_SOLUTION", QUERY_FLAG_ONE_SOLUTION)
20  .value("QUERY_FLAG_PERSIST_SOLUTIONS", QUERY_FLAG_PERSIST_SOLUTIONS)
21  .value("QUERY_FLAG_UNIQUE_SOLUTIONS", QUERY_FLAG_UNIQUE_SOLUTIONS)
22  .export_values();
23 
24  class_<QueryContext, std::shared_ptr<QueryContext>>
25  ("QueryContext", init<int>())
26  .def(init<const QueryContext &, const ModalOperatorPtr &>())
27  .def_readwrite("queryFlags", &QueryContext::queryFlags)
28  .def_readwrite("modalIteration", &QueryContext::modalIteration)
29  .def_readwrite("selector", &QueryContext::selector);
30 
31  // QueryContextPtr uses `const QueryContext` which currently requires
32  // a custom converter to be defined in order to be used in Python.
33  register_ptr_to_python<std::shared_ptr<const QueryContext> >();
34  implicitly_convertible<std::shared_ptr<QueryContext>, std::shared_ptr<const QueryContext> >();
35  }
36 }
void createType< QueryContext >()
@ QUERY_FLAG_ONE_SOLUTION
Definition: QueryFlag.h:17
@ QUERY_FLAG_ALL_SOLUTIONS
Definition: QueryFlag.h:15
@ QUERY_FLAG_UNIQUE_SOLUTIONS
Definition: QueryFlag.h:21
@ QUERY_FLAG_PERSIST_SOLUTIONS
Definition: QueryFlag.h:19
GraphSelector selector
Definition: QueryContext.h:38
ModalIteration modalIteration
Definition: QueryContext.h:34