|
Infinity Engine v0.6.20
C++ API Documentation
|
Central registry and management system for source-specific AssetPlugin instances. More...
#include <AssetPluginStore.hpp>
Static Public Member Functions | |
| static void | setDefaultLoader (const std::string &name) |
| Sets the default asset loader by plugin name. | |
| template<typename T > | |
| static void | setDefaultLoader () |
| Sets the default asset loader by plugin type. | |
| static void | setSecondaryLoader (const std::string &name) |
| Sets the secondary asset loader by plugin name. | |
| template<typename T > | |
| static void | setSecondaryLoader () |
| Sets the secondary asset loader by plugin type. | |
| static void | resetDefaults () |
| Resets all loader preferences to their default state. | |
| static void | addPlugin (const std::filesystem::path &path) |
| Loads and registers a plugin from a shared library file. | |
| static void | addPlugin (CreateAssetPluginFunction *factory) |
| Registers a plugin using a factory function. | |
| static AssetPlugin & | getDefaultLoader () |
| Gets the currently configured default loader. | |
| static AssetPlugin & | getSecondaryLoader () |
| Gets the currently configured secondary loader. | |
| static AssetPlugin & | getFallbackLoader () |
| Gets the fallback loader. | |
| template<typename T > | |
| static AssetPlugin & | getLoader () |
| Gets a loader by its C++ type. | |
| static AssetPlugin & | getLoader (const std::string &name) |
| Gets a loader by its plugin name. | |
Central registry and management system for source-specific AssetPlugin instances.
AssetPluginStore provides a singleton-style interface for managing multiple asset loading plugins within the Infinity engine. Each plugin represents a different asset source (filesystem, remote server, database, etc.) and provides loading implementations for the asset types it supports.
The store implements a fallback chain mechanism: when loading an asset, the default loader is tried first. If it cannot provide a valid asset (because the asset doesn't exist in that source or the loader doesn't support that type), the secondary loader is automatically attempted. This allows for flexible asset sourcing with graceful fallback behavior.
Plugins can be loaded dynamically from shared libraries or registered via factory functions, and can be selected either by name or by C++ type.
|
static |
Loads and registers a plugin from a shared library file.
Dynamically loads an AssetPlugin from the specified shared library (e.g., .dll, .so, .dylib) and adds it to the plugin store. The library must export the CreateAssetPlugin and DestroyAssetPlugin functions.
| path | Filesystem path to the plugin shared library |
| std::runtime_error | if the plugin cannot be loaded or is invalid |
|
static |
Registers a plugin using a factory function.
Adds a plugin to the store by providing a factory function that creates plugin instances. This is useful for statically-linked plugins or when programmatic plugin registration is preferred.
| factory | Pointer to a function that creates AssetPlugin instances |
|
static |
Gets the currently configured default loader.
Returns the primary asset source that will be tried first when loading assets.
| std::runtime_error | if no default loader is configured |
|
static |
Gets the fallback loader.
Returns the system's ultimate fallback loader, which is used when both default and secondary loaders are unavailable or fail to provide a valid asset.
|
inlinestatic |
Gets a loader by its C++ type.
Template method for retrieving a specific plugin instance by its compile-time type.
| T | The plugin class type to retrieve |
| std::runtime_error | if the requested plugin type is not registered |
|
static |
Gets a loader by its plugin name.
Retrieves a specific plugin instance by the name it reports via getPluginName().
| name | The name of the plugin to retrieve |
| std::runtime_error | if no plugin with the specified name exists |
|
static |
Gets the currently configured secondary loader.
Returns the fallback asset source that will be tried when the default loader cannot provide a valid asset.
| std::runtime_error | if no secondary loader is configured |
|
static |
Resets all loader preferences to their default state.
Clears any configured default and secondary loaders, reverting to the system's initial loader configuration.
|
inlinestatic |
Sets the default asset loader by plugin type.
Template convenience method that sets the default loader using the plugin's C++ type rather than its name string.
| T | The plugin class type to set as default |
|
static |
Sets the default asset loader by plugin name.
Configures which plugin should be used as the primary asset source. The default loader is attempted first when loading assets. If it cannot provide a valid asset, the system falls back to the secondary loader.
| name | The name of the plugin to set as default |
|
inlinestatic |
Sets the secondary asset loader by plugin type.
Template convenience method that sets the secondary loader using the plugin's C++ type rather than its name string.
| T | The plugin class type to set as secondary |
|
static |
Sets the secondary asset loader by plugin name.
Configures which plugin should be used as a fallback source when the default loader cannot provide a valid asset. This enables multi-source asset loading strategies, such as checking local filesystem first, then falling back to a remote source.
| name | The name of the plugin to set as secondary |