Boost logo

Boost-Commit :

From: steven_at_[hidden]
Date: 2008-05-17 20:09:45


Author: steven_watanabe
Date: 2008-05-17 20:09:44 EDT (Sat, 17 May 2008)
New Revision: 45458
URL: http://svn.boost.org/trac/boost/changeset/45458

Log:
*** Still Unstable *** initial implementation of scaled units
Added:
   sandbox/units/boost/units/make_scaled_unit.hpp (contents, props changed)
   sandbox/units/libs/units/test/test_scaled_unit.cpp (contents, props changed)
Text files modified:
   sandbox/units/boost/units/base_unit.hpp | 5 ++-
   sandbox/units/boost/units/detail/conversion_impl.hpp | 6 ++--
   sandbox/units/boost/units/detail/dimensionless_unit.hpp | 9 +++--
   sandbox/units/boost/units/detail/unscale.hpp | 8 ++--
   sandbox/units/boost/units/dimensionless_type.hpp | 48 ----------------------------------
   sandbox/units/boost/units/heterogeneous_system.hpp | 55 ++++++++++++++++++++++++---------------
   sandbox/units/boost/units/io.hpp | 24 ++++++++++++++++
   sandbox/units/boost/units/scale.hpp | 23 ++--------------
   sandbox/units/boost/units/scaled_base_unit.hpp | 22 +++++----------
   sandbox/units/boost/units/systems/imperial/base_units/yard.hpp | 1
   sandbox/units/boost/units/systems/si/prefixes.hpp | 27 ++++++++++++++++++
   sandbox/units/libs/units/example/runtime_unit.cpp | 2 +
   sandbox/units/libs/units/test/Jamfile.v2 | 4 ++
   sandbox/units/libs/units/test_headers/generate_header.jam | 3 +
   14 files changed, 118 insertions(+), 119 deletions(-)

Modified: sandbox/units/boost/units/base_unit.hpp
==============================================================================
--- sandbox/units/boost/units/base_unit.hpp (original)
+++ sandbox/units/boost/units/base_unit.hpp 2008-05-17 20:09:44 EDT (Sat, 17 May 2008)
@@ -79,12 +79,13 @@
         typedef unit<
             Dim,
             heterogeneous_system<
- heterogeneous_system_pair<
+ heterogeneous_system_impl<
                     dimension_list<
                         heterogeneous_system_dim<Derived,static_rational<1> >,
                         dimensionless_type
>,
- Dim
+ Dim,
+ no_scale
>
>
> unit_type;

Modified: sandbox/units/boost/units/detail/conversion_impl.hpp
==============================================================================
--- sandbox/units/boost/units/detail/conversion_impl.hpp (original)
+++ sandbox/units/boost/units/detail/conversion_impl.hpp 2008-05-17 20:09:44 EDT (Sat, 17 May 2008)
@@ -8,8 +8,8 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#ifndef BOOST_UNITS_CONVERSION_IMPL_HPP
-#define BOOST_UNITS_CONVERSION_IMPL_HPP
+#ifndef BOOST_UNITS_DETAIL_CONVERSION_IMPL_HPP
+#define BOOST_UNITS_DETAIL_CONVERSION_IMPL_HPP
 
 #include <boost/mpl/bool.hpp>
 #include <boost/mpl/size.hpp>
