Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64268 - in sandbox/SOC/2010/bit_masks: . boost/integer boost/integer/bitfield_tuple boost/integer/detail/bft boost/integer/detail/bft/ext boost/integer/detail/bft/ext/fusion
From: bbartmanboost_at_[hidden]
Date: 2010-07-22 13:15:07


Author: bbartman
Date: 2010-07-22 13:15:06 EDT (Thu, 22 Jul 2010)
New Revision: 64268
URL: http://svn.boost.org/trac/boost/changeset/64268

Log:
working on reorganizing the file structure and naming conventsion
Added:
   sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple/interface_metafunctions.hpp (contents, props changed)
   sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/arg_parsing_meta_functions.hpp
      - copied unchanged from r64257, /sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/pointer_parsing_meta_functions.hpp
Removed:
   sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/pointer_parsing_meta_functions.hpp
Text files modified:
   sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple.hpp | 1
   sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple/pointer.hpp | 2
   sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/arg_parse_impl.hpp | 2
   sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/ext/bitfield_iterator.hpp | 2
   sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/ext/fusion/at_impl.hpp | 2
   sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/reference_builder.hpp | 149 ----------------------------------------
   sandbox/SOC/2010/bit_masks/notes.txt | 62 ++++++++--------
   7 files changed, 36 insertions(+), 184 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-07-22 13:15:06 EDT (Thu, 22 Jul 2010)
@@ -26,6 +26,7 @@
 #include <boost/mpl/size.hpp>
 #include <boost/type_traits/add_reference.hpp>
 #include <boost/integer/detail/bft/reference_builder.hpp>
+#include <boost/integer/bitfield_tuple/interface_metafunctions.hpp>
 #include <boost/integer/detail/bft/ext/bitfield_tuple_fusion_includes.hpp>
 #include <boost/integer/detail/fusion_ext_includes.hpp>
 #include <boost/integer/detail/bft/make_bitfield_tuple.hpp>

Added: sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple/interface_metafunctions.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple/interface_metafunctions.hpp 2010-07-22 13:15:06 EDT (Thu, 22 Jul 2010)
@@ -0,0 +1,132 @@
+// 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)
+
+
+#ifndef BOOST_BFT_INTERFACE_META_FUNCITONS_HPP
+#define BOOST_BFT_INTERFACE_META_FUNCITONS_HPP
+
+namespace boost {
+
+/** Checks to see if a name exists.
+ * returns mpl::true_ or mpl::false_
+ */
+template <typename BitfieldTuple, typename Name>
+struct name_exists {
+ typedef typename mpl::not_<
+ is_same <
+ typename ::boost::mpl::find_if<
+ typename BitfieldTuple::members,
+ detail::match_name<
+ mpl::_1,
+ Name
+ >
+ >::type,
+ typename mpl::end<
+ typename BitfieldTuple::members
+ >::type
+ >
+ >::type type;
+};
+
+/** Returns an element by which has a given name. */
+template <typename BitfieldTuple, typename Name>
+struct find_by_element_name {
+
+ BOOST_STATIC_ASSERT(( name_exists<BitfieldTuple,Name>::type::value ));
+
+ typedef typename mpl::deref<
+ typename mpl::find_if<
+ typename BitfieldTuple::members,
+ detail::match_name<
+ mpl::_1,
+ Name
+ >
+ >::type
+ >::type type;
+};
+
+/** Returns an element from members within bitfield_tuple
+ * at a given index.
+ */
+template <typename BitfieldTuple, std::size_t Index>
+struct find_by_element_index {
+
+ BOOST_STATIC_ASSERT((
+ mpl::size<typename BitfieldTuple::members>::value
+ >
+ Index
+ ));
+
+ typedef typename mpl::at_c<
+ typename BitfieldTuple::members,
+ Index
+ >::type type;
+};
+
+template <typename BitfieldTuple, typename Name>
+struct get_proxy_reference_type_by_name {
+ // search for the name,
+ typedef typename mpl::find_if<
+ typename BitfieldTuple::members,
+ detail::match_name<
+ mpl::_1,
+ Name
+ >
+ >::type element_iter;
+
+ // get the end iterator from members.
+ typedef typename mpl::end<
+ typename BitfieldTuple::members
+ >::type member_end;
+
+ // create the bitfield_reference type that will be returned if
+ // disable_if is enabled.
+ typedef typename BitfieldTuple::template bitfield_reference<
+ typename mpl::if_<
+ is_const<BitfieldTuple>,
+ typename add_const<
+ typename mpl::deref<
+ element_iter
+ >::type
+ >::type,
+ typename mpl::deref<
+ element_iter
+ >::type
+ >::type
+ > type;
+
+};
+
+template <typename BitfieldTuple, std::size_t Index>
+struct get_proxy_reference_type_by_index {
+ // check to make sure index is valid
+ typedef typename mpl::less<
+ mpl::size_t<
+ Index
+ >,
+ mpl::size<
+ typename BitfieldTuple::members
+ >
+ > is_valid_index;
+
+ // get the bitfield_element from members.
+ typedef typename mpl::at_c<
+ typename BitfieldTuple::members,
+ Index
+ >::type bft_element_t;
+
+ // create the reference type
+ typedef typename BitfieldTuple::template bitfield_reference<
+ typename mpl::if_<
+ is_const<BitfieldTuple>,
+ typename add_const<bft_element_t>::type,
+ bft_element_t
+ >::type
+ > type;
+};
+
+} // end boost
+
+#endif

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-22 13:15:06 EDT (Thu, 22 Jul 2010)
@@ -7,7 +7,7 @@
 #ifndef BOOST_POINTER_MEMBER_FIELD_HPP
 #define BOOST_POINTER_MEMBER_FIELD_HPP
 #include <cstddef>
