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

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)
 Mark a root as persistent, replacing a transient declaration.
 
void unmarkRoot (const std::string &name)
 Remove an explicit persistent-root declaration.
 
void markTransientRoot (std::string name)
 Mark a root for reconstruction from new script definitions.
 
void unmarkTransientRoot (const std::string &name)
 Remove an explicit transient-root declaration.
 
void clearRoots ()
 Clear every explicit persistent and transient declaration.
 
std::vector< std::string > roots () const
 Return the explicit persistent roots.
 
std::vector< std::string > transientRoots () const
 Return the explicit transient roots.
 
void setRootPolicies (std::vector< std::string > persistent, std::vector< std::string > transient)
 Atomically replace explicit persistent/transient root policy.
 
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 Preserve 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 persistent roots (markRoot) or a compatibility heuristic that skips engine module bindings. Roots marked transient are excluded. Native providers choose Preserve or Reset through IStateProvider::reloadPolicy(). 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 第 29 行定义.

构造及析构函数说明

◆ 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.cpp 第 438 行定义.

引用了 captureState(), error, state , 以及 vm.

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

◆ captureState()

bool eve::dev::Snapshot::captureState ( HSQUIRRELVM  vm,
StateValue &  out,
std::string *  error = nullptr 
) const

Capture script roots plus every Preserve IStateProvider.

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

在文件 Snapshot.cpp 第 383 行定义.

引用了 error, eve::StateValue::integer(), name, eve::StateValue::object(), p, eve::caps::Reset, roots(), eve::StateValue::set(), top , 以及 vm.

被这些函数引用 capture().

◆ clearRoots()

void eve::dev::Snapshot::clearRoots ( )

Clear every explicit persistent and transient declaration.

在文件 Snapshot.cpp 第 323 行定义.

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

◆ instance()

◆ isEngineBinding()

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

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

在文件 Snapshot.cpp 第 295 行定义.

引用了 name.

◆ loadFile()

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

在文件 Snapshot.cpp 第 538 行定义.

引用了 error, path , 以及 vm.

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

◆ markRoot()

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

Mark a root as persistent, replacing a transient declaration.

在文件 Snapshot.cpp 第 297 行定义.

引用了 name, r , 以及 unmarkTransientRoot().

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

◆ markTransientRoot()

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

Mark a root for reconstruction from new script definitions.

在文件 Snapshot.cpp 第 310 行定义.

引用了 name, r , 以及 unmarkRoot().

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

◆ 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.cpp 第 512 行定义.

引用了 error , 以及 vm.

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

◆ 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 第 455 行定义.

引用了 error, eve::StateValue::find(), eve::StateValue::isObject(), name, p, eve::caps::Reset, roots(), state, top, v , 以及 vm.

◆ roots()

std::vector< std::string > eve::dev::Snapshot::roots ( ) const

Return the explicit persistent roots.

在文件 Snapshot.cpp 第 328 行定义.

被这些函数引用 eve::dev::ReloadSession::begin(), 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.hpp 第 62 行定义.

引用了 vm.

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

◆ saveFile()

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

在文件 Snapshot.cpp 第 526 行定义.

引用了 error, path , 以及 vm.

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

◆ setRootPolicies()

void eve::dev::Snapshot::setRootPolicies ( std::vector< std::string >  persistent,
std::vector< std::string >  transient 
)

Atomically replace explicit persistent/transient root policy.

在文件 Snapshot.cpp 第 332 行定义.

引用了 markRoot(), markTransientRoot() , 以及 name.

被这些函数引用 eve::dev::ReloadSession::abort().

◆ transientRoots()

std::vector< std::string > eve::dev::Snapshot::transientRoots ( ) const

Return the explicit transient roots.

在文件 Snapshot.cpp 第 330 行定义.

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

◆ unmarkRoot()

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

Remove an explicit persistent-root declaration.

在文件 Snapshot.cpp 第 306 行定义.

引用了 name.

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

◆ unmarkTransientRoot()

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

Remove an explicit transient-root declaration.

在文件 Snapshot.cpp 第 319 行定义.

引用了 name.

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


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