RTBKit  0.9
Open-source framework to create real-time ad bidding systems.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Static Public Member Functions | Public Attributes
RTBKIT::CurrencyPool Struct Reference

#include <currency.h>

List of all members.

Public Member Functions

void clear ()
bool empty () const
 CurrencyPool (const Amount &amount)
CurrencyPooloperator+= (const Amount &amount)
CurrencyPooloperator-= (const Amount &amount)
CurrencyPool operator+ (const Amount &amount) const
CurrencyPool operator- (const Amount &amount) const
CurrencyPooloperator+= (const CurrencyPool &other)
CurrencyPooloperator-= (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 &currency) 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

Detailed Description

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.


Member Function Documentation

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.

Return the maximum of 0 or the amount for each entry.

Definition at line 349 of file currency.h.


The documentation for this struct was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator