Runtime-state serialization for state hot reload. 更多...
#include <IStateProvider.h>
Public 成员函数 | |
| virtual | ~IStateProvider ()=default |
| I state provider. | |
| virtual const char * | stateKind () const =0 |
| Stable kind label, e.g. "dialogue" / "anim" / "rpg.casting". | |
| virtual Result< Value > | capture ()=0 |
| Capture an owning, canonical snapshot of this provider. | |
| virtual Result< void > | restore (const Value &in)=0 |
| Restore captured state onto the (possibly new) definitions. | |
| virtual Result< void > | resetToDefaults ()=0 |
| Reset this provider to its default state (Reset reload policy). | |
| virtual StateReloadPolicy | reloadPolicy () const |
| Whether live state is preserved or reset across code reload. | |
静态 Public 属性 | |
| static constexpr const char * | capabilityName = "IStateProvider" |
详细描述
Runtime-state serialization for state hot reload.
A module that owns mutable runtime state (animation state machines, dialogue sessions, RPG casting, card phases) implements this and registers with eve::cap::addListener<IStateProvider>(). A reload session captures every provider before code/asset reload and restores the captured state afterwards, so running state survives definition changes instead of being reset.
Modules that do not register a provider are treated as stateless and are simply skipped — the same trimming story as IAssetReloader.
在文件 IStateProvider.h 第 29 行定义.
构造及析构函数说明
◆ ~IStateProvider()
|
virtualdefault |
I state provider.
成员函数说明
◆ capture()
Capture an owning, canonical snapshot of this provider.
- 返回
- Snapshot or a structured failure; no state is changed on failure. @thread Owner thread during a paused reload transaction. @reentrancy Does not invoke script callbacks.
◆ reloadPolicy()
|
inlinevirtual |
Whether live state is preserved or reset across code reload.
在文件 IStateProvider.h 第 60 行定义.
◆ resetToDefaults()
|
pure virtual |
Reset this provider to its default state (Reset reload policy).
◆ restore()
Restore captured state onto the (possibly new) definitions.
- 返回
- Structured failure when the state is incompatible with the current definitions. Snapshot restore rolls affected providers back on failure.
- 注解
- Must accept this provider's own capture() result against unchanged definitions, including after a failed restore/reset, so rollback can recover its pre-operation state. Must not invoke script callbacks.
◆ stateKind()
|
pure virtual |
Stable kind label, e.g. "dialogue" / "anim" / "rpg.casting".
类成员变量说明
◆ capabilityName
|
staticconstexpr |
在文件 IStateProvider.h 第 31 行定义.
该类的文档由以下文件生成:
- src/engine/common/IStateProvider.h