载入中...
搜索中...
未找到
eve::definition 命名空间参考

命名空间

namespace  detail
 

类

struct  DefinitionHandle
 A generation-qualified reference to one definition incarnation. 更多...
 
struct  InstanceIdentity
 Canonical identity carried by every typed runtime instance. 更多...
 
struct  ReloadOutcome
 Identity transition emitted by a typed runtime reload operation. 更多...
 
class  RuntimeInstance
 Owns one strongly typed runtime state and its definition identity. 更多...
 
class  RuntimeInstanceCore
 Type-erased bookkeeping shared by every RuntimeInstance<State>. 更多...
 

类型定义

template<class State >
using RuntimeStateEncoder = std::function< eve::Result< eve::Value >(const State &)>
 Converts one domain-owned runtime state into an owning Value.
 
template<class State >
using RuntimeStateDecoder = std::function< eve::Result< State >(const eve::Value &)>
 Decodes one domain-owned runtime state from an owning Value.
 

枚举

enum class  ReloadPolicy : std::uint8_t { KeepInstanceValues , ReapplyDefaults , RebuildInstance , RejectWhileActive }
 Policy used when a live definition is replaced. 更多...
 
enum class  ReloadDisposition : std::uint8_t { Unchanged , Kept , DefaultsReapplied , Rebuilt }
 Observable result of a successful or no-op definition reload. 更多...
 

函数

const char * reloadPolicyName (ReloadPolicy policy) noexcept
 Stable spelling for a runtime definition reload policy.
 
template<class State >
void * cloneRuntimeState (const void *state)
 Payload operations for one state type; used by RuntimeInstance<State>.
 
template<class State >
void assignRuntimeState (void *destination, const void *source)
 Payload assignment for one state type.
 
template<class State >
void destroyRuntimeState (void *state) noexcept
 Payload destruction for one state type.
 
template<class State >
eve::Result< eve::SnapshotEnvelope > snapshotRuntimeInstance (const RuntimeInstance< State > &runtime, std::string type, eve::LogicalId schema, eve::SchemaVersion schemaVersion, eve::Revision revision, eve::SimulationTick tick, const eve::SnapshotHashProvider &hashProvider, const RuntimeStateEncoder< State > &encode)
 Capture a typed runtime instance in the common snapshot envelope.
 
template<class State >
eve::Result< void > restoreRuntimeInstance (RuntimeInstance< State > &runtime, const eve::SnapshotEnvelope &snapshot, std::string_view expectedType, const eve::LogicalId &expectedSchema, eve::SchemaVersion expectedVersion, const eve::SnapshotHashProvider &hashProvider, const RuntimeStateDecoder< State > &decode)
 Verify and atomically restore a typed runtime instance.
 

类型定义说明

◆ RuntimeStateDecoder

template<class State >
using eve::definition::RuntimeStateDecoder = typedef std::function<eve::Result<State>(const eve::Value&)>

Decodes one domain-owned runtime state from an owning Value.

在文件 RuntimeSnapshot.h 第 31 行定义.

◆ RuntimeStateEncoder

template<class State >
using eve::definition::RuntimeStateEncoder = typedef std::function<eve::Result<eve::Value>(const State&)>

Converts one domain-owned runtime state into an owning Value.

在文件 RuntimeSnapshot.h 第 27 行定义.

枚举类型说明

◆ ReloadDisposition

enum class eve::definition::ReloadDisposition : std::uint8_t
strong

Observable result of a successful or no-op definition reload.

枚举值
Unchanged 
Kept 
DefaultsReapplied 
Rebuilt 

在文件 DefinitionRuntime.h 第 132 行定义.

◆ ReloadPolicy

enum class eve::definition::ReloadPolicy : std::uint8_t
strong

Policy used when a live definition is replaced.

枚举值
KeepInstanceValues 

Replace the definition generation and preserve all instance values.

ReapplyDefaults 

Replace the typed state with defaults produced from the new definition.

RebuildInstance 

Let the consumer atomically construct a new state from the new definition.

RejectWhileActive 

Reject the reload while the instance is active; inactive instances keep values.

在文件 DefinitionRuntime.h 第 30 行定义.

函数说明

◆ assignRuntimeState()

template<class State >
void eve::definition::assignRuntimeState ( void *  destination,
const void *  source 
)

Payload assignment for one state type.

Assign runtime state.

在文件 DefinitionRuntime.h 第 261 行定义.

引用了 source.

◆ cloneRuntimeState()

template<class State >
void * eve::definition::cloneRuntimeState ( const void *  state)

Payload operations for one state type; used by RuntimeInstance<State>.

Clones runtime state.

State.

在文件 DefinitionRuntime.h 第 253 行定义.

引用了 state.

