IBR-DTNSuite
0.8
|
#include <BloomFilter.h>
Public Member Functions | |
BloomFilter (std::size_t table_size=8196, 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 |
float | 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 59 of file BloomFilter.h.
ibrcommon::BloomFilter::BloomFilter | ( | std::size_t | table_size = 8196 , |
std::size_t | salt_count = 2 |
||
) |
Definition at line 119 of file BloomFilter.cpp.
References bit_table_, bits_per_char, and table_size_.
ibrcommon::BloomFilter::BloomFilter | ( | const BloomFilter & | filter | ) |
Definition at line 126 of file BloomFilter.cpp.
References bit_table_, bits_per_char, and table_size_.
ibrcommon::BloomFilter::~BloomFilter | ( | ) | [virtual] |
Definition at line 133 of file BloomFilter.cpp.
References bit_table_.
void ibrcommon::BloomFilter::clear | ( | ) |
Definition at line 153 of file BloomFilter.cpp.
References _itemcount, bit_table_, bits_per_char, and table_size_.
Referenced by dtn::routing::SummaryVector::clear(), and dtn::routing::SummaryVector::commit().
void ibrcommon::BloomFilter::compute_indices | ( | const bloom_type & | hash, |
std::size_t & | bit_index, | ||
std::size_t & | bit | ||
) | const [protected, virtual] |
Definition at line 286 of file BloomFilter.cpp.
References bits_per_char, and table_size_.
Referenced by contains(), and insert().
bool ibrcommon::BloomFilter::contains | ( | const unsigned char * | key_begin, |
const std::size_t | length | ||
) | const [virtual] |
Definition at line 185 of file BloomFilter.cpp.
References _hashp, bit_mask, bit_table_, bits_per_char, compute_indices(), and ibrcommon::DefaultHashProvider::hash().
Referenced by dtn::routing::SummaryVector::contains(), contains(), contains_all(), contains_none(), dtn::routing::SummaryVector::getNotIn(), dtn::storage::MemoryBundleStorage::remove(), and dtn::storage::SimpleBundleStorage::remove().
bool ibrcommon::BloomFilter::contains | ( | const T & | t | ) | const [inline] |
Definition at line 102 of file BloomFilter.h.
References contains().
bool ibrcommon::BloomFilter::contains | ( | const std::string & | key | ) | const |
Definition at line 204 of file BloomFilter.cpp.
References contains().
bool ibrcommon::BloomFilter::contains | ( | const char * | data, |
const std::size_t & | length | ||
) | const |
Definition at line 209 of file BloomFilter.cpp.
References contains().
InputIterator ibrcommon::BloomFilter::contains_all | ( | const InputIterator | begin, |
const InputIterator | end | ||
) | const [inline] |
Definition at line 112 of file BloomFilter.h.
References contains().
InputIterator ibrcommon::BloomFilter::contains_none | ( | const InputIterator | begin, |
const InputIterator | end | ||
) | const [inline] |
Definition at line 127 of file BloomFilter.h.
References contains().
float ibrcommon::BloomFilter::getAllocation | ( | ) | const |
Definition at line 292 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 159 of file BloomFilter.cpp.
References _hashp, _itemcount, bit_mask, bit_table_, bits_per_char, compute_indices(), and ibrcommon::DefaultHashProvider::hash().
Referenced by dtn::routing::SummaryVector::add(), dtn::routing::SummaryVector::commit(), and insert().
void ibrcommon::BloomFilter::insert | ( | const T & | t | ) | [inline] |
Definition at line 80 of file BloomFilter.h.
References insert().
void ibrcommon::BloomFilter::insert | ( | const std::string & | key | ) |
Definition at line 175 of file BloomFilter.cpp.
References insert().
void ibrcommon::BloomFilter::insert | ( | const char * | data, |
const std::size_t & | length | ||
) |
Definition at line 180 of file BloomFilter.cpp.
References insert().
void ibrcommon::BloomFilter::insert | ( | const InputIterator | begin, |
const InputIterator | end | ||
) | [inline] |
Definition at line 90 of file BloomFilter.h.
References insert().
void ibrcommon::BloomFilter::load | ( | const cell_type * | data, |
size_t | len | ||
) |
Definition at line 267 of file BloomFilter.cpp.
References _itemcount, bit_table_, and table_size_.
Referenced by dtn::routing::operator>>().
bool ibrcommon::BloomFilter::operator! | ( | ) | const |
Definition at line 148 of file BloomFilter.cpp.
References table_size_.
BloomFilter & ibrcommon::BloomFilter::operator&= | ( | const BloomFilter & | filter | ) |
Definition at line 219 of file BloomFilter.cpp.
References _hashp, bit_table_, bits_per_char, and table_size_.
BloomFilter & ibrcommon::BloomFilter::operator= | ( | const BloomFilter & | filter | ) |
Definition at line 138 of file BloomFilter.cpp.
References _hashp, bit_table_, bits_per_char, and table_size_.
BloomFilter & ibrcommon::BloomFilter::operator^= | ( | const BloomFilter & | filter | ) |
Definition at line 251 of file BloomFilter.cpp.
References _hashp, bit_table_, bits_per_char, and table_size_.
BloomFilter & ibrcommon::BloomFilter::operator|= | ( | const BloomFilter & | filter | ) |
Definition at line 235 of file BloomFilter.cpp.
References _hashp, bit_table_, bits_per_char, and table_size_.
std::size_t ibrcommon::BloomFilter::size | ( | ) | const [virtual] |
Definition at line 214 of file BloomFilter.cpp.
References bits_per_char, and table_size_.
Referenced by dtn::routing::SummaryVector::getLength(), and dtn::routing::operator<<().
const cell_type * ibrcommon::BloomFilter::table | ( | ) | const |
Definition at line 281 of file BloomFilter.cpp.
References bit_table_.
Referenced by dtn::routing::operator<<().
DefaultHashProvider ibrcommon::BloomFilter::_hashp [protected] |
Definition at line 153 of file BloomFilter.h.
Referenced by contains(), insert(), operator&=(), operator=(), operator^=(), and operator|=().
unsigned int ibrcommon::BloomFilter::_itemcount [protected] |
Definition at line 158 of file BloomFilter.h.
Referenced by clear(), getAllocation(), insert(), and load().
const unsigned char ibrcommon::BloomFilter::bit_mask [static, protected] |
{ 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }
Definition at line 63 of file BloomFilter.h.
Referenced by contains(), and insert().
unsigned char* ibrcommon::BloomFilter::bit_table_ [protected] |
Definition at line 155 of file BloomFilter.h.
Referenced by BloomFilter(), clear(), contains(), insert(), load(), operator&=(), operator=(), operator^=(), operator|=(), table(), and ~BloomFilter().
const std::size_t ibrcommon::BloomFilter::bits_per_char = 0x08 [static, protected] |
Definition at line 62 of file BloomFilter.h.
Referenced by BloomFilter(), clear(), compute_indices(), contains(), insert(), operator&=(), operator=(), operator^=(), operator|=(), and size().
std::size_t ibrcommon::BloomFilter::salt_count_ [protected] |
Definition at line 159 of file BloomFilter.h.
Referenced by getAllocation().
std::size_t ibrcommon::BloomFilter::table_size_ [protected] |
Definition at line 156 of file BloomFilter.h.
Referenced by BloomFilter(), clear(), compute_indices(), getAllocation(), load(), operator!(), operator&=(), operator=(), operator^=(), operator|=(), and size().