Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62311 - in sandbox/SOC/2010/bit_masks: boost/integer boost/integer/details lib/integer/test
From: bbartmanboost_at_[hidden]
Date: 2010-05-30 11:17:21


Author: bbartman
Date: 2010-05-30 11:17:19 EDT (Sun, 30 May 2010)
New Revision: 62311
URL: http://svn.boost.org/trac/boost/changeset/62311

Log:
working on testing compound masks
Text files modified:
   sandbox/SOC/2010/bit_masks/boost/integer/bit_mask_group.hpp | 34 +++++++++++++++++++++
   sandbox/SOC/2010/bit_masks/boost/integer/compound_mask.hpp | 63 ++++++++++++++++++++++++++++++++++++++++
   sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_impl.hpp | 2 -
   sandbox/SOC/2010/bit_masks/boost/integer/integral_mask.hpp | 2
   sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2 | 1
   sandbox/SOC/2010/bit_masks/lib/integer/test/bit_mask_test.cpp | 2
   sandbox/SOC/2010/bit_masks/lib/integer/test/compound_mask_test.cpp | 24 +++++++++++++++
   7 files changed, 124 insertions(+), 4 deletions(-)

Modified: sandbox/SOC/2010/bit_masks/boost/integer/bit_mask_group.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/bit_mask_group.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/bit_mask_group.hpp 2010-05-30 11:17:19 EDT (Sun, 30 May 2010)
@@ -0,0 +1,34 @@
+// 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_BIT_MASK_GROUP_HPP
+#define BOOST_BIT_MASK_GROUP_HPP
+
+
+#include <boost/integer/compound_mask.hpp>
+#include <boost/mpl/list.hpp>
+
+
+typedef mpl::list<int> temp;
+namespace boost {
+
+template < typename Mask0,
+ typename Mask1 = mpl::nulltype_,
+ typename Mask2 = integral_mask< typename Mask0::value_type, 0 >,
+ typename Mask3 = integral_mask< typename Mask0::value_type, 0 >,
+ typename Mask4 = integral_mask< typename Mask0::value_type, 0 >,
+ typename Mask5 = integral_mask< typename Mask0::value_type, 0 >,
+ typename Mask6 = integral_mask< typename Mask0::value_type, 0 >,
+ typename Mask7 = integral_mask< typename Mask0::value_type, 0 >,
+ typename Mask8 = integral_mask< typename Mask0::value_type, 0 >,
+ typename Mask9 = integral_mask< typename Mask0::value_type, 0 >
+ >
+struct t;
+
+
+} // namespace
+
+#endif

Modified: sandbox/SOC/2010/bit_masks/boost/integer/compound_mask.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/compound_mask.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/compound_mask.hpp 2010-05-30 11:17:19 EDT (Sun, 30 May 2010)
@@ -4,7 +4,70 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 
 
