EVENGINE_API_FOUNDATION public API. 更多...
#include <Module.h>
类 | |
| struct | State |
Public 类型 | |
| typedef Module *(* | creator_t) () |
| typedef void(* | exposer_t) (ssq::Table &) |
静态 Public 成员函数 | |
| static ModuleManager & | inst () |
| Singleton registry holding every registered engine module. | |
| static Module * | find (const char *name) |
| Finds a live module instance by name, or nullptr. @ownership Borrowed; ModuleManager owns the returned instance. @nullable Yes when the name is unknown or the module is not created. @lifetime Valid until module shutdown, unregister, or registry teardown; callers must not retain it across those boundaries. @thread Main/composition thread; the registry is not concurrently mutable. @reentrancy No module registration or shutdown may be re-entered by this call. | |
| static Module * | find (const char *name, creator_t factory) |
| Looks up a factory's own generation, including retired plugin generations. @ownership Borrowed; the registry owns the instance. @nullable Yes before this factory creates its instance. @lifetime Until process teardown; retired plugin instances remain resident. @thread Main/composition thread only; does not invoke callbacks. | |
| static void | insert (const char *name, Module *inst) |
| Stores a module instance under a name (used by Module_IMPL). | |
| static void | insert (const char *name, Module *instance, creator_t factory) |
| Stores an instance in its factory generation; transfers ownership to the registry. | |
| static void | register_module (const char *name, creator_t c, exposer_t e) |
| Registers a module factory (creator + script exposer) by name. | |
| static eve::Result< void > | beginPluginRegistration () |
| Begins an atomic native-plugin module registration transaction. | |
| static eve::Result< void > | beginPluginRegistration (std::string owner) |
| Begins registration/replacement of modules owned by a canonical plugin path. | |
| static eve::Result< void > | finishPluginRegistration (bool commit) |
| Commits or rolls back the active plugin registration transaction. | |
| static void | expose (Runtime &runtime) |
Installs the eve table and defers native class method bindings. | |
| static void | expose (ssq::VM &vm) |
| Expose. | |
| static int | expose_pending () |
| Expose pending. | |
| static Runtime * | runtime () |
| Active runtime associated with the last expose() call, or nullptr. @ownership Borrowed; the embedding application owns the Runtime. @nullable Yes before expose() and after detach(). @lifetime Valid only until the runtime is detached or destroyed. @thread Main/composition thread; do not query while detach is running. @reentrancy The result must not be used to re-enter module lifecycle callbacks. | |
| static ssq::VM * | vm () |
| Script VM of the last expose call, including raw-VM embedders, or nullptr. @ownership Borrowed; Runtime or the embedding host owns the VM. @nullable Yes before expose and after detach. @lifetime Until owner destruction or detach; raw-VM embedders call detach(nullptr) before destruction. @thread Main/script thread only. @reentrancy Do not unload modules or detach the runtime while using the VM. | |
| static void | detach (Runtime *runtime) |
| Clears the active runtime if it matches; called during shutdown. | |
| template<typename T > | |
| static T * | getInstance (const char *name) |
Casts the registered instance of a module to T (may be null). @ownership Borrowed; the manager owns the module instance. @nullable Yes when no live instance is registered under name. @lifetime Valid until module shutdown or registry teardown; do not retain across either. @thread Main/composition thread only. @reentrancy The returned instance must not be used to re-enter registry mutation. | |
| template<typename T > | |
| static T * | requireInstance (const char *name) |
| Returns the live instance, creating it lazily through the registered factory. @ownership Borrowed; ModuleManager owns the lazily-created instance. @nullable No when the registration has a valid factory; invalid registration is an invariant failure. @lifetime Valid until module shutdown or registry teardown; do not retain across either. @thread Main/composition thread only. @reentrancy Factory code must not recursively request the same module. | |
| static void | requireAll () |
| Instantiates every registered module through its factory. | |
静态 Protected 成员函数 | |
| static void | exposeVM (ssq::VM &vm) |
| Expose vm. | |
友元 | |
| struct | ModuleBindAccess |
详细描述
成员类型定义说明
◆ creator_t
◆ exposer_t
成员函数说明
◆ beginPluginRegistration() [1/2]
|
static |
Begins an atomic native-plugin module registration transaction.
在文件 ModuleRegistry.cpp 第 112 行定义.
◆ beginPluginRegistration() [2/2]
|
static |
Begins registration/replacement of modules owned by a canonical plugin path.
- 参数
-
owner Owning copy of the plugin identity; other owners cannot be replaced.
- 返回
- Conflict for nested registration. Rollback preserves the previous generation.
- 注解
- Main/script thread only; initializer must only register modules. @cost Copies registration metadata once per library load/reload.
在文件 ModuleRegistry.cpp 第 114 行定义.
引用了 eve::Applied, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), owner, eve::Status::success() , 以及 eve::Result< T >::success().
◆ detach()
|
static |
Clears the active runtime if it matches; called during shutdown.
在文件 ModuleRegistry.cpp 第 181 行定义.
被这些函数引用 eve::Runtime::initialize() , 以及 eve::Runtime::shutdown().
◆ expose() [1/2]
|
static |
Installs the eve table and defers native class method bindings.
Result helpers and script ECS are bound immediately. Each module's expose(ssq::Table&) (class + methods + nested types) runs on the first script get of that class name, or of a nested class it owns. The default unfiltered startup path eagerly completes all bindings while preserving the canonical script ECS object identities.
在文件 Module.cpp 第 204 行定义.
引用了 exposeVM(), inst(), runtime() , 以及 eve::Runtime::vm().
被这些函数引用 eve::Runtime::initialize().
◆ expose() [2/2]
|
static |
◆ expose_pending()
|
static |
Expose pending.
在文件 Module.cpp 第 216 行定义.
引用了 active, count, eve::flushPostEcsHooks(), inst() , 以及 scope.
◆ exposeVM()
|
staticprotected |
Expose vm.
在文件 Module.cpp 第 181 行定义.
引用了 eve::script::exposeProviderBindings(), eve::script::exposeResultBindings(), inst(), eve::prepareEcsScriptInjection() , 以及 vm().
◆ find() [1/2]
|
static |
Finds a live module instance by name, or nullptr. @ownership Borrowed; ModuleManager owns the returned instance. @nullable Yes when the name is unknown or the module is not created. @lifetime Valid until module shutdown, unregister, or registry teardown; callers must not retain it across those boundaries. @thread Main/composition thread; the registry is not concurrently mutable. @reentrancy No module registration or shutdown may be re-entered by this call.
在文件 ModuleRegistry.cpp 第 16 行定义.
引用了 EV_PARAM_CHECK, name , 以及 p.
◆ find() [2/2]
Looks up a factory's own generation, including retired plugin generations. @ownership Borrowed; the registry owns the instance. @nullable Yes before this factory creates its instance. @lifetime Until process teardown; retired plugin instances remain resident. @thread Main/composition thread only; does not invoke callbacks.
在文件 ModuleRegistry.cpp 第 23 行定义.
引用了 current, EV_PARAM_CHECK, name, previous, retired , 以及 state.
◆ finishPluginRegistration()
|
static |
Commits or rolls back the active plugin registration transaction.
- 参数
-
commit Whether to keep newly registered modules.
- 返回
- Applied when committed, NoOp when explicitly rolled back, or a structured registration conflict/failure.
在文件 ModuleRegistry.cpp 第 127 行定义.
引用了 eve::Applied, eve::Conflict, error, eve::Diagnostic::error(), eve::Result< T >::failure(), name, eve::NoOp, previous, eve::Status::success() , 以及 eve::Result< T >::success().
◆ getInstance()
|
inlinestatic |
Casts the registered instance of a module to T (may be null). @ownership Borrowed; the manager owns the module instance. @nullable Yes when no live instance is registered under name. @lifetime Valid until module shutdown or registry teardown; do not retain across either. @thread Main/composition thread only. @reentrancy The returned instance must not be used to re-enter registry mutation.
◆ insert() [1/2]
|
static |
Stores a module instance under a name (used by Module_IMPL).
在文件 ModuleRegistry.cpp 第 72 行定义.
引用了 EV_PARAM_CHECK , 以及 name.
◆ insert() [2/2]
Stores an instance in its factory generation; transfers ownership to the registry.
- 参数
-
name Registered name, borrowed for this call. instance Owned instance, non-null, retained until registry teardown. factory Identifies the active or retired generation.
- 注解
- Main/composition thread only; invokes no callbacks.
在文件 ModuleRegistry.cpp 第 37 行定义.
引用了 current, EV_ASSERT, EV_PARAM_CHECK, name, previous, retired , 以及 state.
◆ inst()
|
static |
Singleton registry holding every registered engine module.
在文件 ModuleRegistry.cpp 第 11 行定义.
被这些函数引用 expose(), expose(), expose_pending(), exposeVM(), eve::ModuleBindAccess::modules() , 以及 vm().
◆ register_module()
Registers a module factory (creator + script exposer) by name.
在文件 ModuleRegistry.cpp 第 84 行定义.
引用了 c, EV_PARAM_CHECK, name, p , 以及 state.
◆ requireAll()
|
static |
Instantiates every registered module through its factory.
Mirrors what load.nut's module-binding loop does for eve run, so embedders that never run load.nut (e.g. the headless eve mcp host) still get the capability providers (IEditorHost, IRenderCapture, ...).
在文件 ModuleRegistry.cpp 第 78 行定义.
被这些函数引用 eve::cmd::Cmdline::McpHost().
◆ requireInstance()
|
inlinestatic |
Returns the live instance, creating it lazily through the registered factory. @ownership Borrowed; ModuleManager owns the lazily-created instance. @nullable No when the registration has a valid factory; invalid registration is an invariant failure. @lifetime Valid until module shutdown or registry teardown; do not retain across either. @thread Main/composition thread only. @reentrancy Factory code must not recursively request the same module.
◆ runtime()
|
static |
Active runtime associated with the last expose() call, or nullptr. @ownership Borrowed; the embedding application owns the Runtime. @nullable Yes before expose() and after detach(). @lifetime Valid only until the runtime is detached or destroyed. @thread Main/composition thread; do not query while detach is running. @reentrancy The result must not be used to re-enter module lifecycle callbacks.
在文件 ModuleRegistry.cpp 第 179 行定义.
被这些函数引用 eve::ui::DatabasePanel::build(), eve::ui::ObjectRegistry::create(), expose(), eve::ui::UI::inspectSetPickHandler(), eve::ui::UI::propertySchema(), eve::ui::DatabasePanel::refresh(), eve::ui::ObjectRegistry::registerObject(), eve::ui::UI::releaseSquirrelRoots(), eve::ui::EditorHost::reloadResource(), eve::ui::UI::sceneSetPickHandler(), eve::ui::DatabasePanel::sync(), eve::ui::DatabasePanel::~DatabasePanel() , 以及 eve::ui::ObjectRegistry::~ObjectRegistry().
◆ vm()
|
static |
Script VM of the last expose call, including raw-VM embedders, or nullptr. @ownership Borrowed; Runtime or the embedding host owns the VM. @nullable Yes before expose and after detach. @lifetime Until owner destruction or detach; raw-VM embedders call detach(nullptr) before destruction. @thread Main/script thread only. @reentrancy Do not unload modules or detach the runtime while using the VM.
在文件 Module.cpp 第 214 行定义.
引用了 inst().
被这些函数引用 expose() , 以及 exposeVM().
友元及相关函数文档
◆ ModuleBindAccess
|
friend |
该类的文档由以下文件生成:
- src/engine/common/Module.h
- src/engine/common/Module.cpp
- src/engine/common/ModulePlugin.cpp
- src/engine/common/ModuleRegistry.cpp