载入中...
搜索中...
未找到
eve::weapon::WeaponDefinitionRuntime类 参考final

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 &registry, 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 &registry, 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]

eve::weapon::WeaponDefinitionRuntime::WeaponDefinitionRuntime ( WeaponDefinitionRuntime &&  )
defaultnoexcept

Weapon definition runtime.

◆ WeaponDefinitionRuntime() [2/2]

eve::weapon::WeaponDefinitionRuntime::WeaponDefinitionRuntime ( const WeaponDefinitionRuntime &  )
delete

◆ ~WeaponDefinitionRuntime()

eve::weapon::WeaponDefinitionRuntime::~WeaponDefinitionRuntime ( )
default

Weapon definition runtime.

成员函数说明

◆ applyTo()

eve::Result< void > eve::weapon::WeaponDefinitionRuntime::applyTo ( WeaponEntity *  entity) const

Atomically project this runtime into a borrowed WeaponEntity.

参数
entityBorrowed 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]

eve::Result< WeaponDefinitionRuntime > eve::weapon::WeaponDefinitionRuntime::create ( eve::definitions::DefinitionRegistry &  registry,
eve::DefinitionRef  definition,
eve::PersistentId  instanceId,
eve::definition::ReloadPolicy  policy = eve::definition::ReloadPolicy::RebuildInstance 
)
static

Create from a common weapon:<name> definition reference.

参数
registryBorrowed registry containing the definition.
definitionLogical weapon definition reference.
instanceIdNon-nil persistent identity for this weapon instance.
policyPolicy 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() , 以及 create().

◆ create() [2/3]

eve::Result< WeaponDefinitionRuntime > eve::weapon::WeaponDefinitionRuntime::create ( eve::definitions::DefinitionRegistry &  registry,
std::string_view  definitionId,
eve::PersistentId  instanceId,
eve::definition::ReloadPolicy  policy = eve::definition::ReloadPolicy::RebuildInstance 
)
static

◆ create() [3/3]

eve::Result< WeaponDefinitionRuntime > eve::weapon::WeaponDefinitionRuntime::create ( Weapon &  module,
std::string_view  definitionId,
eve::PersistentId  instanceId,
eve::definition::ReloadPolicy  policy = eve::definition::ReloadPolicy::RebuildInstance 
)
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()

eve::definition::DefinitionHandle eve::weapon::WeaponDefinitionRuntime::definitionHandle ( ) const
noexcept

Return the exact generation-qualified definition handle.

在文件 WeaponDefinitionRuntime.cpp 第 471 行定义.

被这些函数引用 definition() , 以及 restore().

◆ identity()

const eve::definition::InstanceIdentity & eve::weapon::WeaponDefinitionRuntime::identity ( ) const
noexcept

Borrow the common instance identity and exact definition generation.

在文件 WeaponDefinitionRuntime.cpp 第 463 行定义.

被这些函数引用 applyTo(), definition(), reload() , 以及 restore().

◆ isActive()

bool eve::weapon::WeaponDefinitionRuntime::isActive ( ) const
noexcept

Return whether the instance is active.

在文件 WeaponDefinitionRuntime.cpp 第 485 行定义.

被这些函数引用 applyTo().

◆ operator=() [1/2]

WeaponDefinitionRuntime & eve::weapon::WeaponDefinitionRuntime::operator= ( const WeaponDefinitionRuntime &  )
delete

◆ operator=() [2/2]

WeaponDefinitionRuntime & eve::weapon::WeaponDefinitionRuntime::operator= ( WeaponDefinitionRuntime &&  )
defaultnoexcept

Operator =.

◆ reload()

◆ reloadPolicy()

eve::definition::ReloadPolicy eve::weapon::WeaponDefinitionRuntime::reloadPolicy ( ) const
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()

void eve::weapon::WeaponDefinitionRuntime::setActive ( bool  active)
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]

const WeaponRuntimeState & eve::weapon::WeaponDefinitionRuntime::state ( ) const
noexcept

Borrow mutable typed firing/resource state.

在文件 WeaponDefinitionRuntime.cpp 第 467 行定义.

被这些函数引用 applyTo().

◆ state() [2/2]

WeaponRuntimeState & eve::weapon::WeaponDefinitionRuntime::state ( )
noexcept

Mutate typed firing/resource state on the owner thread.

在文件 WeaponDefinitionRuntime.cpp 第 469 行定义.


该类的文档由以下文件生成: