CernVM-FS  2.12.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SimpleHashFilter Class Reference

#include <hash_filter.h>

Inheritance diagram for SimpleHashFilter:
Collaboration diagram for SimpleHashFilter:

Public Member Functions

 SimpleHashFilter ()
void Fill (const shash::Any &hash)
bool Contains (const shash::Any &hash) const
void Freeze ()
size_t Count () const
- Public Member Functions inherited from AbstractHashFilter
virtual ~AbstractHashFilter ()

Private Attributes

std::set< shash::Anyhashes_
bool frozen_

Detailed Description

This is a simplistic implementation of AbstractHashFilter mainly used for testing purposes. It uses an std::set and thus is highly suboptimal.

Definition at line 66 of file hash_filter.h.

Constructor & Destructor Documentation

SimpleHashFilter::SimpleHashFilter ( )

Definition at line 68 of file hash_filter.h.

Member Function Documentation

bool SimpleHashFilter::Contains ( const shash::Any hash) const

Decides if a presented hash is in the filter or not Depending on the concrete implementation of this method it could be a prob- abilistic answer. However, implementations should ensure a recall rate of 100%, say: never produce false negatives.

hashthe hash to be queried
true if the hash is (probably) contained in the set false if it is definitely not in the set

Implements AbstractHashFilter.

Definition at line 75 of file hash_filter.h.

size_t SimpleHashFilter::Count ( ) const

Returns the number of objects already inserted into the filter.

number of objects in the filter

Implements AbstractHashFilter.

Definition at line 80 of file hash_filter.h.

void SimpleHashFilter::Fill ( const shash::Any hash)

Adds the given hash to the filter

hashthe hash to be added to the HashFilter

Implements AbstractHashFilter.

Definition at line 70 of file hash_filter.h.

Here is the call graph for this function:

void SimpleHashFilter::Freeze ( )

Freezes the filter after filling it with all values. This is not necessary but could be used for certain optimizations depending on the implementation of the AbstractHashFilter. Note: After Freeze() has been called, Fill() should fail!

Reimplemented from AbstractHashFilter.

Definition at line 79 of file hash_filter.h.

Member Data Documentation

bool SimpleHashFilter::frozen_

Definition at line 84 of file hash_filter.h.

Referenced by Fill(), and Freeze().

std::set<shash::Any> SimpleHashFilter::hashes_

Definition at line 83 of file hash_filter.h.

Referenced by Contains(), Count(), and Fill().

The documentation for this class was generated from the following file: