Exposes one card collection through the generic atomic transfer API. 更多...
#include <CardContainers.h>
类 | |
| class | PreparedState |
Public 成员函数 | |
| CardContainerAdapter (eve::container::ContainerId id, CardContainerKind kind, Deck *deck=nullptr, Hand *hand=nullptr, std::vector< CardData * > *discard=nullptr, eve::container::Capacity capacity=eve::container::Capacity::unlimited(), std::vector< std::string > acceptedKinds={}) | |
| Bind a borrowed Deck, Hand or discard collection. | |
| const eve::container::ContainerDescriptor & | descriptor () const noexcept override |
| Descriptor. | |
| eve::Result< eve::container::ContainerSnapshot > | snapshot () const override |
| Snapshot. | |
| eve::Result< void > | validateInsert (const eve::container::ContainerObject &object, std::optional< eve::container::SlotIndex > destination, std::optional< eve::container::MembershipId > ignoredObject=std::nullopt) const override |
| Validate insert. | |
| eve::Result< std::unique_ptr< eve::container::IContainer::PreparedState > > | prepare (const eve::container::ContainerSnapshot &expected, const eve::container::ContainerSnapshot &candidate) override |
Prepare an exact replacement from expected to candidate. | |
| eve::Revision | revision () const noexcept |
| Return the current adapter revision for optimistic requests. | |
Public 成员函数 继承自 eve::container::IContainer | |
| virtual | ~IContainer ()=default |
详细描述
Exposes one card collection through the generic atomic transfer API.
The referenced Deck/Hand/vector is caller-owned and must outlive every synchronous call. The adapter does not delete cards. For Discard, the caller supplies the authoritative vector because Card's existing discard UI is deliberately not made a second source of truth. The legacy vectors still contain borrowed pointers, so the owning Card module must remove a card from all such vectors before destroying its ECS entity.
Snapshots carry an ECS handle and therefore reject destroyed or reused card slots as stale. Restore must recreate Card entities first, then construct a fresh adapter over the restored collection.
在文件 CardContainers.h 第 50 行定义.
构造及析构函数说明
◆ CardContainerAdapter()
| eve::card::CardContainerAdapter::CardContainerAdapter | ( | eve::container::ContainerId | id, |
| CardContainerKind | kind, | ||
| Deck * | deck = nullptr, |
||
| Hand * | hand = nullptr, |
||
| std::vector< CardData * > * | discard = nullptr, |
||
| eve::container::Capacity | capacity = eve::container::Capacity::unlimited(), |
||
| std::vector< std::string > | acceptedKinds = {} |
||
| ) |
Bind a borrowed Deck, Hand or discard collection.
- 参数
-
id Stable container identity. kind Which Card collection is exposed. deck Borrowed deck when kind is Deck. hand Borrowed hand when kind is Hand. discard Borrowed authoritative vector when kind is Discard. capacity Optional maximum number of cards. acceptedKinds Optional card-kind allowlist.
在文件 CardContainers.cpp 第 60 行定义.
引用了 eve::card::Deck, eve::card::Discard, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::container::ContainerDescriptor::filter, eve::card::Hand, eve::InvalidArgument, eve::PreconditionViolation , 以及 eve::Result< T >::success().
成员函数说明
◆ descriptor()
|
inlineoverridevirtualnoexcept |
◆ prepare()
|
overridevirtual |
Prepare an exact replacement from expected to candidate.
- 参数
-
expected Snapshot observed during transfer preflight. candidate Fully constructed post-transfer snapshot.
- 返回
- A detached state whose commit and rollback operations cannot fail; no observable state may change before commit.
- 备注
- The adapter must reject a stale
expectedsnapshot. The adapter is borrowed and must outlive the returned state; the caller must externally serialize access to the adapter.
Prepare.
实现了 eve::container::IContainer.
在文件 CardContainers.cpp 第 193 行定义.
引用了 eve::container::ContainerDescriptor::capacity, eve::Conflict, eve::container::ContainerSnapshot::entries, eve::Diagnostic::error(), eve::container::ContainerSnapshot::id, eve::container::ContainerDescriptor::id, eve::ui::WidgetDesc::id, ids, eve::detail::StrongUint64< Tag >::incremented(), index, eve::InvalidArgument, eve::InvariantViolation, eve::container::Capacity::isUnlimited(), eve::container::ContainerId::isValid(), payload, eve::container::ContainerSnapshot::revision, snapshot(), eve::StaleHandle, eve::container::Capacity::value() , 以及 values.
◆ revision()
|
inlinenoexcept |
Return the current adapter revision for optimistic requests.
在文件 CardContainers.h 第 83 行定义.
◆ snapshot()
|
overridevirtual |
Snapshot.
实现了 eve::container::IContainer.
在文件 CardContainers.cpp 第 135 行定义.
引用了 eve::container::ContainerDescriptor::capacity, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::container::ContainerDescriptor::id, id, eve::ui::WidgetDesc::id, ids, eve::InvalidArgument, eve::InvariantViolation, eve::container::Capacity::isUnlimited(), eve::container::ContainerId::isValid(), snapshot(), eve::Result< T >::success(), eve::container::Capacity::value() , 以及 values.
被这些函数引用 prepare() , 以及 snapshot().
◆ validateInsert()
|
overridevirtual |
Validate insert.
实现了 eve::container::IContainer.
在文件 CardContainers.cpp 第 164 行定义.
引用了 eve::container::ContainerDescriptor::capacity, eve::Conflict, eve::Diagnostic::error(), eve::container::Filter::evaluate(), eve::Result< T >::failure(), eve::container::ContainerDescriptor::filter, eve::container::ContainerDescriptor::id, eve::ui::WidgetDesc::id, eve::InvalidArgument, eve::container::Capacity::isUnlimited(), eve::container::ContainerId::isValid(), payload, eve::StaleHandle, eve::Result< T >::success(), eve::ui::WidgetDesc::type, u, eve::container::Capacity::value() , 以及 values.
该类的文档由以下文件生成:
- src/modules/card/CardContainers.h
- src/modules/card/CardContainers.cpp
Public 成员函数 继承自