$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r55866 - in sandbox: boost/mapreduce libs/mapreduce/doc libs/mapreduce/examples/prime libs/mapreduce/examples/wordcount libs/mapreduce/test
From: cdm.henderson_at_[hidden]
Date: 2009-08-29 13:46:14
Author: chenderson
Date: 2009-08-29 13:46:13 EDT (Sat, 29 Aug 2009)
New Revision: 55866
URL: http://svn.boost.org/trac/boost/changeset/55866
Log:
Breaking change: map_task and reduce_task now must implement a function operator rather than static methods map and reduce. The functor signatures are the same the the previous static methods.
Text files modified: 
   sandbox/boost/mapreduce/job.hpp                         |     4 ++--                                    
   sandbox/libs/mapreduce/doc/index.html                   |    19 ++++++++++++++-----                     
   sandbox/libs/mapreduce/doc/platform.html                |     4 ++--                                    
   sandbox/libs/mapreduce/doc/tutorial.html                |     8 ++++----                                
   sandbox/libs/mapreduce/doc/wordcount.html               |     8 ++++----                                
   sandbox/libs/mapreduce/examples/prime/prime.cpp         |     4 ++--                                    
   sandbox/libs/mapreduce/examples/wordcount/wordcount.cpp |     4 ++--                                    
   sandbox/libs/mapreduce/test/mrtest.cpp                  |    12 ++++++------                            
   8 files changed, 36 insertions(+), 27 deletions(-)
