Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r53767 - in sandbox/bloom_filter/trunk/boost: . bloom_filter
From: mikhailberis_at_[hidden]
Date: 2009-06-09 03:03:28


Author: mikhailberis
Date: 2009-06-09 03:03:28 EDT (Tue, 09 Jun 2009)
New Revision: 53767
URL: http://svn.boost.org/trac/boost/changeset/53767

Log:
Moving bloom_filter.hpp implementation into bloom_filter subdirectory.
Added:
   sandbox/bloom_filter/trunk/boost/bloom_filter/
   sandbox/bloom_filter/trunk/boost/bloom_filter/bloom_filter.hpp (props changed)
      - copied unchanged from r53766, /sandbox/bloom_filter/trunk/boost/bloom_filter.hpp
Removed:
   sandbox/bloom_filter/trunk/boost/bloom_filter.hpp

Deleted: sandbox/bloom_filter/trunk/boost/bloom_filter.hpp
==============================================================================
--- sandbox/bloom_filter/trunk/boost/bloom_filter.hpp 2009-06-09 03:03:28 EDT (Tue, 09 Jun 2009)
+++ (empty file)
@@ -1,79 +0,0 @@
-#ifndef BLOOM_FILTER_20090608_0
-#define BLOOM_FILTER_20090608_0
-
-// Copyright 2009 (c) Dean Michael Berris <mikhailberis_at_[hidden]>
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#include <bitset>
-#include <boost/array.hpp>
-#include <boost/function.hpp>
-
-#include <boost/type_traits/add_const.hpp>
-#include <boost/type_traits/add_reference.hpp>
-
-namespace boost {
-
- template <class Input, size_t M, size_t K>
- struct bloom_filter {
- private:
- std::bitset<M> bit_set;
- array<function<size_t(Input)>, K> hash_array;
-
- typedef typename add_const<typename add_reference<Input>::type>::type const_ref;
-
- public:
- typedef std::bitset<M> bitset_type;
- static size_t const size = M;
- static size_t const functions = K;
-
- explicit bloom_filter(
- array<function<size_t(Input)>, K> const & hash_functions
- ) :
- hash_array(hash_functions) {}
-
- bloom_filter(bloom_filter const & other) :
- bit_set(other.bit_set), hash_array(other.hash_array) {}
-
- bloom_filter & operator=(bloom_filter rhs) {
- rhs.swap(*this);
- return *this;
- }
-
- bloom_filter & swap(bloom_filter & other) {
- using std::swap;
- swap(bit_set, other.bit_set);
- swap(hash_array, other.hash_array);
- return *this;
- }
-
- void insert(const_ref input) {
- for(size_t k = 0; k < K; ++k)
- bit_set[hash_array[k](input)] = 1;
- }
-
- bool contains(const_ref input) const {
- bool result = true;
- for(size_t k = 0; k < K && result; ++k)
- result = result && bit_set[hash_array[k](input)];
- return result;
- }
-
- bool operator[](const_ref input) const {
- return contains(input);
- }
-
- bloom_filter & clear() {
- bit_set.reset();
- return *this;
- }
-
- bitset_type const & state() const {
- return bit_set;
- }
- };
-}
-
-#endif
-


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk