$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r72609 - in sandbox/bloom_filter/trunk/libs/bloom_filter: doc/html example
From: cpp.cabrera_at_[hidden]
Date: 2011-06-15 20:57:22
Author: alejandro
Date: 2011-06-15 20:57:21 EDT (Wed, 15 Jun 2011)
New Revision: 72609
URL: http://svn.boost.org/trac/boost/changeset/72609
Log:
Updated acknowledgements and history. Testing needs a lot of work. Added an example.
Added:
   sandbox/bloom_filter/trunk/libs/bloom_filter/example/custom_hash.cpp   (contents, props changed)
Removed:
   sandbox/bloom_filter/trunk/libs/bloom_filter/doc/html/testing.html
Text files modified: 
   sandbox/bloom_filter/trunk/libs/bloom_filter/doc/html/acknowledgements.html |     8 ++++++--                                
   sandbox/bloom_filter/trunk/libs/bloom_filter/doc/html/history.html          |    16 ++++++++++++++--                        
   2 files changed, 20 insertions(+), 4 deletions(-)
Modified: sandbox/bloom_filter/trunk/libs/bloom_filter/doc/html/acknowledgements.html
==============================================================================
--- sandbox/bloom_filter/trunk/libs/bloom_filter/doc/html/acknowledgements.html	(original)
+++ sandbox/bloom_filter/trunk/libs/bloom_filter/doc/html/acknowledgements.html	2011-06-15 20:57:21 EDT (Wed, 15 Jun 2011)
@@ -32,7 +32,11 @@
       </a>
     </div>
 
-    <h1 class="title">To be completed...</h1>
+    <h1 class="title">Acknowledgements</h1>
+    <ul>
+      <li>Vicente J. Botet Escribá - for providing me with guidance throughout the project, including guidance on Boost standards compliance, Boost process, and on interface design.</li>
+      <li>Google - for hosting the Google Summer of Code program and making it possible for me to participate in an open-source project.</li>
+    </ul>
 
     <hr/>
     <div class="spirit-nav">
@@ -46,7 +50,7 @@
 
     <footer>
       <p>
-	Last revised: <time datetime="2011-06-14">June 14, 2011</time>.
+	Last revised: <time datetime="2011-06-15">June 15, 2011</time>.
       </p>
 
       <p class="copyright">
Modified: sandbox/bloom_filter/trunk/libs/bloom_filter/doc/html/history.html
==============================================================================
--- sandbox/bloom_filter/trunk/libs/bloom_filter/doc/html/history.html	(original)
+++ sandbox/bloom_filter/trunk/libs/bloom_filter/doc/html/history.html	2011-06-15 20:57:21 EDT (Wed, 15 Jun 2011)
@@ -35,7 +35,19 @@
       </a>
     </div>
 
-    <h1 class="title">To be completed...</h1>
+    <h1 class="title">Version history</h1>
+    <h2>v1.0</h2>
+    <ul>
+      <li>Initial release.</li>
+      <li>Features:
+      <ul>
+	<li>Basic Bloom filter class</li>
+	<li>One hasher object implemented based on Boost.Functional hash</li>
+	<li>Various examples: basic, advanced, url, string, custom_hasher</li>
+	<li>A test-suite that covers all basic functionality.</li>
+      </ul>
+      </li>
+    </ul>
 
     <hr/>
     <div class="spirit-nav">
@@ -52,7 +64,7 @@
 
     <footer>
       <p>
-	Last revised: <time datetime="2011-06-06">June 6, 2011</time>.
+	Last revised: <time datetime="2011-06-15">June 15, 2011</time>.
       </p>
 
       <p class="copyright">
Deleted: sandbox/bloom_filter/trunk/libs/bloom_filter/doc/html/testing.html
==============================================================================
--- sandbox/bloom_filter/trunk/libs/bloom_filter/doc/html/testing.html	2011-06-15 20:57:21 EDT (Wed, 15 Jun 2011)
+++ (empty file)
@@ -1,73 +0,0 @@
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml">
-  <head>
-    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
-    <link rel="stylesheet" type="text/css" 
-	  href="../../../../doc/src/boostbook.css"/>
-    <link rel="stylesheet" type="text/css" href="style/my.css"/>
-
-    <title>Boost.BloomFilter</title>  
-  </head>
-
-  <body>
-    <header>
-      <img src="../../../../boost.png" width="277" height="86" 
-	   alt="Boost C++ Libraries"/>
-      <p>
-	Home
-	Libraries 
-	People 
-	FAQ 
-	More 
-      </p>
-    </header>
-
-    <hr/>
-    <div class="spirit-nav">
-      <a accesskey="p" href="reference/hash/default.html">
-	<img src="../../../../doc/src/images/prev.png" alt="Prev"/>
-      </a>
-      <a accesskey="h" href="index.html">
-	<img src="../../../../doc/src/images/home.png" alt="Home"/>
-      </a>
-      <a accesskey="n" href="bibliography.html">
-	<img src="../../../../doc/src/images/next.png" alt="Next"/>
-      </a>
-    </div>
-
-    <h1 class="title">To be completed...</h1>
-
-    <hr/>
-    <div class="spirit-nav">
-      <a accesskey="p" href="reference/hash/default.html">
-	<img src="../../../../doc/src/images/prev.png" alt="Prev"/>
-      </a>
-      <a accesskey="h" href="index.html">
-	<img src="../../../../doc/src/images/home.png" alt="Home"/>
-      </a>
-      <a accesskey="n" href="bibliography.html">
-	<img src="../../../../doc/src/images/next.png" alt="Next"/>
-      </a>
-    </div>
-
-    <footer>
-      <p>
-	Last revised: <time datetime="2011-06-14">June 14, 2011</time>.
-      </p>
-
-      <p class="copyright">
-	Copyright © 2011 
-	<a href="mailto:cpp.cabrera_at_[hidden]">Alejandro Cabrera</a>
-      </p>
-      
-      <p class="copyright">
-	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)
-      </p>
-    </footer>
-
-  </body>
-</html>
Added: sandbox/bloom_filter/trunk/libs/bloom_filter/example/custom_hash.cpp
==============================================================================
--- (empty file)
+++ sandbox/bloom_filter/trunk/libs/bloom_filter/example/custom_hash.cpp	2011-06-15 20:57:21 EDT (Wed, 15 Jun 2011)
@@ -0,0 +1,80 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Alejandro Cabrera 2011.
+// 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)
+//
+// See http://www.boost.org/libs/bloom_filter for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+// example demonstrating how to overload default hash function
+// in order to support user-defined type
+#include <boost/bloom_filter/bloom.hpp>
+#include <sstream>
+#include <string>
+#include <iostream>
+using namespace boost::bloom_filter;
+using namespace std;
+
+class URL {
+public:
+  URL() : _data() {}
+  explicit URL(const string& url) : _data(url) {}
+
+  const string data() const {
+    return _data;
+  }
+private:
+  string _data;
+};
+
+// provide an overload for your class
+// alternatively, implement own Hasher that can handle your type
+namespace boost {
+  namespace bloom_filter {
+    template <size_t Seed>
+    struct boost_hash<URL, Seed> {
+      size_t operator()(const URL& t) {
+	return boost::hash_value(t.data()) + Seed;
+      }
+    };
+  }
+}
+
+const URL gen_url(const size_t num)
+{
+  static const string start_url("https://www.");
+  static const string end_url(".com/");
+  static stringstream stringer;
+  string result;
+
+  stringer << num;
+  stringer >> result;
+  stringer.clear();
+
+  return URL(start_url + result + end_url);
+}
+
+int main () {
+  static const size_t INSERT_MAX = 5000;
+  static const size_t CONTAINS_MAX = 10000;
+  static const size_t NUM_BITS = 32768; // 8KB
+
+  bloom_filter<URL, NUM_BITS> bloom;
+  size_t collisions = 0;
+
+  for (size_t i = 0; i < INSERT_MAX; ++i) {
+    bloom.insert(gen_url(i));
+  }
+
+  for (size_t i = INSERT_MAX; i < CONTAINS_MAX; ++i) {
+    if (bloom.contains(gen_url(i))) ++collisions;
+  }
+
+  cout << "collisions: " << collisions << endl;
+
+  return 0;
+}