Cogs.Core
|
Extension registry used to host and manage extension instances. More...
#include <ExtensionRegistry.h>
Public Types | |
enum class | ExtensionModuleLoadResult { Success , Failure , NoExtensionsFound } |
Defines possible results of an extension module load. More... | |
Static Public Member Functions | |
static void | add (Extension *extension, StringView version) |
Adds the given extension to the registry, ensuring the initialization methods are called at appropriate times. | |
static bool | hasExtension (const StringView &key, bool silent=false) |
Check if an extension with the given key is present in this build. | |
static void * | getExtensionSymbol (const char *extension, const char *name) |
Retrieves the address of a symbol in the extension module. | |
static void | initializeStatic () |
Performs static initialization of all extensions registered with add(). | |
static void | initialize (Context *context) |
Performs initialization of all extensions registered with add(). | |
static void | cleanup (Context *context) |
Cleanup the given context. | |
static void | remove (Context *context) |
Removes the given context. | |
static const void * | loadExtensionModule (const std::string &path, void **modulehandle=nullptr, ExtensionModuleLoadResult *result=nullptr) |
Load the extension module with the given name. | |
template<typename API > | |
static ModuleAPI< API > | loadExtensionModule (const std::string &path) |
Loads the extension module with the given name. | |
template<typename ComponentSystemType > | |
static ComponentSystemType * | registerExtensionSystem (Context *context, SystemPriority::ESystemPriority systemPriority, uint32_t capacity) |
Registers an instance of the given component system type in the extension system registry. | |
template<typename ComponentSystemType > | |
static ComponentSystemType * | getExtensionSystem (Context *context) |
Retrieve the extension component system of the given template type. | |
Static Private Member Functions | |
static std::vector< Extension * > & | getExtensions () |
Get the extension registry. | |
static std::deque< Extension * > & | getDelayedExtensions () |
Static Private Attributes | |
static std::vector< Context * > | contexts |
static bool | initialized = false |
static bool | locked = false |
Extension registry used to host and manage extension instances.
Definition at line 106 of file ExtensionRegistry.h.
|
strong |
Defines possible results of an extension module load.
Enumerator | |
---|---|
Success | Module was loaded successfully and extensions loaded. |
Failure | Module failed loading. |
NoExtensionsFound | Module loaded, but no valid extensions were registered by the module. The module code has still been loaded into the process and may be accessed. |
Definition at line 157 of file ExtensionRegistry.h.
|
static |
Adds the given extension to the registry, ensuring the initialization methods are called at appropriate times.
extension | Pointer to the extension to add. |
Definition at line 34 of file ExtensionRegistry.cpp.
References Cogs::StringView::data(), Cogs::StringView::empty(), and getExtensions().
|
static |
Cleanup the given context.
Definition at line 115 of file ExtensionRegistry.cpp.
Referenced by Cogs::Core::Engine::~Engine().
|
staticprivate |
Definition at line 213 of file ExtensionRegistry.cpp.
|
staticprivate |
Get the extension registry.
Definition at line 206 of file ExtensionRegistry.cpp.
Referenced by add().
|
static |
Retrieves the address of a symbol in the extension module.
extension | Extension name. |
symbol | Symbol name. |
Definition at line 81 of file ExtensionRegistry.cpp.
|
inlinestatic |
Retrieve the extension component system of the given template type.
ComponentSystemType | Type of the component system to retrieve. |
context | Context to retrieve the system from. |
Definition at line 227 of file ExtensionRegistry.h.
References Cogs::Core::Context::getExtensionSystem().
|
static |
Check if an extension with the given key is present in this build.
key | Pointer to a string containing the key to search for. |
silent | Do not log that an extension is missing. |
Definition at line 64 of file ExtensionRegistry.cpp.
|
static |
Performs initialization of all extensions registered with add().
This method should be called once after creating a new context.
Definition at line 106 of file ExtensionRegistry.cpp.
Referenced by Cogs::Core::Context::initialize().
|
static |
Performs static initialization of all extensions registered with add().
This method should only be called once per application run.
Definition at line 91 of file ExtensionRegistry.cpp.
Referenced by Cogs::Core::Context::initializeStatic().
|
inlinestatic |
Loads the extension module with the given name.
path | Path to a dynamic library file to load. |
Definition at line 188 of file ExtensionRegistry.h.
|
static |
Load the extension module with the given name.
The name must point to a valid dynamic library.
path | Path to a dynamic library file to load. |
Definition at line 127 of file ExtensionRegistry.cpp.
References Cogs::Core::Extension::initialize(), and Cogs::Core::Extension::initializeStatic().
|
inlinestatic |
Registers an instance of the given component system type in the extension system registry.
ComponentSystemType | Type of system to create. Must provide specialized getExtensionKey() method. |
systemPriority | Priority to use when registering the system. |
context | Context to register the system in. |
capacity | Initial system capacity. |
Definition at line 208 of file ExtensionRegistry.h.
References Cogs::Core::Context::engine, and Cogs::Core::Context::registerExtensionSystem().
|
static |
Removes the given context.
Definition at line 122 of file ExtensionRegistry.cpp.
Referenced by Cogs::Core::Engine::~Engine().
|
staticprivate |
Definition at line 240 of file ExtensionRegistry.h.
|
staticprivate |
Definition at line 241 of file ExtensionRegistry.h.
|
staticprivate |
Definition at line 242 of file ExtensionRegistry.h.