载入中...
搜索中...
未找到
eve::economy::MarketRegistry类 参考

过程级市场配置注册表:注册 / JSON 加载 / 按 id 或地区/国家查询 / 报价。 更多...

#include <Market.h>

静态 Public 成员函数

static Result< void > registerMarket (const MarketConfig &config)
 注册或替换一个市场配置。
 
static Result< int > loadFromJson (std::string_view json)
 解析单个市场对象或市场数组并逐项注册。
 
static const MarketConfig * find (const std::string &id)
 按 id 查询;未注册返回 nullptr。 @ownership Borrowed from the process-wide registry; caller must not free it. @lifetime Valid until the next registerMarket / loadFromJson / clear. @nullable Yes when the id is unknown.
 
static const MarketConfig * findRegional (const std::string &regionId)
 查找绑定该 regionId 的第一个启用地区市场。 @ownership Borrowed from the registry. @lifetime Valid until the next mutating registry call. @nullable Yes when none matches.
 
static const MarketConfig * findNational (const std::string &nationId)
 查找绑定该 nationId 的第一个启用全国市场。 @ownership Borrowed from the registry. @lifetime Valid until the next mutating registry call. @nullable Yes when none matches.
 
static int count ()
 已注册市场数量。
 
static bool has (const std::string &id)
 id 是否已注册。
 
static const MarketConfig * marketAt (int index)
 按 id 字典序返回第 index 个市场。 @ownership Borrowed from the registry. @lifetime Valid until the next mutating registry call. @nullable Yes when index is out of range.
 
static void clear ()
 清空注册表(测试用)。
 
static Result< int > quoteBuyPrice (const std::string &marketId, const std::string &resourceType)
 买入报价:basePrice * (10000 + buyPremiumBps) / 10000,至少为 1。
 
static Result< int > quoteSellPrice (const std::string &marketId, const std::string &resourceType)
 卖出报价:basePrice * (10000 - sellDiscountBps) / 10000,至少为 0。
 

详细描述

过程级市场配置注册表:注册 / JSON 加载 / 按 id 或地区/国家查询 / 报价。

在文件 Market.h 第 49 行定义.

成员函数说明

◆ clear()

void eve::economy::MarketRegistry::clear ( )
static

清空注册表(测试用)。

在文件 Market.cpp 第 334 行定义.

被这些函数引用 eve::economy::Economy::clearMarkets().

◆ count()

int eve::economy::MarketRegistry::count ( )
static

已注册市场数量。

在文件 Market.cpp 第 320 行定义.

被这些函数引用 eve::economy::Economy::marketCount().

◆ find()

const MarketConfig * eve::economy::MarketRegistry::find ( const std::string &  id)
static

按 id 查询;未注册返回 nullptr。 @ownership Borrowed from the process-wide registry; caller must not free it. @lifetime Valid until the next registerMarket / loadFromJson / clear. @nullable Yes when the id is unknown.

在文件 Market.cpp 第 292 行定义.

引用了 end.

被这些函数引用 eve::economy::Economy::getMarketCurrencyType(), eve::economy::Economy::getMarketListingBasePrice(), eve::economy::Economy::getMarketListingCount(), eve::economy::Economy::getMarketListingResourceType(), eve::economy::Economy::getMarketNationId(), eve::economy::Economy::getMarketRegionId(), eve::economy::Economy::getMarketScope(), eve::economy::Economy::getMarketTariffBps(), has(), eve::economy::Economy::isMarketEnabled(), marketAt(), quoteBuyPrice() , 以及 quoteSellPrice().

◆ findNational()

const MarketConfig * eve::economy::MarketRegistry::findNational ( const std::string &  nationId)
static

查找绑定该 nationId 的第一个启用全国市场。 @ownership Borrowed from the registry. @lifetime Valid until the next mutating registry call. @nullable Yes when none matches.

在文件 Market.cpp 第 309 行定义.

引用了 best , 以及 eve::economy::National.

被这些函数引用 eve::economy::Economy::findNationalMarket().

◆ findRegional()

const MarketConfig * eve::economy::MarketRegistry::findRegional ( const std::string &  regionId)
static

查找绑定该 regionId 的第一个启用地区市场。 @ownership Borrowed from the registry. @lifetime Valid until the next mutating registry call. @nullable Yes when none matches.

在文件 Market.cpp 第 298 行定义.

引用了 best , 以及 eve::economy::Regional.

被这些函数引用 eve::economy::Economy::findRegionalMarket().

◆ has()

bool eve::economy::MarketRegistry::has ( const std::string &  id)
static

id 是否已注册。

在文件 Market.cpp 第 322 行定义.

引用了 find().

被这些函数引用 eve::economy::Economy::hasMarket().

◆ loadFromJson()

Result< int > eve::economy::MarketRegistry::loadFromJson ( std::string_view  json)
static

解析单个市场对象或市场数组并逐项注册。

参数
jsoneve.economy.market v1 对象,或同结构对象数组。
返回
成功时为新注册/替换的市场数量。 @cost Cheap JSON parse of authoring-size market tables; amortize at load.

在文件 Market.cpp 第 260 行定义.

引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Value::fromJson(), eve::Value::getIf(), eve::InvalidArgument, ok, registerMarket(), root , 以及 eve::Result< T >::success().

被这些函数引用 eve::economy::Economy::registerMarketsFromJson().

◆ marketAt()

const MarketConfig * eve::economy::MarketRegistry::marketAt ( int  index)
static

按 id 字典序返回第 index 个市场。 @ownership Borrowed from the registry. @lifetime Valid until the next mutating registry call. @nullable Yes when index is out of range.

在文件 Market.cpp 第 324 行定义.

引用了 find(), ids, index, left, right , 以及 size.

被这些函数引用 eve::economy::Economy::getMarketId().

◆ quoteBuyPrice()

Result< int > eve::economy::MarketRegistry::quoteBuyPrice ( const std::string &  marketId,
const std::string &  resourceType 
)
static

买入报价:basePrice * (10000 + buyPremiumBps) / 10000,至少为 1。

返回
市场或挂牌缺失时 NotFound。

在文件 Market.cpp 第 336 行定义.

引用了 eve::economy::MarketListing::basePrice, eve::economy::MarketListing::buyPremiumBps, eve::Diagnostic::error(), eve::Result< T >::failure(), find(), eve::NotFound , 以及 eve::Result< T >::success().

被这些函数引用 eve::economy::Economy::quoteBuyPrice().

◆ quoteSellPrice()

Result< int > eve::economy::MarketRegistry::quoteSellPrice ( const std::string &  marketId,
const std::string &  resourceType 
)
static

卖出报价:basePrice * (10000 - sellDiscountBps) / 10000,至少为 0。

返回
市场或挂牌缺失时 NotFound。

在文件 Market.cpp 第 353 行定义.

引用了 eve::economy::MarketListing::basePrice, eve::Diagnostic::error(), eve::Result< T >::failure(), find(), eve::NotFound, eve::economy::MarketListing::sellDiscountBps , 以及 eve::Result< T >::success().

被这些函数引用 eve::economy::Economy::quoteSellPrice().

◆ registerMarket()

Result< void > eve::economy::MarketRegistry::registerMarket ( const MarketConfig &  config)
static

注册或替换一个市场配置。

返回
校验失败时返回 InvalidArgument 诊断。 @cost Cheap: 校验并拷贝一份小型挂牌表;按市场重建摊销。

在文件 Market.cpp 第 253 行定义.

引用了 eve::economy::MarketConfig::id, eve::economy::normalizeMarketConfig(), ok , 以及 eve::Result< T >::success().

被这些函数引用 loadFromJson().


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