plugify  1.0.0.0
All Classes Namespaces Functions Variables Pages
plugin_manager.hpp
1 #pragma once
2 
3 #include <cstdint>
4 #include <string>
5 #include <filesystem>
6 #include <functional>
7 #include <optional>
8 #include <plugify_export.h>
9 
10 namespace plugify {
11  class ModuleRef;
12  class PluginRef;
13  class PluginReferenceDescriptorRef;
14 
18  using UniqueId = std::ptrdiff_t;
19 
24  using ModuleOpt = std::optional<ModuleRef>;
25 
30  using PluginOpt = std::optional<PluginRef>;
31 
37  public:
38  virtual ~IPluginManager() = default;
39 
44  virtual bool Initialize() = 0;
45 
49  virtual void Terminate() = 0;
50 
55  virtual bool IsInitialized() const = 0;
56 
62  virtual ModuleOpt FindModule(std::string_view moduleName) const = 0;
63 
69  virtual ModuleOpt FindModuleFromId(UniqueId moduleId) const = 0;
70 
76  virtual ModuleOpt FindModuleFromLang(std::string_view moduleLang) const = 0;
77 
83  virtual ModuleOpt FindModuleFromPath(const std::filesystem::path& moduleFilePath) const = 0;
84 
89  virtual std::vector<ModuleRef> GetModules() const = 0;
90 
96  virtual PluginOpt FindPlugin(std::string_view pluginName) const = 0;
97 
103  virtual PluginOpt FindPluginFromId(UniqueId pluginId) const = 0;
104 
110  virtual PluginOpt FindPluginFromDescriptor(const PluginReferenceDescriptorRef& pluginDescriptor) const = 0;
111 
116  virtual std::vector<PluginRef> GetPlugins() const = 0;
117  };
118 } // namespace plugify
Interface for the plugin manager provided to the user, implemented in the core.
virtual bool Initialize()=0
Initialize the plugin manager.
virtual ModuleOpt FindModuleFromId(UniqueId moduleId) const =0
Find a module by unique identifier.
virtual PluginOpt FindPlugin(std::string_view pluginName) const =0
Find a plugin by name.
virtual ModuleOpt FindModule(std::string_view moduleName) const =0
Find a module by name.
virtual std::vector< ModuleRef > GetModules() const =0
Get a vector of references to all modules.
virtual void Terminate()=0
Terminate the plugin manager.
virtual ModuleOpt FindModuleFromPath(const std::filesystem::path &moduleFilePath) const =0
Find a module by file path.
virtual std::vector< PluginRef > GetPlugins() const =0
Get a vector of references to all plugins.
virtual bool IsInitialized() const =0
Check if the plugin manager is initialized.
virtual PluginOpt FindPluginFromDescriptor(const PluginReferenceDescriptorRef &pluginDescriptor) const =0
Find a plugin by its descriptor.
virtual ModuleOpt FindModuleFromLang(std::string_view moduleLang) const =0
Find a module by language.
virtual PluginOpt FindPluginFromId(UniqueId pluginId) const =0
Find a plugin by unique identifier.
A reference class for the PluginReferenceDescriptor structure.