+#ifndef BOOST_COMPOIND_BIT_MASK_HPP
+#define BOOST_COMPOIND_BIT_MASK_HPP
+
+#include <boost/integer/bit_mask.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/bitor.hpp>
+
 namespace boost {
 
 
+
+/** \brief This is a compound bitmask composed of 1 or up to 10 other bitmasks
+ * via bitwise or.
+ * There are a lot of issues which come with this particular meta function
+ * to start, what types should be allowed to compose the compound mask?
+ * For now the answer to that question is only mask which all have the same
+ * value type. In the future it may be OK to allow the user to use
+ * differing value_types but for now this is going to be restring the
+ * useage of this meta-function to types which all share the same type.
+ */
+template < typename Mask0,
+ typename Mask1 = integral_mask< typename Mask0::value_type, 0 >,
+ typename Mask2 = integral_mask< typename Mask0::value_type, 0 >,
+ typename Mask3 = integral_mask< typename Mask0::value_type, 0 >,
+ typename Mask4 = integral_mask< typename Mask0::value_type, 0 >,
+ typename Mask5 = integral_mask< typename Mask0::value_type, 0 >,
+ typename Mask6 = integral_mask< typename Mask0::value_type, 0 >,
+ typename Mask7 = integral_mask< typename Mask0::value_type, 0 >,
+ typename Mask8 = integral_mask< typename Mask0::value_type, 0 >,
+ typename Mask9 = integral_mask< typename Mask0::value_type, 0 >
+ >
+struct compound_mask
+ :integral_mask<
+ typename Mask0::value_type,
+ Mask0::value |
+ Mask1::value |
+ Mask2::value |
+ Mask3::value |
+ Mask4::value |
+ Mask5::value |
+ Mask6::value |
+ Mask7::value |
+ Mask8::value |
+ Mask9::value
+ >
+{
+ /** Re-exposing the composing masks.
+ * These aren't not meant to be iterated over as this is not a sequence
+ * which is the justification for not providing a tuple like interface
+ * for the this meta-function.
+ */
+ typedef Mask0 mask0;
+ typedef Mask1 mask1;
+ typedef Mask2 mask2;
+ typedef Mask3 mask3;
+ typedef Mask4 mask4;
+ typedef Mask5 mask5;
+ typedef Mask6 mask6;
+ typedef Mask7 mask7;
+ typedef Mask8 mask8;
+ typedef Mask9 mask9;
+};
+
+
 } // namespace boost
+
+#endif

Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_impl.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_impl.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_impl.hpp 2010-05-30 11:17:19 EDT (Sun, 30 May 2010)
@@ -7,8 +7,6 @@
 #ifndef BOOST_BIT_MASK_IMPL_HPP
 #define BOOST_BIT_MASK_IMPL_HPP
 
-
-
 namespace boost { namespace details {
 
 } // end of details namespace.

Modified: sandbox/SOC/2010/bit_masks/boost/integer/integral_mask.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/integral_mask.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/integral_mask.hpp 2010-05-30 11:17:19 EDT (Sun, 30 May 2010)
@@ -33,7 +33,7 @@
 {
     typedef integral_mask<T,Value> type;
 
- operator T() {
+ operator T() const{
         return type::value;
     }
 

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-05-30 11:17:19 EDT (Sun, 30 May 2010)
@@ -24,5 +24,6 @@
         [ run bitwise_high_bits_testing.cpp ]
         [ run bitwise_low_bits_testing.cpp ]
         [ run compound_mask_test.cpp ]
+ [ run bit_mask_group_test.cpp ]
     ;
 

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bit_mask_test.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bit_mask_test.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bit_mask_test.cpp 2010-05-30 11:17:19 EDT (Sun, 30 May 2010)
@@ -3,8 +3,8 @@
 // (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#include "test_type_list.hpp"
 #include <boost/integer/bit_mask.hpp>
+#include "test_type_list.hpp"
 
 template <typename T>
 void test_function() {

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/compound_mask_test.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/compound_mask_test.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/compound_mask_test.cpp 2010-05-30 11:17:19 EDT (Sun, 30 May 2010)
@@ -4,7 +4,31 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 
 #include <boost/integer/compound_mask.hpp>
+#include "test_type_list.hpp"
+
 
 int main() {
+
+ // first testing section for using compond mask.
+ {
+ // first test.
+ typedef compound_mask< high_bits<int,1> , low_bits<int,1> > combo_mask;
+ BOOST_ASSERT(( combo_mask() == (high_bits<int,1>() | low_bits<int,1>()) ));
+
+ typedef compound_mask< combo_mask, bit_mask<int, 3, 5> > combo_mask2;
+ BOOST_ASSERT(( combo_mask2() == (combo_mask() | bit_mask<int, 3, 5>() ) ));
+ BOOST_ASSERT(( combo_mask2() > 0 )) ;
+
+ typedef compound_mask<
+ combo_mask2,
+ bit_mask<int,15,10>,
+ integral_mask<int, 6>
+ > combo_mask3;
+
+ BOOST_ASSERT((combo_mask3() ==
+ ( combo_mask2() | bit_mask<int,15,10>() | integral_mask<int, 6>() )
+ ));
+
+ }
     return 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