IBR-DTNSuite
0.12
|
#include <BloomFilter.h>
Public Member Functions | |
BloomFilter (std::size_t table_size=8192, std::size_t salt_count=2) | |
BloomFilter (const BloomFilter &filter) | |
virtual | ~BloomFilter () |
void | load (const cell_type *data, size_t len) |
BloomFilter & | operator= (const BloomFilter &filter) |
bool | operator! () const |
void | clear () |
void | insert (const unsigned char *key_begin, const std::size_t length) |
template<typename T > | |
void | insert (const T &t) |
void | insert (const std::string &key) |
void | insert (const char *data, const std::size_t &length) |
template<typename InputIterator > | |
void | insert (const InputIterator begin, const InputIterator end) |
virtual bool | contains (const unsigned char *key_begin, const std::size_t length) const |
template<typename T > | |
bool | contains (const T &t) const |
bool | contains (const std::string &key) const |
bool | contains (const char *data, const std::size_t &length) const |
template<typename InputIterator > | |
InputIterator | contains_all (const InputIterator begin, const InputIterator end) const |
template<typename InputIterator > | |
InputIterator | contains_none (const InputIterator begin, const InputIterator end) const |
virtual std::size_t | size () const |
BloomFilter & | operator&= (const BloomFilter &filter) |
BloomFilter & | operator|= (const BloomFilter &filter) |
BloomFilter & | operator^= (const BloomFilter &filter) |
const cell_type * | table () const |
double | getAllocation () const |
Protected Member Functions | |
virtual void | compute_indices (const bloom_type &hash, std::size_t &bit_index, std::size_t &bit) const |
Protected Attributes | |
DefaultHashProvider | _hashp |
unsigned char * | bit_table_ |
std::size_t | table_size_ |
unsigned int | _itemcount |
std::size_t | salt_count_ |
Static Protected Attributes | |
static const std::size_t | bits_per_char = 0x08 |
static const unsigned char | bit_mask [bits_per_char] |
Definition at line 77 of file BloomFilter.h.
ibrcommon::BloomFilter::BloomFilter | ( | std::size_t | table_size = 8192 , |
std::size_t | salt_count = 2 |
||
) |
Definition at line 139 of file BloomFilter.cpp.
References bit_table_, bits_per_char, and table_size_.
ibrcommon::BloomFilter::BloomFilter | ( | const BloomFilter & | filter) |
Definition at line 151 of file BloomFilter.cpp.
References bit_table_, bits_per_char, and table_size_.
|
virtual |
Definition at line 158 of file BloomFilter.cpp.
References bit_table_.
void ibrcommon::BloomFilter::clear | ( | ) |
Definition at line 178 of file BloomFilter.cpp.
References _itemcount, bit_table_, bits_per_char, and table_size_.
Referenced by dtn::data::MemoryBundleSet::clear(), and dtn::storage::SQLiteBundleSet::clear().
|
protectedvirtual |
Definition at line 311 of file BloomFilter.cpp.
References bits_per_char, and table_size_.
Referenced by contains(), and insert().
|
virtual |
Definition at line 210 of file BloomFilter.cpp.
References _hashp, bit_mask, bit_table_, bits_per_char, compute_indices(), and ibrcommon::DefaultHashProvider::hash().
Referenced by contains(), contains_all(), contains_none(), and dtn::data::BundleID::isIn().
|
inline |
Definition at line 120 of file BloomFilter.h.
References contains().
bool ibrcommon::BloomFilter::contains | ( | const std::string & | key) | const |
Definition at line 229 of file BloomFilter.cpp.
References contains().
bool ibrcommon::BloomFilter::contains | ( | const char * | data, |
const std::size_t & | length | ||
) | const |
Definition at line 234 of file BloomFilter.cpp.
References contains().
|
inline |
Definition at line 130 of file BloomFilter.h.
References contains().
|
inline |
Definition at line 145 of file BloomFilter.h.
References contains().
double ibrcommon::BloomFilter::getAllocation | ( | ) | const |
Definition at line 317 of file BloomFilter.cpp.
References _itemcount, salt_count_, and table_size_.
void ibrcommon::BloomFilter::insert | ( | const unsigned char * | key_begin, |
const std::size_t | length | ||
) |
Definition at line 184 of file BloomFilter.cpp.
References _hashp, _itemcount, bit_mask, bit_table_, bits_per_char, compute_indices(), and ibrcommon::DefaultHashProvider::hash().
Referenced by dtn::data::BundleID::addTo(), and insert().
|
inline |
Definition at line 98 of file BloomFilter.h.
References insert().
void ibrcommon::BloomFilter::insert | ( | const std::string & | key) |
Definition at line 200 of file BloomFilter.cpp.
References insert().
void ibrcommon::BloomFilter::insert | ( | const char * | data, |
const std::size_t & | length | ||
) |
Definition at line 205 of file BloomFilter.cpp.
References insert().
|
inline |
Definition at line 108 of file BloomFilter.h.
References insert().
void ibrcommon::BloomFilter::load | ( | const cell_type * | data, |
size_t | len | ||
) |
Definition at line 292 of file BloomFilter.cpp.
References _itemcount, bit_table_, and table_size_.
Referenced by dtn::storage::SQLiteBundleSet::deserialize(), and dtn::data::MemoryBundleSet::deserialize().
bool ibrcommon::BloomFilter::operator! | ( | ) | const |
Definition at line 173 of file BloomFilter.cpp.
References table_size_.
BloomFilter & ibrcommon::BloomFilter::operator&= | ( | const BloomFilter & | filter) |
Definition at line 244 of file BloomFilter.cpp.
References _hashp, bit_table_, bits_per_char, and table_size_.
BloomFilter & ibrcommon::BloomFilter::operator= | ( | const BloomFilter & | filter) |
Definition at line 163 of file BloomFilter.cpp.
References _hashp, bit_table_, bits_per_char, and table_size_.
BloomFilter & ibrcommon::BloomFilter::operator^= | ( | const BloomFilter & | filter) |
Definition at line 276 of file BloomFilter.cpp.
References _hashp, bit_table_, bits_per_char, and table_size_.
BloomFilter & ibrcommon::BloomFilter::operator|= | ( | const BloomFilter & | filter) |
Definition at line 260 of file BloomFilter.cpp.
References _hashp, bit_table_, bits_per_char, and table_size_.
|
virtual |
Definition at line 239 of file BloomFilter.cpp.
References bits_per_char, and table_size_.
Referenced by dtn::data::MemoryBundleSet::getLength(), dtn::storage::SQLiteBundleSet::getLength(), dtn::storage::SQLiteBundleSet::serialize(), and dtn::data::MemoryBundleSet::serialize().
const cell_type * ibrcommon::BloomFilter::table | ( | ) | const |
Definition at line 306 of file BloomFilter.cpp.
References bit_table_.
Referenced by dtn::storage::SQLiteBundleSet::serialize(), and dtn::data::MemoryBundleSet::serialize().
|
protected |
Definition at line 171 of file BloomFilter.h.
Referenced by contains(), insert(), operator&=(), operator=(), operator^=(), and operator|=().
|
protected |
Definition at line 176 of file BloomFilter.h.
Referenced by clear(), getAllocation(), insert(), and load().
|
staticprotected |
Definition at line 81 of file BloomFilter.h.
Referenced by contains(), and insert().
|
protected |
Definition at line 173 of file BloomFilter.h.
Referenced by BloomFilter(), clear(), contains(), insert(), load(), operator&=(), operator=(), operator^=(), operator|=(), table(), and ~BloomFilter().
|
staticprotected |
Definition at line 80 of file BloomFilter.h.
Referenced by BloomFilter(), clear(), compute_indices(), contains(), insert(), operator&=(), operator=(), operator^=(), operator|=(), and size().
|
protected |
Definition at line 177 of file BloomFilter.h.
Referenced by getAllocation().
|
protected |
Definition at line 174 of file BloomFilter.h.
Referenced by BloomFilter(), clear(), compute_indices(), getAllocation(), load(), operator!(), operator&=(), operator=(), operator^=(), operator|=(), and size().