载入中...
搜索中...
未找到
ClimbingPersistence.cpp
浏览该文件的文档.
1#include "climbing/Climbing.h"
2
4
5#include "physics/World3D.h"
6
7#include <utility>
8
9namespace eve::climbing {
10
12 return publishProfile(std::move(profile), true);
13}
14
16 auto value = eve::Value::fromJson(json);
17 if (!value) return eve::Result<void>::failure(value.status());
18 auto profile = decodeClimbingProfileDefinition(value.value());
19 if (!profile) return eve::Result<void>::failure(profile.status());
20 return setProfile(std::move(profile).takeValue());
21}
22
24 auto value = eve::Value::fromJson(json);
25 if (!value) return eve::Result<void>::failure(value.status());
26 auto profile = decodeClimbingProfileDefinition(value.value());
27 if (!profile) return eve::Result<void>::failure(profile.status());
28 return reloadProfile(std::move(profile).takeValue());
29}
30
32 auto value = snapshot();
33 if (!value) return eve::Result<std::string>::failure(value.status());
34 return value.value().toJson();
35}
36
38 auto value = eve::Value::fromJson(json);
39 if (!value) return eve::Result<void>::failure(value.status());
40 return restore(value.value(), world);
41}
42
43} // namespace eve::climbing
double value
Versioned, lossless codecs for climbing definitions.
Deterministic climbing/parkour planning and capsule-constrained execution.
World3D * world
Move-only operation result carrying either a value or Status.
Definition Result.h:155
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
static Result< Value > fromJson(std::string_view json)
Parse one strict JSON value into an owning Value.
Definition Value.cpp:57
eve::Result< std::string > snapshotJson() const
Serializes the canonical runtime snapshot as JSON.
eve::Result< void > reloadProfileJson(std::string_view json)
Parses and hot-reloads a canonical profile JSON document transactionally.
eve::Result< void > setProfile(ClimbingProfile profile)
Replaces the runtime profile after validating all dimensions and action definitions.
Definition Climbing.cpp:93
eve::Result< void > restoreJson(std::string_view json, physics::World3D &world)
Parses and atomically restores a canonical runtime snapshot JSON document.
eve::Result< eve::Value > snapshot() const
Captures deterministic runtime state; debug candidates and final bone poses are excluded.
eve::Result< void > setProfileJson(std::string_view json)
Parses and installs a canonical profile JSON document transactionally.
eve::Result< void > reloadProfile(ClimbingProfile profile)
Atomically publishes a validated profile while pinning any active execution to its old snapshot.
eve::Result< void > restore(const eve::Value &value, physics::World3D &world)
Restores a fully parsed candidate atomically after revalidating all process-local Physics links.
Box3D rigid-body world. Script coordinates are meters (Box3D native), unlike 2D World which uses pixe...
Definition World3D.h:63
eve::Result< ClimbingProfileDefinition > decodeClimbingProfileDefinition(const eve::Value &value)
Decode and validate an owning profile candidate transactionally.
Runtime profile controlling capsule geometry and probe limits.
Definition Climbing.h:218