载入中...
搜索中...
未找到
eve::card::CardContainerAdapter类 参考final

Exposes one card collection through the generic atomic transfer API. 更多...

#include <CardContainers.h>

类 eve::card::CardContainerAdapter 继承关系图:
eve::container::IContainer

类

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.

参数
idStable container identity.
kindWhich Card collection is exposed.
deckBorrowed deck when kind is Deck.
handBorrowed hand when kind is Hand.
discardBorrowed authoritative vector when kind is Discard.
capacityOptional maximum number of cards.
acceptedKindsOptional 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()

const eve::container::ContainerDescriptor & eve::card::CardContainerAdapter::descriptor ( ) const
inlineoverridevirtualnoexcept

Descriptor.

实现了 eve::container::IContainer.

在文件 CardContainers.h 第 68 行定义.

◆ prepare()

eve::Result< std::unique_ptr< eve::container::IContainer::PreparedState > > eve::card::CardContainerAdapter::prepare ( const eve::container::ContainerSnapshot &  expected,
const eve::container::ContainerSnapshot &  candidate 
)
overridevirtual

Prepare an exact replacement from expected to candidate.

参数
expectedSnapshot observed during transfer preflight.
candidateFully 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 expected snapshot. 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()

eve::Revision eve::card::CardContainerAdapter::revision ( ) const
inlinenoexcept

Return the current adapter revision for optimistic requests.

在文件 CardContainers.h 第 83 行定义.

◆ snapshot()

◆ validateInsert()


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