载入中...
搜索中...
未找到
eve::attributes::AttributeProjection类 参考

Canonical selected-attribute storage with owner and revision checks. 更多...

#include <AttributeProjection.h>

Public 成员函数

 AttributeProjection (std::string subject={})
 Construct an empty projection with an optional stable subject id.
 
Result< void > bindOwner (ecs::EntityHandle owner)
 Bind the projection to one live generation-qualified ECS owner.
 
const ecs::EntityHandle & owner () const noexcept
 Return the owner handle used for stale detection.
 
Revision revision () const noexcept
 Return the monotonically changing content revision.
 
bool isStale () const noexcept
 Return whether the bound owner no longer resolves at its generation.
 
bool initialized () const noexcept
 Return whether initial domain values have been installed.
 
Result< void > initialize (std::span< const AttributeSnapshotBase > values)
 Seed base values once from an existing domain compatibility field.
 
Result< void > setBase (std::string_view attribute, double value)
 Set a canonical base value and advance the projection revision.
 
Result< void > modifyBase (std::string_view attribute, double delta)
 Add to a canonical base value and advance the projection revision.
 
Result< double > getFinal (std::string_view attribute, double fallback=0.0) const
 Read a deterministic final value, or the supplied default when absent.
 
bool has (std::string_view attribute) const
 Return whether the canonical set contains a base or modifier for the name.
 
Result< ModifierId > addModifier (AttributeModifier modifier)
 Add a canonical modifier using the shared source/priority/sequence rules.
 
int modifierCount () const noexcept
 Return the number of canonical modifiers currently retained.
 
const AttributeModifier * modifierAt (int index) const
 Return a modifier in deterministic sequence order.
 
Result< AttributeProjectionSnapshot > snapshot (std::span< const std::string_view > attributes) const
 Capture only named attributes and their modifiers.
 
Result< void > restore (const AttributeProjectionSnapshot &snapshot, Revision expectedRevision)
 Restore a snapshot after owner and optimistic revision validation.
 

详细描述

Canonical selected-attribute storage with owner and revision checks.

The class is synchronous and thread-affine to its owning ECS world. It owns the AttributeSet; callers do not retain pointers into it across structural ECS changes. restore first builds a candidate set and publishes it only after all validation and modifier insertion succeeds.

在文件 AttributeProjection.h 第 55 行定义.

构造及析构函数说明

◆ AttributeProjection()

eve::attributes::AttributeProjection::AttributeProjection ( std::string  subject = {})

Construct an empty projection with an optional stable subject id.

在文件 AttributeProjection.cpp 第 23 行定义.

成员函数说明

◆ addModifier()

Result< ModifierId > eve::attributes::AttributeProjection::addModifier ( AttributeModifier  modifier)

Add a canonical modifier using the shared source/priority/sequence rules.

在文件 AttributeProjection.cpp 第 104 行定义.

引用了 eve::attributes::AttributeSet::addModifier() , 以及 eve::Result< T >::failure().

◆ bindOwner()

Result< void > eve::attributes::AttributeProjection::bindOwner ( ecs::EntityHandle  owner)

Bind the projection to one live generation-qualified ECS owner.

在文件 AttributeProjection.cpp 第 25 行定义.

引用了 eve::Applied, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::NoOp, owner(), eve::StaleHandle, eve::Status::success() , 以及 eve::Result< T >::success().

◆ getFinal()

Result< double > eve::attributes::AttributeProjection::getFinal ( std::string_view  attribute,
double  fallback = 0.0 
) const

Read a deterministic final value, or the supplied default when absent.

在文件 AttributeProjection.cpp 第 92 行定义.

引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::attributes::AttributeSet::getFinal(), eve::InvalidArgument , 以及 eve::Result< T >::success().

◆ has()

bool eve::attributes::AttributeProjection::has ( std::string_view  attribute) const

Return whether the canonical set contains a base or modifier for the name.

