Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r63104 - in sandbox/SOC/2010/bit_masks: boost/integer boost/integer/details/bft lib/integer/test lib/integer/test/bft_testing
From: bbartmanboost_at_[hidden]
Date: 2010-06-19 13:30:17


Author: bbartman
Date: 2010-06-19 13:30:16 EDT (Sat, 19 Jun 2010)
New Revision: 63104
URL: http://svn.boost.org/trac/boost/changeset/63104

Log:
renaming an internal type. to make it look more consistant accross the rest of the implementation
Removed:
   sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/twos_complement_testing.cpp
Text files modified:
   sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple.hpp | 73 ++++++++++++++++++---------------------
   sandbox/SOC/2010/bit_masks/boost/integer/details/bft/arg_parse_impl.hpp | 2
   sandbox/SOC/2010/bit_masks/boost/integer/details/bft/bft_element.hpp | 4 +-
   sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2 | 1
   sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/name_accessor_test.cpp | 2
   sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/ref_type_testing.cpp | 10 ++--
   sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_tuple_test.cpp | 9 ++--
   7 files changed, 47 insertions(+), 54 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-19 13:30:16 EDT (Sat, 19 Jun 2010)
@@ -54,13 +54,6 @@
     template <typename MaskInfo>
     struct bit_ref {
 
- /** typedefs
- * return_type - is the type which is retrieved from
- * within storage is turned into and returned as.
- *
- * mask - contains all information needed to iteract with data in the
- * the stroage.
- */
         typedef typename MaskInfo::return_type return_type;
         typedef bit_ref<MaskInfo> _self;
         typedef typename make_unsigned<
@@ -82,27 +75,20 @@
          * Because the bit_ref is an abstraction of a reference then it also
          * must behave like a reference type.
          */
- bit_ref(storage_type& ref)
+ bit_ref(storage_type& ref, int = 0)
             :_ref( *reinterpret_cast<unsigned_storage_type*>(&ref) )
         { }
 
- /** const Reference constructor.
- * Because the bit_ref is an abstraction of a reference then it also
- * must behave like a reference type.
- */
- bit_ref(storage_type const& ref)
- :_ref( *reinterpret_cast<unsigned_storage_type const*>(&ref) )
- { }
 
         /** copy constructor.
- * This is because references are copy construtible.
+ * This is because references are copy constructible.
          */
- // bit_ref( bit_ref<MaskInfo> const& x)
- // :_ref( x )
- // { }
+ bit_ref( bit_ref<MaskInfo> const& x)
+ :_ref( x._ref )
+ { }
         
         /** Implicit conversion operator
- * this allows for implicit conversion to the return_type.
+ * Returns the value retrieved from the mask.
          */
         operator return_type() const {
             return static_cast< return_type >( _ref.get() );
@@ -125,19 +111,15 @@
         bit_ref();
     };
 
+ /** Const reference type.
+ * This class is used when the storage type is const so that mutability
+ * can be removed from the reference type.
+ */
     template <typename MaskInfo>
     struct const_bit_ref {
 
- /** typedefs
- * return_type - is the type which is retrieved from
- * within storage is turned into and returned as.
- *
- * mask - contains all information needed to iteract with data in the
- * the stroage.
- */
         typedef typename MaskInfo::return_type return_type;
         typedef bit_ref<MaskInfo> _self;
- typedef typename make_unsigned<return_type>::type unsigned_return_type;
         typedef typename make_unsigned<
             storage_type
>::type const unsigned_storage_type;
@@ -162,14 +144,14 @@
         { }
 
         /** copy constructor.
- * This is because references are copy construtible.
+ * This is because references are copy constructible.
          */
- // bit_ref( bit_ref<MaskInfo> const& x)
- // :_ref( x )
- // { }
+ const_bit_ref( bit_ref<MaskInfo> const& x)
+ :_ref( x.ref )
+ { }
         
         /** Implicit conversion operator
- * this allows for implicit conversion to the return_type.
+ * Returns the value of the bit mask.
          */
         operator return_type() const {
             return _ref.get();
@@ -206,18 +188,24 @@
      * TODO: The signature of this will need to change possibly to
      * use enable_if or some form of internal dispatching.
      * XXX
+ * TODO: look into the creation of a member wise constructor.
      */
- template <typename T>
- bitfield_tuple(T const& x);
+ template <typename T> bitfield_tuple(T const& x);
+
+
 
- // TODO: look into the creation of a member wise constructor.
-
+ /** Assignment Operator.
+ * Provides assignment from this type to another.
+ */
     _self const& operator=(_self const& x) {
         this->_data = x._data;
     }
 
- /**
- * Retuns a copy of the internally stored type.
+ /** Internal storage accessors
+ * Returns a reference of the internally stored type. This provides the
+ * ability for the fusion sequence extension to work correctly.
+ * TODO Remove this at a later time if I can figure out how to make get
+ * callable from within the fusion functions.
      */
     //@{
     storage_type const& data( ) const {
@@ -234,6 +222,11 @@
     std::string to_string() const;
     //@}
 
+
+ /** Meta-member-function
+ * searches within member for a bft_element with name_type the same as Name
+ * and returns mpl::true_ if it found it and mpl::false_ if not.
+ */
     template <typename Name>
     struct name_exists {
         typedef typename mpl::not_<
@@ -249,7 +242,7 @@
                     members
>::type
>
- >::type type;
+ >::type type;
     };
 
     /** Get function interfaces.

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-19 13:30:16 EDT (Sat, 19 Jun 2010)
@@ -139,7 +139,7 @@
     typedef StoragePolicy storage_policy;
     typedef typename mpl::push_back<
         FieldVector,
- bitfield_element_<
+ bitfield_element<
             ReturnType,
             NameType,
             Offset,

Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bft/bft_element.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bft/bft_element.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bft/bft_element.hpp 2010-06-19 13:30:16 EDT (Sat, 19 Jun 2010)
@@ -16,12 +16,12 @@
             typename Offset,
             typename FieldWidth
>
-struct bitfield_element_ {
+struct bitfield_element {
     typedef ReturnType return_type;
     typedef NameType name_type;
     typedef Offset offset;
     typedef FieldWidth field_width;
- typedef bitfield_element_<return_type, name_type, offset, field_width> type;
+ typedef bitfield_element<return_type, name_type, offset, field_width> type;
 };
 
 

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-19 13:30:16 EDT (Sat, 19 Jun 2010)
@@ -37,7 +37,6 @@
         [ run bft_testing/ref_type_testing.cpp ]
         [ run bft_testing/name_accessor_test.cpp ]
         [ run bft_testing/get_interface_test.cpp ]
- [ run bft_testing/twos_complement_testing.cpp ]
         [ compile bft_testing/compile_pass/fusion_includes.cpp ]
         [ run bft_testing/fusion_iterator_testing.cpp ]
         [ run bft_testing/fusion_integration_testing.cpp ]

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/name_accessor_test.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/name_accessor_test.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/name_accessor_test.cpp 2010-06-19 13:30:16 EDT (Sat, 19 Jun 2010)
@@ -17,7 +17,7 @@
 
 
     typedef mpl::vector<
- details::bitfield_element_<
+ details::bitfield_element<
             int,
             red,
             mpl::size_t<0>,

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/ref_type_testing.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/ref_type_testing.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/ref_type_testing.cpp 2010-06-19 13:30:16 EDT (Sat, 19 Jun 2010)
@@ -18,19 +18,19 @@
> bft;
 
 
-typedef details::bitfield_element_< char,
+typedef details::bitfield_element< char,
 red,mpl::size_t<9>,mpl::size_t<8> > element_1;
 
-typedef details::bitfield_element_< char,
+typedef details::bitfield_element< char,
 red, mpl::size_t<0>, mpl::size_t<8> > element_2;
 
-typedef details::bitfield_element_< char,
+typedef details::bitfield_element< char,
 red, mpl::size_t<8>, mpl::size_t<8> > element_3;
 
-typedef details::bitfield_element_< char,
+typedef details::bitfield_element< char,
 red, mpl::size_t<16>, mpl::size_t<8> > element_4;
 
-typedef details::bitfield_element_< char,
+typedef details::bitfield_element< char,
 red, mpl::size_t<24>, mpl::size_t<8> > element_5;
 
 int main() {

Deleted: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/twos_complement_testing.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/twos_complement_testing.cpp 2010-06-19 13:30:16 EDT (Sat, 19 Jun 2010)
+++ (empty file)
@@ -1,68 +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)
-
-
-
-// boost includes.
-#include <boost/integer/details/arbitrary_twos_complement.hpp>
-#include <boost/assert.hpp>
-
-
-using namespace boost;
-int main() {
- // basic cast storing a negative number.
- {
- std::size_t storage = 0;
- char temp = -2;
- storage = twos_complement_encoding< char, 4, unsigned int >( temp );
- BOOST_ASSERT((storage == 0xe));
-
- temp = twos_complement_decoding< unsigned int, 4, char >( storage );
- BOOST_ASSERT((temp == -2));
- }
- // storing a non negative number with a signed type.
- {
- std::size_t storage = 0;
- char temp = 2;
- storage = twos_complement_encoding< char, 4, unsigned int >( temp );
- BOOST_ASSERT((storage == bits_mask<std::size_t, 1>::value ));
-
- temp = twos_complement_decoding< unsigned int, 4, char >( storage );
- BOOST_ASSERT((temp == 2));
- }
- // storing an unsigned number
- {
- std::size_t storage = 0;
- unsigned char temp = 2;
- storage = twos_complement_encoding< unsigned char, 4, unsigned int >( temp );
- BOOST_ASSERT((storage == bits_mask<std::size_t, 1>::value ));
-
- temp = twos_complement_decoding< unsigned int, 4, unsigned char >( storage );
- BOOST_ASSERT((temp == 2));
- }
- // corner case stroing a boolean
- {
- std::size_t storage = 0;
- bool temp = true;
- storage = twos_complement_encoding< bool, 4, unsigned int >( temp );
- BOOST_ASSERT((storage == bits_mask<std::size_t, 0>::value ));
-
- temp = twos_complement_decoding< unsigned int, 4, bool >( storage );
- BOOST_ASSERT((temp == true));
- }
-
- // corner case storing a type with width one.
- {
- std::size_t storage = 0;
- char temp = 1;
- storage = twos_complement_encoding< char, 1, unsigned int >( temp );
- BOOST_ASSERT((storage == bits_mask<std::size_t, 0>::value ));
-
- temp = twos_complement_decoding< unsigned int, 1, char >( storage );
- BOOST_ASSERT((temp == 1));
- }
- return 0;
-}
-

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_tuple_test.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_tuple_test.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_tuple_test.cpp 2010-06-19 13:30:16 EDT (Sat, 19 Jun 2010)
@@ -30,6 +30,7 @@
         typedef storage<int> storage_t;
         BOOST_MPL_ASSERT(( is_same<storage_t::storage_type, int> ));
     }
+
     // testing member type
     {
         typedef member<int, blue, 6 > member_test_1;
@@ -37,10 +38,10 @@
         BOOST_ASSERT(( is_same<member_test_1::name_type, blue>::value ));
         BOOST_ASSERT(( member_test_1::field_width == 6 ));
     }
- // testing bitfield_element_
+ // testing bitfield_element
     {
- // bitfield_element_
- typedef details::bitfield_element_<
+ // bitfield_element
+ typedef details::bitfield_element<
             int, red, mpl::size_t<5>, mpl::size_t<4>
> bft_element_test_1;
         BOOST_ASSERT(( is_same<bft_element_test_1::return_type, int>::value ));
@@ -67,7 +68,7 @@
     BOOST_MPL_ASSERT((
         is_same<
             mpl::front< pa::field_vector >::type,
- details::bitfield_element_<
+ details::bitfield_element<
                 int,
                 red,
                 mpl::size_t<0>,


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