knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
Top.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/formulas/Top.h"
7 #include "knowrob/integration/python/utils.h"
8 
9 using namespace knowrob;
10 
11 const std::shared_ptr<Top> &Top::get() {
12  static std::shared_ptr<Top> singleton(new Top);
13  return singleton;
14 }
15 
16 Top::Top()
17  : Predicate("true", std::vector<TermPtr>()) {
18 }
19 
20 bool Top::isEqual(const Formula& /*other*/) const {
21  return true; // isEqual is only called of other also has type "Bottom"
22 }
23 
24 void Top::write(std::ostream &os) const {
25  os << "\u22A4";
26 }
27 
28 namespace knowrob::py {
29  template<>
30  void createType<Top>() {
31  using namespace boost::python;
32  class_<Top, std::shared_ptr<Top>, bases<Predicate>>("Top", no_init)
33  .def("get", &Top::get, return_value_policy<copy_const_reference>());
34  }
35 }
void write(std::ostream &os) const override
Definition: Top.cpp:24
bool isEqual(const Formula &other) const override
Definition: Top.cpp:20
static const std::shared_ptr< Top > & get()
Definition: Top.cpp:11
void createType< Top >()
Definition: Top.cpp:30
std::shared_ptr< Term > TermPtr
Definition: Term.h:117