eXpress “1.5”
|
00001 00009 #ifndef express_robertsfilter_h 00010 #define express_robertsfilter_h 00011 00012 #include <boost/unordered_set.hpp> 00013 #include <queue> 00014 #include <vector> 00015 00016 static size_t DEFAULT_LOC_SIZE = 10000; 00017 static size_t DEFAULT_GLOB_SIZE = 100000; 00018 00030 class RobertsFilter { 00035 std::queue<std::string> _local_queue; 00040 boost::unordered_set<std::string> _local_set; 00045 std::vector<std::string> _global_vector; 00050 boost::unordered_set<std::string> _global_set; 00055 size_t _local_size; 00060 size_t _global_size; 00061 00062 public: 00068 RobertsFilter(size_t local_size=DEFAULT_LOC_SIZE, 00069 size_t global_size=DEFAULT_GLOB_SIZE); 00077 bool test_and_push(const std::string& key); 00078 }; 00079 00080 #endif