本文整理汇总了C++中ledger::pointer::visitStateItems方法的典型用法代码示例。如果您正苦于以下问题:C++ pointer::visitStateItems方法的具体用法?C++ pointer::visitStateItems怎么用?C++ pointer::visitStateItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ledger::pointer
的用法示例。
在下文中一共展示了pointer::visitStateItems方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void OrderBookDB::update (Ledger::pointer ledger)
{
boost::unordered_set< uint256 > seen;
boost::unordered_map< currencyIssuer_t, std::vector<OrderBook::pointer> > destMap;
boost::unordered_map< currencyIssuer_t, std::vector<OrderBook::pointer> > sourceMap;
boost::unordered_set< currencyIssuer_t > XRPBooks;
WriteLog (lsDEBUG, OrderBookDB) << "OrderBookDB::update>";
// walk through the entire ledger looking for orderbook entries
int books = 0;
try
{
ledger->visitStateItems(BIND_TYPE(&updateHelper, P_1, boost::ref(seen), boost::ref(destMap),
boost::ref(sourceMap), boost::ref(XRPBooks), boost::ref(books)));
}
catch (const SHAMapMissingNode&)
{
WriteLog (lsINFO, OrderBookDB) << "OrderBookDB::update encountered a missing node";
ScopedLockType sl (mLock, __FILE__, __LINE__);
mSeq = 0;
return;
}
WriteLog (lsDEBUG, OrderBookDB) << "OrderBookDB::update< " << books << " books found";
{
ScopedLockType sl (mLock, __FILE__, __LINE__);
mXRPBooks.swap(XRPBooks);
mSourceMap.swap(sourceMap);
mDestMap.swap(destMap);
}
getApp().getLedgerMaster().newOrderBookDB();
}
示例2: update
void OrderBookDB::update (Ledger::pointer ledger)
{
hash_set< uint256 > seen;
OrderBookDB::IssueToOrderBook destMap;
OrderBookDB::IssueToOrderBook sourceMap;
hash_set< Issue > XDVBooks;
WriteLog (lsDEBUG, OrderBookDB) << "OrderBookDB::update>";
// walk through the entire ledger looking for orderbook entries
int books = 0;
try
{
ledger->visitStateItems(std::bind(&updateHelper, std::placeholders::_1,
std::ref(seen), std::ref(destMap),
std::ref(sourceMap), std::ref(XDVBooks), std::ref(books)));
}
catch (const SHAMapMissingNode&)
{
WriteLog (lsINFO, OrderBookDB)
<< "OrderBookDB::update encountered a missing node";
ScopedLockType sl (mLock);
mSeq = 0;
return;
}
WriteLog (lsDEBUG, OrderBookDB)
<< "OrderBookDB::update< " << books << " books found";
{
ScopedLockType sl (mLock);
mXDVBooks.swap(XDVBooks);
mSourceMap.swap(sourceMap);
mDestMap.swap(destMap);
}
getApp().getLedgerMaster().newOrderBookDB();
}