$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r63272 - in sandbox/SOC/2010/bit_masks: boost/integer boost/integer/details boost/integer/details/bft boost/integer/details/bft/ext lib/integer/test lib/integer/test/bft_testing
From: bbartmanboost_at_[hidden]
Date: 2010-06-23 19:45:21
Author: bbartman
Date: 2010-06-23 19:45:20 EDT (Wed, 23 Jun 2010)
New Revision: 63272
URL: http://svn.boost.org/trac/boost/changeset/63272
Log:
completed variadic macro controlled template support, this allows for upto 50 parameters to be used on a bitfield_tuple
Added:
   sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/variadic_sequence_testing.cpp   (contents, props changed)
Text files modified: 
   sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple.hpp                               |    18 +-----                                  
   sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple_fwd.hpp                           |    12 ----                                    
   sandbox/SOC/2010/bit_masks/boost/integer/details/bft/arg_parse_impl.hpp                   |     1                                         
   sandbox/SOC/2010/bit_masks/boost/integer/details/bft/ext/tag_of.hpp                       |     6 -                                       
   sandbox/SOC/2010/bit_masks/boost/integer/details/bft/template_expansion_macros.hpp        |   100 +++++++++++++++++++++++++++++++++++++++ 
   sandbox/SOC/2010/bit_masks/boost/integer/details/bitfield_tuple_impl.hpp                  |    38 ++-------------                         
   sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2                                    |     3                                         
   sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/template_expansion_marco_test.cpp |     1                                         
   8 files changed, 114 insertions(+), 65 deletions(-)
