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