knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
PredicateIndicator.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_PREDICATE_INDICATOR_H_
7 #define KNOWROB_PREDICATE_INDICATOR_H_
8 
9 #include <utility>
10 #include <vector>
11 #include <memory>
12 #include <string>
13 #include "knowrob/terms/Atom.h"
14 
15 namespace knowrob {
19  class PredicateIndicator : public Printable {
20  public:
25  PredicateIndicator(std::string_view functor, uint32_t arity)
26  : functor_(Atom::Tabled(functor)), arity_(arity) {}
27 
33  : functor_(std::move(functor)), arity_(arity) {}
34 
35  // Override '==' operator
36  bool operator==(const PredicateIndicator &other) const;
37 
38  // Override '<' operator
39  bool operator<(const PredicateIndicator &other) const;
40 
46  auto &functor() const { return functor_; }
47 
53  auto arity() const { return arity_; }
54 
59  std::shared_ptr<Term> toTerm() const;
60 
61  // Override Printable::write
62  void write(std::ostream &os) const override;
63 
64  private:
65  const AtomPtr functor_;
66  const uint32_t arity_;
67  };
68 }
69 
70 #endif //KNOWROB_PREDICATE_INDICATOR_H_
void write(std::ostream &os) const override
PredicateIndicator(std::string_view functor, uint32_t arity)
PredicateIndicator(AtomPtr functor, uint32_t arity)
bool operator<(const PredicateIndicator &other) const
bool operator==(const PredicateIndicator &other) const
std::shared_ptr< Term > toTerm() const
std::shared_ptr< Atom > AtomPtr
Definition: Atom.h:69