Modified: sandbox/boost/mapreduce/job.hpp
==============================================================================
--- sandbox/boost/mapreduce/job.hpp	(original)
+++ sandbox/boost/mapreduce/job.hpp	2009-08-29 13:46:13 EDT (Sat, 29 Aug 2009)
@@ -72,7 +72,7 @@
         map_task_runner &operator()(typename map_task_type::key_type const &key,
                                     typename map_task_type::value_type     &value)
         {
-            map_task_type::map(*this, key, value);
+            map_task_type()(*this, key, value);
 
             // consolidating map intermediate results can save network time by
             // aggregating the mapped valued at mapper
@@ -128,7 +128,7 @@
         void operator()(typename reduce_task_type::key_type const &key, It it, It ite)
         {
             ++result_.counters.reduce_keys_executed;
-            reduce_task_type::reduce(*this, key, it, ite);
+            reduce_task_type()(*this, key, it, ite);
             ++result_.counters.reduce_keys_completed;
         }
 
Modified: sandbox/libs/mapreduce/doc/index.html
==============================================================================
--- sandbox/libs/mapreduce/doc/index.html	(original)
+++ sandbox/libs/mapreduce/doc/index.html	2009-08-29 13:46:13 EDT (Sat, 29 Aug 2009)
@@ -84,7 +84,16 @@
               <dl class="fields"> 
                 <p>The latest updates can be found in the <a href='https://svn.boost.org/svn/boost/sandbox'>Boost Sandbox</a></p> 
 
-                <dt>8th August 2009</dt>
+                <dt>29 Aug 2009</dt>
+                <dd>
+                <ul>
+                  <li><i>Breaking change</i>: <code>map_task</code> and <code>reduce_task</code> now must implement a
+                    function operator rather than static methods <code>map</code> and <code>reduce</code>. The functor
+                    signatures are the same the the previous static methods.</li>
+                  <li>Fixed iteration in the case where each result key has multiple values</li>
+                </ul>
+                </dd>
+                <dt>8 Aug 2009</dt>
                 <dd>
                   <a href='http://www.boostpro.com/vault/index.php?action=downloadfile&filename=mapreduce_0_3.zip&directory=&'>
                     DOWNLOAD v0.3
@@ -99,16 +108,16 @@
                     <li>Update documentation</li>
                 </ul></dd>
 
-                <dt>26th July 2009</dt>
+                <dt>26 Jul 2009</dt>
                 <dd><ul><li>Added parametrised file_handler on the datasource.</li>
                     <li>Added memory mapped file support as an alternative to to std::ifstream</li>
                     <li>Added examples directory with wordcount example</li>
                     <li>Removed test directory</li>
                     <li>Code clean-up</li></ul>
                 </dd>
-                <dt>23rd July 2009</dt>
+                <dt>23 Jul 2009</dt>
                 <dd>Added to Boost Sandbox (subversion)</dd>
-                <dt>21st July 2009</dt>
+                <dt>21 Jul 2009</dt>
                 <dd>
                   <a href='http://www.boostpro.com/vault/index.php?action=downloadfile&filename=mapreduce_0_2.zip&directory=&'>
                     DOWNLOAD v0.2
@@ -124,7 +133,7 @@
                 </dd>
               </dl>
               <dl class="fields"> 
-                <dt>19th July 2009</dt>
+                <dt>19 Jul 2009</dt>
                 <dd>
                   <a href='http://www.boostpro.com/vault/index.php?action=downloadfile&filename=mapreduce_0_1.zip&directory=&'>
                     DOWNLOAD v0.1
Modified: sandbox/libs/mapreduce/doc/platform.html
==============================================================================
--- sandbox/libs/mapreduce/doc/platform.html	(original)
+++ sandbox/libs/mapreduce/doc/platform.html	2009-08-29 13:46:13 EDT (Sat, 29 Aug 2009)
@@ -129,7 +129,7 @@
             <p>
               I have successfully compiled using GCC 3.4.4 under Cygwin, but do not have a full
               development environment with Boost et al. to run any tests.</p>
-            <pre>$ g++ -Wall -c -DLINUX -I../../../.. -I/cygdrive/c/root/Development/Library/Boost/boost_1_39_0 wordcount.cpp</pre>
+            <pre>$ g++ -Wall -c -I../../../.. -I/cygdrive/c/root/Development/Library/Boost/boost_1_39_0 wordcount.cpp</pre>
             <p>
               There are also some missing functions in the <code>linux_os</code> namespace which
               I have not implemented. Any help implementing these for non-Windows platforms is appreciated.</p>  
@@ -143,7 +143,7 @@
             <p>
               I have successfully compiled using GCC 4.3.3 on Ubuntu Linux 9.04 (32bit), but do not yet have a full
               development environment with Boost et al. to run any tests.</p>
-            <pre>$ g++ -Wall -c -DLINUX -I../../../.. -I/cygdrive/c/root/Development/Library/Boost/boost_1_39_0 wordcount.cpp</pre>
+            <pre>$ g++ -Wall -c -I../../../.. -I/cygdrive/c/root/Development/Library/Boost/boost_1_39_0 wordcount.cpp</pre>
             
             </div>
           </div> 
Modified: sandbox/libs/mapreduce/doc/tutorial.html
==============================================================================
--- sandbox/libs/mapreduce/doc/tutorial.html	(original)
+++ sandbox/libs/mapreduce/doc/tutorial.html	2009-08-29 13:46:13 EDT (Sat, 29 Aug 2009)
@@ -77,7 +77,7 @@
               <ul>
                 <li>Provide type definitions for Map Key (<code>k1</code>) and Map Value (<code>v1</code>);
                   <code>key_type</code> and <code> value_type</code></li>
-                <li>Implement a static mapper function <code>map()</code></li>
+                <li>Implement a function operator <code>operator()()</code></li>
               </ul>
 <pre>
 struct map_task : public boost::mapreduce::map_task<
@@ -85,7 +85,7 @@
                              std::pair<char const *, char const *> > // MapValue
 {
     template<typename Runtime>
-    static void map(Runtime &runtime, std::string const &key, value_type const &value);
+    void operator()(Runtime &runtime, std::string const &key, value_type const &value) const;
 };
 </pre>
 <p>The MapTask functor is derived from the <code>boost::mapreduce::map_task</code> to define the
@@ -102,13 +102,13 @@
               <ul>
                 <li>Provide type definitions for Reduce Key (<code>k2</code>) and Reduce Value (<code>v2</code>);
                   <code>key_type</code> and <code> value_type</code></li>
-                <li>Implement a static reducer function <code>reduce()</code></li>
+                <li>Implement a reducer function operator <code>operator()()</code></li>
               </ul>
 <pre>
 struct reduce_task : public boost::mapreduce::reduce_task<std::string, unsigned>
 {
     template<typename Runtime, typename It>
-    static void reduce(Runtime &runtime, std::string const &key, It it, It const ite)
+    void operator()(Runtime &runtime, std::string const &key, It it, It const ite) const    
     {
         runtime.emit(key, std::accumulate(it, ite, 0));
     }
Modified: sandbox/libs/mapreduce/doc/wordcount.html
==============================================================================
--- sandbox/libs/mapreduce/doc/wordcount.html	(original)
+++ sandbox/libs/mapreduce/doc/wordcount.html	2009-08-29 13:46:13 EDT (Sat, 29 Aug 2009)
@@ -57,7 +57,7 @@
   <code>key</code>/<code>value</code> types of the input of the map task.
 </p>
 <p>
-  The <code>map</code> function takes three parameters; the <code>runtime</code> which is passed by the MapReduce
+  The map function operator takes three parameters; the <code>runtime</code> which is passed by the MapReduce
   library to be used as a callback to <em>emit</em> intermediate key/value pairs. The other two parameters are the
   <code>key</code> and <code>value</code> for the map task to process. Normally these parameters would be expected
   to be passed as a reference-to-const, but this is not a requirement. For example, if the <code>value</code> type
@@ -76,7 +76,7 @@
                              std::pair<char const *, char const *> > // MapValue
 {
     template<typename Runtime>
-    static void map(Runtime &runtime, std::string const &/*key*/, value_type &value)
+    void operator()(Runtime &runtime, std::string const &/*key*/, value_type &value) const
     {
         bool in_word = false;
         char const *ptr = value.first;
@@ -118,7 +118,7 @@
   parameters to define the <code>key</code> and <code>value</code> types output of the reduce task.
 </p>
 <p>
-  The <code>reduce</code> function takes four parameters; the <code>runtime</code> object is the library's
+  The reduce function operator takes four parameters; the <code>runtime</code> object is the library's
   callback as described above. The second parametrer is the <code>key</code> of the reduce task and the
   third and fourth parameters are a pair of iterators dictating the range of <code>value</code> objects
   for the reduce task. In this Word Count example, the <code>key</code> is a text string containing the
@@ -131,7 +131,7 @@
 struct reduce_task : public boost::mapreduce::reduce_task<std::string, unsigned>
 {
     template<typename Runtime, typename It>
-    static void reduce(Runtime &runtime, std::string const &key, It it, It const ite)
+    void operator()(Runtime &runtime, std::string const &key, It it, It const ite) const
     {
         runtime.emit(key, std::accumulate(it, ite, 0));
     }
Modified: sandbox/libs/mapreduce/examples/prime/prime.cpp
==============================================================================
--- sandbox/libs/mapreduce/examples/prime/prime.cpp	(original)
+++ sandbox/libs/mapreduce/examples/prime/prime.cpp	2009-08-29 13:46:13 EDT (Sat, 29 Aug 2009)
@@ -60,7 +60,7 @@
 struct map_task : public boost::mapreduce::map_task<long, long>
 {
     template<typename Runtime>
-    static void map(Runtime &runtime, key_type const &key, value_type const &value)
+    void operator()(Runtime &runtime, key_type const &key, value_type const &value) const
     {
         BOOST_STATIC_ASSERT((boost::is_same<key_type, value_type>::value));
         for (typename key_type loop=key; loop<=value; ++loop)
@@ -71,7 +71,7 @@
 struct reduce_task : public boost::mapreduce::reduce_task<bool, long>
 {
     template<typename Runtime, typename It>
-    static void reduce(Runtime &runtime, key_type const &key, It it, It ite)
+    void operator()(Runtime &runtime, key_type const &key, It it, It ite) const
     {
         if (key)
             for_each(it, ite, boost::bind(&Runtime::emit, &runtime, true, _1));
Modified: sandbox/libs/mapreduce/examples/wordcount/wordcount.cpp
==============================================================================
--- sandbox/libs/mapreduce/examples/wordcount/wordcount.cpp	(original)
+++ sandbox/libs/mapreduce/examples/wordcount/wordcount.cpp	2009-08-29 13:46:13 EDT (Sat, 29 Aug 2009)
@@ -40,7 +40,7 @@
                              std::pair<char const *, char const *> >    // MapValue (memory mapped file contents)
 {
     template<typename Runtime>
-    static void map(Runtime &runtime, key_type const &/*key*/, value_type &value)
+    void operator()(Runtime &runtime, key_type const &/*key*/, value_type &value) const
     {
         bool in_word = false;
         char const *ptr = value.first;
@@ -75,7 +75,7 @@
                                 unsigned>
 {
     template<typename Runtime, typename It>
-    static void reduce(Runtime &runtime, key_type const &key, It it, It const ite)
+    void operator()(Runtime &runtime, key_type const &key, It it, It const ite) const
     {
         runtime.emit(key, std::accumulate(it, ite, 0));
     }
Modified: sandbox/libs/mapreduce/test/mrtest.cpp
==============================================================================
--- sandbox/libs/mapreduce/test/mrtest.cpp	(original)
+++ sandbox/libs/mapreduce/test/mrtest.cpp	2009-08-29 13:46:13 EDT (Sat, 29 Aug 2009)
@@ -52,13 +52,13 @@
   : public boost::mapreduce::map_task<std::string, map_value_type>
 {
     template<typename Runtime>
-    static void map(Runtime &runtime, std::string const &key, T &value);
+    void operator()(Runtime &runtime, std::string const &key, T &value) const;
 };
 
 struct reduce_task : public boost::mapreduce::reduce_task<std::string, unsigned>
 {
     template<typename Runtime, typename It>
-    static void reduce(Runtime &runtime, std::string const &key, It it, It const ite)
+    void operator()(Runtime &runtime, std::string const &key, It it, It const ite) const
     {
         runtime.emit(key, std::accumulate(it, ite, 0));
     }
@@ -68,10 +68,10 @@
 void
 map_task<
     std::pair<
-        char const *, char const *> >::map(
+        char const *, char const *> >::operator()(
             Runtime           &runtime,
             std::string const &/*key*/,
-            std::pair<char const *, char const *> &value)
+            std::pair<char const *, char const *> &value) const
 {
     bool in_word = false;
     char const *ptr = value.first;
@@ -117,10 +117,10 @@
 
 template<> template<typename Runtime>
 void
-map_task<std::ifstream>::map(
+map_task<std::ifstream>::operator()(
     Runtime            &runtime,
     std::string const  &/*key*/,
-    std::ifstream      &value)
+    std::ifstream      &value) const
 {
     while (!value.eof())
     {