One state hot-reload transaction: capture → reload → restore. 更多...
#include <ReloadSession.h>
Public 成员函数 | |
| ReloadSession (const ReloadSession &)=delete | |
| ReloadSession & | operator= (const ReloadSession &)=delete |
| bool | begin (HSQUIRRELVM vm, std::string *err=nullptr) |
| Start a session: capture current script + native state. | |
| bool | commit (HSQUIRRELVM vm, std::string *err=nullptr) |
| End the session, restoring captured state over the new definitions (old values win; newly added fields kept). | |
| bool | abort (HSQUIRRELVM vm, std::string *err=nullptr) |
| End the session, rolling back to the captured state. | |
| bool | active () const |
| Whether a session is currently open. | |
静态 Public 成员函数 | |
| static ReloadSession & | instance () |
详细描述
One state hot-reload transaction: capture → reload → restore.
A script reload (soft_reload_scripts) drives this via the eve.dev API:
- begin(): snapshot script state roots + every registered IStateProvider into an in-memory buffer, and persist
eve_snapshot.jsonas a manual rollback point. - (scripts are re-dofile'd in between)
- commit(): restore the captured state on top of the new definitions — captured root values win, fields the new script added are kept, native providers are restored (falling back to resetToDefaults() on failure).
- abort(): restore the captured state unchanged and clear the session.
在文件 ReloadSession.h 第 27 行定义.
构造及析构函数说明
◆ ReloadSession()
|
delete |
成员函数说明
◆ abort()
| bool eve::dev::ReloadSession::abort | ( | HSQUIRRELVM | vm, |
| std::string * | err = nullptr |
||
| ) |
End the session, rolling back to the captured state.
在文件 ReloadSession.cpp 第 59 行定义.
引用了 eve::StateValue::null(), ok , 以及 vm.
◆ active()
|
inline |
Whether a session is currently open.
在文件 ReloadSession.h 第 50 行定义.
◆ begin()
| bool eve::dev::ReloadSession::begin | ( | HSQUIRRELVM | vm, |
| std::string * | err = nullptr |
||
| ) |
Start a session: capture current script + native state.
- 返回
- false when capture fails (session stays inactive).
在文件 ReloadSession.cpp 第 12 行定义.
引用了 eve::dev::Snapshot::instance(), eve::StateValue::null(), eve::dev::Snapshot::saveFile() , 以及 vm.
◆ commit()
| bool eve::dev::ReloadSession::commit | ( | HSQUIRRELVM | vm, |
| std::string * | err = nullptr |
||
| ) |
End the session, restoring captured state over the new definitions (old values win; newly added fields kept).
在文件 ReloadSession.cpp 第 28 行定义.
引用了 eve::StateValue::find(), eve::dev::Snapshot::instance(), eve::StateValue::isObject(), eve::StateValue::keys(), eve::StateValue::mergeDefaults(), name, eve::StateValue::null(), ok , 以及 vm.
◆ instance()
|
static |
在文件 ReloadSession.cpp 第 7 行定义.
被这些函数引用 eve::dev::DevTool::exposeScriptApi().
◆ operator=()
|
delete |
该类的文档由以下文件生成:
- src/engine/devtools/ReloadSession.h
- src/engine/devtools/ReloadSession.cpp