@@ -249,7 +249,7 @@
     template<class Begin>
     struct apply
     {
- typedef unit<dimensionless_type, heterogeneous_system<heterogeneous_system_pair<dimensionless_type, dimensionless_type> > > unit_type;
+ typedef unit<dimensionless_type, heterogeneous_system<heterogeneous_system_impl<dimensionless_type, dimensionless_type, no_scale> > > unit_type;
         typedef one type;
         static type value() {
             return(type());

Modified: sandbox/units/boost/units/detail/dimensionless_unit.hpp
==============================================================================
--- sandbox/units/boost/units/detail/dimensionless_unit.hpp (original)
+++ sandbox/units/boost/units/detail/dimensionless_unit.hpp 2008-05-17 20:09:44 EDT (Sat, 17 May 2008)
@@ -2,7 +2,7 @@
 // unit/quantity manipulation and conversion
 //
 // Copyright (C) 2003-2008 Matthias Christian Schabel
-// Copyright (C) 2008 Steven Watanabe
+// Copyright (C) 2007-2008 Steven Watanabe
 //
 // Distributed under the Boost Software License, Version 1.0. (See
 // accompanying file LICENSE_1_0.txt or copy at
@@ -24,8 +24,8 @@
 template<class T>
 struct homogeneous_system;
 
-template<class T1, class T2>
-struct heterogeneous_system_pair;
+template<class T1, class T2, class Scale>
+struct heterogeneous_system_impl;
 
 namespace detail {
 
@@ -38,7 +38,8 @@
 template<>
 struct is_dimensionless_system<
    boost::units::heterogeneous_system<
- boost::units::heterogeneous_system_pair<
+ boost::units::heterogeneous_system_impl<
+ boost::units::dimensionless_type,
            boost::units::dimensionless_type,
            boost::units::dimensionless_type
>

Modified: sandbox/units/boost/units/detail/unscale.hpp
==============================================================================
--- sandbox/units/boost/units/detail/unscale.hpp (original)
+++ sandbox/units/boost/units/detail/unscale.hpp 2008-05-17 20:09:44 EDT (Sat, 17 May 2008)
@@ -8,8 +8,8 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#ifndef BOOST_UNITS_UNSCALE_HPP_INCLUDED
-#define BOOST_UNITS_UNSCALE_HPP_INCLUDED
+#ifndef BOOST_UNITS_DETAIL_UNSCALE_HPP_INCLUDED
+#define BOOST_UNITS_DETAIL_UNSCALE_HPP_INCLUDED
 
 #include <string>
 
@@ -37,8 +37,8 @@
 template<class T>
 struct heterogeneous_system;
 
-template<class T, class D>
-struct heterogeneous_system_pair;
+template<class T, class D, class Scale>
+struct heterogeneous_system_impl;
 
 template<class T, class E>
 struct heterogeneous_system_dim;

Modified: sandbox/units/boost/units/dimensionless_type.hpp
==============================================================================
--- sandbox/units/boost/units/dimensionless_type.hpp (original)
+++ sandbox/units/boost/units/dimensionless_type.hpp 2008-05-17 20:09:44 EDT (Sat, 17 May 2008)
@@ -2,7 +2,7 @@
 // unit/quantity manipulation and conversion
 //
 // Copyright (C) 2003-2008 Matthias Christian Schabel
-// Copyright (C) 2008 Steven Watanabe
+// Copyright (C) 2007-2008 Steven Watanabe
 //
 // Distributed under the Boost Software License, Version 1.0. (See
 // accompanying file LICENSE_1_0.txt or copy at
@@ -37,52 +37,6 @@
 
 } // namespace units
 
-#ifndef BOOST_UNITS_DOXYGEN
-
-namespace mpl {
-
-/// INTERNAL ONLY
-template<> struct deref<units::dimensionless_type> { };
-
-/// INTERNAL ONLY
-template<>
-struct plus<units::dimensionless_type, units::dimensionless_type>
-{
- typedef units::dimensionless_type type;
-};
-
-/// INTERNAL ONLY
-template<>
-struct minus<units::dimensionless_type, units::dimensionless_type>
-{
- typedef units::dimensionless_type type;
-};
-
-/// INTERNAL ONLY
-template<>
-struct times<units::dimensionless_type, units::dimensionless_type>
-{
- typedef units::dimensionless_type type;
-};
-
-/// INTERNAL ONLY
-template<>
-struct divides<units::dimensionless_type, units::dimensionless_type>
-{
- typedef units::dimensionless_type type;
-};
-
-/// INTERNAL ONLY
-template<>
-struct negate<units::dimensionless_type>
-{
- typedef units::dimensionless_type type;
-};
-
-} // namespace mpl
-
-#endif
-
 } // namespace boost
 
 #if BOOST_UNITS_HAS_BOOST_TYPEOF

Modified: sandbox/units/boost/units/heterogeneous_system.hpp
==============================================================================
--- sandbox/units/boost/units/heterogeneous_system.hpp (original)
+++ sandbox/units/boost/units/heterogeneous_system.hpp 2008-05-17 20:09:44 EDT (Sat, 17 May 2008)
@@ -54,13 +54,17 @@
 } // namespace detail
 
 /// INTERNAL ONLY
-template<class L, class Dimensions>
-struct heterogeneous_system_pair
+template<class L, class Dimensions, class Scale>
+struct heterogeneous_system_impl
 {
     typedef L type;
     typedef Dimensions dimensions;
+ typedef Scale scale;
 };
 
+/// INTERNAL ONLY
+typedef dimensionless_type no_scale;
+
 /// A system that can represent any possible combination
 /// of units at the expense of not preserving information
 /// about how it was created. Do not create specializations
@@ -87,7 +91,7 @@
     boost::units::unit< \
         Dimensions, \
         boost::units::heterogeneous_system< \
- boost::units::heterogeneous_system_pair< \
+ boost::units::heterogeneous_system_impl< \
                 boost::units::dimension_list< \
                     boost::units::heterogeneous_system_dim< \
                         BaseUnit, \
@@ -95,7 +99,8 @@
>, \
                     boost::units::dimensionless_type \
>, \
- Dimensions \
+ Dimensions, \
+ boost::units::no_scale \
> \
> \
>
@@ -109,7 +114,7 @@
 
 #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
 
-BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::heterogeneous_system_pair, (class)(class))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::heterogeneous_system_impl, (class)(class)(class))
 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::heterogeneous_system, (class))
 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::heterogeneous_system_dim, (class)(class))
 
@@ -235,7 +240,7 @@
         typename mpl::begin<typename System::type>::type,
         typename mpl::begin<exponents>::type
>::type unit_list;
- typedef heterogeneous_system<heterogeneous_system_pair<unit_list,Dimensions> > type;
+ typedef heterogeneous_system<heterogeneous_system_impl<unit_list, Dimensions, no_scale> > type;
 };
 
 template<class Dimensions, class T>
@@ -248,9 +253,10 @@
 struct multiply_systems
 {
     typedef heterogeneous_system<
- heterogeneous_system_pair<
+ heterogeneous_system_impl<
             typename mpl::times<typename T0::type, typename T1::type>::type,
- typename mpl::times<typename T0::dimensions, typename T1::dimensions>::type
+ typename mpl::times<typename T0::dimensions, typename T1::dimensions>::type,
+ typename mpl::times<typename T0::scale, typename T1::scale>::type
>
> type;
 };
@@ -259,9 +265,10 @@
 struct divide_systems
 {
     typedef heterogeneous_system<
- heterogeneous_system_pair<
+ heterogeneous_system_impl<
             typename mpl::divides<typename T0::type, typename T1::type>::type,
- typename mpl::divides<typename T0::dimensions, typename T1::dimensions>::type
+ typename mpl::divides<typename T0::dimensions, typename T1::dimensions>::type,
+ typename mpl::divides<typename T0::scale, typename T1::scale>::type
>
> type;
 };
@@ -273,9 +280,10 @@
 struct static_power<heterogeneous_system<S>, static_rational<N,D> >
 {
     typedef heterogeneous_system<
- heterogeneous_system_pair<
+ heterogeneous_system_impl<
             typename static_power<typename S::type, static_rational<N,D> >::type,
- typename static_power<typename S::dimensions, static_rational<N,D> >::type
+ typename static_power<typename S::dimensions, static_rational<N,D> >::type,
+ typename static_power<typename S::scale, static_rational<N,D> >::type
>
> type;
 };
@@ -285,9 +293,10 @@
 struct static_root<heterogeneous_system<S>, static_rational<N,D> >
 {
     typedef heterogeneous_system<
- heterogeneous_system_pair<
+ heterogeneous_system_impl<
             typename static_root<typename S::type, static_rational<N,D> >::type,
- typename static_root<typename S::dimensions, static_rational<N,D> >::type
+ typename static_root<typename S::dimensions, static_rational<N,D> >::type,
+ typename static_root<typename S::scale, static_rational<N,D> >::type
>
> type;
 };
