⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 working_set.h

📁 这是一个著名的应用层组播中间件的源码
💻 H
字号:
//Copyright (c) 2004, Charles Killian, Adolfo Rodriguez, Dejan Kostic, Sooraj Bhat, and Amin Vahdat//All rights reserved.////Redistribution and use in source and binary forms, with or without//modification, are permitted provided that the following conditions are met:////   * Redistributions of source code must retain the above copyright//     notice, this list of conditions and the following disclaimer.//   * Redistributions in binary form must reproduce the above copyright//     notice, this list of conditions and the following disclaimer in//     the documentation and/or other materials provided with the//     distribution.//   * Neither the names of Duke University nor The University of//     California, San Diego, nor the names of its contributors//     may be used to endorse or promote products derived from//     this software without specific prior written permission.////THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE//IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE//DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE//FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL//DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR//SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE//USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.#ifndef __working_set#define __working_set#include "bullet-summary_ticket.h"#include "digest.h"#include "bloom_filter.h"#include "bitmap_digest.h"#include <set>/*  #define USE_WS_STORE 1 */#if USE_WS_STORE#include "object_file_store.h"#endif#define USE_BLOOM 1using std::set;using std::less;struct equal_int{  bool operator()(int  i1, int i2) const  {    return i1 == i2;  }};class working_set{ public:/*    static const int UNIVERSE_SIZE= 2000000003; */  static const int UNIVERSE_SIZE= 50003;  static const int INSERT= 2050;  static const int ASKING_WINDOW = 1000;  static const int KEEP = 5000;  static const int max_stories=1000;  working_set	(int  digest_size = 0, int digest_ratio = 10);  ~working_set	( );  int  insert  (int key, int shallow = 0, unsigned char * data = 0,		int size = 0);  int  contains (int key);  int  reset ();    unsigned char*  export_sketch ( int & size);  unsigned char*  export_digest (int & size);  double  compute_resemblance (unsigned char* buffer);  double  compute_resemblance (bullet_summary_ticket& source_ticket);  bullet_summary_ticket& get_sketch () {return sketch;}  void  Testspeed ();  int get_different_keys     (list < int>& result,      int starter,     digest &  source_digest,      int high, int low, int maximum_count=99999);  int get_modulo_keys     (list < int>& result,      digest &  source_digest, int low, int high,     int mod, int mod_max, int maximum_count=99999);  unsigned char *get_message(int item, int &size);  void  dump_stats ();  int get_last();  int  get_earliest ();  int  get_first ();  void  get_false_positives (list < int>& result);  void  get_asking (int* asking, int count, list < int>& result);  int stats (int max, int ending);#if USE_WS_STOREvoid  set_store (int elements,int size, char* name);#endif protected:  map <int, message*, less<int> > contents;  bullet_summary_ticket sketch;#if USE_BLOOM   bloom_filter local_digest;#else  bitmap_digest local_digest;#endif  int duplicates;  int last_seq;  int earliest_seq;  int elements;  int  capacity;  int   buffer_count;  int story[max_stories];#if USE_WS_STORE  object_file_store* file_store;  int ssize;#endif  int keep;private:};#endif //__working_set

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -