sdbf
3.3
|
00001 #ifndef __SDBF_SET_H 00002 #define __SDBF_SET_H 00003 00004 #include <ostream> 00005 #include <string> 00006 #include <vector> 00007 #include <boost/thread/thread.hpp> 00008 #include "sdbf_class.h" 00009 #include "bloom_filter.h" 00010 #include "util.h" 00011 00012 00013 /// sdbf_set class 00014 class sdbf_set { 00015 00016 friend std::ostream& operator<<(std::ostream& os, const sdbf_set& s); ///< output operator 00017 friend std::ostream& operator<<(std::ostream& os, const sdbf_set *s); ///< output operator 00018 00019 public: 00020 /// creates blank sdbf_set 00021 sdbf_set(); 00022 00023 /// creates blank sdbf_set with index 00024 sdbf_set(bloom_filter *index); 00025 00026 /// loads an sdbf_set from a file 00027 sdbf_set(const char *fname); 00028 00029 /// destructor 00030 ~sdbf_set(); 00031 00032 /// accessor method for individual hashes 00033 class sdbf* at(uint32_t pos); 00034 00035 /// adds a single hash to this set 00036 void add(class sdbf *hash); 00037 00038 /// adds the items in another set to this set 00039 void add(sdbf_set *hashset); 00040 00041 00042 /// Returns the number of sdbfs in this set 00043 uint64_t size( ) ; 00044 00045 /// Computes the data size of this set 00046 uint64_t input_size( ) ; 00047 00048 uint64_t filter_count(); 00049 00050 /// Compares all objects in a set to each other 00051 void compare_all(int32_t threshold); 00052 std::string compare_all_quiet(int32_t threshold, int32_t thread_count); 00053 00054 ///queries one set for the contents of another 00055 void compare_to(sdbf_set *other,int32_t threshold, uint32_t sample_size); 00056 std::string compare_to_quiet(sdbf_set *other,int32_t threshold, uint32_t sample_size, int32_t thread_count); 00057 00058 /// return a string which contains the output-encoded sdbfs in this set 00059 std::string to_string() const; 00060 00061 /// return a string which contains the results of this set's index seraching 00062 std::string index_results() const; 00063 00064 00065 /// is this empty? 00066 int empty(); 00067 00068 /// retrieve name of set 00069 std::string name() const; 00070 00071 /// name this set. 00072 void set_name(std::string name); 00073 00074 /// change output separator 00075 void set_separator(char sep); 00076 00077 /// setup bloom filter vector 00078 void vector_init(); 00079 00080 public: 00081 /// index for this set 00082 class bloom_filter *index; 00083 /// giant bloom filter vector for this set 00084 std::vector<class bloom_filter*> *bf_vector; 00085 00086 private: 00087 00088 std::vector<class sdbf*> items; 00089 std::string setname; 00090 boost::mutex add_hash_mutex; 00091 char sep; 00092 00093 }; 00094 00095 #endif