Adapts one Bag's item quantities to the common resource protocol. 更多...
#include <InventoryResourceAccount.h>
Public 成员函数 | |
| InventoryResourceAccount (Bag &bag) | |
| Bind the adapter to one caller-owned inventory bag. | |
| InventoryResourceAccount (const InventoryResourceAccount &)=delete | |
| InventoryResourceAccount & | operator= (const InventoryResourceAccount &)=delete |
| InventoryResourceAccount (InventoryResourceAccount &&)=delete | |
| InventoryResourceAccount & | operator= (InventoryResourceAccount &&)=delete |
| ~InventoryResourceAccount () override=default | |
| Inventory resource account. | |
| eve::Result< eve::resource::Affordability > | canAfford (const eve::resource::CostSpec &cost) const override |
| Query whether a cost can be paid from currently available funds. | |
| eve::Result< eve::resource::Reservation > | reserve (const eve::resource::CostSpec &cost) override |
| Reserve all items of a cost without changing visible balances. | |
| eve::Result< eve::resource::Receipt > | debit (const eve::resource::CostSpec &cost) override |
| Atomically debit all items immediately. | |
| eve::Result< eve::resource::Receipt > | credit (const eve::resource::CostSpec &cost) override |
| Atomically credit all items immediately. | |
| eve::Result< eve::resource::Receipt > | commit (const eve::resource::Reservation &reservation) override |
| Commit one active reservation as an atomic debit. | |
| eve::Result< void > | rollback (const eve::resource::Reservation &reservation) override |
| Release one active reservation without changing balances. | |
Public 成员函数 继承自 eve::resource::IResourceAccount | |
| virtual | ~IResourceAccount ()=default |
| Releases IResourceAccount resources. | |
详细描述
Adapts one Bag's item quantities to the common resource protocol.
Each ResourceId is the canonical ItemDefinition id. The bag's slot vector remains the only balance store; this adapter owns only reservation records and an opaque AccountNonce. It therefore works for both item prices and weapon ammunition without creating a second resource map. The Bag is borrowed and must outlive this adapter. Calls are synchronous on the Bag owner thread. Failed multi-item mutations restore slots, generated instance ids and queued inventory events before returning.
在文件 InventoryResourceAccount.h 第 30 行定义.
构造及析构函数说明
◆ InventoryResourceAccount() [1/3]
|
explicit |
Bind the adapter to one caller-owned inventory bag.
在文件 InventoryResourceAccount.cpp 第 81 行定义.
◆ InventoryResourceAccount() [2/3]
|
delete |
◆ InventoryResourceAccount() [3/3]
|
delete |
◆ ~InventoryResourceAccount()
|
overridedefault |
Inventory resource account.
成员函数说明
◆ canAfford()
|
overridevirtual |
Query whether a cost can be paid from currently available funds.
- 参数
-
cost Valid canonical cost borrowed for the call.
- 返回
- Structured affordability, or a failed Result for invalid input/provider failure.
Can afford.
实现了 eve::resource::IResourceAccount.
在文件 InventoryResourceAccount.cpp 第 114 行定义.
引用了 cost, eve::Result< T >::failure(), eve::resource::AccountNonce::isZero(), eve::resource::CostSpec::items(), eve::Result< T >::success() , 以及 valid.
◆ commit()
|
overridevirtual |
Commit one active reservation as an atomic debit.
- 参数
-
reservation Credential borrowed for the call.
- 返回
- A debit receipt, or Conflict/NotFound without partial mutation.
Commits commit.
实现了 eve::resource::IResourceAccount.
在文件 InventoryResourceAccount.cpp 第 293 行定义.
引用了 eve::Applied, eve::Conflict, covered, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::resource::AccountNonce::isZero(), eve::Status::success(), eve::Result< T >::success() , 以及 eve::detail::StrongUint64< Tag >::value().
◆ credit()
|
overridevirtual |
Atomically credit all items immediately.
- 参数
-
cost Valid canonical positive quantities borrowed for the call.
- 返回
- A credit receipt, or a failure with no state mutation.
Credit.
实现了 eve::resource::IResourceAccount.
在文件 InventoryResourceAccount.cpp 第 264 行定义.
引用了 eve::Applied, cost, eve::Result< T >::failure(), eve::resource::AccountNonce::isZero(), eve::Status::success(), eve::Result< T >::success() , 以及 eve::detail::StrongUint64< Tag >::value().
◆ debit()
|
overridevirtual |
Atomically debit all items immediately.
- 参数
-
cost Valid canonical cost borrowed for the call.
- 返回
- A debit receipt, or a failure with no state mutation.
Debit.
实现了 eve::resource::IResourceAccount.
在文件 InventoryResourceAccount.cpp 第 248 行定义.
引用了 eve::Applied, canAfford(), cost, eve::Result< T >::failure(), eve::resource::AccountNonce::isZero(), eve::Status::success(), eve::Result< T >::success() , 以及 eve::detail::StrongUint64< Tag >::value().
◆ operator=() [1/2]
|
delete |
◆ operator=() [2/2]
|
delete |
◆ reserve()
|
overridevirtual |
Reserve all items of a cost without changing visible balances.
- 参数
-
cost Valid canonical cost borrowed for the call.
- 返回
- A reservation credential, or a failure with no state mutation.
Reserve.
实现了 eve::resource::IResourceAccount.
在文件 InventoryResourceAccount.cpp 第 135 行定义.
引用了 eve::Applied, canAfford(), eve::Conflict, cost, eve::Diagnostic::error(), eve::Result< T >::failure(), id, eve::InvariantViolation, eve::resource::AccountNonce::isZero(), eve::Status::success(), eve::Result< T >::success(), eve::detail::StrongUint64< Tag >::value() , 以及 value.
◆ rollback()
|
overridevirtual |
Release one active reservation without changing balances.
- 参数
-
reservation Credential borrowed for the call.
- 返回
- Applied on the first rollback; duplicate/foreign credentials fail explicitly.
Rollback.
实现了 eve::resource::IResourceAccount.
在文件 InventoryResourceAccount.cpp 第 319 行定义.
引用了 eve::Applied, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::resource::AccountNonce::isZero(), eve::Status::success() , 以及 eve::Result< T >::success().
该类的文档由以下文件生成:
- src/modules/inventory/InventoryResourceAccount.h
- src/modules/inventory/InventoryResourceAccount.cpp
Public 成员函数 继承自