Transactional adapter over one VehicleEntity::Seats component. 更多...
#include <ContainerAdapters.h>
类 | |
| class | PreparedState |
详细描述
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.
- 参数
-
id Stable container identity, normally vehicle:seat:<vehicle-id>.vehicle Borrowed VehicleEntity; the ECS handle detects destruction and slot reuse after construction. accepted Optional side-effect-free object filter.
在文件 ContainerAdapters.cpp 第 170 行定义.
成员函数说明
◆ descriptor()
|
inlineoverridevirtualnoexcept |
◆ 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.
- 参数
-
seatIndex Explicit seat slot. occupantId Positive stable gameplay occupant ID. sink Optional synchronous canonical GameEvent observer. tick Injected 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.
- 参数
-
seatIndex Explicit seat slot. sink Optional synchronous canonical GameEvent observer. tick Injected 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()
|
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.
在文件 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.
◆ revision()
|
noexcept |
Return the live seat-component revision, or zero when stale.
在文件 ContainerAdapters.cpp 第 182 行定义.
引用了 value , 以及 eve::detail::StrongUint64< detail::RevisionTag >::zero().
◆ snapshot()
|
overridevirtual |
Snapshot.
实现了 eve::container::IContainer.
在文件 ContainerAdapters.cpp 第 209 行定义.
引用了 eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::container::ContainerDescriptor::id, id, index, eve::InvariantViolation, eve::container::ContainerId::isValid(), eve::StaleHandle, eve::Result< T >::success() , 以及 value.
◆ validateInsert()
|
overridevirtual |
Validate insert.
实现了 eve::container::IContainer.
在文件 ContainerAdapters.cpp 第 234 行定义.
引用了 eve::Conflict, count, eve::Diagnostic::error(), eve::container::Filter::evaluate(), eve::Result< T >::failure(), eve::container::ContainerDescriptor::filter, eve::container::ContainerDescriptor::id, index, eve::InvalidArgument, eve::container::ContainerId::isValid(), eve::StaleHandle, eve::Result< T >::success(), type , 以及 value.
被这些函数引用 enter().
该类的文档由以下文件生成:
- src/modules/vehicle/ContainerAdapters.h
- src/modules/vehicle/ContainerAdapters.cpp
Public 成员函数 继承自