|
Infinity Engine v0.6.20
C++ API Documentation
|
Base class for plugin component libraries that provide custom ProceduralComponents. More...
#include <Plugin.hpp>
Public Member Functions | |
| virtual | ~ComponentLibrary ()=default |
| Virtual destructor. | |
| virtual void | registerComponents ()=0 |
| Register all components provided by this plugin. | |
Public Attributes | |
| ankerl::unordered_dense::map< Infinity::Procedural::ComponentID, std::pair< CreateComponentFunction *, DeleteComponentFunction * > > | registrants |
| Registry mapping ComponentIDs to their creation and deletion functions. | |
Protected Member Functions | |
| template<typename T > | |
| void | registerComponent (const std::string &group, const std::string &name) |
| Registers a component type with the specified group and name. | |
| template<typename T > | |
| void | registerComponent (const Infinity::Procedural::ComponentID &id) |
| Registers a component type with the specified ComponentID. | |
Base class for plugin component libraries that provide custom ProceduralComponents.
ComponentLibrary defines the interface that all Infinity Engine plugins must implement to register their custom procedural generation components. Plugin developers should inherit from this class and implement the registerComponents() method to register all component types their plugin provides.
The library maintains a registry of component factory functions that the engine uses to instantiate components by their ComponentID (group and name).
|
virtualdefault |
Virtual destructor.
|
inlineprotected |
Registers a component type with the specified ComponentID.
Creates factory functions for instantiating and destroying the component type, and adds them to the registrants map. The component type must inherit from ProceduralComponent and have a constructor accepting ProceduralComponentDescription.
| T | The component type to register. Must inherit from ProceduralComponent. |
| id | The ComponentID (group and name) for this component. |
|
inlineprotected |
Registers a component type with the specified group and name.
| T | The component type to register. Must inherit from ProceduralComponent. |
| group | The component's group identifier (e.g., "My.Company.Components"). |
| name | The component's name within the group (e.g., "MeshGenerator"). |
|
pure virtual |
Register all components provided by this plugin.
Plugin developers should override this method to register each component type their plugin provides using the registerComponent<T>(...) template method.
Example implementation:
Each registered component type must:
The group and name strings will be used by the host application to request creation of specific component types from your plugin.
| ankerl::unordered_dense::map<Infinity::Procedural::ComponentID, std::pair<CreateComponentFunction*, DeleteComponentFunction*> > Infinity::Plugin::ComponentLibrary::registrants |
Registry mapping ComponentIDs to their creation and deletion functions.
Maps each registered component's ID to a pair of function pointers: one for creating component instances and one for destroying them.