载入中...
搜索中...
未找到

EVENGINE_API_FOUNDATION public API. 更多...

#include <Module.h>

类

struct  ModuleInfo
 ModuleInfo public API. 更多...
 

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 void insert (const char *name, Module *inst)
 Stores a module instance under a name (used by Module_IMPL).
 
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 > 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 active runtime, or nullptr. @ownership Borrowed; Runtime owns the VM. @nullable Yes when no runtime is attached. @lifetime Valid until Runtime destruction or detach(); never retain it across either. @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.
 

Protected 属性

std::unordered_map< std::string, ModuleInfo > registered_modules
 
bool plugin_registration_active_ = false
 
std::vector< std::string > plugin_registration_added_
 
std::string plugin_registration_error_
 
Runtime * active_runtime_ = nullptr
 

友元

struct ModuleBindAccess
 

详细描述

EVENGINE_API_FOUNDATION public API.

在文件 Module.h 第 55 行定义.

成员类型定义说明

◆ creator_t

typedef Module *(* eve::ModuleManager::creator_t) ()

在文件 Module.h 第 57 行定义.

◆ exposer_t

typedef void(* eve::ModuleManager::exposer_t) (ssq::Table &)

在文件 Module.h 第 58 行定义.

成员函数说明

◆ beginPluginRegistration()

eve::Result< void > eve::ModuleManager::beginPluginRegistration ( )
static

Begins an atomic native-plugin module registration transaction.

在文件 Module.cpp 第 228 行定义.

引用了 eve::Applied, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), inst(), eve::Status::success() , 以及 eve::Result< T >::success().

被这些函数引用 eve::plugins::Plugins::load().

◆ detach()

void eve::ModuleManager::detach ( Runtime *  runtime)
static

Clears the active runtime if it matches; called during shutdown.

在文件 Module.cpp 第 299 行定义.

引用了 active_runtime_, inst() , 以及 runtime().

被这些函数引用 eve::Runtime::initialize() , 以及 eve::Runtime::shutdown().

◆ expose() [1/2]

void eve::ModuleManager::expose ( Runtime &  runtime)
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 第 282 行定义.

引用了 active_runtime_, exposeVM(), inst(), runtime() , 以及 eve::Runtime::vm().

被这些函数引用 eve::Runtime::initialize().

◆ expose() [2/2]

void eve::ModuleManager::expose ( ssq::VM &  vm)
static

Expose.

在文件 Module.cpp 第 287 行定义.

引用了 active_runtime_, exposeVM(), inst() , 以及 vm().

◆ expose_pending()

int eve::ModuleManager::expose_pending ( )
static

Expose pending.

在文件 Module.cpp 第 303 行定义.

引用了 active, active_runtime_, count, eve::Runtime::enter(), eve::flushPostEcsHooks(), inst(), registered_modules , 以及 scope.

被这些函数引用 eve::plugins::Plugins::load().

◆ exposeVM()

void eve::ModuleManager::exposeVM ( ssq::VM &  vm)
staticprotected

Expose vm.

在文件 Module.cpp 第 264 行定义.

引用了 eve::script::exposeResultBindings(), inst(), eve::prepareEcsScriptInjection(), registered_modules , 以及 vm().

被这些函数引用 expose() , 以及 expose().

◆ find()

Module * eve::ModuleManager::find ( const char *  name)
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.

在文件 Module.cpp 第 175 行定义.

引用了 EV_PARAM_CHECK, inst(), name, p , 以及 registered_modules.

◆ finishPluginRegistration()

eve::Result< void > eve::ModuleManager::finishPluginRegistration ( bool  commit)
static

Commits or rolls back the active plugin registration transaction.

参数
commitWhether to keep newly registered modules.
返回
Applied when committed, NoOp when explicitly rolled back, or a structured registration conflict/failure.

在文件 Module.cpp 第 239 行定义.

引用了 eve::Applied, eve::Conflict, error, eve::Diagnostic::error(), eve::Result< T >::failure(), inst(), name, eve::NoOp, eve::Status::success() , 以及 eve::Result< T >::success().

