Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r63044 - in sandbox/SOC/2010/bit_masks: boost/integer/details boost/integer/details/bft/ext lib/integer/test/bft_testing
From: bbartmanboost_at_[hidden]
Date: 2010-06-17 12:28:11


Author: bbartman
Date: 2010-06-17 12:28:10 EDT (Thu, 17 Jun 2010)
New Revision: 63044
URL: http://svn.boost.org/trac/boost/changeset/63044

Log:
completed implementation and unit testing for next operation
Text files modified:
   sandbox/SOC/2010/bit_masks/boost/integer/details/bft/ext/bitfield_iterator.hpp | 41 +++++++++++++++++++++++++++------------
   sandbox/SOC/2010/bit_masks/boost/integer/details/fusion_ext_includes.hpp | 1
   sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/fusion_integration_testing.cpp | 15 +++++++++++++
   3 files changed, 43 insertions(+), 14 deletions(-)

Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bft/ext/bitfield_iterator.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bft/ext/bitfield_iterator.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bft/ext/bitfield_iterator.hpp 2010-06-17 12:28:10 EDT (Thu, 17 Jun 2010)
@@ -15,10 +15,6 @@
 #include <boost/fusion/iterator/iterator_facade.hpp>
 #include <boost/mpl/void.hpp>
 
-
-
-
-
 namespace boost {
 
 namespace details {
@@ -55,9 +51,7 @@
     typedef BitfieldTuple bitfield_tuple_type;
     //@}
 
- /** member value Of struct.
- *
- */
+ /** Fusion Extension: value_of */
     template<typename Iter>
     struct value_of {
         typedef typename Iter::bitfield_tuple_type::template bit_ref<
@@ -65,32 +59,51 @@
                 typename Iter::bitfield_tuple_type::members,
                 typename Iter::index
>::type
- > type;
+ > type;
     };
 
+ /** Fusion Extension: deref */
     template <typename Iter>
     struct deref {
         // the type returned by dereferencing the iterator.
- typedef typename value_of<Iter>::type type;
+ typedef typename value_of<Iter>::type type;
+
+ // const dereference operation.
+ static type call(Iter const& iter) {
+ return type( iter._data.data() );
+ }
 
- // dereference operation.
+ // non-const dereference operation.
         static type call(Iter& iter) {
             return type( iter._data.data() );
         }
     };
 
+ /** Fusion Extension: next */
     template<typename Iter>
     struct next {
- typedef typename details::IMPLEMENT_ME type;
- static type call(Iter& iter);
+ typedef bitfield_tuple_iterator<
+ typename Iter::bitfield_tuple_type,
+ Iter::index::value + 1
+ > type;
+ static type call(Iter const& iter) {
+ return type( iter._data );
+ }
+
+ // non-const next operation.
+ static type call(Iter& iter) {
+ return type( iter._data );
+ }
     };
 
+ /** Fusion Extension: prior */
     template<typename Iter>
     struct prior {
         typedef typename details::IMPLEMENT_ME type;
         static type call(Iter& iter);
     };
 
+ /** Fusion Extension: distance */
     template <typename Iter1,typename Iter2>
     struct distance {
         // The distance between iterators of type It1 and It2 as
@@ -99,23 +112,25 @@
         static type call(Iter1& it1,Iter2& it2);
         };
 
+ /** Fusion Extension: key_of */
     template <typename Iter>
     struct key_of {
         typedef typename details::IMPLEMENT_ME type;
     };
 
+ /** Fusion Extension: value_of_data */
     template <typename Iter>
     struct value_of_data {
         typedef typename details::IMPLEMENT_ME type;
     };
 
+ /** Fusion Extension: deref_data */
     template <typename Iter>
     struct deref_data {
         typedef typename details::IMPLEMENT_ME type;
         static type call(Iter& it);
     };
 
-
 };
 
 } // end boost::fusion

Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/fusion_ext_includes.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/fusion_ext_includes.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/fusion_ext_includes.hpp 2010-06-17 12:28:10 EDT (Thu, 17 Jun 2010)
@@ -7,4 +7,5 @@
 #define BOOST_BITFIELD_FUSION_EXT_INCLUDES_HPP
 #include <boost/fusion/iterator/value_of.hpp>
 #include <boost/fusion/iterator/deref.hpp>
+#include <boost/fusion/iterator/next.hpp>
 #endif

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/fusion_integration_testing.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/fusion_integration_testing.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/fusion_integration_testing.cpp 2010-06-17 12:28:10 EDT (Thu, 17 Jun 2010)
@@ -26,6 +26,7 @@
 
 
 int main() {
+
     // bitfield_tuple tag_of testing
     {
         // bitfield_tuple_tag
@@ -41,14 +42,26 @@
         typedef fusion::result_of::value_of<iter>::type value_of_result;
         BOOST_MPL_ASSERT(( is_same< value_of_result::return_type, char> ));
     }
+
     // Iterator deref
     {
         typedef bitfield_tuple_iterator<test_tuple,0> Iter;
         test_tuple temp;
         temp.get<red>() = 3;
         Iter it(temp);
- BOOST_ASSERT(( fusion::result_of::deref<Iter>::call(it) == 3 ));
+ BOOST_ASSERT(( fusion::deref(it) == 3 ));
     }
+
+ // iterator next
+ {
+ typedef bitfield_tuple_iterator<test_tuple,0> Iter;
+ test_tuple temp;
+ temp.get<green>() = 3;
+ Iter it(temp);
+ BOOST_ASSERT(( fusion::deref(fusion::next(it)) == 3 ));
+ }
+
+
     /*
     bmg_t bmg;
 


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