-#include <boost/integer/detail/bft/pointer_parsing_meta_functions.hpp>
+#include <boost/integer/detail/bft/arg_parsing_meta_functions.hpp>
 #include <boost/integer/high_bits_mask.hpp>
 #include <boost/integer/bit_width.hpp>
 

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-22 13:15:06 EDT (Thu, 22 Jul 2010)
@@ -28,7 +28,7 @@
 #include <boost/integer/bitfield_tuple/pointer.hpp>
 
 #include <boost/integer/detail/bft/name_lookup.hpp>
-#include <boost/integer/detail/bft/pointer_parsing_meta_functions.hpp>
+#include <boost/integer/detail/bft/arg_parsing_meta_functions.hpp>
 #include <boost/integer/detail/bft/pointer_packing_policy.hpp>
 
 

Modified: sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/ext/bitfield_iterator.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/ext/bitfield_iterator.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/ext/bitfield_iterator.hpp 2010-07-22 13:15:06 EDT (Thu, 22 Jul 2010)
@@ -58,7 +58,7 @@
     /** Fusion Extension: value_of */
     template<typename Iter>
     struct value_of {
- typedef typename detail::get_reference_type_by_index<
+ typedef typename boost::get_proxy_reference_type_by_index<
             BitfieldTuple,
             Iter::index::value
>::type type;

Modified: sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/ext/fusion/at_impl.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/ext/fusion/at_impl.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/ext/fusion/at_impl.hpp 2010-07-22 13:15:06 EDT (Thu, 22 Jul 2010)
@@ -21,7 +21,7 @@
 
     template <typename BitfieldTuple, typename N>
     struct apply {
- typedef typename ::boost::detail::get_reference_type_by_index<
+ typedef typename ::boost::get_proxy_reference_type_by_index<
             BitfieldTuple,
             N::value
>::type type;

Deleted: sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/pointer_parsing_meta_functions.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/pointer_parsing_meta_functions.hpp 2010-07-22 13:15:06 EDT (Thu, 22 Jul 2010)
+++ (empty file)
@@ -1,149 +0,0 @@
-// 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)
-
-
-#ifndef BOOST_BITFIELD_TUPLE_POINTER_PARSING_HELPERS_HPP
-#define BOOST_BITFIELD_TUPLE_POINTER_PARSING_HELPERS_HPP
-
-#include <boost/cstdint.hpp>
-#include <boost/integer/bits_mask.hpp>
-#include <cstddef>
-#include <boost/mpl/size_t.hpp>
-#include <boost/type_traits/make_unsigned.hpp>
-#include <boost/mpl/if.hpp>
-
-/** This file contains metafunctions which are used to do complex operations
- * on the Mask provided by the user.
- */
-namespace boost { namespace detail { namespace pointer_member {
-
-template <typename T>
-struct get_mask_type {
- typedef typename mpl::if_c<
- (4 < sizeof(T*)),
- uint64_t,
- uint32_t
- >::type type;
-};
-
-
-
-// this is ugly but I would like it for organizational purposes.
-namespace ptr_detail {
-
-// Count leading zeros helper
-// basically recurse until the true false condition is evaluated as false.
-template <
- typename Mask,
- typename IndexingMask = bits_mask<
- typename make_unsigned<
- typename Mask::value_type
- >::type,
- bit_width<
- typename Mask::value_type
- >::value - 1
- >,
- std::size_t ZeroCount = 0,
- bool = true
->
-struct clz_helper;
-
-/** Continued recursive case. */
-template <
- typename Mask,
- typename IndexingMask,
- std::size_t ZeroCount
->
-struct clz_helper<Mask,IndexingMask,ZeroCount,true>
- :clz_helper<
- Mask,
- bits_mask<
- typename IndexingMask::value_type,
- IndexingMask::offset - 1
- >,
- ZeroCount + 1,
- ((IndexingMask::value & Mask::value) == 0)
- &&
- (IndexingMask::offset >= 0)
- >
-{ };
-
-/** Recursive Termination Case. */
-template <
- typename Mask,
- typename IndexingMask,
- std::size_t ZeroCount
->
-struct clz_helper<Mask,IndexingMask,ZeroCount,false> {
- typedef mpl::size_t<ZeroCount - 1> type;
-};
-
-
-template <
- typename Mask,
- typename IndexingMask = bits_mask<
- typename make_unsigned< typename Mask::value_type >::type,
- 0
- >,
- std::size_t ZeroCount = 0,
- bool = true
->
-struct ctz_helper;
-
-/** Recursive loop. */
-
-template <
- typename Mask,
- typename IndexingMask,
- std::size_t ZeroCount
->
-struct ctz_helper<Mask,IndexingMask,ZeroCount,true>
- :ctz_helper<
- Mask,
- bits_mask<
- typename IndexingMask::value_type,
- IndexingMask::offset + 1
- >,
- ZeroCount + 1,
- ((IndexingMask::value & Mask::value) == 0)
- &&
- (IndexingMask::offset < bit_width< typename Mask::value_type >::value)
- >
-{ };
-
-/** Recursive tremination. */
-template <
- typename Mask,
- typename IndexingMask,
- std::size_t ZeroCount
->
-struct ctz_helper<Mask,IndexingMask,ZeroCount,false> {
- typedef mpl::size_t<ZeroCount - 1 > type;
-};
-
-} // end ptr_detail
-
-template <typename Mask>
-struct count_leading_zeros {
- typedef typename ptr_detail::clz_helper<Mask>::type type;
-};
-
-
-template <typename Mask>
-struct count_trailing_zeros {
- typedef typename ptr_detail::ctz_helper<Mask>::type type;
-};
-
-
-template <typename Mask, typename Policy>
-struct pointer_member_info {
- typedef Mask mask;
- typedef Policy policy;
-};
-
-
-}}} // end boost::detail::pointer_member
-
-#endif

Modified: sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/reference_builder.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/reference_builder.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/reference_builder.hpp 2010-07-22 13:15:06 EDT (Thu, 22 Jul 2010)
@@ -17,95 +17,6 @@
  */
 namespace boost { namespace detail {
 
-
-
-/** Checks to see if a name exists.
- * returns mpl::true_ or mpl::false_
- */
-template <typename BitfieldTuple, typename Name>
-struct name_exists {
- typedef typename mpl::not_<
- is_same <
- typename ::boost::mpl::find_if<
- typename BitfieldTuple::members,
- detail::match_name<
- mpl::_1,
- Name
- >
- >::type,
- typename mpl::end<
- typename BitfieldTuple::members
- >::type
- >
- >::type type;
-};
-
-/** Returns an element by which has a given name. */
-template <typename BitfieldTuple, typename Name>
-struct find_by_element_name {
-
- BOOST_STATIC_ASSERT(( name_exists<BitfieldTuple,Name>::type::value ));
-
- typedef typename mpl::deref<
- typename mpl::find_if<
- typename BitfieldTuple::members,
- detail::match_name<
- mpl::_1,
- Name
- >
- >::type
- >::type type;
-};
-
-/** Returns an element from members within bitfield_tuple
- * at a given index.
- */
-template <typename BitfieldTuple, std::size_t Index>
-struct find_by_element_index {
-
- BOOST_STATIC_ASSERT((
- mpl::size<typename BitfieldTuple::members>::value
- >
- Index
- ));
-
- typedef typename mpl::at_c<
- typename BitfieldTuple::members,
- Index
- >::type type;
-};
-
-
-
-
-/** Used for building the proxy reference types based on a given name.
- * The CV qualifiers refer to CV qualifiers which are applied to another type
- * then used by then used for the creation of a reference type that has the
- * correct qualifiers. This will take most or all of the guess work out of
- * creating reference types when needed.
- */
-template <typename BitfieldTuple, typename Name, typename CQualifier>
-struct make_reference_type_by_name {
-
- typedef typename find_by_element_name<BitfieldTuple,Name>::type bft_element;
- // apply qualifiers from CVQualifiers to the bft_element type
- // this will allow me to pass the qualifiers into the newly created reference
- // type then unpack them and apply them to the rest of the internal types
- // correctly.
-
- typedef typename mpl::if_<
- typename is_const<CQualifier>::type,
- typename add_const<bft_element>::type,
- bft_element
- >::type bft_element_c_qualifier_applied;
-
-
- typedef typename BitfieldTuple::template bitfield_reference<
- bft_element_c_qualifier_applied
- > type;
-};
-
-
 template <typename BitfieldTuple, typename Name>
 struct disable_if_reference_type_by_name {
     // search for the name,
@@ -184,67 +95,7 @@
 };
 
 
-template <typename BitfieldTuple, typename Name>
-struct get_reference_type_by_name {
- // search for the name,
- typedef typename mpl::find_if<
- typename BitfieldTuple::members,
- detail::match_name<
- mpl::_1,
- Name
- >
- >::type element_iter;
 
- // get the end iterator from members.
- typedef typename mpl::end<
- typename BitfieldTuple::members
- >::type member_end;
-
- // create the bitfield_reference type that will be returned if
- // disable_if is enabled.
- typedef typename BitfieldTuple::template bitfield_reference<
- typename mpl::if_<
- is_const<BitfieldTuple>,
- typename add_const<
- typename mpl::deref<
- element_iter
- >::type
- >::type,
- typename mpl::deref<
- element_iter
- >::type
- >::type
- > type;
-
-};
-
-template <typename BitfieldTuple, std::size_t Index>
-struct get_reference_type_by_index {
- // check to make sure index is valid
- typedef typename mpl::less<
- mpl::size_t<
- Index
- >,
- mpl::size<
- typename BitfieldTuple::members
- >
- > is_valid_index;
-
- // get the bitfield_element from members.
- typedef typename mpl::at_c<
- typename BitfieldTuple::members,
- Index
- >::type bft_element_t;
-
- // create the reference type
- typedef typename BitfieldTuple::template bitfield_reference<
- typename mpl::if_<
- is_const<BitfieldTuple>,
- typename add_const<bft_element_t>::type,
- bft_element_t
- >::type
- > type;
-};
 
 
 }} // end boost::detail

Modified: sandbox/SOC/2010/bit_masks/notes.txt
==============================================================================
--- sandbox/SOC/2010/bit_masks/notes.txt (original)
+++ sandbox/SOC/2010/bit_masks/notes.txt 2010-07-22 13:15:06 EDT (Thu, 22 Jul 2010)
@@ -6,36 +6,7 @@
 
 
 2) reference_builder.hpp
- a) TODO: Move the following meta-functions into the boost namespace
- and create some documentation on how they are used/when they are useful.
- I ) template <typename BitfieldTuple, typename Name>
- struct name_exists;
-
- II ) template <typename BitfieldTuple, typename Name>
- struct find_by_element_name;
-
- III ) template <typename BitfieldTuple, std::size_t Index>
- struct find_by_element_index;
-
- IV ) template <typename BitfieldTuple, typename Name>
- struct get_reference_type_by_name;
- a) Rename to get_proxy_type_by_name.
- b) create documentation for this meta function.
-
- V ) template <typename BitfieldTuple, std::size_t Index>
- struct get_reference_type_by_index;
- a) Rename to get_proxy_type_by_index.
- b) Create documentation for this meta function.
 
