载入中...
搜索中...
未找到
ScriptComponentSnapshot.h
浏览该文件的文档.
1#pragma once
2
8#include "common/Export.h"
9#include "common/Generation.h"
10#include "common/Identity.h"
11#include "common/Result.h"
12#include "common/Revision.h"
14#include "common/Snapshot.h"
15#include "common/Time.h"
16#include "common/Value.h"
17
18#include <string>
19#include <string_view>
20#include <vector>
21
22namespace ssq {
23class Object;
24}
25
26namespace eve {
27
29inline constexpr const char* kScriptComponentSnapshotType = "eve.script-components";
30
55
69 const ssq::Object& entityInstance);
70
73
93
108 const SnapshotHashProvider& hashProvider);
109
113
116 std::string_view json, const SnapshotHashProvider& hashProvider);
117
133
134} // namespace eve
std::uint64_t revision
int instanceId
#define EVENGINE_API_FOUNDATION_INLINE
仅供"只有内联成员"的类型使用的组宏:拥有者 dllexport,消费方不导入。
Definition Export.h:170
#define EVENGINE_API_FOUNDATION
每个链接组(link group)各自的导出宏。
Definition Export.h:106
Runtime replacement generation for stale-handle rejection.
Strong identity values shared by persistence, content and logical-name APIs.
Move-only, checked operation results for the common layer.
Monotonic state revision for concurrency and change checks.
Persistent data-contract version identity.
Versioned, integrity-checked persistence envelopes.
SimulationTick tick
Common time values and an injectable deterministic simulation clock.
Owning, renderer-independent dynamic values.
Human-readable, scoped identifier in the form namespace:name.
Definition Identity.h:414
Move-only operation result carrying either a value or Status.
Definition Result.h:176
std::map< std::string, Value > Object
Definition Value.h:34
Id128 public API.
Definition Identity.h:111
Build metadata (engine git commit, build time, third-party version).
Definition Build.cpp:16
EVENGINE_API_FOUNDATION Result< std::string > scriptComponentStatesJson()
引擎侧脚本组件数据的**工具视图**(MCP eve_script_components 与诊断用)。
EVENGINE_API_FOUNDATION Result< std::string > serializeScriptComponentSnapshot(PersistentId instanceId, Revision revision, SimulationTick tick, const SnapshotHashProvider &hashProvider)
采集并序列化成确定性 JSON(存档写盘用)。 @cost 同 snapshotScriptComponents + 一次序列化。
constexpr const char * kScriptComponentSnapshotType
脚本组件快照的稳定类型(SnapshotEnvelope::type)。
EVENGINE_API_FOUNDATION Result< void > restoreScriptComponents(const SnapshotEnvelope &snapshot, const SnapshotHashProvider &hashProvider)
用快照里的数据**整体替换**当前的脚本组件数据。
EVENGINE_API_FOUNDATION LogicalId scriptComponentSnapshotSchema()
脚本组件快照的 payload schema:eve:script-components 版本 1。
EVENGINE_API_FOUNDATION Result< std::vector< ScriptComponentInstanceState > > scriptComponentInstancesOf(const ssq::Object &entityInstance)
读一个脚本实体实例上挂着的全部**已登记**组件的状态。
std::function< Result< ContentId >(std::string_view canonicalInput)> SnapshotHashProvider
Injected content-digest implementation used by snapshots.
Definition Snapshot.h:36
EVENGINE_API_FOUNDATION Result< void > restoreScriptComponentSnapshotJson(std::string_view json, const SnapshotHashProvider &hashProvider)
从 JSON 解析、校验并恢复。
EVENGINE_API_FOUNDATION Result< SnapshotEnvelope > snapshotScriptComponents(PersistentId instanceId, Revision revision, SimulationTick tick, const SnapshotHashProvider &hashProvider)
把引擎侧的脚本组件数据封成一个快照信封。
EVEngine ECS 集成层:底层实现使用 sunxfancy/ECS.hpp https://github.com/sunxfancy/ECS.hpp
Definition ECS.h:21
一个脚本实体实例上某个组件的**当前状态**(供引擎工具读取)。
std::string name
组件名(脚本登记时给的)。
Generation generation
注册表里的代际(同名同版本每次重新登记 +1)。
SchemaVersion version
组件版本。
Value::Object fields
字段名 → 当前值,按注册表记录的**声明顺序**收集( inspector 需要稳定顺序)。
Stable outer format shared by persistence and cross-process snapshots.
Definition Snapshot.h:46