Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73237 - in sandbox/bloom_filter/trunk/libs/bloom_filter/doc/html: reference style tut
From: cpp.cabrera_at_[hidden]
Date: 2011-07-19 02:39:56


Author: alejandro
Date: 2011-07-19 02:39:55 EDT (Tue, 19 Jul 2011)
New Revision: 73237
URL: http://svn.boost.org/trac/boost/changeset/73237

Log:
Fully updated the Bloom instantitaion tutorial module. Discovered a few errors in the basic Bloom filter reference - corrected one of them. Added an "example" listing class CSS rule.
Text files modified:
   sandbox/bloom_filter/trunk/libs/bloom_filter/doc/html/reference/bloom.html | 2
   sandbox/bloom_filter/trunk/libs/bloom_filter/doc/html/style/my.css | 9 +++
   sandbox/bloom_filter/trunk/libs/bloom_filter/doc/html/tut/creating.html | 96 ++++++++++++++++++++++++++++++++++++++++
   3 files changed, 106 insertions(+), 1 deletions(-)

Modified: sandbox/bloom_filter/trunk/libs/bloom_filter/doc/html/reference/bloom.html
==============================================================================
--- sandbox/bloom_filter/trunk/libs/bloom_filter/doc/html/reference/bloom.html (original)
+++ sandbox/bloom_filter/trunk/libs/bloom_filter/doc/html/reference/bloom.html 2011-07-19 02:39:55 EDT (Tue, 19 Jul 2011)
@@ -55,7 +55,7 @@
         <code class="c_func">bloom_filter</code>(<code class="c_keyword">const</code> <code class="c_namespace">std::initializer_list</code>&lt;<code class="c_type">T</code>&gt;&amp;); <code class="c_comment">// requires C++11</code>
 
         &lt;<code class="c_keyword">typename</code> <code class="c_type">InputIterator</code>&gt;
- <code class="c_func">bloom_filter</code>(<code class="c_keyword">const</code> <code class="c_type">InputIterator</code> <code class="c_id">start</code>, <code class="c_keyword">const</code> <code class="c_type">InputIterator</code> <code class="c_id">end</code>);
+ <code class="c_func">basic_bloom_filter</code>(<code class="c_keyword">const</code> <code class="c_type">InputIterator</code> <code class="c_id">start</code>, <code class="c_keyword">const</code> <code class="c_type">InputIterator</code> <code class="c_id">end</code>);
 
         <code class="c_comment">// data structure metadata query functions</code>
         <code class="c_keyword">static constexpr</code> <code class="c_type">size_t</code> <code class="c_func">bit_capacity</code>() <code class="c_keyword">const</code>;

Modified: sandbox/bloom_filter/trunk/libs/bloom_filter/doc/html/style/my.css
==============================================================================
--- sandbox/bloom_filter/trunk/libs/bloom_filter/doc/html/style/my.css (original)
+++ sandbox/bloom_filter/trunk/libs/bloom_filter/doc/html/style/my.css 2011-07-19 02:39:55 EDT (Tue, 19 Jul 2011)
@@ -63,6 +63,15 @@
     margin: 0 5%;
 }
 