被这些函数引用 eve::plugins::Plugins::load().

◆ getInstance()

template<typename T >
static T * eve::ModuleManager::getInstance ( const char *  name)
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.

在文件 Module.h 第 133 行定义.

◆ insert()

void eve::ModuleManager::insert ( const char *  name,
Module *  inst 
)
static

Stores a module instance under a name (used by Module_IMPL).

在文件 Module.cpp 第 194 行定义.

引用了 EV_PARAM_CHECK, inst(), name , 以及 registered_modules.

◆ inst()

ModuleManager & eve::ModuleManager::inst ( )
static

Singleton registry holding every registered engine module.

在文件 Module.cpp 第 170 行定义.

被这些函数引用 beginPluginRegistration(), detach(), expose(), expose(), expose_pending(), exposeVM(), find(), finishPluginRegistration(), insert(), eve::ModuleBindAccess::modules(), register_module(), requireAll() , 以及 runtime().

◆ register_module()

void eve::ModuleManager::register_module ( const char *  name,
creator_t  c,
exposer_t  e 
)
static

Registers a module factory (creator + script exposer) by name.

在文件 Module.cpp 第 207 行定义.

引用了 c, EV_PARAM_CHECK, inst(), name, p, plugin_registration_active_, plugin_registration_added_, plugin_registration_error_ , 以及 registered_modules.

被这些函数引用 eve::ModuleRegister::ModuleRegister().

◆ requireAll()

void eve::ModuleManager::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, ...).

在文件 Module.cpp 第 200 行定义.

引用了 inst() , 以及 registered_modules.

被这些函数引用 eve::cmd::Cmdline::McpHost().

◆ requireInstance()

template<typename T >
static T * eve::ModuleManager::requireInstance ( const char *  name)
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.

在文件 Module.h 第 146 行定义.

◆ runtime()

Runtime * eve::ModuleManager::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.

在文件 Module.cpp 第 292 行定义.

引用了 active_runtime_ , 以及 inst().

被这些函数引用 eve::ui::DatabasePanel::build(), eve::ui::ObjectRegistry::create(), detach(), 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(), vm(), eve::ui::DatabasePanel::~DatabasePanel() , 以及 eve::ui::ObjectRegistry::~ObjectRegistry().

◆ vm()

ssq::VM * eve::ModuleManager::vm ( )
static

Script VM of the active runtime, or nullptr. @ownership Borrowed; Runtime owns the VM. @nullable Yes when no runtime is attached. @lifetime Valid until Runtime destruction or detach(); never retain it across either. @thread Main/script thread only. @reentrancy Do not unload modules or detach the runtime while using the VM.

在文件 Module.cpp 第 294 行定义.

引用了 active , 以及 runtime().

被这些函数引用 expose() , 以及 exposeVM().

友元及相关函数文档

◆ ModuleBindAccess

friend struct ModuleBindAccess
friend

在文件 Module.h 第 198 行定义.

类成员变量说明

◆ active_runtime_

Runtime* eve::ModuleManager::active_runtime_ = nullptr
protected

在文件 Module.h 第 196 行定义.

被这些函数引用 detach(), expose(), expose(), expose_pending() , 以及 runtime().

◆ plugin_registration_active_

bool eve::ModuleManager::plugin_registration_active_ = false
protected

在文件 Module.h 第 193 行定义.

被这些函数引用 register_module().

◆ plugin_registration_added_

std::vector<std::string> eve::ModuleManager::plugin_registration_added_
protected

在文件 Module.h 第 194 行定义.

被这些函数引用 register_module().

◆ plugin_registration_error_

std::string eve::ModuleManager::plugin_registration_error_
protected

在文件 Module.h 第 195 行定义.

被这些函数引用 register_module().

◆ registered_modules

std::unordered_map<std::string, ModuleInfo> eve::ModuleManager::registered_modules
protected

该类的文档由以下文件生成: