Script + native state snapshot for state hot reload. 更多...
#include <Snapshot.hpp>
Public 成员函数 | |
| Snapshot (const Snapshot &)=delete | |
| Snapshot & | operator= (const Snapshot &)=delete |
| void | markRoot (std::string name) |
| void | unmarkRoot (const std::string &name) |
| void | clearRoots () |
| std::vector< std::string > | roots () const |
| std::string | capture (HSQUIRRELVM vm, std::string *error=nullptr) const |
| Capture marked roots, or heuristic roots when none marked. | |
| bool | restore (HSQUIRRELVM vm, const std::string &json, std::string *error=nullptr) const |
| bool | saveFile (HSQUIRRELVM vm, const std::string &path, std::string *error=nullptr) const |
| bool | loadFile (HSQUIRRELVM vm, const std::string &path, std::string *error=nullptr) const |
| std::vector< std::string > | rootsFor (HSQUIRRELVM vm) const |
| Marked roots, or heuristic roots when none marked (script-facing). | |
| bool | captureState (HSQUIRRELVM vm, StateValue &out, std::string *error=nullptr) const |
| Capture script roots plus every registered IStateProvider. | |
| bool | restoreState (HSQUIRRELVM vm, const StateValue &state, std::string *error=nullptr) const |
| Restore a captured state; v1-shaped values restore roots only. | |
静态 Public 成员函数 | |
| static Snapshot & | instance () |
| static bool | isEngineBinding (const std::string &name) |
| Built-in names never auto-captured (modules / boot bindings). | |
详细描述
Script + native state snapshot for state hot reload.
Captures serializable Squirrel values from the root table — either explicitly marked roots (markRoot) or a heuristic that skips engine module bindings — plus the state of every registered eve::caps::IStateProvider. Closures / native userdata are skipped.
Format (v2): JSON object { "version":2, "roots": { name: value, ... }, "native": { "<stateKind>": <captured>, ... } } v1 files (roots only) are still readable.
在文件 Snapshot.hpp 第 28 行定义.
构造及析构函数说明
◆ Snapshot()
|
delete |
成员函数说明
◆ capture()
| std::string eve::dev::Snapshot::capture | ( | HSQUIRRELVM | vm, |
| std::string * | error = nullptr |
||
| ) | const |
Capture marked roots, or heuristic roots when none marked.
在文件 Snapshot.cpp 第 401 行定义.
引用了 captureState(), error, state , 以及 vm.
被这些函数引用 eve::dev::DevTool::exposeScriptApi() , 以及 saveFile().
◆ captureState()
| bool eve::dev::Snapshot::captureState | ( | HSQUIRRELVM | vm, |
| StateValue & | out, | ||
| std::string * | error = nullptr |
||
| ) | const |
Capture script roots plus every registered IStateProvider.
- 参数
-
out Receives { "version":2, "roots": {...}, "native": {...} }.
- 返回
- false when the VM is null; provider failures are skipped.
在文件 Snapshot.cpp 第 347 行定义.
引用了 error, eve::StateValue::integer(), name, eve::StateValue::object(), p, eve::cap::query(), roots(), eve::StateValue::set() , 以及 vm.
被这些函数引用 capture().
◆ clearRoots()
| void eve::dev::Snapshot::clearRoots | ( | ) |
在文件 Snapshot.cpp 第 304 行定义.
被这些函数引用 eve::dev::DevTool::exposeScriptApi().
◆ instance()
|
static |
在文件 Snapshot.cpp 第 285 行定义.
被这些函数引用 eve::dev::ReloadSession::begin(), eve::dev::ReloadSession::commit() , 以及 eve::dev::DevTool::exposeScriptApi().
◆ isEngineBinding()
|
static |
◆ loadFile()
| bool eve::dev::Snapshot::loadFile | ( | HSQUIRRELVM | vm, |
| const std::string & | path, | ||
| std::string * | error = nullptr |
||
| ) | const |
在文件 Snapshot.cpp 第 494 行定义.
被这些函数引用 eve::dev::DevTool::exposeScriptApi().
◆ markRoot()
| void eve::dev::Snapshot::markRoot | ( | std::string | name | ) |
◆ operator=()
◆ restore()
| bool eve::dev::Snapshot::restore | ( | HSQUIRRELVM | vm, |
| const std::string & | json, | ||
| std::string * | error = nullptr |
||
| ) | const |
在文件 Snapshot.cpp 第 468 行定义.
引用了 error, restoreState() , 以及 vm.
被这些函数引用 eve::dev::DevTool::exposeScriptApi() , 以及 loadFile().
◆ restoreState()
| bool eve::dev::Snapshot::restoreState | ( | HSQUIRRELVM | vm, |
| const StateValue & | state, | ||
| std::string * | error = nullptr |
||
| ) | const |
Restore a captured state; v1-shaped values restore roots only.
- 返回
- false on invalid input or when a provider's restore fails (its resetToDefaults() is attempted as a fallback).
在文件 Snapshot.cpp 第 418 行定义.
引用了 error, eve::StateValue::find(), eve::StateValue::isObject(), name, p, eve::cap::query(), roots(), state, v , 以及 vm.
被这些函数引用 restore().
◆ roots()
| std::vector< std::string > eve::dev::Snapshot::roots | ( | ) | const |
在文件 Snapshot.cpp 第 306 行定义.
被这些函数引用 captureState() , 以及 restoreState().
◆ rootsFor()
|
inline |
Marked roots, or heuristic roots when none marked (script-facing).
在文件 Snapshot.hpp 第 48 行定义.
引用了 vm.
被这些函数引用 eve::dev::DevTool::exposeScriptApi().
◆ saveFile()
| bool eve::dev::Snapshot::saveFile | ( | HSQUIRRELVM | vm, |
| const std::string & | path, | ||
| std::string * | error = nullptr |
||
| ) | const |
在文件 Snapshot.cpp 第 482 行定义.
被这些函数引用 eve::dev::ReloadSession::begin() , 以及 eve::dev::DevTool::exposeScriptApi().
◆ unmarkRoot()
| void eve::dev::Snapshot::unmarkRoot | ( | const std::string & | name | ) |
该类的文档由以下文件生成:
- src/engine/devtools/Snapshot.hpp
- src/engine/devtools/Snapshot.cpp