◆ destroyRuntimeState()

template<class State >
void eve::definition::destroyRuntimeState ( void *  state)
noexcept

Payload destruction for one state type.

Destroys runtime state.

在文件 DefinitionRuntime.h 第 268 行定义.

引用了 state.

◆ reloadPolicyName()

const char * eve::definition::reloadPolicyName ( ReloadPolicy  policy)
inlinenoexcept

Stable spelling for a runtime definition reload policy.

返回
A non-null borrowed pointer to immutable static text; the caller must not free or retain it as mutable storage. @ownership Borrowed from the program's static storage. @nullable No. @lifetime Static for the process lifetime. @thread Thread-safe and side-effect free. @reentrancy Does not invoke callbacks or access runtime-instance state.

在文件 DefinitionRuntime.h 第 51 行定义.

引用了 KeepInstanceValues, ReapplyDefaults, RebuildInstance , 以及 RejectWhileActive.

◆ restoreRuntimeInstance()

template<class State >
eve::Result< void > eve::definition::restoreRuntimeInstance ( RuntimeInstance< State > &  runtime,
const eve::SnapshotEnvelope &  snapshot,
std::string_view  expectedType,
const eve::LogicalId &  expectedSchema,
eve::SchemaVersion  expectedVersion,
const eve::SnapshotHashProvider &  hashProvider,
const RuntimeStateDecoder< State > &  decode 
)

Verify and atomically restore a typed runtime instance.

参数
runtimeDestination instance; no state is changed on any failure.
snapshotCandidate common envelope.
expectedTypeExact adapter-owned snapshot type.
expectedSchemaExact adapter-owned payload schema.
expectedVersionOnly this version is accepted; migration belongs to the domain adapter and must happen before this function.
hashProviderExplicit provider used to verify the envelope hash.
decodeDomain decoder; it must return a complete candidate state.
返回
Success, or a schema/hash/identity/stale/decode failure.

Restore runtime instance.

Failure.

Failure.

Failure.

Failure.

Failure.

Error.

Generation.

Failure.

Failure.

Failure.

Failure.

在文件 RuntimeSnapshot.h 第 135 行定义.

引用了 active, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), generation, eve::Value::getIf(), eve::SnapshotEnvelope::instanceId, eve::InvalidArgument, object, eve::DefinitionRef::parse(), eve::detail::Id128< Tag >::parse(), eve::ParseError, eve::SnapshotEnvelope::payload, eve::SnapshotEnvelope::revision, eve::definition::detail::runtimeSnapshotShape(), eve::definition::detail::runtimeSnapshotUint(), eve::SnapshotEnvelope::schema, eve::SnapshotEnvelope::schemaVersion, shape, eve::StaleHandle, eve::SnapshotEnvelope::tick, eve::SnapshotEnvelope::type, eve::UnknownVersion, eve::Unsupported, eve::validateSnapshotPayloadMetadata() , 以及 eve::verifySnapshotEnvelope().

被这些函数引用 eve::card::CardDefinitionRuntime::restore(), eve::rpg::SkillDefinitionRuntime::restore(), eve::vehicle::VehicleDefinitionRuntime::restore() , 以及 eve::weapon::WeaponDefinitionRuntime::restore().

◆ snapshotRuntimeInstance()

template<class State >
eve::Result< eve::SnapshotEnvelope > eve::definition::snapshotRuntimeInstance ( const RuntimeInstance< State > &  runtime,
std::string  type,
eve::LogicalId  schema,
eve::SchemaVersion  schemaVersion,
eve::Revision  revision,
eve::SimulationTick  tick,
const eve::SnapshotHashProvider &  hashProvider,
const RuntimeStateEncoder< State > &  encode 
)

Capture a typed runtime instance in the common snapshot envelope.

参数
runtimeInstance whose identity and state are captured.
typeStable runtime type name, owned by the domain adapter.
schemaStable payload schema identifier.
schemaVersionExact version emitted by the adapter.
revisionDomain revision associated with this capture.
tickDeterministic simulation tick associated with this capture.
hashProviderExplicit content-digest provider.
encodeDomain encoder; it must not retain the state reference.
返回
A sealed envelope or a structured encoding/validation failure.

Snapshot runtime instance.

Failure.

Error.

Value.

Make snapshot envelope.

在文件 RuntimeSnapshot.h 第 96 行定义.

引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::makeSnapshotEnvelope(), payload, revision, tick , 以及 type.

被这些函数引用 eve::card::CardDefinitionRuntime::snapshot(), eve::rpg::SkillDefinitionRuntime::snapshot(), eve::vehicle::VehicleDefinitionRuntime::snapshot() , 以及 eve::weapon::WeaponDefinitionRuntime::snapshot().