RTBKit  0.9
Open-source framework to create real-time ad bidding systems.
common/tags.h
00001 /* tags.h                                                          -*- C++ -*-
00002    Jeremy Barnes, 26 February 2013
00003    
00004    Copyright (c) 2013 Datacratic Inc.  All rights reserved.
00005 
00006    Definitions of the "tags" class used for creative and campaign filtering.
00007    
00008    This file is part of RTBkit.
00009 */
00010 
00011 #pragma once
00012 
00013 
00014 namespace RTBKIT {
00015 
00016 
00017 /*****************************************************************************/
00018 /* TAG                                                                       */
00019 /*****************************************************************************/
00020 
00023 struct Tag {
00024     std::string scope;
00025     std::string key;
00026     std::string value;
00027 };
00028 
00029 
00030 /*****************************************************************************/
00031 /* TAGS                                                                      */
00032 /*****************************************************************************/
00033 
00034 struct Tags {
00035 
00036     
00037 
00039     std::vector<uint64_t> active;
00040 };
00041 
00042 #if 0
00043 struct TagsContext {
00044     BidRequest * breq;
00045 };
00046 
00047 struct Predicate {
00048     virtual ~Predicate()
00049     {
00050     }
00051 
00052     bool evaluate(const Tags & tags, TagsContext & context) const = 0;
00053 };
00054 
00055 struct OrPredicate: public Predicate {
00056     
00057     std::vector<std::unique_ptr<Predicate> > subexpr;
00058 };
00059 
00060 struct AndPredicate: public Predicate {
00061 
00062 
00063     std::vector<std::unique_ptr<Predicate> > subexpr;
00064 };
00065 #endif
00066 
00067 /*****************************************************************************/
00068 /* TAG FILTER                                                                */
00069 /*****************************************************************************/
00070 
00076 struct TagFilter {
00077     Tags mustIncludeOneOf;
00078     Tags mustIncludeAllOf;
00079     Tags mustNotIncludeAnyOf;
00080 
00082     bool matches(const Tags & tagsToMatch) const;
00083 };
00084 
00085 
00086 /*****************************************************************************/
00087 /* TAG FILTER EXPRESSION                                                     */
00088 /*****************************************************************************/
00089 
00092 struct TagFilterExpression : public std::vector<TagFilter> {
00093     
00094 };
00095 
00096 } // namespace RTBKIT
00097 
00098 
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator