Corrade::PluginManager namespace

Plugin management.

Contents

This library contains Manager, which takes care of loading, unloading and instancing plugins. There is also an AbstractPlugin class, which is the base of all plugins. See Plugin management for a brief introduction to how plugins work.

This library is built if WITH_PLUGINMANAGER is enabled when building Corrade. To use this library with CMake, you need to request the PluginManager component of the Corrade package and link to the Corrade::PluginManager target:

find_package(Corrade REQUIRED PluginManager)

# ...
target_link_libraries(your-app Corrade::PluginManager)

See also Downloading and building Corrade and Using Corrade with CMake for more information.

Classes

class AbstractManager
Non-templated base for plugin managers.
template<class Interface>
class AbstractManagingPlugin
Base class for plugin interfaces with access to associated manager.
class AbstractPlugin
Base class for plugin interfaces.
template<class T>
class Manager
Plugin manager.
class PluginMetadata
Plugin metadata.

Enums

enum class LoadState: unsigned short { NotFound = 1 << 0, WrongPluginVersion = 1 << 1, WrongInterfaceVersion = 1 << 2, WrongMetadataFile = 1 << 3, UnresolvedDependency = 1 << 4, LoadFailed = 1 << 5, Static = 1 << 6, Loaded = (1 << 7) | LoadState::Static, NotLoaded = 1 << 8, UnloadFailed = 1 << 9, Required = 1 << 10, Used = 1 << 11 }
Plugin load state.

Typedefs

using LoadStates = Containers::EnumSet<LoadState>
Plugin load states.

Functions

auto operator<<(Utility::Debug& debug, PluginManager::LoadState value) -> Utility::Debug&
Debug output operator.

Enum documentation

enum class Corrade::PluginManager::LoadState: unsigned short

Plugin load state.

Enumerators
NotFound

The plugin cannot be found. Returned by AbstractManager::loadState() and AbstractManager::load().

WrongPluginVersion

The plugin is build with different version of plugin manager and cannot be loaded. Returned by AbstractManager::load().

WrongInterfaceVersion

The plugin uses different interface than the interface used by plugin manager and cannot be loaded. Returned by AbstractManager::load().

WrongMetadataFile

The plugin doesn't have any metadata file or the metadata file contains errors. Returned by AbstractManager::load().

UnresolvedDependency

The plugin depends on another plugin, which cannot be loaded (e.g. not found or wrong version). Returned by AbstractManager::load().

LoadFailed

The plugin failed to load for other reason (e.g. linking failure). Returned by AbstractManager::load().

Static

The plugin is static. Returned by AbstractManager::loadState() and AbstractManager::load().

Loaded

The plugin is successfully loaded. Returned by AbstractManager::loadState() and AbstractManager::load(). The value includes value of LoadState::Static, see LoadStates for more information. In Emscripten, Windows RT, iOS and CORRADE_TARGET_ANDROID the value is equivalent to LoadState::Static.

NotLoaded

The plugin is not loaded. Plugin can be unloaded only if is dynamic and is not required by any other plugin. Returned by AbstractManager::loadState() and AbstractManager::load().

UnloadFailed

The plugin failed to unload. Returned by AbstractManager::unload().

Required

The plugin cannot be unloaded because another plugin is depending on it. Unload that plugin first and try again. Returned by AbstractManager::unload().

Used

AbstractManager::unload() returns this if the plugin has an active instance and cannot be unloaded. Destroy all instances and try again. AbstractManager::load() returns this if loading a file path directly and a plugin with the same name already exists.

Typedef documentation

typedef Containers::EnumSet<LoadState> Corrade::PluginManager::LoadStates

Plugin load states.

Useful when checking whether LoadState in in given set of values, for example:

if(loadState & (LoadState::WrongPluginVersion|LoadState::WrongInterfaceVersion)) {
    // ...
}

Note that LoadState::Loaded includes value of LoadState::Static, so you can use loadState & LoadState::Loaded instead of much more verbose state & (LoadState::Loaded|LoadState::Static).

Function documentation

Utility::Debug& Corrade::PluginManager::operator<<(Utility::Debug& debug, PluginManager::LoadState value)

Debug output operator.