@@ -329,13 +338,14 @@
 struct unscale<heterogeneous_system<T> >
 {
     typedef heterogeneous_system<
- heterogeneous_system_pair<
+ heterogeneous_system_impl<
             typename detail::unscale_heterogeneous_system_impl<
                 mpl::size<typename T::type>::value
>::template apply<
                 typename mpl::begin<typename T::type>::type
>::type,
- typename T::dimensions
+ typename T::dimensions,
+ no_scale
>
> type;
 };
@@ -380,9 +390,12 @@
 template<class T>
 struct get_scale_list<heterogeneous_system<T> >
 {
- typedef typename detail::get_scale_list_of_heterogeneous_system_impl<
- mpl::size<typename T::type>::value
- >::template apply<typename T::type>::type type;
+ typedef typename mpl::times<
+ typename detail::get_scale_list_of_heterogeneous_system_impl<
+ mpl::size<typename T::type>::value
+ >::template apply<typename T::type>::type,
+ typename T::scale
+ >::type type;
 };
 
 /// INTERNAL ONLY
@@ -397,8 +410,8 @@
 template<class System, class Dimension>
 struct check_system : mpl::false_ {};
 
-template<class System, class Dimension>
-struct check_system<heterogeneous_system<heterogeneous_system_pair<System, Dimension> >, Dimension> : mpl::true_ {};
+template<class System, class Dimension, class Scale>
+struct check_system<heterogeneous_system<heterogeneous_system_impl<System, Dimension, Scale> >, Dimension> : mpl::true_ {};
 
 } // namespace detail
 

Modified: sandbox/units/boost/units/io.hpp
==============================================================================
--- sandbox/units/boost/units/io.hpp (original)
+++ sandbox/units/boost/units/io.hpp 2008-05-17 20:09:44 EDT (Sat, 17 May 2008)
@@ -2,7 +2,7 @@
 // unit/quantity manipulation and conversion
 //
 // Copyright (C) 2003-2008 Matthias Christian Schabel
-// Copyright (C) 2008 Steven Watanabe
+// Copyright (C) 2007-2008 Steven Watanabe
 //
 // Distributed under the Boost Software License, Version 1.0. (See
 // accompanying file LICENSE_1_0.txt or copy at
@@ -145,6 +145,24 @@
     };
 };
 
+template<int N>
+struct print_scale_impl {
+ template<class Begin, class Os>
+ struct apply {
+ static void value(Os& os) {
+ os << ' ' << mpl::deref<Begin>::type::base << '^' << mpl::deref<Begin>::type::exponent;
+ }
+ };
+};
+
+template<>
+struct print_scale_impl<0> {
+ template<class Begin, class Os>
+ struct apply {
+ static void value(Os&) {}
+ };
+};
+
 } // namespace detail
 
 /// Print an @c unit as a list of base units and exponents e.g "m s^-1"
