Binds a typed card runtime to one Definitions registry incarnation. 更多...
#include <CardDefinitionRuntime.h>
Public 成员函数 | |
| CardDefinitionRuntime (CardDefinitionRuntime &&) noexcept=default | |
| Move a card runtime while retaining its borrowed registry binding. | |
| CardDefinitionRuntime & | operator= (CardDefinitionRuntime &&) noexcept=default |
| Move-assign a card runtime. | |
| CardDefinitionRuntime (const CardDefinitionRuntime &)=delete | |
| Card runtimes are not implicitly copyable. | |
| CardDefinitionRuntime & | operator= (const CardDefinitionRuntime &)=delete |
| Card runtimes are not implicitly copy-assignable. | |
| ~CardDefinitionRuntime ()=default | |
| Destroy the card runtime; the registry remains caller-owned. | |
| const eve::definition::InstanceIdentity & | identity () const noexcept |
| Borrow the unified instance identity. | |
| const CardRuntimeState & | state () const noexcept |
| Borrow the strongly typed card runtime state. | |
| CardRuntimeState & | state () noexcept |
| Mutate the strongly typed card runtime state on the owner thread. | |
| eve::definition::DefinitionHandle | definitionHandle () const noexcept |
| Borrow the exact generation-qualified definition handle. | |
| eve::definition::ReloadPolicy | reloadPolicy () const noexcept |
| Return the policy used by the next reload call. | |
| void | setActive (bool active) noexcept |
| Mark the instance active/inactive for RejectWhileActive. | |
| bool | isActive () const noexcept |
| Return whether RejectWhileActive currently treats the instance as active. | |
| eve::Result< void > | applyTo (CardData *card) const |
| Apply the typed state and common identity to an ECS CardData. | |
| eve::Result< eve::definition::ReloadOutcome > | reload (eve::definition::ReloadPolicy policy) |
| Reload from the registry's current generation and execute policy. | |
| eve::Result< eve::SnapshotEnvelope > | snapshot (eve::Revision revision, eve::SimulationTick tick, const eve::SnapshotHashProvider &hashProvider) const |
| Capture card instance state in the common SnapshotEnvelope. | |
| eve::Result< std::string > | snapshotJson (eve::Revision revision, eve::SimulationTick tick, const eve::SnapshotHashProvider &hashProvider) const |
| Serialize snapshot() as canonical JSON. | |
| eve::Result< void > | restore (const eve::SnapshotEnvelope &snapshot, const eve::SnapshotHashProvider &hashProvider) |
| Verify and atomically restore a same-generation card snapshot. | |
静态 Public 成员函数 | |
| static eve::Result< CardDefinitionRuntime > | create (eve::definitions::DefinitionRegistry ®istry, eve::DefinitionRef definition, eve::PersistentId instanceId, eve::definition::ReloadPolicy policy=eve::definition::ReloadPolicy::KeepInstanceValues) |
| Create a card runtime from the current typed definition. | |
详细描述
Binds a typed card runtime to one Definitions registry incarnation.
The registry is borrowed and must outlive this adapter. CardData remains the ECS/presentation object; this adapter owns the definition-bound typed state and projects it into CardData through applyTo. All methods are owner-thread affine and synchronous. Reload prepares the complete typed state before changing its identity; a failure leaves both unchanged.
在文件 CardDefinitionRuntime.h 第 48 行定义.
构造及析构函数说明
◆ CardDefinitionRuntime() [1/2]
|
defaultnoexcept |
Move a card runtime while retaining its borrowed registry binding.
◆ CardDefinitionRuntime() [2/2]
|
delete |
Card runtimes are not implicitly copyable.
◆ ~CardDefinitionRuntime()
|
default |
Destroy the card runtime; the registry remains caller-owned.
成员函数说明
◆ applyTo()
| eve::Result< void > eve::card::CardDefinitionRuntime::applyTo | ( | CardData * | card | ) | const |
Apply the typed state and common identity to an ECS CardData.
- 参数
-
card Borrowed CardData; it remains owned by ECS.
- 返回
- Success, or InvalidArgument for a null card.
在文件 CardDefinitionRuntime.cpp 第 251 行定义.
引用了 eve::card::CardRuntimeState::attack, binding, eve::card::CardRuntimeState::cost, eve::card::CardRuntimeState::currentHealth, eve::definition::InstanceIdentity::definition, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::DefinitionRef::id(), identity(), eve::InvalidArgument, isActive(), eve::card::CardRuntimeState::kind, eve::LogicalId::name(), eve::card::CardRuntimeState::name, eve::card::CardData::Identity::name, eve::card::CardData::DefinitionBinding::reloadPolicy, state(), stats, eve::Result< T >::success(), eve::card::CardRuntimeState::tint , 以及 eve::card::CardData::Visual::tint.
◆ create()
|
static |
Create a card runtime from the current typed definition.
- 参数
-
registry Registry whose lifetime exceeds this adapter. definition Logical card:<name>reference.instanceId Non-nil persistent identity for this card instance.
- 返回
- A typed runtime or a structured resolution/parse failure.
在文件 CardDefinitionRuntime.cpp 第 216 行定义.
引用了 eve::definition::RuntimeInstance< State >::create(), eve::Diagnostic::error(), eve::Result< T >::failure(), handle, eve::InvalidArgument, state() , 以及 eve::Result< T >::success().
◆ definitionHandle()
|
noexcept |
Borrow the exact generation-qualified definition handle.
在文件 CardDefinitionRuntime.cpp 第 243 行定义.
被这些函数引用 restore().
◆ identity()
|
noexcept |
Borrow the unified instance identity.
在文件 CardDefinitionRuntime.cpp 第 235 行定义.
◆ isActive()
|
noexcept |
Return whether RejectWhileActive currently treats the instance as active.
在文件 CardDefinitionRuntime.cpp 第 249 行定义.
被这些函数引用 applyTo().
◆ operator=() [1/2]
|
defaultnoexcept |
Move-assign a card runtime.
◆ operator=() [2/2]
|
delete |
Card runtimes are not implicitly copy-assignable.
◆ reload()
| eve::Result< eve::definition::ReloadOutcome > eve::card::CardDefinitionRuntime::reload | ( | eve::definition::ReloadPolicy | policy | ) |
Reload from the registry's current generation and execute policy.
- 参数
-
policy Policy to execute for this card instance.
- 返回
- A typed reload outcome, or a stale/parse/policy failure. On failure the adapter state and generation remain unchanged.
在文件 CardDefinitionRuntime.cpp 第 281 行定义.
引用了 eve::card::CardRuntimeState::currentHealth, eve::Diagnostic::error(), eve::Result< T >::failure(), identity(), eve::InvalidArgument, eve::card::CardRuntimeState::maxHealth , 以及 eve::Result< T >::success().
◆ reloadPolicy()
|
inlinenoexcept |
Return the policy used by the next reload call.
在文件 CardDefinitionRuntime.h 第 81 行定义.
◆ restore()
| eve::Result< void > eve::card::CardDefinitionRuntime::restore | ( | const eve::SnapshotEnvelope & | snapshot, |
| const eve::SnapshotHashProvider & | hashProvider | ||
| ) |
Verify and atomically restore a same-generation card snapshot.
在文件 CardDefinitionRuntime.cpp 第 319 行定义.
引用了 current, definitionHandle(), eve::Diagnostic::error(), eve::Result< T >::failure(), identity(), eve::InvalidArgument, eve::definition::restoreRuntimeInstance() , 以及 eve::StaleHandle.
◆ setActive()
|
noexcept |
Mark the instance active/inactive for RejectWhileActive.
在文件 CardDefinitionRuntime.cpp 第 247 行定义.
引用了 active.
◆ snapshot()
| eve::Result< eve::SnapshotEnvelope > eve::card::CardDefinitionRuntime::snapshot | ( | eve::Revision | revision, |
| eve::SimulationTick | tick, | ||
| const eve::SnapshotHashProvider & | hashProvider | ||
| ) | const |
Capture card instance state in the common SnapshotEnvelope.
在文件 CardDefinitionRuntime.cpp 第 302 行定义.
引用了 revision, eve::definition::snapshotRuntimeInstance(), eve::Result< T >::success(), tick , 以及 value.
被这些函数引用 snapshotJson().
◆ snapshotJson()
| eve::Result< std::string > eve::card::CardDefinitionRuntime::snapshotJson | ( | eve::Revision | revision, |
| eve::SimulationTick | tick, | ||
| const eve::SnapshotHashProvider & | hashProvider | ||
| ) | const |
Serialize snapshot() as canonical JSON.
在文件 CardDefinitionRuntime.cpp 第 311 行定义.
引用了 eve::Result< T >::failure(), revision, eve::serializeSnapshotEnvelope(), snapshot(), tick , 以及 value.
◆ state() [1/2]
|
noexcept |
Borrow the strongly typed card runtime state.
在文件 CardDefinitionRuntime.cpp 第 239 行定义.
◆ state() [2/2]
|
noexcept |
Mutate the strongly typed card runtime state on the owner thread.
在文件 CardDefinitionRuntime.cpp 第 241 行定义.
该类的文档由以下文件生成:
- src/modules/card/CardDefinitionRuntime.h
- src/modules/card/CardDefinitionRuntime.cpp