Holds a registry of plugins, loading and compiling them on the fly. More...
#include <Plugin.h>
Public Types | |
| enum class | LoadMode { Load = 0 , Reload = 1 } |
| Instructs loadPlugin to Load or Reload the plugin. More... | |
Public Member Functions | |
| void | init (Span< PluginDynamicLibrary > librariesStorage) |
| Init a PluginRegistry with some given storage. | |
| Result | close () |
| Unregisters all plugins. | |
| Result | replaceDefinitions (Span< PluginDefinition > &&definitions) |
| Appends the definitions to registry. | |
| Result | loadPlugin (const StringView identifier, const PluginCompiler &compiler, const PluginSysroot &sysroot, StringView executablePath, LoadMode loadMode=LoadMode::Load) |
| Loads a plugin with given identifier, compiling it with given PluginCompiler. | |
| Result | unloadPlugin (const StringView identifier) |
| Unloads an already loaded plugin by its identifier. | |
| Result | removeAllBuildProducts (const StringView identifier) |
| Removes all temporary build products of the Plugin with given identifier. | |
| PluginDynamicLibrary * | findPlugin (const StringView identifier) |
| Find a PluginDynamicLibrary in the registry with a given identifier. | |
| size_t | getNumberOfEntries () const |
| Returns the total number of registry entries (counting both loaded and unloaded plugins) | |
| const PluginIdentifier & | getIdentifierAt (size_t index) const |
| Returns the PluginIdentifier corresponding to the index entry of the registry. | |
| const PluginDynamicLibrary & | getPluginDynamicLibraryAt (size_t index) |
| Returns the PluginIdentifier corresponding to the index entry of the registry. | |
| void | getPluginsToReloadBecauseOf (StringView relativePath, TimeMs tolerance, Function< void(const PluginIdentifier &)> onPlugin) |
| Enumerates all plugins that must be reloaded when relativePath is modified. | |
Holds a registry of plugins, loading and compiling them on the fly.
|
strong |
Instructs loadPlugin to Load or Reload the plugin.
| Result SC::PluginRegistry::close | ( | ) |
Unregisters all plugins.
|
nodiscard |
Find a PluginDynamicLibrary in the registry with a given identifier.
| identifier | Identifier of the Plugin to find |
nullptr)
|
inlinenodiscard |
Returns the PluginIdentifier corresponding to the index entry of the registry.
|
inlinenodiscard |
Returns the total number of registry entries (counting both loaded and unloaded plugins)
|
inlinenodiscard |
Returns the PluginIdentifier corresponding to the index entry of the registry.
| void SC::PluginRegistry::getPluginsToReloadBecauseOf | ( | StringView | relativePath, |
| TimeMs | tolerance, | ||
| Function< void(const PluginIdentifier &)> | onPlugin ) |
Enumerates all plugins that must be reloaded when relativePath is modified.
| relativePath | A relative path of the file that has been modified |
| tolerance | How many milliseconds must be passed to consider a file as modified |
| onPlugin | Callback that will be called with Plugins affected by the modification |
| void SC::PluginRegistry::init | ( | Span< PluginDynamicLibrary > | librariesStorage | ) |
Init a PluginRegistry with some given storage.
| Result SC::PluginRegistry::loadPlugin | ( | const StringView | identifier, |
| const PluginCompiler & | compiler, | ||
| const PluginSysroot & | sysroot, | ||
| StringView | executablePath, | ||
| LoadMode | loadMode = LoadMode::Load ) |
Loads a plugin with given identifier, compiling it with given PluginCompiler.
| identifier | The Plugin identifier that must be loaded |
| compiler | The compiler used |
| sysroot | The sysroot (library / include files) used |
| executablePath | The loader executable path holding symbols used by the plugin |
| loadMode | If to load or force reload of the plugin |
| Result SC::PluginRegistry::removeAllBuildProducts | ( | const StringView | identifier | ) |
Removes all temporary build products of the Plugin with given identifier.
| identifier | Identifier of the plugin |
| Result SC::PluginRegistry::replaceDefinitions | ( | Span< PluginDefinition > && | definitions | ) |
Appends the definitions to registry.
| definitions | found plugin definitions |
| Result SC::PluginRegistry::unloadPlugin | ( | const StringView | identifier | ) |
Unloads an already loaded plugin by its identifier.
| identifier | Identifier of a plugin that must be unloaded |