Binds a typed WeaponDefinition to one mutable runtime instance. 更多...
#include <WeaponDefinitionRuntime.h>
Public 成员函数 | |
| WeaponDefinitionRuntime (WeaponDefinitionRuntime &&) noexcept=default | |
| Weapon definition runtime. | |
| WeaponDefinitionRuntime & | operator= (WeaponDefinitionRuntime &&) noexcept=default |
| Operator =. | |
| WeaponDefinitionRuntime (const WeaponDefinitionRuntime &)=delete | |
| WeaponDefinitionRuntime & | operator= (const WeaponDefinitionRuntime &)=delete |
| ~WeaponDefinitionRuntime ()=default | |
| Weapon definition runtime. | |
| const eve::definition::InstanceIdentity & | identity () const noexcept |
| Borrow the common instance identity and exact definition generation. | |
| const WeaponRuntimeState & | state () const noexcept |
| Borrow mutable typed firing/resource state. | |
| WeaponRuntimeState & | state () noexcept |
| Mutate typed firing/resource state on the owner thread. | |
| eve::definition::DefinitionHandle | definitionHandle () const noexcept |
| Return the exact generation-qualified definition handle. | |
| eve::Result< WeaponDefinition > | definition () const |
| Resolve the current strongly typed WeaponDefinition projection. | |
| eve::definition::ReloadPolicy | reloadPolicy () const noexcept |
| Return the policy used by the next reload call. | |
| void | setActive (bool active) noexcept |
| Set the active guard used by RejectWhileActive. | |
| bool | isActive () const noexcept |
| Return whether the instance is active. | |
| eve::Result< void > | applyTo (WeaponEntity *entity) const |
| Atomically project this runtime into a borrowed WeaponEntity. | |
| eve::Result< eve::definition::ReloadOutcome > | reload (eve::definition::ReloadPolicy policy) |
| Reload the registry's current generation using a typed policy. | |
| eve::Result< eve::SnapshotEnvelope > | snapshot (eve::Revision revision, eve::SimulationTick tick, const eve::SnapshotHashProvider &hashProvider) const |
| Capture stable typed runtime 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 deterministic JSON. | |
| eve::Result< void > | restore (const eve::SnapshotEnvelope &snapshot, const eve::SnapshotHashProvider &hashProvider) |
| Verify and restore a same-generation snapshot transactionally. | |
静态 Public 成员函数 | |
| static eve::Result< WeaponDefinitionRuntime > | create (eve::definitions::DefinitionRegistry ®istry, eve::DefinitionRef definition, eve::PersistentId instanceId, eve::definition::ReloadPolicy policy=eve::definition::ReloadPolicy::RebuildInstance) |
Create from a common weapon:<name> definition reference. | |
| static eve::Result< WeaponDefinitionRuntime > | create (eve::definitions::DefinitionRegistry ®istry, std::string_view definitionId, eve::PersistentId instanceId, eve::definition::ReloadPolicy policy=eve::definition::ReloadPolicy::RebuildInstance) |
Create from a weapon:<definitionId> logical name. | |
| static eve::Result< WeaponDefinitionRuntime > | create (Weapon &module, std::string_view definitionId, eve::PersistentId instanceId, eve::definition::ReloadPolicy policy=eve::definition::ReloadPolicy::RebuildInstance) |
| Create through the existing Weapon module facade. | |
详细描述
Binds a typed WeaponDefinition to one mutable runtime instance.
The registry is borrowed and must outlive this adapter. All calls are synchronous and owner-thread affine. RebuildInstance is the default policy: changing a definition preserves compatible firing state while clamping it to the new typed limits. RejectWhileActive rejects replacement while the instance is marked active.
在文件 WeaponDefinitionRuntime.h 第 69 行定义.
构造及析构函数说明
◆ WeaponDefinitionRuntime() [1/2]
|
defaultnoexcept |
Weapon definition runtime.
◆ WeaponDefinitionRuntime() [2/2]
|
delete |
◆ ~WeaponDefinitionRuntime()
|
default |
Weapon definition runtime.
成员函数说明
◆ applyTo()
| eve::Result< void > eve::weapon::WeaponDefinitionRuntime::applyTo | ( | WeaponEntity * | entity | ) | const |
Atomically project this runtime into a borrowed WeaponEntity.
- 参数
-
entity Borrowed ECS entity. The adapter does not retain it. @ownership Borrowed; ECS owns the entity and its components. @lifetime The pointer is used only during this synchronous call. @thread Must be called on the entity's owner thread.
- 返回
- Success or a structured projection failure. Failure leaves the entity unchanged.
在文件 WeaponDefinitionRuntime.cpp 第 487 行定义.
引用了 binding, definition(), eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), identity(), eve::InvalidArgument, isActive(), source, state() , 以及 eve::Result< T >::success().
◆ create() [1/3]
|
static |
Create from a common weapon:<name> definition reference.
- 参数
-
registry Borrowed registry containing the definition. definition Logical weapon definition reference. instanceId Non-nil persistent identity for this weapon instance. policy Policy used by subsequent reload calls.
- 返回
- A typed adapter or a structured resolution/parse failure.
在文件 WeaponDefinitionRuntime.cpp 第 424 行定义.
引用了 eve::definition::RuntimeInstance< State >::create(), definition(), eve::Diagnostic::error(), eve::Result< T >::failure(), handle, eve::InvalidArgument , 以及 eve::Result< T >::success().
◆ create() [2/3]
|
static |
Create from a weapon:<definitionId> logical name.
在文件 WeaponDefinitionRuntime.cpp 第 443 行定义.
引用了 create(), eve::Diagnostic::error(), eve::Result< T >::failure(), eve::DefinitionRef::fromId(), eve::LogicalId::fromParts(), eve::InvalidArgument , 以及 reference.
◆ create() [3/3]
|
static |
Create through the existing Weapon module facade.
在文件 WeaponDefinitionRuntime.cpp 第 457 行定义.
引用了 create() , 以及 eve::weapon::Weapon::definitionRegistry().
◆ definition()
| eve::Result< WeaponDefinition > eve::weapon::WeaponDefinitionRuntime::definition | ( | ) | const |
Resolve the current strongly typed WeaponDefinition projection.
在文件 WeaponDefinitionRuntime.cpp 第 475 行定义.
引用了 definition(), definitionHandle(), eve::Diagnostic::error(), eve::Result< T >::failure(), identity() , 以及 eve::InvalidArgument.
被这些函数引用 applyTo(), create(), definition(), reload() , 以及 restore().
◆ definitionHandle()
|
noexcept |
Return the exact generation-qualified definition handle.
在文件 WeaponDefinitionRuntime.cpp 第 471 行定义.
被这些函数引用 definition() , 以及 restore().
◆ identity()
|
noexcept |
Borrow the common instance identity and exact definition generation.
在文件 WeaponDefinitionRuntime.cpp 第 463 行定义.
被这些函数引用 applyTo(), definition(), reload() , 以及 restore().
◆ isActive()
|
noexcept |
Return whether the instance is active.
在文件 WeaponDefinitionRuntime.cpp 第 485 行定义.
被这些函数引用 applyTo().
◆ operator=() [1/2]
|
delete |
◆ operator=() [2/2]
|
defaultnoexcept |
Operator =.
◆ reload()
| eve::Result< eve::definition::ReloadOutcome > eve::weapon::WeaponDefinitionRuntime::reload | ( | eve::definition::ReloadPolicy | policy | ) |
Reload the registry's current generation using a typed policy.
在文件 WeaponDefinitionRuntime.cpp 第 530 行定义.
引用了 eve::weapon::Resource::cost, eve::weapon::WeaponRuntimeState::currentSpread, definition(), eve::Diagnostic::error(), eve::Result< T >::failure(), identity(), eve::weapon::Resource::infinite, eve::InvalidArgument, eve::weapon::Resource::kind, eve::weapon::Resource::max, eve::weapon::Resource::regen, eve::weapon::Resource::reserve, eve::weapon::WeaponRuntimeState::resource, eve::weapon::WeaponRuntimeState::selector, eve::Result< T >::success() , 以及 eve::weapon::Resource::value.
◆ reloadPolicy()
|
inlinenoexcept |
Return the policy used by the next reload call.
在文件 WeaponDefinitionRuntime.h 第 113 行定义.
◆ restore()
| eve::Result< void > eve::weapon::WeaponDefinitionRuntime::restore | ( | const eve::SnapshotEnvelope & | snapshot, |
| const eve::SnapshotHashProvider & | hashProvider | ||
| ) |
Verify and restore a same-generation snapshot transactionally.
- 返回
- Failure leaves all typed runtime state unchanged.
在文件 WeaponDefinitionRuntime.cpp 第 585 行定义.
引用了 current, definition(), definitionHandle(), eve::Diagnostic::error(), eve::Result< T >::failure(), identity(), eve::InvalidArgument, eve::definition::restoreRuntimeInstance() , 以及 eve::StaleHandle.
◆ setActive()
|
noexcept |
Set the active guard used by RejectWhileActive.
在文件 WeaponDefinitionRuntime.cpp 第 483 行定义.
引用了 active.
◆ snapshot()
| eve::Result< eve::SnapshotEnvelope > eve::weapon::WeaponDefinitionRuntime::snapshot | ( | eve::Revision | revision, |
| eve::SimulationTick | tick, | ||
| const eve::SnapshotHashProvider & | hashProvider | ||
| ) | const |
Capture stable typed runtime state in the common SnapshotEnvelope.
在文件 WeaponDefinitionRuntime.cpp 第 568 行定义.
引用了 revision, eve::definition::snapshotRuntimeInstance(), eve::Result< T >::success(), tick , 以及 value.
被这些函数引用 snapshotJson().
◆ snapshotJson()
| eve::Result< std::string > eve::weapon::WeaponDefinitionRuntime::snapshotJson | ( | eve::Revision | revision, |
| eve::SimulationTick | tick, | ||
| const eve::SnapshotHashProvider & | hashProvider | ||
| ) | const |
Serialize snapshot() as canonical deterministic JSON.
在文件 WeaponDefinitionRuntime.cpp 第 577 行定义.
引用了 eve::Result< T >::failure(), revision, eve::serializeSnapshotEnvelope(), snapshot(), tick , 以及 value.
◆ state() [1/2]
|
noexcept |
Borrow mutable typed firing/resource state.
在文件 WeaponDefinitionRuntime.cpp 第 467 行定义.
被这些函数引用 applyTo().
◆ state() [2/2]
|
noexcept |
Mutate typed firing/resource state on the owner thread.
在文件 WeaponDefinitionRuntime.cpp 第 469 行定义.
该类的文档由以下文件生成:
- src/modules/weapon/WeaponDefinitionRuntime.h
- src/modules/weapon/WeaponDefinitionRuntime.cpp