Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r63835 - in sandbox/SOC/2010/bit_masks: boost/bitfield boost/integer/details/bft lib/integer/test/bft_testing
From: bbartmanboost_at_[hidden]
Date: 2010-07-10 21:15:18


Author: bbartman
Date: 2010-07-10 21:15:16 EDT (Sat, 10 Jul 2010)
New Revision: 63835
URL: http://svn.boost.org/trac/boost/changeset/63835

Log:
completed some work on the make bitfield tuple function I did encounter an error which is going to take some time to fix.
Text files modified:
   sandbox/SOC/2010/bit_masks/boost/bitfield/bitfield.hpp | 2
   sandbox/SOC/2010/bit_masks/boost/integer/details/bft/make_bitfield_tuple.hpp | 42 ++++++++++++++++++++++++++++++++++++++++
   sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/make_bft_testing.cpp | 34 +++++++++++++++++++++++++++++++
   3 files changed, 76 insertions(+), 2 deletions(-)

Modified: sandbox/SOC/2010/bit_masks/boost/bitfield/bitfield.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/bitfield/bitfield.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/bitfield/bitfield.hpp 2010-07-10 21:15:16 EDT (Sat, 10 Jul 2010)
@@ -18,7 +18,7 @@
 
 #include <cassert>
 #include <limits>
-#include <netinet/in.h>
+
 
 namespace boost { namespace integer {
     

Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bft/make_bitfield_tuple.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bft/make_bitfield_tuple.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bft/make_bitfield_tuple.hpp 2010-07-10 21:15:16 EDT (Sat, 10 Jul 2010)
@@ -6,11 +6,50 @@
 
 #ifndef BOOST_BFT_MAKE_BFT_HPP
 #define BOOST_BFT_MAKE_BFT_HPP
+#include <boost/config.hpp>
 #include <cstddef>
 
 
 namespace boost { namespace details {
+#ifdef BOOST_MSVC
+
+template <typename T>
+struct bft_create_param_fix_return_type {
+ typedef T type;
+};
+
+template <typename ReturnType, typename NameType, typename Offset, typename Width>
+struct bft_create_param_fix_return_type< bitfield_element<ReturnType,NameType,Offset,Width> >{
+ typedef ReturnType type;
+};
+
+
+
+template <typename BitfieldTuple, std::size_t Index>
+struct get_create_parameter {
+ // check for valid Index.
+ typedef typename mpl::less<
+ mpl::size_t<Index>,
+ typename mpl::size<
+ typename BitfieldTuple::members
+ >::type
+ >::type is_valid_index;
+
+ typedef typename mpl::if_<
+ is_valid_index,
+ typename mpl::at_c<
+ typename BitfieldTuple::members,
+ Index
+ >::type,
+ mpl::void_*
+ >::type element_type;
+
+ typedef typename bft_create_param_fix_return_type<element_type>::type type;
+};
 
+
+
+#else
 /** Used to generate a function parameter for the create function used
  * with make_bitfield_tuple
  */
@@ -24,6 +63,7 @@
     typedef mpl::void_* type;
 };
 
+
 template <typename BitfieldTuple, std::size_t Index>
 struct get_create_parameter {
     typedef typename mpl::if_<
@@ -43,6 +83,8 @@
>::type type;
 };
 
+#endif
+
 /** This is a function which is used to assign a value into a bitfield_tuple
  * as well as remove the actual mpl::void_* from the parameter list through
  * specialization.

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/make_bft_testing.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/make_bft_testing.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/make_bft_testing.cpp 2010-07-10 21:15:16 EDT (Sat, 10 Jul 2010)
@@ -6,7 +6,7 @@
 
 #include <boost/integer/bitfield_tuple.hpp>
 #include <boost/assert.hpp>
-
+#include <iostream>
 
 using namespace boost;
 using namespace boost::bitfields;
@@ -29,6 +29,37 @@
 
 int main() {
     {
+#ifdef BOOST_MSVC
+ using namespace ::boost::details;
+ // Checking to make sure that the indexs work correctly.
+ BOOST_MPL_ASSERT(( get_create_parameter<test_tuple,0>::is_valid_index ));
+ BOOST_MPL_ASSERT(( get_create_parameter<test_tuple,1>::is_valid_index ));
+ BOOST_MPL_ASSERT(( get_create_parameter<test_tuple,2>::is_valid_index ));
+ BOOST_MPL_ASSERT(( get_create_parameter<test_tuple,3>::is_valid_index ));
+ BOOST_MPL_ASSERT_NOT(( get_create_parameter<test_tuple,4>::is_valid_index ));
+ BOOST_MPL_ASSERT_NOT(( get_create_parameter<test_tuple,5>::is_valid_index ));
+ BOOST_MPL_ASSERT_NOT(( get_create_parameter<test_tuple,6>::is_valid_index ));
+ BOOST_MPL_ASSERT_NOT(( get_create_parameter<test_tuple,7>::is_valid_index ));
+ BOOST_MPL_ASSERT_NOT(( get_create_parameter<test_tuple,8>::is_valid_index ));
+ BOOST_MPL_ASSERT_NOT(( get_create_parameter<test_tuple,9>::is_valid_index ));
+ BOOST_MPL_ASSERT_NOT(( get_create_parameter<test_tuple,10>::is_valid_index ));
+ BOOST_MPL_ASSERT_NOT(( get_create_parameter<test_tuple,11>::is_valid_index ));
+ BOOST_MPL_ASSERT_NOT(( get_create_parameter<test_tuple,12>::is_valid_index ));
+ BOOST_MPL_ASSERT_NOT(( get_create_parameter<test_tuple,13>::is_valid_index ));
+ BOOST_MPL_ASSERT_NOT(( get_create_parameter<test_tuple,14>::is_valid_index ));
+ // BOOST_ASSERT((false));
+ // checking to make sure that the if statement part of it works correctly.
+
+
+ BOOST_MPL_ASSERT(( is_same<get_create_parameter<test_tuple,0>::type, char> ));
+ BOOST_MPL_ASSERT(( is_same<get_create_parameter<test_tuple,1>::type, unsigned char> ));
+ BOOST_MPL_ASSERT(( is_same<get_create_parameter<test_tuple,2>::type, int> ));
+ BOOST_MPL_ASSERT(( is_same<get_create_parameter<test_tuple,3>::type, bool> ));
+ BOOST_MPL_ASSERT(( is_same<get_create_parameter<test_tuple,4>::type, mpl::void_*> ));
+#endif
+ }
+ {
+#if 1
         using namespace ::boost::details;
         BOOST_MPL_ASSERT((
             is_same<
@@ -42,6 +73,7 @@
                 int
>
         ));
+#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