RTBKit  0.9
Open-source framework to create real-time ad bidding systems.
examples/augmentor_ex.h
00001 
00013 #pragma once
00014 
00015 #include "rtbkit/core/agent_configuration/agent_configuration_listener.h"
00016 #include "rtbkit/plugins/augmentor/augmentor_base.h"
00017 #include "soa/service/zmq_named_pub_sub.h"
00018 #include "soa/service/service_base.h"
00019 
00020 #include <string>
00021 #include <memory>
00022 
00023 namespace RTBKIT {
00024 
00025 struct FrequencyCapStorage;
00026 
00027 struct AgentConfigEntry;
00028 
00029 /******************************************************************************/
00030 /* FREQUENCY CAP AUGMENTOR                                                    */
00031 /******************************************************************************/
00032 
00044 struct FrequencyCapAugmentor :
00045     public RTBKIT::SyncAugmentor
00046 {
00047 
00048     FrequencyCapAugmentor(
00049             std::shared_ptr<Datacratic::ServiceProxies> services,
00050             const std::string& serviceName,
00051             const std::string& augmentorName = "frequency-cap-ex");
00052 
00053     void init();
00054 
00055 private:
00056 
00057     virtual RTBKIT::AugmentationList
00058     onRequest(const RTBKIT::AugmentationRequest& request);
00059 
00060     size_t getCap(
00061             const std::string& augmentor,
00062             const std::string& agent,
00063             const RTBKIT::AgentConfigEntry& config) const;
00064 
00065 
00066     std::shared_ptr<FrequencyCapStorage> storage;
00067 
00068     RTBKIT::AgentConfigurationListener agentConfig;
00069     Datacratic::ZmqNamedMultipleSubscriber palEvents;
00070 };
00071 
00072 
00073 } // namespace RTBKIT
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator