mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
first draft
This commit is contained in:
@@ -1,11 +1,24 @@
|
||||
#include "Ledger.h"
|
||||
#include "OrderBook.h"
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
|
||||
/*
|
||||
we can eventually make this cached and just update it as transactions come in.
|
||||
But for now it is probably faster to just generate it each time
|
||||
*/
|
||||
|
||||
class BookListeners
|
||||
{
|
||||
boost::unordered_set<InfoSub*> mListeners;
|
||||
public:
|
||||
typedef boost::shared_ptr<BookListeners> pointer;
|
||||
|
||||
void addSubscriber(InfoSub* sub);
|
||||
void removeSubscriber(InfoSub* sub);
|
||||
void publish(Json::Value& jvObj);
|
||||
};
|
||||
|
||||
class OrderBookDB
|
||||
{
|
||||
std::vector<OrderBook::pointer> mEmptyVector;
|
||||
@@ -13,6 +26,9 @@ class OrderBookDB
|
||||
std::map<uint160, std::vector<OrderBook::pointer> > mIssuerMap;
|
||||
//std::vector<OrderBook::pointer> mAllOrderBooks;
|
||||
|
||||
// issuerIn, issuerOut, currencyIn, currencyOut
|
||||
std::map<uint160, std::map<uint160, std::map<uint160, std::map<uint160, BookListeners::pointer> > > > mListeners;
|
||||
|
||||
std::map<uint256, bool > mKnownMap;
|
||||
|
||||
public:
|
||||
@@ -30,10 +46,11 @@ public:
|
||||
float getPrice(uint160& currencyIn,uint160& currencyOut);
|
||||
|
||||
|
||||
OrderBook::pointer getBook(uint160 mCurrencyIn, uint160 mCurrencyOut, uint160 mIssuerIn, uint160 mIssuerOut);
|
||||
BookListeners::pointer getBookListeners(uint160 currencyIn, uint160 currencyOut, uint160 issuerIn, uint160 issuerOut);
|
||||
BookListeners::pointer makeBookListeners(uint160 currencyIn, uint160 currencyOut, uint160 issuerIn, uint160 issuerOut);
|
||||
|
||||
// see if this txn effects any orderbook
|
||||
void processTxn(const SerializedTransaction& stTxn, TER terResult,TransactionMetaSet::pointer& meta,Json::Value& jvObj);
|
||||
|
||||
};
|
||||
|
||||
// vim:ts=4
|
||||
|
||||
Reference in New Issue
Block a user