Sane C++ Libraries
C++ Platform Abstraction Libraries
SC::PluginRegistry Struct Reference

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

Result replaceDefinitions (Vector< PluginDefinition > &&definitions)
 Appends the definitions to registry. More...
 
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. More...
 
Result unloadPlugin (const StringView identifier)
 Unloads an already loaded plugin by its identifier. More...
 
Result removeAllBuildProducts (const StringView identifier)
 Removes all temporary build products of the Plugin with given identifier. More...
 
const PluginDynamicLibraryfindPlugin (const StringView identifier)
 Find a PluginDynamicLibrary in the registry with a given identifier. More...
 
size_t getNumberOfEntries () const
 Returns the total number of registry entries (counting both loaded and unloaded plugins) More...
 
const PluginIdentifiergetIdentifierAt (size_t index) const
 Returns the PluginIdentifier corresponding to the index entry of the registry. More...
 
const PluginDynamicLibrarygetPluginDynamicLibraryAt (size_t index)
 Returns the PluginIdentifier corresponding to the index entry of the registry. More...
 

Detailed Description

Holds a registry of plugins, loading and compiling them on the fly.

Member Enumeration Documentation

◆ LoadMode

enum class SC::PluginRegistry::LoadMode
strong

Instructs loadPlugin to Load or Reload the plugin.

Member Function Documentation

◆ findPlugin()

const PluginDynamicLibrary * SC::PluginRegistry::findPlugin ( const StringView  identifier)

Find a PluginDynamicLibrary in the registry with a given identifier.

Parameters
identifierIdentifier of the Plugin to find
Returns
Pointer to the found PluginDynamicLibrary if found (or nullptr)

◆ getIdentifierAt()

const PluginIdentifier & SC::PluginRegistry::getIdentifierAt ( size_t  index) const
inline

Returns the PluginIdentifier corresponding to the index entry of the registry.

◆ getNumberOfEntries()

size_t SC::PluginRegistry::getNumberOfEntries ( ) const
inline

Returns the total number of registry entries (counting both loaded and unloaded plugins)

◆ getPluginDynamicLibraryAt()

const PluginDynamicLibrary & SC::PluginRegistry::getPluginDynamicLibraryAt ( size_t  index)
inline

Returns the PluginIdentifier corresponding to the index entry of the registry.

◆ loadPlugin()

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.

Parameters
identifierThe Plugin identifier that must be loaded
compilerThe compiler used
sysrootThe sysroot (library / include files) used
executablePathThe loader executable path holding symbols used by the plugin
loadModeIf to load or force reload of the plugin
Returns
Valid Result if the plugin has been found, compiled, loaded and inited successfully

◆ removeAllBuildProducts()

Result SC::PluginRegistry::removeAllBuildProducts ( const StringView  identifier)

Removes all temporary build products of the Plugin with given identifier.

Parameters
identifierIdentifier of the plugin
Returns
Valid Result if all build products for the given plugin can be successfully removed

◆ replaceDefinitions()

Result SC::PluginRegistry::replaceDefinitions ( Vector< PluginDefinition > &&  definitions)

Appends the definitions to registry.

Parameters
definitionsfound plugin definitions
Returns
Valid Result if definitions have been replaced successfully

◆ unloadPlugin()

Result SC::PluginRegistry::unloadPlugin ( const StringView  identifier)

Unloads an already loaded plugin by its identifier.

Parameters
identifierIdentifier of a plugin that must be unloaded
Returns
Valid Result if an already loaded plugin exists with the given identifier and it can be unloaded

The documentation for this struct was generated from the following file: