载入中...
搜索中...
未找到
eve::vehicle::VehicleSeatContainerAdapter类 参考final

Transactional adapter over one VehicleEntity::Seats component. 更多...

#include <ContainerAdapters.h>

类 eve::vehicle::VehicleSeatContainerAdapter 继承关系图:
eve::container::IContainer

类

class  PreparedState
 

Public 成员函数

 VehicleSeatContainerAdapter (eve::container::ContainerId id, VehicleEntity *vehicle, eve::container::AcceptedCondition accepted={})
 Binds an adapter to a live ECS vehicle.
 
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 live seat-component revision, or zero when stale.
 
eve::Result< eve::container::MembershipId > enter (eve::container::SlotIndex seatIndex, int occupantId, eve::container::GameEventSink sink={}, eve::SimulationTick tick=eve::SimulationTick::zero())
 Stage and publish an occupant entering a seat.
 
eve::Result< eve::container::MembershipId > exit (eve::container::SlotIndex seatIndex, eve::container::GameEventSink sink={}, eve::SimulationTick tick=eve::SimulationTick::zero())
 Stage and publish the occupant leaving a seat.
 
- Public 成员函数 继承自 eve::container::IContainer
virtual ~IContainer ()=default
 

详细描述

Transactional adapter over one VehicleEntity::Seats component.

The ECS entity is held by a generation-qualified handle. The adapter does not own the vehicle or occupants. A prepared state must be committed or rolled back before the vehicle entity is destroyed; stale destruction is rejected during snapshot/prepare and an invalid lifetime during noexcept commit terminates, as required by IContainer::PreparedState.

Seat membership is explicit-slot, capacity equals the number of declared seats, and the seat component's revision is the sole optimistic-concurrency revision. VehicleSystem's legacy enter/exit facade delegates to this class.

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

构造及析构函数说明

◆ VehicleSeatContainerAdapter()

eve::vehicle::VehicleSeatContainerAdapter::VehicleSeatContainerAdapter ( eve::container::ContainerId  id,
VehicleEntity *  vehicle,
eve::container::AcceptedCondition  accepted = {} 
)

Binds an adapter to a live ECS vehicle.

参数
idStable container identity, normally vehicle:seat:<vehicle-id>.
vehicleBorrowed VehicleEntity; the ECS handle detects destruction and slot reuse after construction.
acceptedOptional side-effect-free object filter.

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

成员函数说明

◆ descriptor()

const eve::container::ContainerDescriptor & eve::vehicle::VehicleSeatContainerAdapter::descriptor ( ) const
inlineoverridevirtualnoexcept

Descriptor.

实现了 eve::container::IContainer.

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

◆ enter()

eve::Result< eve::container::MembershipId > eve::vehicle::VehicleSeatContainerAdapter::enter ( eve::container::SlotIndex  seatIndex,
int  occupantId,
eve::container::GameEventSink  sink = {},
eve::SimulationTick  tick = eve::SimulationTick::zero() 
)

Stage and publish an occupant entering a seat.

参数
seatIndexExplicit seat slot.
occupantIdPositive stable gameplay occupant ID.
sinkOptional synchronous canonical GameEvent observer.
tickInjected simulation tick for emitted envelopes.
返回
Occupant membership identity, or a rejection with no mutation.

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

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

◆ exit()

eve::Result< eve::container::MembershipId > eve::vehicle::VehicleSeatContainerAdapter::exit ( eve::container::SlotIndex  seatIndex,
eve::container::GameEventSink  sink = {},
eve::SimulationTick  tick = eve::SimulationTick::zero() 
)

Stage and publish the occupant leaving a seat.

参数
seatIndexExplicit seat slot.
sinkOptional synchronous canonical GameEvent observer.
tickInjected simulation tick for emitted envelopes.
返回
Removed occupant identity, or a rejection with no mutation.

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

引用了 eve::container::Accepted, current, eve::Diagnostic::error(), eve::container::Exit, eve::Result< T >::failure(), eve::Status::failure(), eve::container::ContainerDescriptor::id, eve::InvariantViolation, eve::container::MembershipId::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::vehicle::VehicleSeatContainerAdapter::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 第 279 行定义.

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

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

◆ revision()

eve::Revision eve::vehicle::VehicleSeatContainerAdapter::revision ( ) const
noexcept

Return the live seat-component revision, or zero when stale.

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

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

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

◆ snapshot()

◆ validateInsert()

eve::Result< void > eve::vehicle::VehicleSeatContainerAdapter::validateInsert ( const eve::container::ContainerObject &  object,
std::optional< eve::container::SlotIndex >  destination,
std::optional< eve::container::MembershipId >  ignoredObject = std::nullopt 
) const
overridevirtual

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