载入中...
搜索中...
未找到
eve::building::BuildingGarrisonContainerAdapter类 参考final

Transactional adapter over one placed building's authoritative garrison. 更多...

#include <ContainerAdapters.h>

类 eve::building::BuildingGarrisonContainerAdapter 继承关系图:
eve::container::IContainer

类

class  PreparedState
 

Public 成员函数

 BuildingGarrisonContainerAdapter (eve::container::ContainerId id, PlacementWorld *world, int instanceId, eve::container::Capacity capacity=eve::container::Capacity::unlimited(), eve::container::AcceptedCondition accepted={})
 Binds an adapter to a placed building.
 
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 authoritative garrison revision, or zero when stale.
 
eve::Result< eve::container::MembershipId > enter (std::string memberId, std::string type="building.garrison.member", std::vector< std::string > tags={}, eve::container::GameEventSink sink={}, eve::SimulationTick tick=eve::SimulationTick::zero())
 Stage and publish a new garrison member.
 
eve::Result< eve::container::MembershipId > exit (eve::container::MembershipId memberId, eve::container::GameEventSink sink={}, eve::SimulationTick tick=eve::SimulationTick::zero())
 Stage and publish removal of one member.
 
- Public 成员函数 继承自 eve::container::IContainer
virtual ~IContainer ()=default
 

详细描述

Transactional adapter over one placed building's authoritative garrison.

The PlacementWorld and building instance are borrowed; neither is deleted by this adapter. Membership is stored in PlacedBuilding::garrison, so a second adapter observes the same state and a rebuilt adapter does not lose members. The building must remain present until a prepared state is committed or rolled back. Removal/replacement is stale-safe at prepare time; violating the lifetime contract before noexcept commit terminates.

Garrison members are insertion-ordered and use contiguous slots. Capacity and the side-effect-free accepted condition are supplied by the caller, because building definitions do not own a universal population policy.

在文件 ContainerAdapters.h 第 36 行定义.

构造及析构函数说明

◆ BuildingGarrisonContainerAdapter()

eve::building::BuildingGarrisonContainerAdapter::BuildingGarrisonContainerAdapter ( eve::container::ContainerId  id,
PlacementWorld *  world,
int  instanceId,
eve::container::Capacity  capacity = eve::container::Capacity::unlimited(),
eve::container::AcceptedCondition  accepted = {} 
)

Binds an adapter to a placed building.

参数
idStable identity, normally building:garrison:<world>:<instance>.
worldBorrowed placement world.
instanceIdExisting placed-building instance identity.
capacityMaximum member count.
acceptedSide-effect-free condition applied before entry.

在文件 ContainerAdapters.cpp 第 159 行定义.

成员函数说明

◆ descriptor()

const eve::container::ContainerDescriptor & eve::building::BuildingGarrisonContainerAdapter::descriptor ( ) const
inlineoverridevirtualnoexcept

Descriptor.

实现了 eve::container::IContainer.

在文件 ContainerAdapters.h 第 51 行定义.

◆ enter()

eve::Result< eve::container::MembershipId > eve::building::BuildingGarrisonContainerAdapter::enter ( std::string  memberId,
std::string  type = "building.garrison.member",
std::vector< std::string >  tags = {},
eve::container::GameEventSink  sink = {},
eve::SimulationTick  tick = eve::SimulationTick::zero() 
)

Stage and publish a new garrison member.

参数
memberIdStable member identity; it must be non-empty.
typeDomain type spelling retained in snapshots.
tagsMember tags used by accepted conditions and consumers.
sinkOptional synchronous canonical GameEvent observer.
tickInjected simulation tick for emitted envelopes.
返回
The member identity, or a rejection with no membership mutation.

在文件 ContainerAdapters.cpp 第 314 行定义.

引用了 eve::container::Accepted, current, eve::container::Enter, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Status::failure(), eve::container::ContainerObject::id, eve::container::ContainerDescriptor::id, eve::container::SlotIndex::invalid(), eve::InvariantViolation, object, prepare(), eve::container::Rejected, revision(), serial, snapshot(), status, eve::Result< T >::success(), tick, type, validateInsert() , 以及 eve::container::SlotIndex::value().

◆ exit()

eve::Result< eve::container::MembershipId > eve::building::BuildingGarrisonContainerAdapter::exit ( eve::container::MembershipId  memberId,
eve::container::GameEventSink  sink = {},
eve::SimulationTick  tick = eve::SimulationTick::zero() 
)

Stage and publish removal of one member.

参数
memberIdStable member identity.
sinkOptional synchronous canonical GameEvent observer.
tickInjected simulation tick for emitted envelopes.
返回
The removed identity, or a rejection with no mutation.

在文件 ContainerAdapters.cpp 第 382 行定义.

引用了 eve::container::Accepted, current, eve::Diagnostic::error(), eve::container::Exit, eve::Result< T >::failure(), eve::Status::failure(), eve::container::ContainerDescriptor::id, index, eve::container::SlotIndex::invalid(), eve::InvariantViolation, eve::container::SlotIndex::isValid(), eve::NotFound, prepare(), eve::container::Rejected, revision(), serial, snapshot(), status, eve::Result< T >::success(), tick , 以及 eve::container::SlotIndex::value().

◆ prepare()

eve::Result< std::unique_ptr< eve::container::IContainer::PreparedState > > eve::building::BuildingGarrisonContainerAdapter::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.

在文件 ContainerAdapters.cpp 第 266 行定义.

引用了 eve::container::ContainerDescriptor::capacity, eve::Conflict, current, eve::container::ContainerSnapshot::entries, eve::Diagnostic::error(), eve::container::ContainerSnapshot::id, eve::container::ContainerDescriptor::id, eve::detail::StrongUint64< Tag >::incremented(), index, eve::InvalidArgument, eve::InvariantViolation, eve::container::Capacity::isUnlimited(), eve::container::ContainerId::isValid(), member, eve::container::ContainerSnapshot::revision, snapshot(), eve::StaleHandle, eve::container::Capacity::value() , 以及 value.

被这些函数引用 enter() , 以及 exit().

◆ revision()

eve::Revision eve::building::BuildingGarrisonContainerAdapter::revision ( ) const
noexcept

Return the authoritative garrison revision, or zero when stale.

在文件 ContainerAdapters.cpp 第 181 行定义.

引用了 value , 以及 eve::detail::StrongUint64< detail::RevisionTag >::zero().

被这些函数引用 enter() , 以及 exit().

◆ snapshot()

◆ validateInsert()


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