- b) TODO: Consider the removal of the following meta-function if it isn't
- used ad it doesn't seem like it is. It does however have some documentation.
-
- I ) template <
- typename BitfieldTuple,
- typename Name,
- typename CQualifier
- >
- struct make_reference_type_by_name;
 
 3) proxy_reference_policy.hpp
     a) Create the custom member.
@@ -160,7 +131,9 @@
         I ) Name exists
         II ) find_by_element_name
         III ) find_by_element_index
- IV ) make_reference_type_by_name <-- Maybe, if its actually being used.
+ IV ) make_reference_type_by_name <-- Maybe, if its actually being
+ used then I'll make a test for it other wise its going to be
+ removed.
         V ) enable_if_reference_type_by_index
         VI ) get_reference_type_by_name
         VII ) get_reference_type_by_index
@@ -242,10 +215,37 @@
                         TO BE ADDED TO TESTS SECTION
     Test which need to be created as a result of modifications or additions!
 --------------------------------------------------------------------------------
-1) Add interface test for the interface macros.
+1) !DONE! Add interface test for the interface macros. !DONE!
+2) interface meta-function test suite.
+
+--------------------------------------------------------------------------------
 
 
+ THINGS TO CREATE EXTERNAL DOCUMENTATION FOR
 --------------------------------------------------------------------------------
+
+inside of file <boost/integer/bitfield_tuple/interface_meta_functions.hpp>
+1) template <typename BitfieldTuple, typename Name>
+ struct name_exists;
+
+2) template <typename BitfieldTuple, typename Name>
+ struct find_by_element_name;
+
+3) template <typename BitfieldTuple, std::size_t Index>
+ struct find_by_element_index;
+
+4) template <typename BitfieldTuple, typename Name>
+ struct get_proxy_reference_type_by_name;
+
+5) template <typename BitfieldTuple, std::size_t Index>
+ struct get_proxy_reference_type_by_index;
+
+no particular file yet.
+6) How to make your own custom policy (After I finish the pointer stuff)
+
+--------------------------------------------------------------------------------
+
+
 This is used for keeping track of different ideas about different possible
 interfaces or implementation of bit masks.
 


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