knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
Atomic.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_ATOMIC_H
7 #define KNOWROB_ATOMIC_H
8 
9 #include "Term.h"
10 #include "XSDType.h"
11 #include <sstream>
12 
13 namespace knowrob {
17  enum class AtomicType {
19  ATOM,
21  NUMERIC,
23  STRING
24  };
25 
26  // forward declaration
27  class Triple;
28 
32  class Atomic : public Term {
33  public:
36 
37  ~Atomic() override = default;
38 
43  bool isSameAtomic(const Atomic &other) const;
44 
48  AtomicType atomicType() const { return atomicType_; }
49 
53  size_t hashOfAtomic() const;
54 
59  virtual std::string_view stringForm() const = 0;
60 
66  static std::shared_ptr<Atomic> makeTripleValue(const Triple &triple);
67 
68  // Override Term
69  const std::set<std::string_view> &variables() const final { return Term::noVariables_; }
70 
71  // override Printable
72  void write(std::ostream &os) const override { os << stringForm(); }
73 
74  protected:
75  const AtomicType atomicType_;
76  };
77 } // knowrob
78 
79 #endif //KNOWROB_ATOMIC_H
static std::shared_ptr< Atomic > makeTripleValue(const Triple &triple)
const AtomicType atomicType_
Definition: Atomic.h:75
~Atomic() override=default
size_t hashOfAtomic() const
void write(std::ostream &os) const override
Definition: Atomic.h:72
bool isSameAtomic(const Atomic &other) const
Atomic(AtomicType atomicType)
Definition: Atomic.h:34
const std::set< std::string_view > & variables() const final
Definition: Atomic.h:69
virtual std::string_view stringForm() const =0
AtomicType atomicType() const
Definition: Atomic.h:48
static const std::set< std::string_view > noVariables_
Definition: Term.h:110
TermType
Definition: Term.h:18
AtomicType
Definition: Atomic.h:17