+.example {
+ white-space: pre;
+ background: #d0d0d0;
+ border: 1px solid;
+ font-family: monospace;
+ display: block;
+ margin: 0 5%;
+}
+
 .func_ref {
     background-color: #f0f0f0;
     display: block;

Modified: sandbox/bloom_filter/trunk/libs/bloom_filter/doc/html/tut/creating.html
==============================================================================
--- sandbox/bloom_filter/trunk/libs/bloom_filter/doc/html/tut/creating.html (original)
+++ sandbox/bloom_filter/trunk/libs/bloom_filter/doc/html/tut/creating.html 2011-07-19 02:39:55 EDT (Tue, 19 Jul 2011)
@@ -40,6 +40,102 @@
 
     <h1 class="title">Instantiating Bloom Filters</h1>
 
+ <p>
+ To instantiate any of the Bloom filters, you must understand the template
+ parameters associated with each class. Reasonable defaults are provided
+ for most template parameters. In most cases, all that will be required is
+ to specify the Bloom filter element type and the bit capacity of the
+ Bloom filter.
+ </p>
+
+
+ <h2>Basic Bloom Filter</h2>
+
+ <div class="listing">
+ <code class="c_keyword">template</code> &lt;<code class="c_keyword">typename</code> <code class="c_type">T</code>,
+ <code class="c_type">size_t</code> <code class="c_type">Size</code>,
+ <code class="c_keyword">class</code> <code class="c_type">HashFunctions</code> = <code class="c_namespace">mpl::</code><code class="c_type">vector</code>&lt;<code class="c_type">boost_hash</code>&lt;<code class="c_type">T</code>, 3&gt; &gt; &gt;
+ <code class="c_keyword">class</code> <code class="c_type">basic_bloom_filter</code>;
+ </div>
+
+ <p>
+ The Basic Bloom filter was designed to be easy to use. For most use cases,
+ it is enough to specify only the element type T and the Size (bit capacity)
+ of the Bloom filter. If the performance of the Bloom filter is not sufficient
+ with the default Hasher set, only then should you attempt to find a better
+ set of Hashers. Below are a few examples of valid instantiations:
+ </p>
+
+ <div class="example">
+ <code class="c_type">basic_bloom_filter</code>&lt;<code class="c_type">int</code>, 1000&gt; <code class="c_id">bloom</code>;
+ <code class="c_type">basic_bloom_filter</code>&lt;<code class="c_type">int</code>, 10000&gt; <code class="c_id">bloom2</code>;
+ <code class="c_type">basic_bloom_filter</code>&lt;<code class="c_type">int</code>, 1000, <code class="c_namespace">boost::mpl::</code><code class="c_type">vector</code>&lt;<code class="c_type">boost_hash</code>&lt;<code class="c_type">int</code>, 3&gt;,
+ <code class="c_type">boost_hash</code>&lt;<code class="c_type">int</code>, 7&gt;,
+ <code class="c_type">boost_hash</code>&lt;<code class="c_type">int</code>, 11&gt; &gt; <code class="c_id">bloom3</code>;
+ </div>
+
+ <h2>Basic Dynamic Bloom Filter</h2>
+
+ <div class="listing">
+ <code class="c_keyword">template</code> &lt;<code class="c_keyword">typename</code> <code class="c_type">T</code>,
+ <code class="c_keyword">class</code> <code class="c_type">HashFunctions</code> = <code class="c_namespace">mpl::</code><code class="c_type">vector</code>&lt;<code class="c_type">boost_hash</code>&lt;<code class="c_type">T</code>, 3&gt; &gt;,
+ <code class="c_keyword">typename</code> <code class="c_type">Block</code> = <code class="c_type">size_t</code>,
+ <code class="c_keyword">typename</code> <code class="c_type">Allocator</code> = <code class="c_namespace">std::</code><code class="c_type">allocator</code>&lt;<code class="c_type">Block</code>&gt; &gt;
+ <code class="c_keyword">class</code> <code class="c_type">dynamic_bloom_filter</code>;
+ </div>
+
+ <p>
+ The Basic dynamic Bloom filter is very similar to the basic Bloom filter.
+ The primary difference is that the bit storage is allocated on the heap
+ rather than the stack, and that the bit capacity is specified in the
+ constructor rather than as a template. Since the Bloom filter is
+ allocated on the heap, there is support for using a custom memory
+ allocator. Simply specify the Allocator parameter. The Block parameter
+ controls the granularity of bit operations for the underlying
+ <a href="http://www.boost.org/doc/libs/release/libs/dynamic_bitset/dynamic_bitset.html">
+ bitset</a>. See below for examples:
+ </p>
+
+ <div class="example">
+ <code class="c_type">dynamic_bloom_filter</code>&lt;<code class="c_type">int</code>&gt; <code class="c_id">bloom</code>(1000);
+ <code class="c_type">dynamic_bloom_filter</code>&lt;<code class="c_type">int</code>&gt; <code class="c_id">bloom2</code>(10000);
+ <code class="c_type">dynamic_bloom_filter</code>&lt;<code class="c_type">int</code>, <code class="c_namespace">boost::mpl::</code><code class="c_type">vector</code>&lt;<code class="c_type">boost_hash</code>&lt;<code class="c_type">int</code>, 3&gt;,
+ <code class="c_type">boost_hash</code>&lt;<code class="c_type">int</code>, 7&gt;,
+ <code class="c_type">boost_hash</code>&lt;<code class="c_type">int</code>, 11&gt; &gt; <code class="c_id">bloom3</code>(1000);
+ <code class="c_type">dynamic_bloom_filter</code>&lt;<code class="c_type">int</code>,
+ <code class="c_namespace">boost::mpl::</code><code class="c_type">vector</code>&lt;<code class="c_type">boost_hash</code>&lt;<code class="c_type">int</code>,3&gt; &gt;,
+ <code class="c_type">size_t</code>, <code class="c_type">my_allocator</code>&gt; <code class="c_id">bloom4</code>(1000);
+ </div>
+
+ <h2>Counting Bloom Filter</h2>
+ <div class="listing">
+ <code class="c_keyword">template</code> &lt;<code class="c_keyword">typename</code> <code class="c_type">T</code>,
+ <code class="c_type">size_t</code> <code class="c_type">NumBins</code>,
+ <code class="c_type">size_t</code> <code class="c_type">BitsPerBin</code> = 4,
+ <code class="c_keyword">class</code> <code class="c_type">HashFunctions</code> = <code class="c_namespace">mpl::</code><code class="c_type">vector</code>&lt;<code class="c_type">boost_hash</code>&lt;<code class="c_type">T</code>, 3&gt; &gt;,
+ <code class="c_keyword">typename</code> <code class="c_type">Block</code> = <code class="c_type">size_t</code>&gt;
+ <code class="c_keyword">class</code> <code class="c_type">counting_bloom_filter</code>;
+ </div>
+
+ <p>
+ Instantiating a counting Bloom filter is slightly different than a basic
+ Bloom filter. In particular, rather than specifying a bit capacity, you
+ must specify a number of bins. The combination of the parameters NumBins
+ and BitsPerBin determines the total bit capacity of the Bloom filter.
+ </p>
+ <p>
+ At a minimum, you must specify the element type and the number of bins.
+ The BitsPerBin parameter is set to a reasonable default that allows
+ 16 insertions before a bin overflow occurs. The HashFunctions and
+ Block parameter behave as with the dynamic Bloom filter. See the
+ example below for more details:
+ </p>
+
+ <div class="example">
+ <code class="c_type">counting_bloom_filter</code>&lt;<code class="c_type">int</code>, 1000&gt; <code class="c_id">bloom</code>;
+ <code class="c_type">counting_bloom_filter</code>&lt;<code class="c_type">int</code>, 1000, 8&gt; <code class="c_id">bloom2</code>;
+ </div>
+
     <hr/>
     <div class="spirit-nav">
       <a accesskey="p" href="hashers.html">


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