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

Script + native state snapshot for state hot reload. 更多...

#include <Snapshot.hpp>

Public 成员函数

 Snapshot (const Snapshot &)=delete
 
Snapshotoperator= (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 Snapshotinstance ()
 
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.hpp28 行定义.

构造及析构函数说明

◆ Snapshot()

eve::dev::Snapshot::Snapshot ( const 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.cpp401 行定义.

引用了 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.

参数
outReceives { "version":2, "roots": {...}, "native": {...} }.
返回
false when the VM is null; provider failures are skipped.

在文件 Snapshot.cpp347 行定义.

引用了 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.cpp304 行定义.

被这些函数引用 eve::dev::DevTool::exposeScriptApi().

◆ instance()

Snapshot & eve::dev::Snapshot::instance ( )
static

◆ isEngineBinding()

bool eve::dev::Snapshot::isEngineBinding ( const std::string &  name)
static

Built-in names never auto-captured (modules / boot bindings).

在文件 Snapshot.cpp290 行定义.

引用了 name.

◆ loadFile()

bool eve::dev::Snapshot::loadFile ( HSQUIRRELVM  vm,
const std::string &  path,
std::string *  error = nullptr 
) const

在文件 Snapshot.cpp494 行定义.

引用了 error, restore() , 以及 vm.

被这些函数引用 eve::dev::DevTool::exposeScriptApi().

◆ markRoot()

void eve::dev::Snapshot::markRoot ( std::string  name)

在文件 Snapshot.cpp292 行定义.

引用了 name.

被这些函数引用 eve::dev::DevTool::exposeScriptApi().

◆ operator=()

Snapshot & eve::dev::Snapshot::operator= ( const Snapshot )
delete

◆ restore()

bool eve::dev::Snapshot::restore ( HSQUIRRELVM  vm,
const std::string &  json,
std::string *  error = nullptr 
) const

在文件 Snapshot.cpp468 行定义.

引用了 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.cpp418 行定义.

引用了 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.cpp306 行定义.

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

◆ rootsFor()

std::vector< std::string > eve::dev::Snapshot::rootsFor ( HSQUIRRELVM  vm) const
inline

Marked roots, or heuristic roots when none marked (script-facing).

在文件 Snapshot.hpp48 行定义.

引用了 vm.

被这些函数引用 eve::dev::DevTool::exposeScriptApi().

◆ saveFile()

bool eve::dev::Snapshot::saveFile ( HSQUIRRELVM  vm,
const std::string &  path,
std::string *  error = nullptr 
) const

在文件 Snapshot.cpp482 行定义.

引用了 capture(), error , 以及 vm.

被这些函数引用 eve::dev::ReloadSession::begin() , 以及 eve::dev::DevTool::exposeScriptApi().

◆ unmarkRoot()

void eve::dev::Snapshot::unmarkRoot ( const std::string &  name)

在文件 Snapshot.cpp300 行定义.

引用了 name.

被这些函数引用 eve::dev::DevTool::exposeScriptApi().


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