@@ -159,6 +177,10 @@
 template<class Char, class Traits, class Dimension, class System>
 std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os, const unit<Dimension, heterogeneous_system<System> >&)
 {
+ detail::print_scale_impl<mpl::size<typename System::scale>::value>::template apply<
+ typename mpl::begin<typename System::scale>::type,
+ std::basic_ostream<Char, Traits>
+ >::value(os);
     detail::print_impl<mpl::size<typename System::type>::value>::template apply<
         typename mpl::begin<typename System::type>::type,
         std::basic_ostream<Char, Traits> >::value(os);

Added: sandbox/units/boost/units/make_scaled_unit.hpp
==============================================================================
--- (empty file)
+++ sandbox/units/boost/units/make_scaled_unit.hpp 2008-05-17 20:09:44 EDT (Sat, 17 May 2008)
@@ -0,0 +1,33 @@
+// Boost.Units - A C++ library for zero-overhead dimensional analysis and
+// unit/quantity manipulation and conversion
+//
+// Copyright (C) 2003-2008 Matthias Christian Schabel
+// Copyright (C) 2007-2008 Steven Watanabe
+//
+// 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_UNITS_MAKE_SCALED_UNIT_HPP_INCLUDED
+#define BOOST_UNITS_MAKE_SCALED_UNIT_HPP_INCLUDED
+
+#include <boost/units/heterogeneous_system.hpp>
+#include <boost/units/unit.hpp>
+
+namespace boost {
+namespace units {
+
+template<class Unit, class Scale>
+struct make_scaled_unit {
+ typedef typename make_scaled_unit<typename reduce_unit<Unit>::type, Scale>::type type;
+};
+
+template<class Dimension, class UnitList, class OldScale, class Scale>
+struct make_scaled_unit<unit<Dimension, heterogeneous_system<heterogeneous_system_impl<UnitList, Dimension, OldScale> > >, Scale> {
+ typedef unit<Dimension, heterogeneous_system<heterogeneous_system_impl<UnitList, Dimension, typename mpl::times<OldScale, dimension_list<Scale, dimensionless_type> >::type> > > type;
+};
+
+}
+}
+
+#endif

Modified: sandbox/units/boost/units/scale.hpp
==============================================================================
--- sandbox/units/boost/units/scale.hpp (original)
+++ sandbox/units/boost/units/scale.hpp 2008-05-17 20:09:44 EDT (Sat, 17 May 2008)
@@ -13,18 +13,7 @@
 
 #include <string>
 
-#include <boost/mpl/bool.hpp>
-#include <boost/mpl/size.hpp>
-#include <boost/mpl/begin.hpp>
-#include <boost/mpl/next.hpp>
-#include <boost/mpl/deref.hpp>
-#include <boost/mpl/plus.hpp>
-#include <boost/mpl/times.hpp>
-#include <boost/mpl/negate.hpp>
-#include <boost/mpl/less.hpp>
-
 #include <boost/units/config.hpp>
-#include <boost/units/dimension.hpp>
 #include <boost/units/static_rational.hpp>
 #include <boost/units/units_fwd.hpp>
 #include <boost/units/detail/one.hpp>
@@ -34,15 +23,6 @@
 
 namespace units {
 
-template<class T>
-struct heterogeneous_system;
-
-template<class T, class D>
-struct heterogeneous_system_pair;
-
-template<class T, class E>
-struct heterogeneous_system_dim;
-
 template<class S, class Scale>
 struct scaled_base_unit;
 
@@ -72,6 +52,9 @@
     static std::string symbol_prefix() { return(std::string()); }
 };
 
+template<long Base>
+const long scale<Base, static_rational<0> >::base;
+
 #ifndef BOOST_UNITS_DOXYGEN
 
 #define BOOST_UNITS_SCALE_SPECIALIZATION(base_,exponent_,val,name,symbol) \

Modified: sandbox/units/boost/units/scaled_base_unit.hpp
==============================================================================
--- sandbox/units/boost/units/scaled_base_unit.hpp (original)
+++ sandbox/units/boost/units/scaled_base_unit.hpp 2008-05-17 20:09:44 EDT (Sat, 17 May 2008)
@@ -8,19 +8,12 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#ifndef BOOST_UNITS_BASE_UNIT_HPP_INCLUDED
-#define BOOST_UNITS_BASE_UNIT_HPP_INCLUDED
+#ifndef BOOST_UNITS_SCALED_BASE_UNIT_HPP_INCLUDED
+#define BOOST_UNITS_SCALED_BASE_UNIT_HPP_INCLUDED
 
 #include <string>
 
 #include <boost/mpl/bool.hpp>
-#include <boost/mpl/size.hpp>
-#include <boost/mpl/begin.hpp>
-#include <boost/mpl/next.hpp>
-#include <boost/mpl/deref.hpp>
-#include <boost/mpl/plus.hpp>
-#include <boost/mpl/times.hpp>
-#include <boost/mpl/negate.hpp>
 #include <boost/mpl/less.hpp>
 #include <boost/type_traits/is_same.hpp>
 
@@ -28,8 +21,6 @@
 #include <boost/units/dimension.hpp>
 #include <boost/units/static_rational.hpp>
 #include <boost/units/units_fwd.hpp>
-#include <boost/units/detail/one.hpp>
-#include <boost/units/detail/static_rational_power.hpp>
 
 namespace boost {
 
@@ -38,8 +29,8 @@
 template<class T>
 struct heterogeneous_system;
 
-template<class T, class D>
-struct heterogeneous_system_pair;
+template<class T, class D, class Scale>
+struct heterogeneous_system_impl;
 
 template<class T, class E>
 struct heterogeneous_system_dim;
@@ -67,12 +58,13 @@
     typedef unit<
         dimension_type,
         heterogeneous_system<
- heterogeneous_system_pair<
+ heterogeneous_system_impl<
                 dimension_list<
                     heterogeneous_system_dim<scaled_base_unit,static_rational<1> >,
                     dimensionless_type
>,
- dimension_type
+ dimension_type,
+ dimensionless_type
>
>
> unit_type;

Modified: sandbox/units/boost/units/systems/imperial/base_units/yard.hpp
==============================================================================
--- sandbox/units/boost/units/systems/imperial/base_units/yard.hpp (original)
+++ sandbox/units/boost/units/systems/imperial/base_units/yard.hpp 2008-05-17 20:09:44 EDT (Sat, 17 May 2008)
@@ -17,6 +17,7 @@
 #include <boost/units/base_unit.hpp>
 #include <boost/units/systems/physical_dimensions/length.hpp>
 #include <boost/units/systems/SI/base_units/meter.hpp>
+#include <boost/units/systems/detail/non_si_unit.hpp>
 
 BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(imperial, yard, "yard", "yd", 0.9144, SI::meter_base_unit, -301); // exact conversion
 

Modified: sandbox/units/boost/units/systems/si/prefixes.hpp
==============================================================================
--- sandbox/units/boost/units/systems/si/prefixes.hpp (original)
+++ sandbox/units/boost/units/systems/si/prefixes.hpp 2008-05-17 20:09:44 EDT (Sat, 17 May 2008)
@@ -2,7 +2,7 @@
 // unit/quantity manipulation and conversion
 //
 // Copyright (C) 2003-2008 Matthias Christian Schabel
-// Copyright (C) 2008 Steven Watanabe
+// Copyright (C) 2007-2008 Steven Watanabe
 //
 // Distributed under the Boost Software License, Version 1.0. (See
 // accompanying file LICENSE_1_0.txt or copy at
@@ -19,6 +19,31 @@
 
 namespace SI {
 
+//#define BOOST_UNITS_METRIC_PREFIX(exponent, name) \
+// typedef make_scaled_unit<dimensionless, scale<10, static_rational<exponent> > >::type name ## _type;\
+// BOOST_UNITS_STATIC_CONSTANT(name, name ## _type)
+//
+//BOOST_UNITS_METRIC_PREFIX(-24, yocto);
+//BOOST_UNITS_METRIC_PREFIX(-21, zepto);
+//BOOST_UNITS_METRIC_PREFIX(-18, atto);
+//BOOST_UNITS_METRIC_PREFIX(-15, femto);
+//BOOST_UNITS_METRIC_PREFIX(-12, pico);
+//BOOST_UNITS_METRIC_PREFIX(-9, nano);
+//BOOST_UNITS_METRIC_PREFIX(-6, micro);
+//BOOST_UNITS_METRIC_PREFIX(-3, milli);
+//BOOST_UNITS_METRIC_PREFIX(-2, centi);
+//BOOST_UNITS_METRIC_PREFIX(-1, deci);
+//BOOST_UNITS_METRIC_PREFIX(1, deka);
+//BOOST_UNITS_METRIC_PREFIX(2, hecto);
+//BOOST_UNITS_METRIC_PREFIX(3, kilo);
+//BOOST_UNITS_METRIC_PREFIX(6, mega);
+//BOOST_UNITS_METRIC_PREFIX(9, giga);
+//BOOST_UNITS_METRIC_PREFIX(12, tera);
+//BOOST_UNITS_METRIC_PREFIX(15, peta);
+//BOOST_UNITS_METRIC_PREFIX(18, exa);
+//BOOST_UNITS_METRIC_PREFIX(21, zetta);
+//BOOST_UNITS_METRIC_PREFIX(24, yotta);
+
 BOOST_UNITS_STATIC_CONSTANT(yocto,long double) = (1e-24); ///< metric prefix for 1.0e-24
 BOOST_UNITS_STATIC_CONSTANT(zepto,long double) = (1e-21); ///< metric prefix for 1.0e-21
 BOOST_UNITS_STATIC_CONSTANT(atto,long double) = (1e-18); ///< metric prefix for 1.0e-18

Modified: sandbox/units/libs/units/example/runtime_unit.cpp
==============================================================================
--- sandbox/units/libs/units/example/runtime_unit.cpp (original)
+++ sandbox/units/libs/units/example/runtime_unit.cpp 2008-05-17 20:09:44 EDT (Sat, 17 May 2008)
@@ -15,12 +15,14 @@
 #include <boost/units/cmath.hpp>
 #include <boost/units/systems/si/length.hpp>
 #include <boost/units/systems/base_units.hpp>
+#include <boost/units/systems/imperial/base_units/foot.hpp>
 
 //[runtime_unit_snippet_1
 
 namespace {
 
 using namespace boost::units;
+using imperial::foot_base_unit;
 
 std::map<std::string, quantity<SI::length> > known_units;
 

Modified: sandbox/units/libs/units/test/Jamfile.v2
==============================================================================
--- sandbox/units/libs/units/test/Jamfile.v2 (original)
+++ sandbox/units/libs/units/test/Jamfile.v2 2008-05-17 20:09:44 EDT (Sat, 17 May 2008)
@@ -20,6 +20,8 @@
 
 import testing ;
 
+#alias test_framework : $(BOOST_ROOT)/libs/test/build//boost_unit_test_framework ;
+
 {
   test-suite units
    :
@@ -38,6 +40,8 @@
     [ run test_cmath.cpp : : : : ]
     [ run test_limits.cpp : : : : ]
     [ run test_custom_unit.cpp : : : : ]
+# [ run test_scaled_conversion.cpp : : : : ]
+# [ run test_scaled_unit.cpp test_framework : : : : ]
 # [ run check_conversion_defs.cpp $(checklibs) : : : <dependency>$(check-conversion-dependencies) : ]
     [ compile-fail fail_implicit_conversion.cpp : : ]
     [ compile-fail fail_quantity_construct.cpp : : ]

Added: sandbox/units/libs/units/test/test_scaled_unit.cpp
==============================================================================
--- (empty file)
+++ sandbox/units/libs/units/test/test_scaled_unit.cpp 2008-05-17 20:09:44 EDT (Sat, 17 May 2008)
@@ -0,0 +1,46 @@
+// Boost.Units - A C++ library for zero-overhead dimensional analysis and
+// unit/quantity manipulation and conversion
+//
+// Copyright (C) 2003-2008 Matthias Christian Schabel
+// Copyright (C) 2007-2008 Steven Watanabe
+//
+// 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)
+
+/**
+\file
+
+\brief test_scaled_conversion.cpp
+
+\detailed
+Test unit scaling
+
+Output:
+@verbatim
+@endverbatim
+**/
+
+#define BOOST_TEST_MAIN
+
+#include <boost/units/systems/si/prefixes.hpp>
+#include <boost/units/systems/si/time.hpp>
+
+#include <sstream>
+
+#include <boost/test/unit_test.hpp>
+
+namespace bu = boost::units;
+namespace SI = boost::units::SI;
+
+BOOST_AUTO_TEST_CASE(test_floating_point) {
+ bu::quantity<SI::time> s1 = 12.5 * SI::seconds;
+ bu::quantity<SI::time> s2(SI::nano * s1);
+ BOOST_CHECK_CLOSE_FRACTION(1e-9 * s1.value(), s2.value(), 0.000000001);
+}
+
+BOOST_AUTO_TEST_CASE(test_output) {
+ std::stringstream stream;
+ stream << SI::nano * 12.5 * SI::seconds;
+ BOOST_CHECK_EQUAL(stream.str(), "12.5 10^-9 s");
+}

Modified: sandbox/units/libs/units/test_headers/generate_header.jam
==============================================================================
--- sandbox/units/libs/units/test_headers/generate_header.jam (original)
+++ sandbox/units/libs/units/test_headers/generate_header.jam 2008-05-17 20:09:44 EDT (Sat, 17 May 2008)
@@ -17,7 +17,8 @@
     print.output $(target) ;
 
     for local file in $(sources) {
- print.text "#include <$(file:G=)>" ;
+ print.text "#include <$(file:G=)>
+" ;
     }
 
 }


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