Modified: sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple.hpp	(original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple.hpp	2010-06-23 19:45:20 EDT (Wed, 23 Jun 2010)
@@ -313,25 +313,15 @@
  *      both a const and non const version of a bitfield. But even I don't do 
  *      that I would like to change the way the reference class works.
  */
-template <  typename T0,
-            typename T1 = mpl::void_,
-            typename T2 = mpl::void_,
-            typename T3 = mpl::void_,
-            typename T4 = mpl::void_,
-            typename T5 = mpl::void_,
-            typename T6 = mpl::void_,
-            typename T7 = mpl::void_,
-            typename T8 = mpl::void_,
-            typename T9 = mpl::void_
->
+template <  BOOST_MAKE_BFT_TEMPLATE_PARAMS() >
 struct bitfield_tuple
     : protected details::bitfield_tuple_base<
-        T0,T1,T2,T3,T4,T5,T6,T7,T8,T9
+        BOOST_BFT_PARAMETER_LIST()
     >
 {
 private:
-    typedef details::bitfield_tuple_base<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9> _base;
-    typedef bitfield_tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9>  _self;
+    typedef details::bitfield_tuple_base<BOOST_BFT_PARAMETER_LIST()> _base;
+    typedef bitfield_tuple<BOOST_BFT_PARAMETER_LIST()>  _self;
 
 public:
     typedef typename _base::field_vector            members;
Modified: sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple_fwd.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple_fwd.hpp	(original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple_fwd.hpp	2010-06-23 19:45:20 EDT (Wed, 23 Jun 2010)
@@ -9,17 +9,7 @@
 
 namespace boost {
 
-template <  typename T0,
-            typename T1,
-            typename T2,
-            typename T3,
-            typename T4,
-            typename T5,
-            typename T6,
-            typename T7,
-            typename T8,
-            typename T9
->
+template < BOOST_BFT_TEMPLATE_ARGS_NO_DEFAULTS() >
 struct bitfield_tuple;
 
 }// end boost
Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bft/arg_parse_impl.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bft/arg_parse_impl.hpp	(original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bft/arg_parse_impl.hpp	2010-06-23 19:45:20 EDT (Wed, 23 Jun 2010)
@@ -233,6 +233,7 @@
         > type;
     };
 };
+
 /* Specialization for filler. */
 template <  std::size_t PaddingBits,
             typename StoragePolicy,
Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bft/ext/tag_of.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bft/ext/tag_of.hpp	(original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bft/ext/tag_of.hpp	2010-06-23 19:45:20 EDT (Wed, 23 Jun 2010)
@@ -15,10 +15,8 @@
     namespace traits {
 
     /** bit_T_group specilization. */
-    template <  typename T0, typename T1, typename T2, typename T3,
-                typename T4, typename T5, typename T6, typename T7,
-                typename T8, typename T9 >
-    struct tag_of< boost::bitfield_tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9> >{
+    template <  BOOST_BFT_TEMPLATE_ARGS_NO_DEFAULTS()>
+    struct tag_of< ::boost::bitfield_tuple< BOOST_BFT_SPECILIZATION_PARAM_LIST() > >{
         typedef bitfield_tuple_tag type;
     };
 
Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bft/template_expansion_macros.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bft/template_expansion_macros.hpp	(original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bft/template_expansion_macros.hpp	2010-06-23 19:45:20 EDT (Wed, 23 Jun 2010)
@@ -6,16 +6,63 @@
 
 #include <boost/preprocessor/repetition/enum.hpp>
 #include <boost/preprocessor/arithmetic/add.hpp>
+#include <boost/preprocessor/repetition/repeat_from_to.hpp>
+
 
 #ifndef BOOST_BITFIELD_TUPLE_TEMPLATE_EXPANSION_MACROS_HPP
 #define BOOST_BITFIELD_TUPLE_TEMPLATE_EXPANSION_MACROS_HPP
 
+// need to handle all cases where the user could/can specify any combonation
+// of BOOST_MPL_LIMIT_VECTOR_SIZE prior to including this file.
+
 #ifndef BOOST_BFT_PARAM_COUNT
-#define BOOST_BFT_PARAM_COUNT 10
+#   ifndef BOOST_MPL_LIMIT_VECTOR_SIZE
+#       define BOOST_BFT_PARAM_COUNT 10
+#   else
+#       if BOOST_MPL_LIMIT_VECTOR_SIZE < 10
+#           error "BOOST_MPL_LIMIT_VECTOR_SIZE must be set to higher then 10 if "
+#           error "or BOOST_BFT_PARAM_COUNT must be defined to be equal to "
+#           error "BOOST_MPL_LIMIT_VECTOR_SIZE if you wish to use bitfield_tuple."
+#       else
+#           define BOOST_BFT_PARAM_COUNT 10
+#       endif
+#   endif
+#else
+#   ifndef BOOST_MPL_LIMIT_VECTOR_SIZE
+#       if BOOST_BFT_PARAM_COUNT <= 10
+#           define BOOST_MPL_LIMIT_VECTOR_SIZE 10
+#       elif BOOST_BFT_PARAM_COUNT <= 20
+#           define BOOST_MPL_LIMIT_VECTOR_SIZE 20
+#       elif BOOST_BFT_PARAM_COUNT <= 30
+#           define BOOST_MPL_LIMIT_VECTOR_SIZE 30
+#       elif BOOST_BFT_PARAM_COUNT <= 40
+#           define BOOST_MPL_LIMIT_VECTOR_SIZE 40
+#       elif BOOST_BFT_PARAM_COUNT <= 50
+#           define BOOST_MPL_LIMIT_VECTOR_SIZE 50
+#       else
+#           error "BOOST_BFT_PARAM_COUNT of value greater then 50 not supported."
+#       endif
+#       
+#   else
+#       if BOOST_BFT_PARAM_COUNT <= BOOST_MPL_LIMIT_VECTOR_SIZE
+#       else
+#           error "BOOST_MPL_LIMIT_VECTOR_SIZE must be greater then or equal to"
+#           error "BOOST_BFT_PARAM_COUNT."
+#       endif
+#   endif
 #endif
 
+
+
+
+/** Creates variadic tempalte behavior by creating parameters up to
+ *  BOOST_BFT_PARAM_COUNT in the fasion of typename TN = mpl::void_, ... 
+ *  where N is the Nth parameter in the parameter list.
+ */
 #define BOOST_MAKE_BFT_TEMPLATE_PARAMS() \
-            BOOST_PP_ENUM(BOOST_BFT_PARAM_COUNT, BOOST_BFT_MAKE_PARAMS, NOTHING)
+            BOOST_PP_ENUM(  BOOST_BFT_PARAM_COUNT,\
+                            BOOST_BFT_MAKE_PARAMS, \
+                            BOOST_BFT_NOTHING )
 
 /** Macro for generating template parameters
  *  for a bitfield_tuple.
@@ -24,4 +71,53 @@
             typename T ## N = mpl::void_
 
 
+/** Macro for generating the code for unpacking a the template parameters for 
+ *  later processing inside of the bitfield_tuple base.
+ */
+#define BOOST_BFT_UNPACK_CALL(Z, N, DATA) \
+                ::template process<T ## N >::type
+
+/** Defines code for the unpacking and parsing of template parameters.
+ *  This is used within the bft_base_impl.
+ */
+#define BOOST_BFT_UNPACK_PARAMS() \
+        BOOST_PP_REPEAT_FROM_TO( \
+            1,\
+            BOOST_BFT_PARAM_COUNT, \
+            BOOST_BFT_UNPACK_CALL,\
+            BOOST_BFT_NOTHING )
+
+
+
+/** Helps produce the sequence T0, ... TN, both with and with out typename 
+ * before it.
+ */
+#define BOOST_BFT_PARAM_LIST(Z,N,DATA) \
+    DATA ## N
+
+/** This is used for making a list of all of the template parameters and that 
+ *  list of comma seperated parameters is then used to name the template within
+ *  itself or to pass all of the template arguments at once.
+ */
+#define BOOST_BFT_PARAMETER_LIST() \
+            BOOST_PP_ENUM(  BOOST_BFT_PARAM_COUNT,\
+                            BOOST_BFT_PARAM_LIST, \
+                            T )
+
+/** Creates the template parameters for the bft_base_class. */
+#define BOOST_BFT_BASE_TEMPLATE_PARAMS() \
+    BOOST_PP_ENUM(  BOOST_BFT_PARAM_COUNT,\
+                    BOOST_BFT_PARAM_LIST, \
+                    typename T )
+
+/** Used for creating template parameter for*/
+#define BOOST_BFT_TEMPLATE_ARGS_NO_DEFAULTS() \
+    BOOST_PP_ENUM(  BOOST_BFT_PARAM_COUNT,\
+                    BOOST_BFT_PARAM_LIST, \
+                    typename T )
+
+
+/** Used for specilizing over the bitfield_tuple sequence. */
+#define BOOST_BFT_SPECILIZATION_PARAM_LIST() \
+                BOOST_BFT_PARAMETER_LIST()
 #endif
Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bitfield_tuple_impl.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bitfield_tuple_impl.hpp	(original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bitfield_tuple_impl.hpp	2010-06-23 19:45:20 EDT (Wed, 23 Jun 2010)
@@ -35,26 +35,13 @@
             mpl::void_,\
             mpl::vector<>,\
             mpl::size_t<0u>\
-        >::\
-        template process<T1 >::type::\
-        template process<T2>::type::\
-        template process<T3>::type::\
-        template process<T4>::type::\
-        template process<T5>::type::\
-        template process<T6>::type::\
-        template process<T7>::type::\
-        template process<T8>::type::\
-        template process<T9>::type 
+        >\
+        BOOST_BFT_UNPACK_PARAMS()
 
 /** bitfield_tuple base class
- *  This class is responsible for preforming static assertions on some 
+ *  The bitfield_tuple_base class is responsible for preforming static assertions on some 
  *  preconditions and dealing with the parsed arguments. This is the base class 
- *  for bitfield_tuple. This class is responsible for, among other things, 
- *  the allocation policy for the bitfield_tuple. The default uses stack 
- *  type storage_type (for additional information reguarding the 
- *  stack_allocation_policy please see its header file (
- *  boost/integer/details/bft/stack_allocation_policy.hpp).
- *
+ *  for bitfield_tuple.
  *
  *
  *  Base Class preconditions.
@@ -69,23 +56,8 @@
  *  3) The bitfields specified must not exceed the bitwidth of the storage type.
  *      Enforced. Not going any where, but may be redefined or altered based
  *          on if I allow the supplied storage type to be an array.
- *
- *
- *
- *
- *
  */
-template <  typename T0,
-            typename T1,
-            typename T2,
-            typename T3,
-            typename T4,
-            typename T5,
-            typename T6,
-            typename T7,
-            typename T8,
-            typename T9
->
+template <  BOOST_BFT_BASE_TEMPLATE_PARAMS() >
 struct bitfield_tuple_base {
 
     
Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2	(original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2	2010-06-23 19:45:20 EDT (Wed, 23 Jun 2010)
@@ -36,11 +36,12 @@
         [ run bft_testing/ref_type_testing.cpp ]
         [ run bft_testing/name_accessor_test.cpp ]
         [ run bft_testing/get_interface_test.cpp ]
-        [ compile bft_testing/compile_pass/fusion_includes.cpp ]
+        [ run bft_testing/compile_pass/fusion_includes.cpp ]
         [ run bft_testing/fusion_iterator_testing.cpp ]
         [ run bft_testing/fusion_integration_testing.cpp ]
         [ run bft_testing/flag_test.cpp ]
         [ run bft_testing/filler_test.cpp ]
         [ run bft_testing/template_expansion_marco_test.cpp ]
+        [ run bft_testing/variadic_sequence_testing.cpp ]
     ;
 
Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/template_expansion_marco_test.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/template_expansion_marco_test.cpp	(original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/template_expansion_marco_test.cpp	2010-06-23 19:45:20 EDT (Wed, 23 Jun 2010)
@@ -5,6 +5,7 @@
 
 
 #include <boost/integer/bitfield_tuple.hpp>
+
 #include <boost/assert.hpp>
 #include <typeinfo>
 #include <iostream>
Added: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/variadic_sequence_testing.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/variadic_sequence_testing.cpp	2010-06-23 19:45:20 EDT (Wed, 23 Jun 2010)
@@ -0,0 +1,37 @@
+//  Copyright 2010 Brian Bartman.
+//  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)
+
+
+#define BOOST_BFT_PARAM_COUNT 11
+#include <boost/integer/bitfield_tuple.hpp>
+#include <boost/assert.hpp>
+
+
+using namespace boost;
+
+struct red;
+struct green;
+struct pink;
+struct blue;
+struct salmon;
+
+typedef bitfield_tuple<
+    member<char,red,4>,
+    member<unsigned char, green,5>,
+    storage<std::size_t>,
+    member<int, salmon, 16>,
+    flag<blue>
+>                                       test_tuple;
+
+
+int main() {
+    test_tuple temp;
+
+    temp.get<blue>() = false;
+    BOOST_ASSERT(( temp.get<blue>() == false));
+    return 0;
+}
+
+