Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64094 - in sandbox/SOC/2010/bit_masks/boost/integer: bitfield_tuple detail/bft
From: bbartmanboost_at_[hidden]
Date: 2010-07-17 09:50:29


Author: bbartman
Date: 2010-07-17 09:50:28 EDT (Sat, 17 Jul 2010)
New Revision: 64094
URL: http://svn.boost.org/trac/boost/changeset/64094

Log:
working on creating specializations for the parsing of arguments and augmenting the bitfield_element to reflect that
Text files modified:
   sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple/custom.hpp | 4
   sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple/pointer.hpp | 4
   sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/arg_parse_impl.hpp | 115 +++++++++++++++++++++++++++++++++++++++
   sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/bft_element.hpp | 10 +++
   4 files changed, 127 insertions(+), 6 deletions(-)

Modified: sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple/custom.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple/custom.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple/custom.hpp 2010-07-17 09:50:28 EDT (Sat, 17 Jul 2010)
@@ -4,8 +4,8 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 
 
-#ifndef BOOST_MEMBER_FIELD_HPP
-#define BOOST_MEMBER_FIELD_HPP
+#ifndef BOOST_CUSTOM_FIELD_HPP
+#define BOOST_CUSTOM_FIELD_HPP
 #include <cstddef>
 
 

Modified: sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple/pointer.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple/pointer.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple/pointer.hpp 2010-07-17 09:50:28 EDT (Sat, 17 Jul 2010)
@@ -4,8 +4,8 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 
 
-#ifndef BOOST_MEMBER_FIELD_HPP
-#define BOOST_MEMBER_FIELD_HPP
+#ifndef BOOST_POINTER_MEMBER_FIELD_HPP
+#define BOOST_POINTER_MEMBER_FIELD_HPP
 #include <cstddef>
 
 

Modified: sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/arg_parse_impl.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/arg_parse_impl.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/arg_parse_impl.hpp 2010-07-17 09:50:28 EDT (Sat, 17 Jul 2010)
@@ -21,6 +21,8 @@
 #include <boost/integer/bitfield_tuple/flag.hpp>
 #include <boost/integer/bitfield_tuple/filler.hpp>
 #include <boost/integer/bitfield_tuple/align.hpp>
+#include <boost/integer/bitfield_tuple/custom.hpp>
+#include <boost/integer/bitfield_tuple/pointer.hpp>
 
 #include <boost/integer/detail/bft/name_lookup.hpp>
 
@@ -233,7 +235,7 @@
 
 
 
-/* Specialization for filler. */
+/* Specialization for bit_align. */
 template < std::size_t AlignTo,
             typename StoragePolicy,
             typename FieldVector,
@@ -292,6 +294,117 @@
 
 
 
+
+
+/** Specialization for custom. */
+template < typename ReturnType,
+ typename Name,
+ typename Mask,
+ typename Policy,
+ typename StoragePolicy,
+ typename FieldVector,
+ typename Offset
+>
+struct bft_arg_parse_impl <
+ bitfields::custom<ReturnType,Name,Mask,Policy>,
+ StoragePolicy,
+ FieldVector,
+ Offset >
+{
+ /*
+ TODO: This needs to be better defined!
+ typedef bitfields::custom<ReturnType,Name,Mask,Policy> param;
+ typedef typename mpl::push_back<
+ FieldVector,
+ bitfield_element<
+ ReturnType,
+ NameType,
+ Offset,
+ mpl::size_t<FieldWidth>
+ >
+ >::type field_vector;
+
+ typedef StoragePolicy storage_policy;
+
+
+
+ // typedef offset;
+
+ typedef bft_arg_parse_impl<param,storage_policy,field_vector,offset> type;
+
+ template <typename NextParam>
+ struct process {
+ typedef bft_arg_parse_impl<
+ NextParam,
+ storage_policy,
+ field_vector,
+ offset
+ > type;
+ };
+ */
+};
+
+
+/** Specialization for pointer. */
+template < typename ReturnType,
+ typename Name,
+ typename Mask,
+ typename StoragePolicy,
+ typename FieldVector,
+ typename Offset
+>
+struct bft_arg_parse_impl <
+ bitfields::pointer<ReturnType,Name,Mask>,
+ StoragePolicy,
+ FieldVector,
+ Offset >
+{
+ /*
+ typedef bitfields::bit_align<AlignTo> param;
+ typedef FieldVector field_vector;
+ typedef StoragePolicy storage_policy;
+
+
+ // computing the position of the next bit which is aligned
+ // to the current value of AlignTo.
+
+ // if the modulus result is 0 then we are aligned to the current position.
+ // If its not then we actually have to adjust the position and move to the
+ // next bit position which is aligned to to AlignTo's value
+
+ typedef mpl::size_t<AlignTo> align_to;
+ typedef typename mpl::modulus<
+ Offset,
+ align_to
+ >::type mod_result;
+
+ typedef typename mpl::if_c< mod_result::value == 0, // then
+ Offset,
+ // else
+ typename mpl::plus<
+ Offset,
+ typename mpl::minus<
+ align_to,
+ mod_result
+ >::type
+ >::type
+ >::type offset;
+
+ typedef bft_arg_parse_impl<param,storage_policy,field_vector,offset> type;
+
+ template <typename NextParam>
+ struct process {
+ typedef bft_arg_parse_impl<
+ NextParam,
+ storage_policy,
+ field_vector,
+ offset
+ > type;
+ };
+ */
+};
+
+
 }} // end boost::detail
 
 #endif

Modified: sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/bft_element.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/bft_element.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/bft_element.hpp 2010-07-17 09:50:28 EDT (Sat, 17 Jul 2010)
@@ -25,9 +25,17 @@
     typedef NameType name_type;
     typedef Offset offset;
     typedef FieldWidth field_width;
- typedef bitfield_element<return_type, name_type, offset, field_width> type;
+
     typedef Mask mask;
     typedef Policy policy;
+ typedef bitfield_element<
+ return_type,
+ name_type,
+ offset,
+ field_width,
+ mask,
+ policy
+ > type;
 };
 
 


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