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 ( )
inline

Definition at line 68 of file hash_filter.h.

Member Function Documentation

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

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.

Parameters
hashthe hash to be queried
Returns
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
inlinevirtual

Returns the number of objects already inserted into the filter.

Returns
number of objects in the filter

Implements AbstractHashFilter.

Definition at line 80 of file hash_filter.h.

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

Adds the given hash to the filter

Parameters
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 ( )
inlinevirtual

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_
private

Definition at line 84 of file hash_filter.h.

Referenced by Fill(), and Freeze().

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

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: