15 static void expose(ssq::Table& table); \
16 static void expose(ssq::Class& vm);
18#define Module_REG(ModuleName) \
20 virtual std::string getName() const override { return name; } \
\
27 [[nodiscard("module instance ownership must be retained or explicitly handled")]] static ModuleName* create(); \
29 static auto nativeModuleFactory() { return &ModuleName::create; } \
30 static const char* name
32#define Module_IMPL(ModuleName, newExpr) \
33 ModuleRegister ModuleName##_register(ModuleName::name, (ModuleManager::creator_t)(ModuleName::create), \
34 ModuleName::expose); \
35 ModuleName* ModuleName::create() { \
36 auto factory = reinterpret_cast<ModuleManager::creator_t>(&ModuleName::create); \
37 auto* p = ModuleManager::find(name, factory); \
38 if (p) return static_cast<ModuleName*>(p); \
39 ModuleName* n = newExpr; \
40 ModuleManager::insert(name, n, factory); \
43 const char* ModuleName::name = #ModuleName
45#define getModInst(N,T) eve::ModuleManager::getInstance<N::T>(#T)
46#define requireModInst(N,T) eve::ModuleManager::requireInstance<N::T>(#T)
58 virtual std::string getName()
const = 0;
64 typedef Module* (*creator_t)();
65 typedef void (*exposer_t)(ssq::Table&);
79 [[nodiscard(
"module lookup result must be checked before use")]]
static Module* find(
const char*
name);
86 [[nodiscard]]
static Module* find(
const char*
name, creator_t factory);
88 static void insert(
const char*
name,
Module* inst);
95 static void insert(
const char*
name,
Module* instance, creator_t factory);
98 static void register_module(
const char*
name, creator_t
c, exposer_t e);
100 [[nodiscard(
"plugin registration outcome must be checked")]]
static eve::Result<void> beginPluginRegistration();
113 [[nodiscard(
"plugin registration outcome must be checked")]]
static eve::Result<void> finishPluginRegistration(
124 static void expose(
Runtime& runtime);
127 static void expose(ssq::VM&
vm);
130 static int expose_pending();
148 static ssq::VM*
vm();
150 static void detach(
Runtime* runtime);
160 template <
typename T>
161 [[nodiscard(
"module lookup result must be checked before use")]]
static T* getInstance(
const char*
name) {
162 return static_cast<T*
>(getInstanceRaw(
name));
173 template <
typename T>
174 [[nodiscard(
"module instance ownership must be retained or explicitly handled")]]
static T* requireInstance(
176 return static_cast<T*
>(requireInstanceRaw(
name));
185 static void requireAll();
189 static void exposeVM(ssq::VM&
vm);
193 static int ensureScriptEcs();
194 static int exposeAllForCompatibility();
204 static Module* getInstanceRaw(
const char*
name);
210 static Module* requireInstanceRaw(
const char*
name);
215 std::unique_ptr<State> state_;
#define EVENGINE_API_FOUNDATION
每个链接组(link group)各自的导出宏。
std::shared_ptr< OceanGpuSpectrum > owner
Move-only, checked operation results for the common layer.
EVENGINE_API_FOUNDATION public API.
EVENGINE_API_FOUNDATION public API.
Move-only operation result carrying either a value or Status.
EVENGINE_API_FOUNDATION public API.
Build metadata (engine git commit, build time, third-party version).
enum EVENGINE_API_FOUNDATION Table
OT_TABLE (editable via Runtime table APIs / ReflectedPropertyModel).
EVEngine ECS 集成层:底层实现使用 sunxfancy/ECS.hpp https://github.com/sunxfancy/ECS.hpp
EVENGINE_API_FOUNDATION public API.