载入中...
搜索中...
未找到
ArtifactProvider.cpp
浏览该文件的文档.
72 eve::Diagnostic::error(eve::DiagnosticCode::Failed, "map artifact prepare failure was injected"));
74 return eve::Result<std::unique_ptr<eve::artifact::PreparedPublication>>::failure(eve::Diagnostic::error(
78 eve::Diagnostic::error(eve::DiagnosticCode::Conflict, "map artifact identity is already published"));
82 if (part.kind == eve::artifact::PartKind::Grid && (part.role == "topology" || topology == nullptr))
88 return eve::Result<std::unique_ptr<eve::artifact::PreparedPublication>>::failure(eve::Diagnostic::error(
89 eve::DiagnosticCode::PreconditionViolation, "map publication requires a complete grid topology"));
118 std::find_if(records_.begin(), records_.end(), [id](const auto& record) { return record.id == id; });
125 if (!record || x < 0 || y < 0 || x >= record->width || y >= record->height) return std::nullopt;
160 eve::Diagnostic::error(eve::DiagnosticCode::Failed, "map artifact snapshot allocation failed"));
167 eve::Diagnostic::error(eve::DiagnosticCode::Conflict, "map artifact restore requires an empty registry"));
173 if (!object || !providerName || *providerName != "map.cpu-registry" || !hasSupportedVersion(*object) || !records)
175 eve::Diagnostic::error(eve::DiagnosticCode::ParseError, "invalid map artifact provider state"));
191 if (!item || !readString(*item, "artifactId", idText) || !readString(*item, "buildKey", buildKey) ||
235void registerMapArtifactProvider() { eve::cap::provide<eve::artifact::IMapArtifactAdapter>(&mapArtifactProvider()); }
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
static constexpr RuntimeHandle fromPacked(std::uint64_t value) noexcept
Reconstructs a handle from an explicit packed boundary value.
Definition RuntimeHandle.h:190
static constexpr index_type invalidIndex
Reserved index value shared by all invalid handles.
Definition RuntimeHandle.h:124
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.cpp:19
Value * find(const std::string &key) noexcept
Return an object member, or nullptr when absent.
Definition Value.cpp:244
A prepared consumer mutation with a non-throwing visibility boundary.
Definition ArtifactPublication.h:102
constexpr bool isNil() const noexcept
Returns whether this value is the all-zero nil ID.
Definition Identity.h:175
static std::optional< Id128 > parse(std::string_view text) noexcept
Parses canonical UUID text.
Definition Identity.h:150
Real map-module provider for generated grid publication.
Definition ArtifactProvider.h:41
void clear() noexcept
Remove all records and reset the local handle allocator.
Definition ArtifactProvider.cpp:130
eve::Result< std::unique_ptr< eve::artifact::PreparedPublication > > prepare(const eve::artifact::PublicationView &publication) override
Stage a topology grid and copy its cells before commit.
Definition ArtifactProvider.cpp:68
const MapArtifactRecord * find(eve::PersistentId id) const noexcept
Find a committed map artifact; the pointer is borrowed. @ownership Borrowed from this provider; calle...
Definition ArtifactProvider.cpp:116
eve::Result< void > restoreState(const eve::Value &state) override
Replace the registry from validated topology state.
Definition ArtifactProvider.cpp:164
eve::Result< eve::Value > snapshotState() const override
Export map identity, build keys, handles and topology cells.
Definition ArtifactProvider.cpp:136
std::optional< std::uint32_t > cell(eve::PersistentId id, std::int32_t x, std::int32_t y) const noexcept
Return one semantic cell, or empty for an invalid coordinate.
Definition ArtifactProvider.cpp:122
void commit() noexcept override
Make the prepared mutation observable; the operation cannot fail.
Definition ArtifactProvider.cpp:54
void rollback() noexcept override
Discard the prepared mutation; idempotent and non-throwing.
Definition ArtifactProvider.cpp:59
MapArtifactStage(MapArtifactProvider &owner, MapArtifactRecord record)
Definition ArtifactProvider.cpp:52
Map-owned CPU registry provider for generated grid artifacts.
放置世界:格子占用(多通道)+ 地形语义 + 已放置建筑实例。 行为由 PlacementSystem 提供;本类暴露便于脚本绑定的薄封装方法。 坐标换算统一走 eve::grid(支持 rectang...
Definition ArchSpaceTileMapProjector.h:10
eve::RuntimeHandle< MapArtifactHandleTag > MapArtifactHandle
Generation-qualified handle for a map artifact record.
Definition ArtifactProvider.h:22
bool readI64(const eve::Value::Object &object, const char *name, std::int64_t &output)
Definition ArtifactProvider.cpp:35
void registerMapArtifactProvider()
Register the map provider in the common capability registry.
Definition ArtifactProvider.cpp:235
MapArtifactProvider & mapArtifactProvider() noexcept
Return the process-owned map artifact provider singleton.
Definition ArtifactProvider.cpp:230
bool readU64(const eve::Value::Object &object, const char *name, std::uint64_t &output)
Definition ArtifactProvider.cpp:28
bool readString(const eve::Value::Object &object, const char *name, std::string &output)
Definition ArtifactProvider.cpp:21
bool hasSupportedVersion(const eve::Value::Object &object) noexcept
Definition ArtifactProvider.cpp:44
@ InvalidArgument
@ PreconditionViolation
@ Failed
@ ParseError
@ Conflict
@ Applied
Result< json::UnsignedIntegerScan > scanUnsignedStringMember(const Value::Object &object, std::string_view name)
Scan a required nonempty decimal-string field using from_chars semantics.
Definition Value.cpp:104
Result< std::string > readNonEmptyStringMember(const Value::Object &object, std::string_view name)
Read a required nonempty string field as an independent owning value.
Definition Value.cpp:33
Result< std::int64_t > readInt64Value(const Value &value)
Read an Int64 without narrowing or numeric coercion.
Definition Value.cpp:57
Definition Container.h:602
Borrowed immutable view of one generated leaf.
Definition ArtifactPublication.h:61
Borrowed immutable view of one complete generated publication.
Definition ArtifactPublication.h:85
std::span< const PartView > parts
Definition ArtifactPublication.h:90
std::string_view buildKey
Definition ArtifactPublication.h:88
Queryable map record containing the copied semantic topology.
Definition ArtifactProvider.h:25