📄 bullet-summary_ticket.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 __bullet_summary_ticket#define __bullet_summary_ticket#include <map>using std::map;using std::less;#define NUM_SUM_TIX_FUNCS 10#define NUM_HANDLES 12typedef struct perm_func { int multiplier; int additive;} cand_permutation_function;typedef struct sum_tic { public: int address; int low; int high; int table[NUM_SUM_TIX_FUNCS]; int handles[NUM_HANDLES]; unsigned char downloaders; unsigned char handle_percentage[NUM_HANDLES];} cand_bullet_summary_ticket;bool operator == ( const cand_bullet_summary_ticket& ticket1, const cand_bullet_summary_ticket& ticket2);typedef struct message { message() : data(NULL), size (0) {}; unsigned char * data; int size; } _message;class bullet_summary_ticket{ public: const static int MAXIMUM_SIZE = 100; const static int DEFAULT_SIZE = 10; bullet_summary_ticket (int universe_size); ~bullet_summary_ticket ( ); int empty(); void insert (int key); void reset (); void remove (int key, map <int, message*, less<int> > & contents); void serialize ( unsigned char* buffer); int import ( unsigned char* buffer); double operator % ( const bullet_summary_ticket& ticket); int size_compacted_in_bytes (); void dump_state (); int get_address() {return st.address;} double range_overlap ( const bullet_summary_ticket& ticket);public: struct sum_tic st;protected: int universe_size; static int permutation_multipliers[NUM_SUM_TIX_FUNCS]; static int permutation_additives[NUM_SUM_TIX_FUNCS]; int origin [NUM_SUM_TIX_FUNCS];private:};#endif //__bullet_summary_ticket
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -