knowrob
2.1.0
A Knowledge Base System for Cognition-enabled Robots
Formula.h
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
#ifndef KNOWROB_FORMULA_H_
7
#define KNOWROB_FORMULA_H_
8
9
#include <memory>
10
#include <ostream>
11
#include "knowrob/Printable.h"
12
13
namespace
knowrob
{
17
enum class
FormulaType
{
18
// A formula of the form `P(t_1,..,t_n)` where each ti is a term
19
// and "P" is a n-ary predicate symbol (or functor).
20
PREDICATE
,
21
// A formula of the form `phi_1 AND ... AND phi_n` where each phi_i is a formula.
22
CONJUNCTION
,
23
// A formula of the form `phi_1 OR ... OR phi_n` where each phi_i is a formula.
24
DISJUNCTION
,
25
NEGATION
,
26
IMPLICATION
,
27
MODAL
28
};
29
34
class
Formula :
public
Printable {
35
public
:
39
explicit
Formula
(
const
FormulaType
&
type
);
40
41
virtual
~Formula
() =
default
;
42
47
bool
operator==
(
const
Formula
&other)
const
;
48
52
FormulaType
type
()
const
{
return
type_
; }
53
59
bool
isAtomic
()
const
;
60
64
bool
isGround
()
const
{
return
isGround_
; }
65
69
bool
isTop
()
const
;
70
74
bool
isBottom
()
const
;
75
76
protected
:
77
const
FormulaType
type_
;
78
bool
isGround_
=
true
;
79
80
virtual
bool
isEqual
(
const
Formula
&other)
const
= 0;
81
};
82
86
class
FormulaLabel
{
87
public
:
88
FormulaLabel
() =
default
;
89
90
virtual
~FormulaLabel
() =
default
;
91
92
bool
operator==
(
const
FormulaLabel
&other);
93
94
protected
:
95
virtual
bool
isEqual
(
const
FormulaLabel
&other)
const
= 0;
96
};
97
98
// alias declaration
99
using
FormulaPtr
= std::shared_ptr<Formula>;
100
using
FormulaLabelPtr
= std::shared_ptr<FormulaLabel>;
101
}
102
103
#endif
//KNOWROB_FORMULA_H_
knowrob::Formula
Definition:
Formula.h:34
knowrob::Formula::type_
const FormulaType type_
Definition:
Formula.h:77
knowrob::Formula::type
FormulaType type() const
Definition:
Formula.h:52
knowrob::Formula::operator==
bool operator==(const Formula &other) const
knowrob::Formula::isBottom
bool isBottom() const
knowrob::Formula::Formula
Formula(const FormulaType &type)
knowrob::Formula::isEqual
virtual bool isEqual(const Formula &other) const =0
knowrob::Formula::isGround
bool isGround() const
Definition:
Formula.h:64
knowrob::Formula::~Formula
virtual ~Formula()=default
knowrob::Formula::isTop
bool isTop() const
knowrob::Formula::isAtomic
bool isAtomic() const
knowrob::Formula::isGround_
bool isGround_
Definition:
Formula.h:78
knowrob::FormulaLabel
Definition:
Formula.h:86
knowrob::FormulaLabel::FormulaLabel
FormulaLabel()=default
knowrob::FormulaLabel::isEqual
virtual bool isEqual(const FormulaLabel &other) const =0
knowrob::FormulaLabel::~FormulaLabel
virtual ~FormulaLabel()=default
knowrob::FormulaLabel::operator==
bool operator==(const FormulaLabel &other)
knowrob
Definition:
DataSource.h:13
knowrob::FormulaPtr
std::shared_ptr< Formula > FormulaPtr
Definition:
Formula.h:99
knowrob::FormulaLabelPtr
std::shared_ptr< FormulaLabel > FormulaLabelPtr
Definition:
Formula.h:100
knowrob::FormulaType
FormulaType
Definition:
Formula.h:17
knowrob::FormulaType::PREDICATE
@ PREDICATE
knowrob::FormulaType::IMPLICATION
@ IMPLICATION
knowrob::FormulaType::NEGATION
@ NEGATION
knowrob::FormulaType::CONJUNCTION
@ CONJUNCTION
knowrob::FormulaType::MODAL
@ MODAL
knowrob::FormulaType::DISJUNCTION
@ DISJUNCTION
include
knowrob
formulas
Formula.h
Generated by
1.9.1