Pothos  0.7.0-gf7fbae99
The Pothos dataflow programming software suite
Plugin.hpp
Go to the documentation of this file.
1 
11 #pragma once
12 #include <Pothos/Config.hpp>
13 #include <Pothos/Plugin/Path.hpp>
14 #include <Pothos/Plugin/Module.hpp>
15 #include <Pothos/Object/Object.hpp>
16 #include <string>
17 
18 namespace Pothos {
19 
24 {
25 public:
27  Plugin(void);
28 
32  Plugin(const PluginPath &path,
33  const Object &object = Object(),
34  const PluginModule &module = PluginModule::null());
35 
40  template <typename ValueType>
41  Plugin(const PluginPath &path, ValueType &&value);
42 
44  const PluginPath &getPath(void) const;
45 
47  const Object &getObject(void) const;
48 
50  PluginModule getModule(void) const;
51 
53  std::string toString(void) const;
54 
55 private:
56  // This module owns the plugin, so its just a weak pointer.
57  std::weak_ptr<PluginModule::Impl> _module;
58  PluginPath _path;
59  Object _object;
60 };
61 
62 } //namespace Pothos
63 
64 #include <utility> //std::forward
65 
66 template <typename ValueType>
67 Pothos::Plugin::Plugin(const PluginPath &path, ValueType &&value):
68  _path(path),
69  _object(Object(std::forward<ValueType>(value)))
70 {
71  return;
72 }
static const PluginModule & null(void)
A reference to a permanent empty module.
Definition: Module.hpp:24
#define POTHOS_API
Definition: Config.hpp:41
Plugin(void)
Create a null plugin.
Definition: ArchiveEntry.hpp:20
Definition: Object.hpp:47
Definition: Path.hpp:24
Definition: Plugin.hpp:23