在文件 AttributeProjection.cpp 第 100 行定义.

引用了 eve::attributes::AttributeSet::has().

◆ initialize()

Result< void > eve::attributes::AttributeProjection::initialize ( std::span< const AttributeSnapshotBase >  values)

Seed base values once from an existing domain compatibility field.

返回
NoOp when already initialized; invalid data is rejected without mutation.

在文件 AttributeProjection.cpp 第 56 行定义.

引用了 eve::Diagnostic::error(), eve::InvalidArgument, eve::NoOp, eve::attributes::AttributeSet::setBase(), eve::Status::success(), eve::Result< T >::success() , 以及 values.

◆ initialized()

bool eve::attributes::AttributeProjection::initialized ( ) const
inlinenoexcept

Return whether initial domain values have been installed.

在文件 AttributeProjection.h 第 73 行定义.

◆ isStale()

bool eve::attributes::AttributeProjection::isStale ( ) const
noexcept

Return whether the bound owner no longer resolves at its generation.

在文件 AttributeProjection.cpp 第 39 行定义.

◆ modifierAt()

const AttributeModifier * eve::attributes::AttributeProjection::modifierAt ( int  index) const
inline

Return a modifier in deterministic sequence order.

返回
A nullable borrowed pointer into the canonical attribute set, or nullptr when index is outside the current range. @ownership Borrowed; the owning AttributeSet retains destruction and storage responsibility. The caller must not delete it. @nullable Yes, for an invalid index. @lifetime Valid until the next modifier/base mutation, restore or owner destruction; copy the modifier if it must outlive that boundary. @thread Owner-thread-affine; no synchronization is provided. @reentrancy Side-effect free and does not invoke callbacks.

在文件 AttributeProjection.h 第 111 行定义.

引用了 index.

◆ modifierCount()

int eve::attributes::AttributeProjection::modifierCount ( ) const
inlinenoexcept

Return the number of canonical modifiers currently retained.

在文件 AttributeProjection.h 第 97 行定义.

◆ modifyBase()

Result< void > eve::attributes::AttributeProjection::modifyBase ( std::string_view  attribute,
double  delta 
)

Add to a canonical base value and advance the projection revision.

在文件 AttributeProjection.cpp 第 81 行定义.

引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument , 以及 eve::attributes::AttributeSet::modifyBase().

◆ owner()

const ecs::EntityHandle & eve::attributes::AttributeProjection::owner ( ) const
inlinenoexcept

Return the owner handle used for stale detection.

在文件 AttributeProjection.h 第 64 行定义.

被这些函数引用 bindOwner().

◆ restore()

Result< void > eve::attributes::AttributeProjection::restore ( const AttributeProjectionSnapshot &  snapshot,
Revision  expectedRevision 
)

◆ revision()

Revision eve::attributes::AttributeProjection::revision ( ) const
inlinenoexcept

Return the monotonically changing content revision.

在文件 AttributeProjection.h 第 67 行定义.

◆ setBase()

Result< void > eve::attributes::AttributeProjection::setBase ( std::string_view  attribute,
double  value 
)

Set a canonical base value and advance the projection revision.

在文件 AttributeProjection.cpp 第 70 行定义.

引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::attributes::AttributeSet::setBase() , 以及 value.

◆ snapshot()

Result< AttributeProjectionSnapshot > eve::attributes::AttributeProjection::snapshot ( std::span< const std::string_view >  attributes) const

Capture only named attributes and their modifiers.

参数
attributesStable allow-list owned by the caller for this synchronous call.

在文件 AttributeProjection.cpp 第 113 行定义.

引用了 eve::attributes::AttributeProjectionSnapshot::bases, eve::attributes::AttributeProjectionSnapshot::capturedRevision, eve::Diagnostic::error(), eve::attributes::AttributeSet::getBase(), eve::InvalidArgument, name , 以及 eve::attributes::AttributeProjectionSnapshot::owner.


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