RTBKit
0.9
Open-source framework to create real-time ad bidding systems.
|
#include <segments.h>
Public Member Functions | |
SegmentList (const std::vector< std::string > &segs) | |
SegmentList (const std::vector< int > &segs) | |
SegmentList (const std::vector< std::pair< int, float > > &segs) | |
bool | contains (int i) const |
bool | contains (const std::string &str) const |
bool | match (const SegmentList &other) const |
bool | match (const std::vector< int > &other) const |
bool | match (const std::vector< std::string > &other) const |
size_t | size () const |
bool | empty () const |
Json::Value | toJson () const |
std::string | toJsonStr () const |
std::string | toString () const |
void | add (int i, float weight=1.0) |
void | add (const std::string &str, float weight=1.0) |
void | sort () |
bool | intsOnly () const |
void | forEach (const std::function< void(int, std::string, float)> &onSegment) const |
void | serialize (ML::DB::Store_Writer &store) const |
void | reconstitute (ML::DB::Store_Reader &store) |
std::string | serializeToString () const |
Static Public Member Functions | |
static SegmentList | createFromJson (const Json::Value &json) |
static int | parseSegmentNum (const std::string &str) |
static SegmentList | reconstituteFromString (const std::string &str) |
Public Attributes | |
ML::compact_vector< int, 7 > | ints |
Categories. | |
std::vector< std::string > | strings |
Those that aren't an integer. | |
ML::compact_vector< float, 5 > | weights |
Weights over ints and strings. |
A set of integral "segments". Immutable once created.
Definition at line 33 of file segments.h.
void RTBKIT::SegmentList::forEach | ( | const std::function< void(int, std::string, float)> & | onSegment | ) | const |
Iterate over all segments and call the given callback.
Definition at line 367 of file segments.cc.
bool RTBKIT::SegmentList::intsOnly | ( | ) | const [inline] |
Return true if there are only integers in the list.
Definition at line 69 of file segments.h.