knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
NamedPlugin.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_NAMED_PLUGIN_H_
7 #define KNOWROB_NAMED_PLUGIN_H_
8 
9 #include <string>
10 #include <memory>
11 
12 namespace knowrob {
17  CPP = 0,
18  PYTHON = 1,
19  };
20 
24  template<class T>
25  class NamedPlugin {
26  public:
32  NamedPlugin(std::string_view name, PluginLanguage language, const std::shared_ptr<T> &plugin)
33  : name_(name), plugin_(plugin), language_(language) {}
34 
38  const std::shared_ptr<T> &operator()() const { return plugin_; }
39 
43  const std::shared_ptr<T> &value() const { return plugin_; }
44 
48  std::string_view name() const { return name_; }
49 
53  PluginLanguage language() const { return language_; }
54 
55  protected:
56  const std::string name_;
57  const std::shared_ptr<T> plugin_;
59  };
60 }
61 
62 #endif //KNOWROB_NAMED_PLUGIN_H_
const std::shared_ptr< T > plugin_
Definition: NamedPlugin.h:57
std::string_view name() const
Definition: NamedPlugin.h:48
const std::string name_
Definition: NamedPlugin.h:56
NamedPlugin(std::string_view name, PluginLanguage language, const std::shared_ptr< T > &plugin)
Definition: NamedPlugin.h:32
const std::shared_ptr< T > & operator()() const
Definition: NamedPlugin.h:38
const std::shared_ptr< T > & value() const
Definition: NamedPlugin.h:43
const PluginLanguage language_
Definition: NamedPlugin.h:58
PluginLanguage language() const
Definition: NamedPlugin.h:53
TermRule & string()
Definition: terms.cpp:63
PluginLanguage
Definition: NamedPlugin.h:16