Canonical attributes component adapter, backed by attributes::AttributeSet. 更多...
#include <RTSTypes.h>
类 | |
| struct | Impl |
Public 成员函数 | |
| AttributeComponent () | |
| Attribute component. | |
| ~AttributeComponent () | |
| Attribute component. | |
| AttributeComponent (const AttributeComponent &other) | |
| Attribute component. | |
| AttributeComponent & | operator= (const AttributeComponent &other) |
| Operator =. | |
| AttributeComponent (AttributeComponent &&other) noexcept | |
| Attribute component. | |
| AttributeComponent & | operator= (AttributeComponent &&other) noexcept |
| Operator =. | |
| Result< void > | setBase (std::string_view attribute, double value) |
| Set one authoritative base value. | |
| Result< void > | modifyBase (std::string_view attribute, double delta) |
| Add to one authoritative base value. | |
| bool | has (std::string_view attribute) const |
| Return whether an attribute exists. | |
| Result< double > | getFinal (std::string_view attribute, double fallback=0.0) const |
| Read the deterministic final value or a caller-supplied default. | |
| std::size_t | modifierCount () const noexcept |
| Return the number of canonical modifiers. | |
| const eve::attributes::AttributeModifier * | modifierAt (int index) const noexcept |
| Return a canonical modifier in deterministic sequence order. | |
| Result< void > | bindOwner (ecs::EntityHandle owner) |
| Bind the canonical attribute state to an ECS owner generation. | |
| bool | initialized () const noexcept |
| Return whether initial unit stat bases have been installed. | |
| Result< void > | initialize (std::span< const eve::attributes::AttributeSnapshotBase > values) |
| Seed unit stat bases once without replacing existing values. | |
| bool | isStale () const noexcept |
| Return whether the canonical attribute owner is stale. | |
| Result< eve::attributes::ModifierId > | addModifier (eve::attributes::AttributeModifier modifier) |
| Add a modifier with the common source/priority/sequence contract. | |
| Result< eve::attributes::AttributeProjectionSnapshot > | snapshot (std::span< const std::string_view > attributes) const |
| Capture selected values with owner and revision metadata. | |
| Result< void > | restore (const eve::attributes::AttributeProjectionSnapshot &snapshot, Revision expectedRevision) |
| Restore selected values after generation and revision checks. | |
详细描述
Canonical attributes component adapter, backed by attributes::AttributeSet.
在文件 RTSTypes.h 第 323 行定义.
构造及析构函数说明
◆ AttributeComponent() [1/3]
| eve::rts::AttributeComponent::AttributeComponent | ( | ) |
Attribute component.
在文件 RTSTypes.cpp 第 261 行定义.
◆ ~AttributeComponent()
|
default |
Attribute component.
◆ AttributeComponent() [2/3]
| eve::rts::AttributeComponent::AttributeComponent | ( | const AttributeComponent & | other | ) |
Attribute component.
在文件 RTSTypes.cpp 第 263 行定义.
◆ AttributeComponent() [3/3]
|
defaultnoexcept |
Attribute component.
成员函数说明
◆ addModifier()
| Result< eve::attributes::ModifierId > eve::rts::AttributeComponent::addModifier | ( | eve::attributes::AttributeModifier | modifier | ) |
Add a modifier with the common source/priority/sequence contract.
在文件 RTSTypes.cpp 第 325 行定义.
◆ bindOwner()
| Result< void > eve::rts::AttributeComponent::bindOwner | ( | ecs::EntityHandle | owner | ) |
Bind the canonical attribute state to an ECS owner generation.
在文件 RTSTypes.cpp 第 311 行定义.
◆ getFinal()
| Result< double > eve::rts::AttributeComponent::getFinal | ( | std::string_view | attribute, |
| double | fallback = 0.0 |
||
| ) | const |
Read the deterministic final value or a caller-supplied default.
在文件 RTSTypes.cpp 第 293 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::NoOp, eve::Status::success() , 以及 eve::Result< T >::success().
◆ has()
| bool eve::rts::AttributeComponent::has | ( | std::string_view | attribute | ) | const |
Return whether an attribute exists.
在文件 RTSTypes.cpp 第 289 行定义.
◆ initialize()
| Result< void > eve::rts::AttributeComponent::initialize | ( | std::span< const eve::attributes::AttributeSnapshotBase > | values | ) |
Seed unit stat bases once without replacing existing values.
在文件 RTSTypes.cpp 第 318 行定义.
引用了 values.
◆ initialized()
|
noexcept |
Return whether initial unit stat bases have been installed.
在文件 RTSTypes.cpp 第 316 行定义.
◆ isStale()
|
noexcept |
Return whether the canonical attribute owner is stale.
在文件 RTSTypes.cpp 第 323 行定义.
◆ modifierAt()
|
noexcept |
Return a canonical modifier in deterministic sequence order.
- 返回
- A nullable borrowed pointer into the canonical AttributeSet, or
nullptrwhenindexis outside the current range. @ownership Borrowed; AttributeComponent owns the underlying modifier and the caller must not delete or transfer the pointer. @nullable Yes, for an invalid index. @lifetime Valid until the next component mutation, restore or destruction; copy the value or query again after that boundary. @thread Owner-thread-affine; no synchronization is provided. @reentrancy Side-effect free and invokes no external callbacks.
在文件 RTSTypes.cpp 第 307 行定义.
引用了 index.
◆ modifierCount()
|
noexcept |
◆ modifyBase()
| Result< void > eve::rts::AttributeComponent::modifyBase | ( | std::string_view | attribute, |
| double | delta | ||
| ) |
Add to one authoritative base value.
在文件 RTSTypes.cpp 第 281 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure() , 以及 eve::InvalidArgument.
◆ operator=() [1/2]
|
defaultnoexcept |
Operator =.
◆ operator=() [2/2]
| AttributeComponent & eve::rts::AttributeComponent::operator= | ( | const AttributeComponent & | other | ) |
Operator =.
在文件 RTSTypes.cpp 第 265 行定义.
◆ restore()
| Result< void > eve::rts::AttributeComponent::restore | ( | const eve::attributes::AttributeProjectionSnapshot & | snapshot, |
| Revision | expectedRevision | ||
| ) |
Restore selected values after generation and revision checks.
在文件 RTSTypes.cpp 第 338 行定义.
引用了 snapshot().
被这些函数引用 eve::rts::RTS::restoreState().
◆ setBase()
| Result< void > eve::rts::AttributeComponent::setBase | ( | std::string_view | attribute, |
| double | value | ||
| ) |
Set one authoritative base value.
在文件 RTSTypes.cpp 第 273 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument , 以及 value.
◆ snapshot()
| Result< eve::attributes::AttributeProjectionSnapshot > eve::rts::AttributeComponent::snapshot | ( | std::span< const std::string_view > | attributes | ) | const |
Capture selected values with owner and revision metadata.
在文件 RTSTypes.cpp 第 330 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure() , 以及 eve::InvariantViolation.
被这些函数引用 restore().
该类的文档由以下文件生成:
- src/modules/rts/RTSTypes.h
- src/modules/rts/RTSTypes.cpp