![]() |
RTBKit
0.9
Open-source framework to create real-time ad bidding systems.
|
#include <currency.h>
Public Member Functions | |
void | clear () |
bool | empty () const |
CurrencyPool (const Amount &amount) | |
CurrencyPool & | operator+= (const Amount &amount) |
CurrencyPool & | operator-= (const Amount &amount) |
CurrencyPool | operator+ (const Amount &amount) const |
CurrencyPool | operator- (const Amount &amount) const |
CurrencyPool & | operator+= (const CurrencyPool &other) |
CurrencyPool & | operator-= (const CurrencyPool &other) |
CurrencyPool | operator+ (const CurrencyPool &spend) const |
CurrencyPool | operator- (const CurrencyPool &spend) const |
CurrencyPool | limit (const CurrencyPool &other) const |
CurrencyPool | nonNegative () const |
bool | operator== (const Amount &other) const |
bool | operator!= (const Amount &other) const |
bool | operator== (const CurrencyPool &other) const |
bool | operator!= (const CurrencyPool &other) const |
bool | hasAvailable (const Amount &amount) const |
Amount | getAvailable (const CurrencyCode ¤cy) const |
bool | isNonNegative () const |
bool | isZero () const |
void | serialize (ML::DB::Store_Writer &store) const |
void | reconstitute (ML::DB::Store_Reader &store) |
Json::Value | toJson () const |
Amounts per currency. | |
std::string | toString () const |
bool | isSameOrPastVersion (const CurrencyPool &otherPool) const |
Static Public Member Functions | |
static CurrencyPool | fromJson (const Json::Value &json) |
Public Attributes | |
ML::compact_vector< Amount, 1 > | currencyAmounts |
This aggregates amounts over multiple currencies. The values are kept separately so that they can be combined according to application specific logic.
Definition at line 243 of file currency.h.
Amount RTBKIT::CurrencyPool::getAvailable | ( | const CurrencyCode & | currency | ) | const |
Return the amount available in the given currency code.
Definition at line 289 of file currency.cc.
bool RTBKIT::CurrencyPool::hasAvailable | ( | const Amount & | amount | ) | const |
Return if there is enough available to cover the given request.
Definition at line 302 of file currency.cc.
CurrencyPool RTBKIT::CurrencyPool::limit | ( | const CurrencyPool & | other | ) | const [inline] |
Limits the other amount so that none of its entries are higher than the current pool.
Definition at line 335 of file currency.h.
CurrencyPool RTBKIT::CurrencyPool::nonNegative | ( | ) | const [inline] |
Return the maximum of 0 or the amount for each entry.
Definition at line 349 of file currency.h.