Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65898 - in branches/release: . boost boost/bimap boost/fusion boost/gil boost/graph boost/intrusive boost/msm boost/numeric/ublas boost/property_tree boost/signals boost/spirit boost/spirit/home boost/spirit/home/karma boost/spirit/home/support boost/statechart boost/tr1 boost/units boost/units/detail boost/units/systems/si/codata boost/uuid boost/variant boost/wave libs libs/array/test libs/bimap libs/graph_parallel libs/mpl/doc/refmanual libs/mpl/doc/src/refmanual libs/msm libs/numeric/ublas libs/numeric/ublas/doc libs/property_tree libs/serialization/test libs/signals libs/spirit libs/spirit/classic/example libs/spirit/doc libs/spirit/example libs/spirit/phoenix libs/spirit/test libs/spirit/test/qi libs/static_assert libs/timer libs/tr1 libs/units/doc libs/units/example libs/units/test libs/utility libs/utility/swap/test libs/uuid libs/wave more status tools tools/bcp tools/regression tools/regression/src tools/release tools/wave
From: steven_at_[hidden]
Date: 2010-10-11 10:55:10


Author: steven_watanabe
Date: 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
New Revision: 65898
URL: http://svn.boost.org/trac/boost/changeset/65898

Log:
Merge units from trunk
Added:
   branches/release/libs/units/example/autoprefixes.cpp
      - copied unchanged from r62532, /trunk/libs/units/example/autoprefixes.cpp
Properties modified:
   branches/release/ (props changed)
   branches/release/INSTALL (props changed)
   branches/release/Jamroot (props changed)
   branches/release/LICENSE_1_0.txt (props changed)
   branches/release/boost/ (props changed)
   branches/release/boost-build.jam (props changed)
   branches/release/boost.css (props changed)
   branches/release/boost.png (props changed)
   branches/release/boost/bimap/ (props changed)
   branches/release/boost/config.hpp (props changed)
   branches/release/boost/fusion/ (props changed)
   branches/release/boost/gil/ (props changed)
   branches/release/boost/graph/ (props changed)
   branches/release/boost/intrusive/ (props changed)
   branches/release/boost/msm/ (props changed)
   branches/release/boost/numeric/ublas/ (props changed)
   branches/release/boost/property_tree/ (props changed)
   branches/release/boost/signals/ (props changed)
   branches/release/boost/spirit/ (props changed)
   branches/release/boost/spirit/home/ (props changed)
   branches/release/boost/spirit/home/karma/ (props changed)
   branches/release/boost/spirit/home/support/attributes.hpp (props changed)
   branches/release/boost/statechart/ (props changed)
   branches/release/boost/tr1/ (props changed)
   branches/release/boost/uuid/ (props changed)
   branches/release/boost/variant/ (props changed)
   branches/release/boost/wave/ (props changed)
   branches/release/bootstrap.bat (props changed)
   branches/release/bootstrap.sh (props changed)
   branches/release/index.htm (props changed)
   branches/release/libs/ (props changed)
   branches/release/libs/array/test/array0.cpp (props changed)
   branches/release/libs/bimap/ (props changed)
   branches/release/libs/graph_parallel/ (props changed)
   branches/release/libs/mpl/doc/refmanual/broken-compiler-workarounds.html (props changed)
   branches/release/libs/mpl/doc/refmanual/categorized-index-concepts.html (props changed)
   branches/release/libs/mpl/doc/refmanual/cfg-no-preprocessed-headers.html (props changed)
   branches/release/libs/mpl/doc/refmanual/composition-and-argument-binding.html (props changed)
   branches/release/libs/mpl/doc/refmanual/data-types-concepts.html (props changed)
   branches/release/libs/mpl/doc/refmanual/data-types-miscellaneous.html (props changed)
   branches/release/libs/mpl/doc/refmanual/extensible-associative-sequence.html (props changed)
   branches/release/libs/mpl/doc/refmanual/inserter-class.html (props changed)
   branches/release/libs/mpl/doc/refmanual/tag-dispatched-metafunction.html (props changed)
   branches/release/libs/mpl/doc/refmanual/trivial-metafunctions-summary.html (props changed)
   branches/release/libs/mpl/doc/src/refmanual/Iterators-Iterator.rst (props changed)
   branches/release/libs/msm/ (props changed)
   branches/release/libs/numeric/ublas/ (props changed)
   branches/release/libs/numeric/ublas/doc/ (props changed)
   branches/release/libs/property_tree/ (props changed)
   branches/release/libs/serialization/test/ (props changed)
   branches/release/libs/serialization/test/test_diamond_complex.cpp (props changed)
   branches/release/libs/signals/ (props changed)
   branches/release/libs/spirit/ (props changed)
   branches/release/libs/spirit/classic/example/ (props changed)
   branches/release/libs/spirit/doc/ (props changed)
   branches/release/libs/spirit/example/ (props changed)
   branches/release/libs/spirit/phoenix/ (props changed)
   branches/release/libs/spirit/test/ (props changed)
   branches/release/libs/spirit/test/qi/optional.cpp (props changed)
   branches/release/libs/static_assert/ (props changed)
   branches/release/libs/timer/ (props changed)
   branches/release/libs/tr1/ (props changed)
   branches/release/libs/utility/swap.html (props changed)
   branches/release/libs/utility/swap/test/std_bitset.cpp (props changed)
   branches/release/libs/utility/value_init_test.cpp (props changed)
   branches/release/libs/uuid/ (props changed)
   branches/release/libs/wave/ (props changed)
   branches/release/more/ (props changed)
   branches/release/rst.css (props changed)
   branches/release/status/ (props changed)
   branches/release/status/Jamfile.v2 (props changed)
   branches/release/status/explicit-failures-markup.xml (props changed)
   branches/release/tools/ (props changed)
   branches/release/tools/bcp/ (props changed)
   branches/release/tools/regression/ (props changed)
   branches/release/tools/regression/src/library_status.cpp (props changed)
   branches/release/tools/release/ (props changed)
   branches/release/tools/wave/ (props changed)
Text files modified:
   branches/release/boost/units/absolute.hpp | 8
   branches/release/boost/units/base_dimension.hpp | 4
   branches/release/boost/units/base_unit.hpp | 4
   branches/release/boost/units/cmath.hpp | 51 +++
   branches/release/boost/units/config.hpp | 2
   branches/release/boost/units/conversion.hpp | 3
   branches/release/boost/units/detail/dimensionless_unit.hpp | 18
   branches/release/boost/units/detail/one.hpp | 5
   branches/release/boost/units/dim.hpp | 4
   branches/release/boost/units/dimensionless_quantity.hpp | 7
   branches/release/boost/units/dimensionless_type.hpp | 5
   branches/release/boost/units/dimensionless_unit.hpp | 7
   branches/release/boost/units/get_dimension.hpp | 12
   branches/release/boost/units/get_system.hpp | 9
   branches/release/boost/units/heterogeneous_system.hpp | 5
   branches/release/boost/units/io.hpp | 499 +++++++++++++++++++++++++++++++++++----
   branches/release/boost/units/is_dim.hpp | 5
   branches/release/boost/units/is_dimension_list.hpp | 5
   branches/release/boost/units/is_dimensionless.hpp | 9
   branches/release/boost/units/is_dimensionless_quantity.hpp | 5
   branches/release/boost/units/is_dimensionless_unit.hpp | 5
   branches/release/boost/units/is_quantity.hpp | 7
   branches/release/boost/units/is_quantity_of_dimension.hpp | 7
   branches/release/boost/units/is_quantity_of_system.hpp | 7
   branches/release/boost/units/is_unit.hpp | 7
   branches/release/boost/units/is_unit_of_dimension.hpp | 7
   branches/release/boost/units/is_unit_of_system.hpp | 7
   branches/release/boost/units/limits.hpp | 6
   branches/release/boost/units/make_scaled_unit.hpp | 15 +
   branches/release/boost/units/make_system.hpp | 10
   branches/release/boost/units/operators.hpp | 23
   branches/release/boost/units/physical_dimensions.hpp | 22 +
   branches/release/boost/units/pow.hpp | 18
   branches/release/boost/units/reduce_unit.hpp | 3
   branches/release/boost/units/scale.hpp | 8
   branches/release/boost/units/static_rational.hpp | 2
   branches/release/boost/units/systems/si/codata/electromagnetic_constants.hpp | 13
   branches/release/boost/units/units_fwd.hpp | 7
   branches/release/libs/units/doc/Jamfile.v2 | 9
   branches/release/libs/units/doc/units.qbk | 136 ++++++++--
   branches/release/libs/units/example/complex.cpp | 2
   branches/release/libs/units/example/composite_output.cpp | 2
   branches/release/libs/units/example/conversion.cpp | 2
   branches/release/libs/units/example/conversion_factor.cpp | 2
   branches/release/libs/units/example/dimension.cpp | 2
   branches/release/libs/units/example/heterogeneous_unit.cpp | 2
   branches/release/libs/units/example/kitchen_sink.cpp | 2
   branches/release/libs/units/example/non_base_dimension.cpp | 2
   branches/release/libs/units/example/performance.cpp | 2
   branches/release/libs/units/example/quantity.cpp | 2
   branches/release/libs/units/example/quaternion.cpp | 2
   branches/release/libs/units/example/radar_beam_height.cpp | 2
   branches/release/libs/units/example/systems.cpp | 2
   branches/release/libs/units/example/temperature.cpp | 2
   branches/release/libs/units/example/tutorial.cpp | 52 ++-
   branches/release/libs/units/example/unit.cpp | 2
   branches/release/libs/units/test/Jamfile.v2 | 21 +
   branches/release/libs/units/test/fail_add_temperature.cpp | 2
   branches/release/libs/units/test/fail_adl_detail.cpp | 2
   branches/release/libs/units/test/fail_base_dimension.cpp | 2
   branches/release/libs/units/test/fail_heterogeneous_unit.cpp | 2
   branches/release/libs/units/test/fail_implicit_conversion.cpp | 2
   branches/release/libs/units/test/fail_quantity_add.cpp | 2
   branches/release/libs/units/test/fail_quantity_add_assign.cpp | 2
   branches/release/libs/units/test/fail_quantity_assign.cpp | 2
   branches/release/libs/units/test/fail_quantity_construct.cpp | 2
   branches/release/libs/units/test/fail_quantity_non_unit.cpp | 2
   branches/release/libs/units/test/fail_quantity_scalar_add.cpp | 2
   branches/release/libs/units/test/fail_quantity_scalar_sub.cpp | 2
   branches/release/libs/units/test/fail_quantity_sub_assign.cpp | 2
   branches/release/libs/units/test/fail_quantity_subtract.cpp | 2
   branches/release/libs/units/test/fail_quantity_unit_add.cpp | 2
   branches/release/libs/units/test/fail_quantity_unit_subtract.cpp | 2
   branches/release/libs/units/test/fail_scalar_quantity_add.cpp | 2
   branches/release/libs/units/test/fail_scalar_quantity_sub.cpp | 2
   branches/release/libs/units/test/fail_unit_quantity_add.cpp | 2
   branches/release/libs/units/test/fail_unit_quantity_subtract.cpp | 2
   branches/release/libs/units/test/test_absolute.cpp | 2
   branches/release/libs/units/test/test_base_dimension.cpp | 2
   branches/release/libs/units/test/test_cmath.cpp | 2
   branches/release/libs/units/test/test_constants.cpp | 2
   branches/release/libs/units/test/test_conversion.cpp | 2
   branches/release/libs/units/test/test_custom_unit.cpp | 12
   branches/release/libs/units/test/test_dimensionless_quantity.cpp | 2
   branches/release/libs/units/test/test_header.hpp | 2
   branches/release/libs/units/test/test_implicit_conversion.cpp | 2
   branches/release/libs/units/test/test_limits.cpp | 2
   branches/release/libs/units/test/test_negative_denominator.cpp | 2
   branches/release/libs/units/test/test_output.cpp | 205 +++++++++++++++
   branches/release/libs/units/test/test_predicates.cpp | 2
   branches/release/libs/units/test/test_quantity.cpp | 2
   branches/release/libs/units/test/test_reduce_unit.cpp | 2
   branches/release/libs/units/test/test_scaled_conversion.cpp | 2
   branches/release/libs/units/test/test_scaled_unit.cpp | 2
   branches/release/libs/units/test/test_trig.cpp | 7
   branches/release/libs/units/test/test_unit.cpp | 2
   branches/release/libs/units/test/test_unscale.cpp | 4
   97 files changed, 1129 insertions(+), 260 deletions(-)

Modified: branches/release/boost/units/absolute.hpp
==============================================================================
--- branches/release/boost/units/absolute.hpp (original)
+++ branches/release/boost/units/absolute.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -8,6 +8,12 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
+///
+/// \file
+/// \brief Absolute units (points rather than vectors).
+/// \details Operations between absolute units, and relative units like temperature differences.
+///
+
 #ifndef BOOST_UNITS_ABSOLUTE_HPP
 #define BOOST_UNITS_ABSOLUTE_HPP
 
@@ -23,7 +29,7 @@
 /// originally for temperatures, this class implements operators for absolute units
 /// so that addition of a relative unit to an absolute unit results in another
 /// absolute unit : absolute<T> +/- T -> absolute<T> and subtraction of one absolute
-/// unit from another results in a relative unit : absolute<T> - absolute<T> -> T
+/// unit from another results in a relative unit : absolute<T> - absolute<T> -> T.
 template<class Y>
 class absolute
 {

Modified: branches/release/boost/units/base_dimension.hpp
==============================================================================
--- branches/release/boost/units/base_dimension.hpp (original)
+++ branches/release/boost/units/base_dimension.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -8,6 +8,10 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
+/// \file
+/// \brief base dimensions (mass, length, time...).
+/// \details base dimension definition registration.
+
 #ifndef BOOST_UNITS_BASE_DIMENSION_HPP
 #define BOOST_UNITS_BASE_DIMENSION_HPP
 

Modified: branches/release/boost/units/base_unit.hpp
==============================================================================
--- branches/release/boost/units/base_unit.hpp (original)
+++ branches/release/boost/units/base_unit.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -8,6 +8,10 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
+/// \file
+/// \brief base unit (meter, kg, sec...).
+/// \details base unit definition registration.
+
 #ifndef BOOST_UNITS_BASE_UNIT_HPP
 #define BOOST_UNITS_BASE_UNIT_HPP
 

Modified: branches/release/boost/units/cmath.hpp
==============================================================================
--- branches/release/boost/units/cmath.hpp (original)
+++ branches/release/boost/units/cmath.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -24,22 +24,22 @@
 #include <boost/units/pow.hpp>
 #include <boost/units/quantity.hpp>
 #include <boost/units/detail/cmath_impl.hpp>
+#include <boost/units/detail/dimensionless_unit.hpp>
 
 #include <boost/units/systems/si/plane_angle.hpp>
 
-/// \file
-/// \brief Overloads of functions in \<cmath\> for quantities
-///
-/// \detailed Only functions for which a dimensionally-correct result type
-/// can be determined are overloaded. All functions work with dimensionless
-/// quantities.
+/// \file
+/// \brief Overloads of functions in \<cmath\> for quantities.
+/// \details Only functions for which a dimensionally-correct result type
+/// can be determined are overloaded.
+/// All functions work with dimensionless quantities.
 
 // BOOST_PREVENT_MACRO_SUBSTITUTION is needed on certain compilers that define
 // some <cmath> functions as macros; it is used for all functions even though it
 // isn't necessary -- I didn't want to think :)
 //
 // the form using namespace detail; return(f(x)); is used
-// to enable ADL for UDTs
+// to enable ADL for UDTs.
 
 namespace boost {
 
@@ -604,6 +604,15 @@
     return quantity<unit<plane_angle_dimension, homogeneous_system<System> >,Y>(acos(val.value())*si::radians);
 }
 
+/// acos of dimensionless quantity returning angle in radians
+template<class Y>
+quantity<angle::radian_base_unit::unit_type,Y>
+acos(const quantity<unit<dimensionless_type, heterogeneous_dimensionless_system>,Y>& val)
+{
+ using std::acos;
+ return quantity<angle::radian_base_unit::unit_type,Y>::from_value(acos(val.value()));
+}
+
 /// asin of dimensionless quantity returning angle in same system
 template<class Y,class System>
 quantity<unit<plane_angle_dimension, homogeneous_system<System> >,Y>
@@ -613,6 +622,15 @@
     return quantity<unit<plane_angle_dimension, homogeneous_system<System> >,Y>(asin(val.value())*si::radians);
 }
 
+/// asin of dimensionless quantity returning angle in radians
+template<class Y>
+quantity<angle::radian_base_unit::unit_type,Y>
+asin(const quantity<unit<dimensionless_type, heterogeneous_dimensionless_system>,Y>& val)
+{
+ using std::asin;
+ return quantity<angle::radian_base_unit::unit_type,Y>::from_value(asin(val.value()));
+}
+
 /// atan of dimensionless quantity returning angle in same system
 template<class Y,class System>
 quantity<unit<plane_angle_dimension, homogeneous_system<System> >,Y>
@@ -622,6 +640,15 @@
     return quantity<unit<plane_angle_dimension, homogeneous_system<System> >,Y>(atan(val.value())*si::radians);
 }
 
+/// atan of dimensionless quantity returning angle in radians
+template<class Y>
+quantity<angle::radian_base_unit::unit_type,Y>
+atan(const quantity<unit<dimensionless_type, heterogeneous_dimensionless_system>, Y>& val)
+{
+ using std::atan;
+ return quantity<angle::radian_base_unit::unit_type,Y>::from_value(atan(val.value()));
+}
+
 /// atan2 of @c value_type returning angle in radians
 template<class Y, class Dimension, class System>
 quantity<unit<plane_angle_dimension, homogeneous_system<System> >, Y>
@@ -632,6 +659,16 @@
     return quantity<unit<plane_angle_dimension, homogeneous_system<System> >, Y>(atan2(y.value(),x.value())*si::radians);
 }
 
+/// atan2 of @c value_type returning angle in radians
+template<class Y, class Dimension, class System>
+quantity<angle::radian_base_unit::unit_type,Y>
+atan2(const quantity<unit<Dimension, heterogeneous_system<System> >, Y>& y,
+ const quantity<unit<Dimension, heterogeneous_system<System> >, Y>& x)
+{
+ using std::atan2;
+ return quantity<angle::radian_base_unit::unit_type,Y>::from_value(atan2(y.value(),x.value()));
+}
+
 } // namespace units
 
 } // namespace boost

Modified: branches/release/boost/units/config.hpp
==============================================================================
--- branches/release/boost/units/config.hpp (original)
+++ branches/release/boost/units/config.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -91,7 +91,7 @@
 /// is not layout compatible with T
 #define BOOST_UNITS_REQUIRE_LAYOUT_COMPATIBILITY
 
-/// If defined will diasable a preprocessor check that the
+/// If defined will disable a preprocessor check that the
 /// compiler is able to handle the library.
 #define BOOST_UNITS_NO_COMPILER_CHECK
 

Modified: branches/release/boost/units/conversion.hpp
==============================================================================
--- branches/release/boost/units/conversion.hpp (original)
+++ branches/release/boost/units/conversion.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -11,6 +11,9 @@
 #ifndef BOOST_UNITS_CONVERSION_HPP
 #define BOOST_UNITS_CONVERSION_HPP
 
+/// \file
+/// \brief Template for defining conversions between quantities.
+
 #include <boost/units/detail/conversion_impl.hpp>
 
 namespace boost {

Modified: branches/release/boost/units/detail/dimensionless_unit.hpp
==============================================================================
--- branches/release/boost/units/detail/dimensionless_unit.hpp (original)
+++ branches/release/boost/units/detail/dimensionless_unit.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -26,6 +26,14 @@
 template<class T1, class T2, class Scale>
 struct heterogeneous_system_impl;
 
+typedef boost::units::heterogeneous_system<
+ boost::units::heterogeneous_system_impl<
+ boost::units::dimensionless_type,
+ boost::units::dimensionless_type,
+ boost::units::dimensionless_type
+ >
+> heterogeneous_dimensionless_system;
+
 namespace detail {
 
 template<class System>
@@ -39,15 +47,7 @@
 };
 
 template<>
-struct void_if_dimensionless<
- boost::units::heterogeneous_system<
- boost::units::heterogeneous_system_impl<
- boost::units::dimensionless_type,
- boost::units::dimensionless_type,
- boost::units::dimensionless_type
- >
- >
-> {
+struct void_if_dimensionless<heterogeneous_dimensionless_system> {
     typedef void type;
 };
 

Modified: branches/release/boost/units/detail/one.hpp
==============================================================================
--- branches/release/boost/units/detail/one.hpp (original)
+++ branches/release/boost/units/detail/one.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -97,6 +97,11 @@
     return(result);
 }
 
+template<class T>
+inline bool operator>(const boost::units::one&, const T& t) {
+ return(1 > t);
+}
+
 } // namespace units
 
 } // namespace boost

Modified: branches/release/boost/units/dim.hpp
==============================================================================
--- branches/release/boost/units/dim.hpp (original)
+++ branches/release/boost/units/dim.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -21,7 +21,7 @@
 #include <boost/units/static_rational.hpp>
 #include <boost/units/detail/dim_impl.hpp>
 
-/// \file
+/// \file dim.hpp
 /// \brief Handling of fundamental dimension/exponent pairs.
 
 namespace boost {
@@ -36,7 +36,7 @@
 
 /// \brief Dimension tag/exponent pair for a single fundamental dimension.
 ///
-/// \detailed
+/// \details
 /// The dim class represents a single dimension tag/dimension exponent pair.
 /// That is, @c dim<tag_type,value_type> is a pair where @c tag_type represents the
 /// fundamental dimension being represented and @c value_type represents the

Modified: branches/release/boost/units/dimensionless_quantity.hpp
==============================================================================
--- branches/release/boost/units/dimensionless_quantity.hpp (original)
+++ branches/release/boost/units/dimensionless_quantity.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -11,6 +11,11 @@
 #ifndef BOOST_UNITS_DIMENSIONLESS_QUANTITY_HPP
 #define BOOST_UNITS_DIMENSIONLESS_QUANTITY_HPP
 
+///
+/// \file
+/// \brief Utility class to simplify construction of dimensionless quantities.
+///
+
 #include <boost/units/dimensionless_unit.hpp>
 #include <boost/units/quantity.hpp>
 
@@ -18,7 +23,7 @@
 
 namespace units {
 
-/// utility class to simplify construction of dimensionless quantities
+/// Utility class to simplify construction of dimensionless quantities.
 template<class System,class Y>
 struct dimensionless_quantity
 {

Modified: branches/release/boost/units/dimensionless_type.hpp
==============================================================================
--- branches/release/boost/units/dimensionless_type.hpp (original)
+++ branches/release/boost/units/dimensionless_type.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -11,6 +11,11 @@
 #ifndef BOOST_UNITS_DIMENSIONLESS_TYPE_HPP
 #define BOOST_UNITS_DIMENSIONLESS_TYPE_HPP
 
+///
+/// \file
+/// \brief Dimension lists in which all exponents resolve to zero reduce to @c dimensionless_type.
+///
+
 #include <boost/mpl/long.hpp>
 #include <boost/mpl/deref.hpp>
 #include <boost/mpl/arithmetic.hpp>

Modified: branches/release/boost/units/dimensionless_unit.hpp
==============================================================================
--- branches/release/boost/units/dimensionless_unit.hpp (original)
+++ branches/release/boost/units/dimensionless_unit.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -11,6 +11,11 @@
 #ifndef BOOST_UNITS_DIMENSIONLESS_UNIT_HPP
 #define BOOST_UNITS_DIMENSIONLESS_UNIT_HPP
 
+///
+/// \file
+/// \brief Utility class to simplify construction of dimensionless units in a system.
+///
+
 #include <boost/units/dimensionless_type.hpp>
 #include <boost/units/unit.hpp>
 
@@ -18,7 +23,7 @@
 
 namespace units {
 
-/// utility class to simplify construction of dimensionless units in a system
+/// Utility class to simplify construction of dimensionless units in a system.
 template<class System>
 struct dimensionless_unit
 {

Modified: branches/release/boost/units/get_dimension.hpp
==============================================================================
--- branches/release/boost/units/get_dimension.hpp (original)
+++ branches/release/boost/units/get_dimension.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -11,6 +11,12 @@
 #ifndef BOOST_UNITS_GET_DIMENSION_HPP
 #define BOOST_UNITS_GET_DIMENSION_HPP
 
+///
+/// \file
+/// \brief Get the dimension of a unit, absolute unit and quantity.
+/// \details
+///
+
 #include <boost/units/units_fwd.hpp>
 
 namespace boost {
@@ -20,21 +26,21 @@
 template<class T>
 struct get_dimension {};
 
-/// get the dimension of a unit
+/// Get the dimension of a unit.
 template<class Dim,class System>
 struct get_dimension< unit<Dim,System> >
 {
     typedef Dim type;
 };
 
-/// get the dimension of an absolute unit
+/// Get the dimension of an absolute unit.
 template<class Unit>
 struct get_dimension< absolute<Unit> >
 {
     typedef typename get_dimension<Unit>::type type;
 };
 
-/// get the dimension of a quantity
+/// Get the dimension of a quantity.
 template<class Unit,class Y>
 struct get_dimension< quantity<Unit,Y> >
 {

Modified: branches/release/boost/units/get_system.hpp
==============================================================================
--- branches/release/boost/units/get_system.hpp (original)
+++ branches/release/boost/units/get_system.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -11,6 +11,9 @@
 #ifndef BOOST_UNITS_GET_SYSTEM_HPP
 #define BOOST_UNITS_GET_SYSTEM_HPP
 
+/// \file
+/// \brief Get the system of a unit, absolute unit or quantity.
+
 #include <boost/units/units_fwd.hpp>
 
 namespace boost {
@@ -20,21 +23,21 @@
 template<class T>
 struct get_system {};
 
-/// get the system of a unit
+/// Get the system of a unit.
 template<class Dim,class System>
 struct get_system< unit<Dim,System> >
 {
     typedef System type;
 };
 
-/// get the system of an absolute unit
+/// Get the system of an absolute unit.
 template<class Unit>
 struct get_system< absolute<Unit> >
 {
     typedef typename get_system<Unit>::type type;
 };
 
-/// get the system of a quantity
+/// Get the system of a quantity.
 template<class Unit,class Y>
 struct get_system< quantity<Unit,Y> >
 {

Modified: branches/release/boost/units/heterogeneous_system.hpp
==============================================================================
--- branches/release/boost/units/heterogeneous_system.hpp (original)
+++ branches/release/boost/units/heterogeneous_system.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -11,6 +11,9 @@
 #ifndef BOOST_UNITS_HETEROGENEOUS_SYSTEM_HPP
 #define BOOST_UNITS_HETEROGENEOUS_SYSTEM_HPP
 
+/// \file
+/// \brief A heterogeneous system is a sorted list of base unit/exponent pairs.
+
 #include <boost/mpl/bool.hpp>
 #include <boost/mpl/plus.hpp>
 #include <boost/mpl/times.hpp>
@@ -45,7 +48,7 @@
 // A normal system is a sorted list of base units.
 // A heterogeneous system is a sorted list of base unit/exponent pairs.
 // As long as we don't need to convert heterogeneous systems
-// directly everything is cool
+// directly everything is cool.
 
 template<class T>
 struct is_zero : mpl::false_ {};

Modified: branches/release/boost/units/io.hpp
==============================================================================
--- branches/release/boost/units/io.hpp (original)
+++ branches/release/boost/units/io.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -2,7 +2,7 @@
 // unit/quantity manipulation and conversion
 //
 // Copyright (C) 2003-2008 Matthias Christian Schabel
-// Copyright (C) 2007-2008 Steven Watanabe
+// Copyright (C) 2007-2010 Steven Watanabe
 //
 // Distributed under the Boost Software License, Version 1.0. (See
 // accompanying file LICENSE_1_0.txt or copy at
@@ -11,20 +11,24 @@
 #ifndef BOOST_UNITS_IO_HPP
 #define BOOST_UNITS_IO_HPP
 
+/// \file
+/// \brief Stream input and output for rationals, units and quantities.
+/// \details Functions and manipulators for output and input of units and quantities.
+/// symbol and name format, and engineering and binary autoprefix.
+/// Serialization output is also supported.
+
 #include <cassert>
+#include <cmath>
 #include <string>
 #include <iosfwd>
 #include <ios>
 #include <sstream>
 
-#include <boost/mpl/size.hpp>
-#include <boost/mpl/begin.hpp>
-#include <boost/mpl/next.hpp>
-#include <boost/mpl/deref.hpp>
 #include <boost/serialization/nvp.hpp>
 
 #include <boost/units/units_fwd.hpp>
 #include <boost/units/heterogeneous_system.hpp>
+#include <boost/units/make_scaled_unit.hpp>
 #include <boost/units/quantity.hpp>
 #include <boost/units/scale.hpp>
 #include <boost/units/static_rational.hpp>
@@ -51,7 +55,7 @@
 
 namespace units {
 
-// get string representation of arbitrary type
+// get string representation of arbitrary type.
 template<class T> std::string to_string(const T& t)
 {
     std::stringstream sstr;
@@ -61,13 +65,13 @@
     return sstr.str();
 }
 
-// get string representation of integral-valued @c static_rational
+/// get string representation of integral-valued @c static_rational.
 template<integer_type N> std::string to_string(const static_rational<N>&)
 {
     return to_string(N);
 }
 
-// get string representation of @c static_rational
+/// get string representation of @c static_rational.
 template<integer_type N, integer_type D> std::string to_string(const static_rational<N,D>&)
 {
     return '(' + to_string(N) + '/' + to_string(D) + ')';
@@ -81,29 +85,41 @@
     return os;
 }
 
-/// traits template for unit names
+/// traits template for unit names.
 template<class BaseUnit>
 struct base_unit_info
 {
+ /// INTERNAL ONLY
+ typedef void base_unit_info_primary_template;
     /// The full name of the unit (returns BaseUnit::name() by default)
     static std::string name()
     {
         return(BaseUnit::name());
     }
-
     /// The symbol for the base unit (Returns BaseUnit::symbol() by default)
     static std::string symbol()
     {
- return(BaseUnit::symbol());
+ return(BaseUnit::symbol()); /// \returns BaseUnit::symbol(), for example "m"
     }
 };
 
-enum format_mode
+/// \enum format_mode format of output of units, for example "m" or "meter".
+enum format_mode
+{
+ symbol_fmt = 0, /// default - reduces unit names to known symbols for both base and derived units.
+ name_fmt = 1, /// output full unit names for base and derived units, for example "meter".
+ raw_fmt = 2, /// output only symbols for base units (but not derived units), for example "m".
+ typename_fmt = 3, /// output demangled typenames (useful only for diagnosis).
+ fmt_mask = 3 /// Bits used for format.
+};
+
+/// \enum autoprefix_mode automatic scaling and prefix (controlled by value of quantity) a, if any,
+enum autoprefix_mode
 {
- symbol_fmt = 0, // default - reduces unit names to known symbols for both base and derived units
- name_fmt, // output full unit names for base and derived units
- raw_fmt, // output only symbols for base units
- typename_fmt // output demangled typenames
+ autoprefix_none = 0, /// No automatic prefix.
+ autoprefix_engineering = 4, /// Scale and prefix with 10^3 multiples, 1234.5 m output as 1.2345 km.
+ autoprefix_binary = 8, /// Scale and prefix with 2^10 (1024) multiples, 1024 as 1 kb.
+ autoprefix_mask = 12 /// Bits used for autoprefix.
 };
 
 namespace detail {
@@ -141,48 +157,103 @@
 
 } // namespace detail
 
+/// returns flags controlling output.
+inline long get_flags(std::ios_base& ios, long mask)
+{
+ return(ios.iword(detail::xalloc_key_holder<true>::value) & mask);
+}
+
+/// Set new flags controlling output format.
+inline void set_flags(std::ios_base& ios, long new_flags, long mask)
+{
+ assert((~mask & new_flags) == 0);
+ long& flags = ios.iword(detail::xalloc_key_holder<true>::value);
+ flags = (flags & ~mask) | new_flags;
+}
+
+/// returns flags controlling output format.
 inline format_mode get_format(std::ios_base& ios)
 {
- return(static_cast<format_mode>(ios.iword(detail::xalloc_key_holder<true>::value)));
+ return(static_cast<format_mode>((get_flags)(ios, fmt_mask)));
 }
 
+/// Set new flags controlling output format.
 inline void set_format(std::ios_base& ios, format_mode new_mode)
 {
- ios.iword(detail::xalloc_key_holder<true>::value) = static_cast<long>(new_mode);
+ (set_flags)(ios, new_mode, fmt_mask);
 }
 
+/// Set new flags for type_name output format.
 inline std::ios_base& typename_format(std::ios_base& ios)
 {
     (set_format)(ios, typename_fmt);
     return(ios);
 }
 
+/// set new flag for raw format output, for example "m".
 inline std::ios_base& raw_format(std::ios_base& ios)
 {
     (set_format)(ios, raw_fmt);
     return(ios);
 }
 
+/// set new format flag for symbol output, for example "m".
 inline std::ios_base& symbol_format(std::ios_base& ios)
 {
     (set_format)(ios, symbol_fmt);
     return(ios);
 }
 
+/// set new format for name output, for example "meter".
 inline std::ios_base& name_format(std::ios_base& ios)
 {
     (set_format)(ios, name_fmt);
     return(ios);
 }
 
+/// get autoprefix flags for output.
+inline autoprefix_mode get_autoprefix(std::ios_base& ios)
+{
+ return static_cast<autoprefix_mode>((get_flags)(ios, autoprefix_mask));
+}
+
+/// Get format for output.
+inline void set_autoprefix(std::ios_base& ios, autoprefix_mode new_mode)
+{
+ (set_flags)(ios, new_mode, autoprefix_mask);
+}
+
+/// Clear autoprefix flags.
+inline std::ios_base& no_prefix(std::ios_base& ios)
+{
+ (set_autoprefix)(ios, autoprefix_none);
+ return ios;
+}
+
+/// Set flag for engineering prefix, so 1234.5 m displays as "1.2345 km".
+inline std::ios_base& engineering_prefix(std::ios_base& ios)
+{
+ (set_autoprefix)(ios, autoprefix_engineering);
+ return ios;
+}
+
+/// Set flag for binary prefix, so 1024 byte displays as "1 Kib".
+inline std::ios_base& binary_prefix(std::ios_base& ios)
+{
+ (set_autoprefix)(ios, autoprefix_binary);
+ return ios;
+}
+
 namespace detail {
 
+/// \return exponent string like "^1/2".
 template<integer_type N, integer_type D>
 inline std::string exponent_string(const static_rational<N,D>& r)
 {
     return '^' + to_string(r);
 }
 
+/// \return empty exponent string for integer rational like 2.
 template<>
 inline std::string exponent_string(const static_rational<1>&)
 {
@@ -201,7 +272,7 @@
     return base_unit_info<typename T::tag_type>::name() + exponent_string(typename T::value_type());
 }
 
-// stringify with symbols
+// stringify with symbols.
 template<int N>
 struct symbol_string_impl
 {
@@ -268,7 +339,7 @@
     };
 };
 
-// stringify with names
+// stringify with names.
 template<int N>
 struct name_string_impl
 {
@@ -407,7 +478,7 @@
     return(str);
 }
 
-// this overload catches scaled units that have a single base unit
+// This overload catches scaled units that have a single base unit
 // raised to the first power. It causes si::nano * si::meters to not
 // put parentheses around the meters. i.e. nm rather than n(m)
 /// INTERNAL ONLY
@@ -423,7 +494,7 @@
     return(str);
 }
 
-// this overload is necessary to disambiguate.
+// This overload is necessary to disambiguate.
 // it catches units that are unscaled and have a single
 // base unit raised to the first power. It is treated the
 // same as any other unscaled unit.
@@ -437,16 +508,30 @@
     return(str);
 }
 
-
-// this overload catches scaled units that have a single scaled base unit
+// This overload catches scaled units that have a single scaled base unit
 // raised to the first power. It moves that scaling on the base unit
 // to the unit level scaling and recurses. By doing this we make sure that
-// si::milli * si::kilograms will print g rather than mkg
+// si::milli * si::kilograms will print g rather than mkg.
+//
+// This transformation will not be applied if base_unit_info is specialized
+// for the scaled base unit.
 //
 /// INTERNAL ONLY
 template<class Dimension,class Unit,class UnitScale, class Scale, class Subformatter>
 inline std::string
-to_string_impl(const unit<Dimension, heterogeneous_system<heterogeneous_system_impl<list<heterogeneous_system_dim<scaled_base_unit<Unit, UnitScale>, static_rational<1> >, dimensionless_type>, Dimension, Scale> > >&, Subformatter f)
+to_string_impl(
+ const unit<
+ Dimension,
+ heterogeneous_system<
+ heterogeneous_system_impl<
+ list<heterogeneous_system_dim<scaled_base_unit<Unit, UnitScale>, static_rational<1> >, dimensionless_type>,
+ Dimension,
+ Scale
+ >
+ >
+ >&,
+ Subformatter f,
+ typename base_unit_info<scaled_base_unit<Unit, UnitScale> >::base_unit_info_primary_template* = 0)
 {
     return(f(
         unit<
@@ -455,7 +540,7 @@
                 heterogeneous_system_impl<
                     list<heterogeneous_system_dim<Unit, static_rational<1> >, dimensionless_type>,
                     Dimension,
- typename mpl::times<Scale, list<UnitScale, dimensionless_type> >::type
+ typename mpl::times<Scale, list<scale_list_dim<UnitScale>, dimensionless_type> >::type
>
>
>()));
@@ -466,7 +551,19 @@
 /// INTERNAL ONLY
 template<class Dimension,class Unit,class UnitScale,class Subformatter>
 inline std::string
-to_string_impl(const unit<Dimension, heterogeneous_system<heterogeneous_system_impl<list<heterogeneous_system_dim<scaled_base_unit<Unit, UnitScale>, static_rational<1> >, dimensionless_type>, Dimension, dimensionless_type> > >&, Subformatter f)
+to_string_impl(
+ const unit<
+ Dimension,
+ heterogeneous_system<
+ heterogeneous_system_impl<
+ list<heterogeneous_system_dim<scaled_base_unit<Unit, UnitScale>, static_rational<1> >, dimensionless_type>,
+ Dimension,
+ dimensionless_type
+ >
+ >
+ >&,
+ Subformatter f,
+ typename base_unit_info<scaled_base_unit<Unit, UnitScale> >::base_unit_info_primary_template* = 0)
 {
     std::string str;
     f.template append_units_to<list<heterogeneous_system_dim<scaled_base_unit<Unit, UnitScale>, static_rational<1> >, dimensionless_type> >(str);
@@ -483,8 +580,8 @@
         detail::scale_symbol_string_impl<Scale::size::value>::template apply<Scale>::value(str);
     }
     template<class Unit>
- std::string operator()(const Unit& unit) {
- return(to_string_impl(unit, *this));
+ std::string operator()(const Unit& u) {
+ return(to_string_impl(u, *this));
     }
     template<class Unit>
     bool is_default_string(const std::string&, const Unit&) {
@@ -494,12 +591,12 @@
 
 struct format_symbol_impl : format_raw_symbol_impl {
     template<class Unit>
- std::string operator()(const Unit& unit) {
- return(symbol_string(unit));
+ std::string operator()(const Unit& u) {
+ return(symbol_string(u));
     }
     template<class Unit>
- bool is_default_string(const std::string& str, const Unit& unit) {
- return(str == to_string_impl(unit, format_raw_symbol_impl()));
+ bool is_default_string(const std::string& str, const Unit& u) {
+ return(str == to_string_impl(u, format_raw_symbol_impl()));
     }
 };
 
@@ -513,8 +610,8 @@
         detail::scale_name_string_impl<Scale::size::value>::template apply<Scale>::value(str);
     }
     template<class Unit>
- std::string operator()(const Unit& unit) {
- return(to_string_impl(unit, *this));
+ std::string operator()(const Unit& u) {
+ return(to_string_impl(u, *this));
     }
     template<class Unit>
     bool is_default_string(const std::string&, const Unit&) {
@@ -524,29 +621,308 @@
 
 struct format_name_impl : format_raw_name_impl {
     template<class Unit>
- std::string operator()(const Unit& unit) {
- return(name_string(unit));
+ std::string operator()(const Unit& u) {
+ return(name_string(u));
     }
     template<class Unit>
- bool is_default_string(const std::string& str, const Unit& unit) {
- return(str == to_string_impl(unit, format_raw_name_impl()));
+ bool is_default_string(const std::string& str, const Unit& u) {
+ return(str == to_string_impl(u, format_raw_name_impl()));
     }
 };
 
 template<class Char, class Traits>
-inline void do_print(std::basic_ostream<Char, Traits>& os, const std::string& s) {
+inline void do_print(std::basic_ostream<Char, Traits>& os, const std::string& s)
+{
     os << s.c_str();
 }
 
-inline void do_print(std::ostream& os, const std::string& s) {
+inline void do_print(std::ostream& os, const std::string& s)
+{
     os << s;
 }
 
 template<class Char, class Traits>
-inline void do_print(std::basic_ostream<Char, Traits>& os, const char* s) {
+inline void do_print(std::basic_ostream<Char, Traits>& os, const char* s)
+{
     os << s;
 }
 
+// For automatically applying the appropriate prefixes.
+
+template<class End, class Prev, class T, class F>
+bool find_matching_scale_impl(End, End, Prev, T, F)
+{
+ return false;
+}
+
+template<class Begin, class End, class Prev, class T, class F>
+bool find_matching_scale_impl(Begin, End end, Prev prev, T t, F f)
+{
+ using std::abs;
+ if(Begin::item::value() > abs(t)) {
+ f(prev, t);
+ return true;
+ } else {
+ return detail::find_matching_scale_impl(
+ typename Begin::next(),
+ end,
+ typename Begin::item(),
+ t,
+ f
+ );
+ }
+}
+
+template<class End, class T, class F>
+bool find_matching_scale_i(End, End, T, F)
+{
+ return false;
+}
+
+template<class Begin, class End, class T, class F>
+bool find_matching_scale_i(Begin, End end, T t, F f)
+{
+ using std::abs;
+ if(Begin::item::value() > abs(t)) {
+ return false;
+ } else {
+ return detail::find_matching_scale_impl(typename Begin::next(), end, typename Begin::item(), t, f);
+ }
+}
+
+template<class Scales, class T, class F>
+bool find_matching_scale(T t, F f)
+{
+ return detail::find_matching_scale_i(Scales(), dimensionless_type(), t, f);
+}
+
+typedef list<scale<10, static_rational<-24> >,
+ list<scale<10, static_rational<-21> >,
+ list<scale<10, static_rational<-18> >,
+ list<scale<10, static_rational<-15> >,
+ list<scale<10, static_rational<-12> >,
+ list<scale<10, static_rational<-9> >,
+ list<scale<10, static_rational<-6> >,
+ list<scale<10, static_rational<-3> >,
+ list<scale<10, static_rational<0> >,
+ list<scale<10, static_rational<3> >,
+ list<scale<10, static_rational<6> >,
+ list<scale<10, static_rational<9> >,
+ list<scale<10, static_rational<12> >,
+ list<scale<10, static_rational<15> >,
+ list<scale<10, static_rational<18> >,
+ list<scale<10, static_rational<21> >,
+ list<scale<10, static_rational<24> >,
+ list<scale<10, static_rational<27> >,
+ dimensionless_type> > > > > > > > > > > > > > > > > > engineering_prefixes;
+
+typedef list<scale<2, static_rational<10> >,
+ list<scale<2, static_rational<20> >,
+ list<scale<2, static_rational<30> >,
+ list<scale<2, static_rational<40> >,
+ list<scale<2, static_rational<50> >,
+ list<scale<2, static_rational<60> >,
+ list<scale<2, static_rational<70> >,
+ dimensionless_type> > > > > > > binary_prefixes;
+
+template<class Os, class Quantity>
+struct print_default_t {
+ typedef void result_type;
+ void operator()() const
+ {
+ *os << q->value() << ' ' << typename Quantity::unit_type();
+ }
+ Os* os;
+ const Quantity* q;
+};
+
+template<class Os, class Quantity>
+print_default_t<Os, Quantity> print_default(Os& os, const Quantity& q)
+{
+ print_default_t<Os, Quantity> result = { &os, &q };
+ return result;
+}
+
+template<class Os>
+struct print_scale_t {
+ typedef void result_type;
+ template<class Prefix, class T>
+ void operator()(Prefix, const T& t) const
+ {
+ *prefixed = true;
+ *os << t / Prefix::value() << ' ';
+ switch(units::get_format(*os)) {
+ case name_fmt: do_print(*os, Prefix::name()); break;
+ case raw_fmt:
+ case symbol_fmt: do_print(*os, Prefix::symbol()); break;
+ case typename_fmt: do_print(*os, units::simplify_typename(Prefix())); *os << ' '; break;
+ }
+ }
+ template<long N, class T>
+ void operator()(scale<N, static_rational<0> >, const T& t) const
+ {
+ *prefixed = false;
+ *os << t << ' ';
+ }
+ Os* os;
+ bool* prefixed;
+};
+
+template<class Os>
+print_scale_t<Os> print_scale(Os& os, bool& prefixed)
+{
+ print_scale_t<Os> result = { &os, &prefixed };
+ return result;
+}
+
+// puts parentheses around a unit
+/// INTERNAL ONLY
+template<class Dimension,class Units,class Scale, class Subformatter>
+inline std::string
+maybe_parenthesize(const unit<Dimension, heterogeneous_system<heterogeneous_system_impl<Units, Dimension, Scale> > >&, Subformatter f)
+{
+ std::string str;
+
+ std::string without_scale = f(unit<Dimension, heterogeneous_system<heterogeneous_system_impl<Units, Dimension, dimensionless_type> > >());
+
+ if (f.is_default_string(without_scale, unit<Dimension, heterogeneous_system<heterogeneous_system_impl<Units, Dimension, dimensionless_type> > >()))
+ {
+ str += "(";
+ str += without_scale;
+ str += ")";
+ }
+ else
+ {
+ str += without_scale;
+ }
+
+ return(str);
+}
+
+// This overload catches scaled units that have a single base unit
+// raised to the first power. It causes si::nano * si::meters to not
+// put parentheses around the meters. i.e. nm rather than n(m)
+/// INTERNAL ONLY
+template<class Dimension,class Unit,class Scale, class Subformatter>
+inline std::string
+maybe_parenthesize(const unit<Dimension, heterogeneous_system<heterogeneous_system_impl<list<heterogeneous_system_dim<Unit, static_rational<1> >,dimensionless_type>, Dimension, Scale> > >&, Subformatter f)
+{
+ return f(unit<Dimension, heterogeneous_system<heterogeneous_system_impl<list<heterogeneous_system_dim<Unit, static_rational<1> >, dimensionless_type>, Dimension, dimensionless_type> > >());
+}
+
+template<class Prefixes, class CharT, class Traits, class Unit, class T, class F>
+void do_print_prefixed_impl(std::basic_ostream<CharT, Traits>& os, const quantity<Unit, T>& q, F default_)
+{
+ bool prefixed;
+ if(detail::find_matching_scale<Prefixes>(q.value(), detail::print_scale(os, prefixed))) {
+ if(prefixed) {
+ switch(units::get_format(os)) {
+ case symbol_fmt: do_print(os, maybe_parenthesize(Unit(), format_symbol_impl())); break;
+ case raw_fmt: do_print(os, maybe_parenthesize(Unit(), format_raw_symbol_impl())); break;
+ case name_fmt: do_print(os, maybe_parenthesize(Unit(), format_name_impl())); break;
+ case typename_fmt: do_print(os, simplify_typename(Unit())); break;
+ }
+ } else {
+ os << Unit();
+ }
+ } else {
+ default_();
+ }
+}
+
+// Handle units like si::kilograms that have a scale embedded in the
+// base unit. This overload is disabled if the scaled base unit has
+// a user-defined string representation.
+template<class Prefixes, class CharT, class Traits, class Dimension, class BaseUnit, class BaseScale, class Scale, class T>
+typename base_unit_info<
+ scaled_base_unit<BaseUnit, Scale>
+>::base_unit_info_primary_template
+do_print_prefixed(
+ std::basic_ostream<CharT, Traits>& os,
+ const quantity<
+ unit<
+ Dimension,
+ heterogeneous_system<
+ heterogeneous_system_impl<
+ list<
+ heterogeneous_system_dim<
+ scaled_base_unit<BaseUnit, BaseScale>,
+ static_rational<1>
+ >,
+ dimensionless_type
+ >,
+ Dimension,
+ Scale
+ >
+ >
+ >,
+ T
+ >& q)
+{
+ quantity<
+ unit<
+ Dimension,
+ heterogeneous_system<
+ heterogeneous_system_impl<
+ list<
+ heterogeneous_system_dim<BaseUnit, static_rational<1> >,
+ dimensionless_type
+ >,
+ Dimension,
+ dimensionless_type
+ >
+ >
+ >,
+ T
+ > unscaled(q);
+ detail::do_print_prefixed_impl<Prefixes>(os, unscaled, detail::print_default(os, q));
+}
+
+template<class Prefixes, class CharT, class Traits, class Dimension, class L, class Scale, class T>
+void do_print_prefixed(
+ std::basic_ostream<CharT, Traits>& os,
+ const quantity<
+ unit<
+ Dimension,
+ heterogeneous_system<
+ heterogeneous_system_impl<
+ L,
+ Dimension,
+ Scale
+ >
+ >
+ >,
+ T
+ >& q)
+{
+ quantity<
+ unit<
+ Dimension,
+ heterogeneous_system<
+ heterogeneous_system_impl<
+ L,
+ Dimension,
+ dimensionless_type
+ >
+ >
+ >,
+ T
+ > unscaled(q);
+ detail::do_print_prefixed_impl<Prefixes>(os, unscaled, detail::print_default(os, q));
+}
+
+template<class Prefixes, class CharT, class Traits, class Dimension, class System, class T>
+void do_print_prefixed(std::basic_ostream<CharT, Traits>& os, const quantity<unit<Dimension, System>, T>& q)
+{
+ detail::do_print_prefixed<Prefixes>(os, quantity<unit<Dimension, typename make_heterogeneous_system<Dimension, System>::type>, T>(q));
+}
+
+template<class Prefixes, class CharT, class Traits, class Unit, class T>
+void do_print_prefixed(std::basic_ostream<CharT, Traits>& os, const quantity<Unit, T>& q)
+{
+ detail::print_default(os, q)();
+}
+
 } // namespace detail
 
 template<class Dimension,class System>
@@ -570,18 +946,18 @@
     return detail::to_string_impl(unit<Dimension,System>(), detail::format_name_impl());
 }
 
-/// Print an @c unit as a list of base units and exponents
+/// Print a @c unit as a list of base units and their exponents.
 ///
-/// for @c symbol_format this gives e.g. "m s^-1" or "J"
-/// for @c name_format this gives e.g. "meter second^-1" or "joule"
-/// for @c raw_format this gives e.g. "m s^-1" or "meter kilogram^2 second^-2"
-/// for @c typename_format this gives the typename itself (currently demangled only on GCC)
+/// for @c symbol_format outputs e.g. "m s^-1" or "J".
+/// for @c name_format outputs e.g. "meter second^-1" or "joule".
+/// for @c raw_format outputs e.g. "m s^-1" or "meter kilogram^2 second^-2".
+/// for @c typename_format outputs the typename itself (currently demangled only on GCC).
 template<class Char, class Traits, class Dimension, class System>
 inline std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os, const unit<Dimension, System>& u)
 {
     if (units::get_format(os) == typename_fmt)
     {
- detail::do_print(os , typename_string(u));
+ detail::do_print(os, typename_string(u));
     }
     else if (units::get_format(os) == raw_fmt)
     {
@@ -603,12 +979,31 @@
     return(os);
 }
 
-/// INTERNAL ONLY
-/// Print a @c quantity. Prints the value followed by the unit
+/// \brief Print a @c quantity.
+/// \details Prints the value followed by the unit.
+/// If the engineering_prefix, or binary_prefix is set,
+/// tries to scale the value appropriately.
+/// For example, it might print 12.345 km instead of 12345 m.
+/// (Note does @b not attempt to automatically scale scalars like double, float...)
 template<class Char, class Traits, class Unit, class T>
 inline std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os, const quantity<Unit, T>& q)
 {
- os << q.value() << ' ' << Unit();
+ if (units::get_autoprefix(os) == autoprefix_none)
+ {
+ os << q.value() << ' ' << Unit();
+ }
+ else if (units::get_autoprefix(os) == autoprefix_engineering)
+ {
+ detail::do_print_prefixed<detail::engineering_prefixes>(os, q);
+ }
+ else if (units::get_autoprefix(os) == autoprefix_binary)
+ {
+ detail::do_print_prefixed<detail::binary_prefixes>(os, q);
+ }
+ else
+ {
+ assert(!"Autoprefixing must be one of: no_prefix, engineering_prefix, binary_prefix");
+ }
     return(os);
 }
 

Modified: branches/release/boost/units/is_dim.hpp
==============================================================================
--- branches/release/boost/units/is_dim.hpp (original)
+++ branches/release/boost/units/is_dim.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -11,6 +11,11 @@
 #ifndef BOOST_UNITS_IS_DIM_HPP
 #define BOOST_UNITS_IS_DIM_HPP
 
+///
+/// \file
+/// \brief Check that a type is a valid @c dim.
+///
+
 #include <boost/mpl/bool.hpp>
 
 #include <boost/units/units_fwd.hpp>

Modified: branches/release/boost/units/is_dimension_list.hpp
==============================================================================
--- branches/release/boost/units/is_dimension_list.hpp (original)
+++ branches/release/boost/units/is_dimension_list.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -11,6 +11,11 @@
 #ifndef BOOST_UNITS_IS_DIMENSION_LIST_HPP
 #define BOOST_UNITS_IS_DIMENSION_LIST_HPP
 
+///
+/// \file
+/// \brief Check that a type is a valid dimension list.
+///
+
 #include <boost/mpl/bool.hpp>
 
 #include <boost/units/units_fwd.hpp>

Modified: branches/release/boost/units/is_dimensionless.hpp
==============================================================================
--- branches/release/boost/units/is_dimensionless.hpp (original)
+++ branches/release/boost/units/is_dimensionless.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -11,6 +11,11 @@
 #ifndef BOOST_UNITS_IS_DIMENSIONLESS_HPP
 #define BOOST_UNITS_IS_DIMENSIONLESS_HPP
 
+///
+/// \file
+/// \brief Check if a unit or quantity is dimensionless.
+///
+
 #include <boost/mpl/bool.hpp>
 #include <boost/units/units_fwd.hpp>
 
@@ -23,13 +28,13 @@
     public mpl::false_
 { };
 
-/// check if a unit is dimensionless
+/// Check if a unit is dimensionless.
 template<class System>
 struct is_dimensionless< unit<dimensionless_type,System> > :
     public mpl::true_
 { };
 
-/// check if a quantity is dimensionless
+/// Check if a quantity is dimensionless.
 template<class Unit,class Y>
 struct is_dimensionless< quantity<Unit,Y> > :
     public is_dimensionless<Unit>

Modified: branches/release/boost/units/is_dimensionless_quantity.hpp
==============================================================================
--- branches/release/boost/units/is_dimensionless_quantity.hpp (original)
+++ branches/release/boost/units/is_dimensionless_quantity.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -11,6 +11,9 @@
 #ifndef BOOST_UNITS_IS_DIMENSIONLESS_QUANTITY_HPP
 #define BOOST_UNITS_IS_DIMENSIONLESS_QUANTITY_HPP
 
+/// \file
+/// \brief check that a type is a dimensionless quantity
+
 #include <boost/units/is_quantity_of_dimension.hpp>
 #include <boost/units/units_fwd.hpp>
 
@@ -18,7 +21,7 @@
 
 namespace units {
 
-/// check that a type is a dimensionless quantity
+/// Check that a type is a dimensionless quantity.
 template<class T>
 struct is_dimensionless_quantity :
     public is_quantity_of_dimension<T,dimensionless_type>

Modified: branches/release/boost/units/is_dimensionless_unit.hpp
==============================================================================
--- branches/release/boost/units/is_dimensionless_unit.hpp (original)
+++ branches/release/boost/units/is_dimensionless_unit.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -11,6 +11,9 @@
 #ifndef BOOST_UNITS_IS_DIMENSIONLESS_UNIT_HPP
 #define BOOST_UNITS_IS_DIMENSIONLESS_UNIT_HPP
 
+/// \file
+/// \brief Check that a type is a dimensionless unit.
+
 #include <boost/units/is_unit_of_dimension.hpp>
 #include <boost/units/units_fwd.hpp>
 
@@ -18,7 +21,7 @@
 
 namespace units {
 
-/// check that a type is a dimensionless unit
+/// Check that a type is a dimensionless unit.
 template<class T>
 struct is_dimensionless_unit :
     public is_unit_of_dimension<T,dimensionless_type>

Modified: branches/release/boost/units/is_quantity.hpp
==============================================================================
--- branches/release/boost/units/is_quantity.hpp (original)
+++ branches/release/boost/units/is_quantity.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -11,6 +11,11 @@
 #ifndef BOOST_UNITS_IS_QUANTITY_HPP
 #define BOOST_UNITS_IS_QUANTITY_HPP
 
+///
+/// \file
+/// \brief Check that a type is a quantity.
+///
+
 #include <boost/mpl/bool.hpp>
 #include <boost/units/units_fwd.hpp>
 
@@ -18,7 +23,7 @@
 
 namespace units {
 
-/// check that a type is a quantity
+/// Check that a type is a quantity.
 template<typename T>
 struct is_quantity :
     public mpl::false_

Modified: branches/release/boost/units/is_quantity_of_dimension.hpp
==============================================================================
--- branches/release/boost/units/is_quantity_of_dimension.hpp (original)
+++ branches/release/boost/units/is_quantity_of_dimension.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -11,6 +11,11 @@
 #ifndef BOOST_UNITS_IS_QUANTITY_OF_DIMENSION_HPP
 #define BOOST_UNITS_IS_QUANTITY_OF_DIMENSION_HPP
 
+///
+/// \file
+/// \brief Check that a type is a quantity of the specified dimension.
+///
+
 #include <boost/mpl/bool.hpp>
 #include <boost/units/units_fwd.hpp>
 #include <boost/units/is_unit_of_dimension.hpp>
@@ -19,7 +24,7 @@
 
 namespace units {
 
-/// check that a type is a quantity of the specified dimension
+/// Check that a type is a quantity of the specified dimension.
 template<class T,class Dim>
 struct is_quantity_of_dimension :
     public mpl::false_

Modified: branches/release/boost/units/is_quantity_of_system.hpp
==============================================================================
--- branches/release/boost/units/is_quantity_of_system.hpp (original)
+++ branches/release/boost/units/is_quantity_of_system.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -11,6 +11,11 @@
 #ifndef BOOST_UNITS_IS_QUANTITY_OF_SYSTEM_HPP
 #define BOOST_UNITS_IS_QUANTITY_OF_SYSTEM_HPP
 
+///
+/// \file
+/// \brief Check that a type is a quantity in a specified system.
+///
+
 #include <boost/mpl/bool.hpp>
 #include <boost/units/units_fwd.hpp>
 #include <boost/units/is_unit_of_system.hpp>
@@ -19,7 +24,7 @@
 
 namespace units {
 
-/// check that a type is a quantity in a specified system
+/// Check that a type is a quantity in a specified system.
 template<class T,class System>
 struct is_quantity_of_system :
     public mpl::false_

Modified: branches/release/boost/units/is_unit.hpp
==============================================================================
--- branches/release/boost/units/is_unit.hpp (original)
+++ branches/release/boost/units/is_unit.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -11,6 +11,11 @@
 #ifndef BOOST_UNITS_IS_UNIT_HPP
 #define BOOST_UNITS_IS_UNIT_HPP
 
+///
+/// \file
+/// \brief Check that a type is a unit.
+///
+
 #include <boost/mpl/bool.hpp>
 #include <boost/units/units_fwd.hpp>
 
@@ -18,7 +23,7 @@
 
 namespace units {
 
-/// check that a type is a unit
+/// Check that a type is a unit.
 template<class T>
 struct is_unit :
     public mpl::false_

Modified: branches/release/boost/units/is_unit_of_dimension.hpp
==============================================================================
--- branches/release/boost/units/is_unit_of_dimension.hpp (original)
+++ branches/release/boost/units/is_unit_of_dimension.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -11,6 +11,11 @@
 #ifndef BOOST_UNITS_IS_UNIT_OF_DIMENSION_HPP
 #define BOOST_UNITS_IS_UNIT_OF_DIMENSION_HPP
 
+///
+/// \file
+/// \brief Check that a type is a unit of the specified dimension.
+///
+
 #include <boost/mpl/bool.hpp>
 #include <boost/units/units_fwd.hpp>
 
@@ -18,7 +23,7 @@
 
 namespace units {
 
-/// check that a type is a unit of the specified dimension
+/// Check that a type is a unit of the specified dimension.
 template<class T,class Dim>
 struct is_unit_of_dimension :
     public mpl::false_

Modified: branches/release/boost/units/is_unit_of_system.hpp
==============================================================================
--- branches/release/boost/units/is_unit_of_system.hpp (original)
+++ branches/release/boost/units/is_unit_of_system.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -11,6 +11,11 @@
 #ifndef BOOST_UNITS_IS_UNIT_OF_SYSTEM_HPP
 #define BOOST_UNITS_IS_UNIT_OF_SYSTEM_HPP
 
+///
+/// \file
+/// \brief Check that a type is a unit in a specified system.
+///
+
 #include <boost/mpl/bool.hpp>
 #include <boost/units/units_fwd.hpp>
 
@@ -18,7 +23,7 @@
 
 namespace units {
 
-/// check that a type is a unit in a specified system
+/// Check that a type is a unit in a specified system.
 template<class T,class System>
 struct is_unit_of_system :
     public mpl::false_

Modified: branches/release/boost/units/limits.hpp
==============================================================================
--- branches/release/boost/units/limits.hpp (original)
+++ branches/release/boost/units/limits.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -7,9 +7,15 @@
 // 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_LIMITS_HPP
 #define BOOST_UNITS_LIMITS_HPP
 
+///
+/// \file
+/// \brief specialize std::numeric_limits for units.
+///
+
 #include <limits>
 
 #include <boost/units/units_fwd.hpp>

Modified: branches/release/boost/units/make_scaled_unit.hpp
==============================================================================
--- branches/release/boost/units/make_scaled_unit.hpp (original)
+++ branches/release/boost/units/make_scaled_unit.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -11,6 +11,7 @@
 #ifndef BOOST_UNITS_MAKE_SCALED_UNIT_HPP_INCLUDED
 #define BOOST_UNITS_MAKE_SCALED_UNIT_HPP_INCLUDED
 
+#include <boost/units/units_fwd.hpp>
 #include <boost/units/heterogeneous_system.hpp>
 #include <boost/units/unit.hpp>
 
@@ -39,6 +40,20 @@
> type;
 };
 
+template<class Dimension, class UnitList, class OldScale, long Base>
+struct make_scaled_unit<unit<Dimension, heterogeneous_system<heterogeneous_system_impl<UnitList, Dimension, OldScale> > >, scale<Base, static_rational<0> > > {
+ typedef unit<
+ Dimension,
+ heterogeneous_system<
+ heterogeneous_system_impl<
+ UnitList,
+ Dimension,
+ OldScale
+ >
+ >
+ > type;
+};
+
 }
 }
 

Modified: branches/release/boost/units/make_system.hpp
==============================================================================
--- branches/release/boost/units/make_system.hpp (original)
+++ branches/release/boost/units/make_system.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -11,6 +11,16 @@
 #ifndef BOOST_UNITS_MAKE_SYSTEM_HPP
 #define BOOST_UNITS_MAKE_SYSTEM_HPP
 
+/// \file
+/// \brief Metafunction returning a homogeneous system that can
+/// represent any combination of the base units.
+/// \details
+/// Metafunction make_system returning a homogeneous system that can
+/// represent any combination of the base units. There must
+/// be no way to represent any of the base units in terms
+/// of the others. make_system<foot_base_unit, meter_base_unit>::type
+/// is not allowed, for example.
+
 #include <boost/units/config.hpp>
 #include <boost/units/dimensionless_type.hpp>
 #include <boost/units/homogeneous_system.hpp>

Modified: branches/release/boost/units/operators.hpp
==============================================================================
--- branches/release/boost/units/operators.hpp (original)
+++ branches/release/boost/units/operators.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -11,29 +11,30 @@
 #ifndef BOOST_UNITS_OPERATORS_HPP
 #define BOOST_UNITS_OPERATORS_HPP
 
+
+///
+/// \file
+/// \brief Compile time operators and typeof helper classes.
+/// \details
+/// These operators declare the compile-time operators needed to support dimensional
+/// analysis algebra. They require the use of Boost.Typeof, emulation or native.
+/// Typeof helper classes define result type for heterogeneous operators on value types.
+/// These must be defined through specialization for powers and roots.
+///
+
 #include <boost/static_assert.hpp>
 #include <boost/type_traits/is_same.hpp>
 
 #include <boost/units/config.hpp>
 
-/// \file
-/// \brief Compile time operators and typeof helper classes.
-///
-/// \detailed
-/// These operators declare the compile-time operators needed to support dimensional
-/// analysis algebra. They require the use of Boost.Typeof.
-/// Typeof helper classes define result type for heterogeneous operators on value types.
-/// These must be defined through specialization for powers and roots.
-
 namespace boost {
-
 namespace units {
 
 #if BOOST_UNITS_HAS_TYPEOF
 
 #ifndef BOOST_UNITS_DOXYGEN
 
-// to avoid need for default constructor and eliminate divide by zero errors
+// to avoid need for default constructor and eliminate divide by zero errors.
 namespace typeof_ {
 
 /// INTERNAL ONLY

Modified: branches/release/boost/units/physical_dimensions.hpp
==============================================================================
--- branches/release/boost/units/physical_dimensions.hpp (original)
+++ branches/release/boost/units/physical_dimensions.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -2,7 +2,7 @@
 // unit/quantity manipulation and conversion
 //
 // Copyright (C) 2003-2008 Matthias Christian Schabel
-// Copyright (C) 2007-2008 Steven Watanabe
+// Copyright (C) 2007-2010 Steven Watanabe
 //
 // Distributed under the Boost Software License, Version 1.0. (See
 // accompanying file LICENSE_1_0.txt or copy at
@@ -11,25 +11,29 @@
 #ifndef BOOST_UNITS_PHYSICAL_UNITS_HPP
 #define BOOST_UNITS_PHYSICAL_UNITS_HPP
 
-/// \file Includes all of the physical_dimension headers.
 ///
-/// \brief Physical dimensions according to the SI system
-///
-/// \detail This header includes all physical dimension headers for both base
-/// derived dimensions. Base dimensions are extended to include plane and
-/// solid angle for convenience.
+/// \file
+/// \brief Physical dimensions according to the SI system.
+/// \details This header includes all physical dimension headers for both base
+/// and derived dimensions.
 ///
 
+// Include all of the physical_dimension headers.
+
+// SI seven fundamental dimensions.
 #include <boost/units/physical_dimensions/amount.hpp>
 #include <boost/units/physical_dimensions/current.hpp>
 #include <boost/units/physical_dimensions/length.hpp>
 #include <boost/units/physical_dimensions/luminous_intensity.hpp>
 #include <boost/units/physical_dimensions/mass.hpp>
-#include <boost/units/physical_dimensions/plane_angle.hpp>
-#include <boost/units/physical_dimensions/solid_angle.hpp>
 #include <boost/units/physical_dimensions/temperature.hpp>
 #include <boost/units/physical_dimensions/time.hpp>
 
+// Base dimensions are extended to include plane and solid angle for convenience.
+#include <boost/units/physical_dimensions/plane_angle.hpp>
+#include <boost/units/physical_dimensions/solid_angle.hpp>
+
+// Derived dimensions.
 #include <boost/units/physical_dimensions/absorbed_dose.hpp>
 #include <boost/units/physical_dimensions/acceleration.hpp>
 #include <boost/units/physical_dimensions/action.hpp>

Modified: branches/release/boost/units/pow.hpp
==============================================================================
--- branches/release/boost/units/pow.hpp (original)
+++ branches/release/boost/units/pow.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -19,13 +19,13 @@
 #include <boost/units/detail/static_rational_power.hpp>
 
 /// \file
-/// \brief Raise values to exponents known at compile-time
+/// \brief Raise values to exponents known at compile-time.
 
 namespace boost {
 
 namespace units {
 
-/// raise a value to a @c static_rational power
+/// raise a value to a @c static_rational power.
 template<class Rat,class Y>
 inline typename power_typeof_helper<Y,Rat>::type
 pow(const Y& x)
@@ -33,7 +33,7 @@
     return power_typeof_helper<Y,Rat>::value(x);
 }
 
-/// raise a value to an integer power
+/// raise a value to an integer power.
 template<long N,class Y>
 inline typename power_typeof_helper<Y,static_rational<N> >::type
 pow(const Y& x)
@@ -43,7 +43,7 @@
 
 #ifndef BOOST_UNITS_DOXYGEN
 
-/// raise @c T to a @c static_rational power
+/// raise @c T to a @c static_rational power.
 template<class T, long N,long D>
 struct power_typeof_helper<T, static_rational<N,D> >
 {
@@ -57,11 +57,11 @@
     }
 };
 
-/// raise @c float to a @c static_rational power
+/// raise @c float to a @c static_rational power.
 template<long N,long D>
 struct power_typeof_helper<float, static_rational<N,D> >
 {
- // N.B. pathscale doesn't accept inheritence for some reason.
+ // N.B. pathscale doesn't accept inheritance for some reason.
     typedef power_typeof_helper<double, static_rational<N,D> > base;
     typedef typename base::type type;
     static type value(const double& x)
@@ -72,7 +72,7 @@
 
 #endif
 
-/// take the @c static_rational root of a value
+/// take the @c static_rational root of a value.
 template<class Rat,class Y>
 typename root_typeof_helper<Y,Rat>::type
 root(const Y& x)
@@ -80,7 +80,7 @@
     return root_typeof_helper<Y,Rat>::value(x);
 }
 
-/// take the integer root of a value
+/// take the integer root of a value.
 template<long N,class Y>
 typename root_typeof_helper<Y,static_rational<N> >::type
 root(const Y& x)
@@ -94,7 +94,7 @@
 template<class T, long N,long D>
 struct root_typeof_helper<T,static_rational<N,D> >
 {
- // N.B. pathscale doesn't accept inheritence for some reason.
+ // N.B. pathscale doesn't accept inheritance for some reason.
     typedef power_typeof_helper<T, static_rational<D,N> > base;
     typedef typename base::type type;
     static type value(const T& x)

Modified: branches/release/boost/units/reduce_unit.hpp
==============================================================================
--- branches/release/boost/units/reduce_unit.hpp (original)
+++ branches/release/boost/units/reduce_unit.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -11,6 +11,9 @@
 #ifndef BOOST_UNITS_REDUCE_UNIT_HPP_INCLUDED
 #define BOOST_UNITS_REDUCE_UNIT_HPP_INCLUDED
 
+/// \file
+/// \brief Returns a unique type for every unit.
+
 namespace boost {
 namespace units {
 

Modified: branches/release/boost/units/scale.hpp
==============================================================================
--- branches/release/boost/units/scale.hpp (original)
+++ branches/release/boost/units/scale.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -11,6 +11,12 @@
 #ifndef BOOST_UNITS_SCALE_HPP_INCLUDED
 #define BOOST_UNITS_SCALE_HPP_INCLUDED
 
+///
+/// \file
+/// \brief 10^3 Engineering & 2^10 binary scaling factors for autoprefixing.
+/// \details
+///
+
 #include <string>
 
 #include <boost/units/config.hpp>
@@ -27,7 +33,7 @@
 struct scaled_base_unit;
 
 /// class representing a scaling factor such as 10^3
-/// The exponent should be a static rational.
+/// The exponent must be a static rational.
 template<long Base, class Exponent>
 struct scale
 {

Modified: branches/release/boost/units/static_rational.hpp
==============================================================================
--- branches/release/boost/units/static_rational.hpp (original)
+++ branches/release/boost/units/static_rational.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -46,7 +46,7 @@
     BOOST_STATIC_CONSTANT(integer_type,value = Value < 0 ? -Value : Value);
 };
 
-/// Compile time rational number.
+// Compile time rational number.
 /**
 This is an implementation of a compile time rational number, where @c static_rational<N,D> represents
 a rational number with numerator @c N and denominator @c D. Because of the potential for ambiguity arising

Modified: branches/release/boost/units/systems/si/codata/electromagnetic_constants.hpp
==============================================================================
--- branches/release/boost/units/systems/si/codata/electromagnetic_constants.hpp (original)
+++ branches/release/boost/units/systems/si/codata/electromagnetic_constants.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -11,6 +11,13 @@
 #ifndef BOOST_UNITS_CODATA_ELECTROMAGNETIC_CONSTANTS_HPP
 #define BOOST_UNITS_CODATA_ELECTROMAGNETIC_CONSTANTS_HPP
 
+///
+/// \file
+/// \brief CODATA recommended values of fundamental electromagnetic constants.
+/// \details CODATA recommended values of the fundamental physical constants: NIST SP 961
+/// CODATA 2006 values as of 2007/03/30
+///
+
 #include <boost/units/static_constant.hpp>
 
 #include <boost/units/systems/detail/constants.hpp>
@@ -26,10 +33,6 @@
 
 #include <boost/units/systems/si/codata/typedefs.hpp>
 
-/// \file
-/// CODATA recommended values of fundamental electromagnetic constants
-/// CODATA 2006 values as of 2007/03/30
-
 namespace boost {
 
 namespace units {
@@ -40,8 +43,6 @@
 
 namespace codata {
 
-/// CODATA recommended values of the fundamental physical constants: NIST SP 961
-
 // ELECTROMAGNETIC
 /// elementary charge
 BOOST_UNITS_PHYSICAL_CONSTANT(e,quantity<electric_charge>,1.602176487e-19*coulombs,4.0e-27*coulombs);

Modified: branches/release/boost/units/units_fwd.hpp
==============================================================================
--- branches/release/boost/units/units_fwd.hpp (original)
+++ branches/release/boost/units/units_fwd.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -11,8 +11,11 @@
 #ifndef BOOST_UNITS_UNITS_FWD_HPP
 #define BOOST_UNITS_UNITS_FWD_HPP
 
+///
 /// \file
-/// Forward declarations of library components.
+/// \brief Forward declarations of library components.
+/// \details Forward declarations of units library - dimensions, systems, quantity and string components.
+///
 
 #ifndef BOOST_UNITS_DOXYGEN
 
@@ -38,6 +41,8 @@
 
 template<class Dim,class System, class Enable=void> class unit;
 
+template<long Base, class Exponent> struct scale;
+
 template<class BaseUnitTag> struct base_unit_info;
 template<class System> struct dimensionless_unit;
 template<class T> struct is_unit;

Modified: branches/release/libs/units/doc/Jamfile.v2
==============================================================================
--- branches/release/libs/units/doc/Jamfile.v2 (original)
+++ branches/release/libs/units/doc/Jamfile.v2 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -28,6 +28,7 @@
 
         # Horribly ugly, but then macros usually are :(
         <doxygen:param>"PREDEFINED= \\
+ \"BOOST_MPL_ASSERT(expr)=\" \\
             \"BOOST_UNITS_STATIC_CONSTANT(a,b)=static const b a\" \\
             \"BOOST_UNITS_AUTO_STATIC_CONSTANT(a,b)=static const auto a = b\" \\
             \"BOOST_UNITS_TYPEOF(a)=typeof(a)\" \\
@@ -54,7 +55,8 @@
 
 run_doxygen units_reference
   :
- [ glob $(here)/../../../boost/units/*.hpp ]
+ [ glob $(here)/../../../boost/units/*.hpp :
+ $(here)/../../../boost/units/physical_dimensions.hpp ]
   :
     "Units Reference"
   ;
@@ -166,10 +168,7 @@
             local dir-name = [ path.basename [ path.parent $(file) ] ] ;
             base_unit = "$(base_unit) ($(dir-name))" ;
         }
- # this looks better, but it won't work until my boostbook patch for
- # annotation.xsl gets applied.
- # print.text "[headerref $(output_filename) $(base_unit)]\\n" : overwrite ;
- print.text "[headerref $(output_filename)]\\n" : overwrite ;
+ print.text "[headerref $(output_filename) $(base_unit)]\\n" : overwrite ;
     }
 }
 

Modified: branches/release/libs/units/doc/units.qbk
==============================================================================
--- branches/release/libs/units/doc/units.qbk (original)
+++ branches/release/libs/units/doc/units.qbk 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -1,9 +1,9 @@
 [library Boost.Units
- [quickbook 1.3]
- [version 1.0.0]
+ [quickbook 1.5]
+ [version 1.1.0]
   [authors [Schabel, Matthias C.]]
   [authors [Watanabe, Steven]]
- [copyright 2003-2008 Matthias Christian Schabel, 2007-2008 Steven Watanabe]
+ [copyright 2003-2008 Matthias Christian Schabel, 2007-2010 Steven Watanabe]
   [license
       Distributed under the Boost Software License, Version 1.0.
       (See accompanying file LICENSE_1_0.txt or copy at
@@ -12,10 +12,15 @@
   [purpose zero-overhead compile-time dimensional analysis and unit computations]
 ]
 
+[/ Some links to external sources.]
+[def __boost [@http://www.boost.org/ Boost]]
+[def __boostroot [@boost: Boost root]]
+[def __boostlicense [@http://www.boost.org/LICENSE_1_0.txt Boost License]]
 [def __boost_mpl [@http://www.boost.org/libs/mpl/doc/index.html Boost Metaprogramming Library]]
 
 [def __mpl_forward_sequence [@http://www.boost.org/libs/mpl/doc/refmanual/forward-sequence.html MPL Forward Sequence]]
 
+[/Links within this document.]
 [def __ordinal [classref boost::units::ordinal ordinal]]
 [def __dim [classref boost::units::dim dim]]
 [def __static_rational [classref boost::units::static_rational static_rational]]
@@ -61,7 +66,6 @@
 [def __unscale [classref boost::units::unscale unscale]]
 
 [def __BOOST_UNITS_STATIC_CONSTANT [macroref BOOST_UNITS_STATIC_CONSTANT]]
-
 [def __BOOST_UNITS_DEFINE_CONVERSION_FACTOR [macroref BOOST_UNITS_DEFINE_CONVERSION_FACTOR]]
 [def __BOOST_UNITS_DEFINE_CONVERSION_FACTOR_TEMPLATE [macroref BOOST_UNITS_DEFINE_CONVERSION_FACTOR_TEMPLATE]]
 [def __BOOST_UNITS_DEFAULT_CONVERSION [macroref BOOST_UNITS_DEFAULT_CONVERSION]]
@@ -113,13 +117,14 @@
    no specific restriction on what base dimensions can be used. Base dimensions are essentially a tag type and
    provide no dimensional analysis functionality themselves.
 * *Dimension* : A collection of zero or more base dimensions, each
- potentially raised to a different rational power. For example, area = \[L\]^2, velocity = \[L\]^1/\[T\]^1, and
+ potentially raised to a different rational power.
+ For example, length = \[L\]^1, area = \[L\]^2, velocity = \[L\]^1/\[T\]^1, and
    energy = \[M\]^1 \[L\]^2/\[T\]^2 are all dimensions.
 * *Base unit* : A base unit represents a specific measure of a dimension. For example, while length is an abstract measure of
    distance, the meter is a concrete base unit of distance. Conversions are defined using base units.
    Much like base dimensions, base units are a tag type used solely to define units and do not support dimensional
    analysis algebra.
-* *Unit* : A set of base units raised to rational exponents, e.g. kg^1 m^1/s^2.
+* *Unit* : A set of base units raised to rational exponents, e.g. m^1, kg^1, m^1/s^2.
 * *System* : A unit system is a collection of base units representing all the measurable entities of interest for a
    specific problem. For example, the SI unit system defines seven base units : length (\[L\]) in meters,
    mass (\[M\]) in kilograms, time (\[T\]) in seconds, current (\[I\]) in amperes, temperature (\[theta\]) in kelvin,
@@ -150,8 +155,8 @@
 While this library attempts to make simple dimensional computations easy to code, it is in no way
 tied to any particular unit system (SI or otherwise). Instead, it provides a highly flexible compile-time
 system for dimensional analysis, supporting arbitrary collections of base dimensions, rational
-powers of units, and explicit quantity conversions. It accomplishes all of this via template metaprogramming techniques. With
-modern optimizing compilers, this results in zero runtime overhead for quantity computations relative to the
+powers of units, and explicit quantity conversions. It accomplishes all of this via template metaprogramming techniques.
+With modern optimizing compilers, this results in zero runtime overhead for quantity computations relative to the
 same code without unit checking.
 
 [endsect]
@@ -319,7 +324,7 @@
 we have the rudimentary beginnings of our unit system, which can be used to determine reduced dimensions for arbitrary
 unit calculations.
 
-[endsect]
+[endsect] [/section Base Units]
 
 [section Scaled Base Units]
 
@@ -340,7 +345,7 @@
 * Similarly, if the symbol for grams is defined as "g", then the symbol for kilograms
   will be "kg" without any extra effort.
 
-[endsect]
+[endsect] [/section Scaled Base Units]
 
 [section Scaled Units]
 
@@ -353,15 +358,14 @@
 
     typedef make_scaled_unit<si::time, scale<10, static_rational<-9> > >::type nanosecond;
 
-nanosecond is a specialization of [___unit], and can be
-used in a quantity normally.
+nanosecond is a specialization of [___unit], and can be used in a quantity normally.
 
     quantity<nanosecond> t(1.0 * si::seconds);
     std::cout << t << std::endl; // prints 1e9 ns
 
-[endsect]
+[endsect] [/section Scaled Units]
 
-[endsect]
+[endsect] [/section:Units Units]
 
 [section:Quantities Quantities]
 
@@ -507,7 +511,8 @@
 
 [dimension_snippet_1]
 
-outputting (with symbol demangling, implemented in [headerref boost/units/detail/utility.hpp])
+outputting (with symbol demangling, implemented in
+[@boost:/boost/units/detail/utility.hpp utility.hpp])
 
 [dimension_output]
 
@@ -518,7 +523,7 @@
 ([@../../libs/units/example/unit.cpp unit.cpp])
 
 This example demonstrates the use of the simple but functional unit system implemented in
-[headerref libs/units/example/test_system.hpp] :
+[@boost:/libs/units/example/test_system.hpp test_system.hpp]
 
 [import ../example/unit.cpp]
 
@@ -557,7 +562,7 @@
 
 [endsect]
 
-[section:KitchenSinkExample Kitchen Sink Example]
+[section:KitchenSinkExample Kitchen Sink Example using SI units]
 
 ([@../../libs/units/example/kitchen_sink.cpp kitchen_sink.cpp])
 
@@ -958,6 +963,60 @@
 
 [endsect]
 
+[section:autoscale Automatically Scaled Units]
+
+It is often desirable to scale a [___unit] automatically, depending on its value,
+to keep the integral part in a limited range, usually between 1 and 999.
+
+For example, using [@http://en.wikipedia.org/wiki/Engineering_notation engineering notation prefixes],
+
+ "1234.5 m" is more helpfully displayed as "1.234 km"
+ "0.000000001234 m" is more clearly displayed as "1.2345 nanometer".
+
+The iostream manipulators `engineering_prefixes` or `binary_prefixes` make this easy.
+
+[import ../example/autoprefixes.cpp]
+
+[autoprefixes_snippet_1]
+
+(The complete set of [@http://physics.nist.gov/cuu/Units/prefixes.html engineering and scientific multiples]
+is not used (not centi or deci for example), but only powers of ten that are multiples of three, 10^3).
+
+Similarly, the equivalent [@http://en.wikipedia.org/wiki/Binary_prefixes binary prefixes]
+used for displaying computing kilobytes, megabytes, gigabytes...
+
+These are the 2^10 = 1024, 2^20 = 1 048 576, 2^30 ... multiples.
+
+(See also [@http://physics.nist.gov/cuu/Units/binary.html Prefixes for binary multiples]
+
+This scale is specified in IEC 60027-2, Second edition, 2000-11,
+Letter symbols to be used in electrical technology -
+Part 2: Telecommunications and electronics).
+
+[autoprefixes_snippet_2]
+
+But note that scalar dimensionless values, like int, float and double,
+are *not* prefixed automatically by the engineering_prefix or binary_prefix iostream manipulators.
+
+[autoprefixes_snippet_3]
+
+You can output the name or symbol of a unit (rather than the most common quantity of a unit).
+
+[autoprefixes_snippet_4]
+
+Note too that all the formatting flags are persistent,
+so that if you set engineering_prefix, then it applies to all future outputs,
+until you select binary_prefix, or explicitly switch autoprefix off.
+You can specify no prefix (the default of course) in two ways:
+
+[autoprefixes_snippet_5]
+
+And you can get the format flags for diagnosing problems.
+
+[autoprefixes_snippet_6]
+
+[endsect] [/section:autoscale Automatically Scaled Units]
+
 [section:ConversionFactor Conversion Factor]
 
 This code demonstrates the use of the `conversion_factor` free function to determine
@@ -1233,7 +1292,7 @@
 and all the members of the Boost mailing list who provided their input into
 the design and implementation of this library.
 
-[endsect]
+[endsect] [/section:Acknowledgements Acknowledgements]
 
 [section:HelpWanted Help Wanted]
 
@@ -1245,29 +1304,46 @@
 
 [endsect]
 
+[section:version_id Version Info]
+
+__boostroot
+
+Last edit to Quickbook file __FILENAME__ was at __TIME__ on __DATE__.
+
+[tip This should appear on the pdf version (but may be redundant on html).]
+[/ Useful on pdf version. See also Last revised timestamp on first page of html version.]
+[/See also Adobe Reader pdf File Properties for creation date, and PDF producer, version and page count.]
+
+[endsect] [/section:version_id Version Info]
+
 [section:ReleaseNotes Release Notes]
 
+1.2 (March 2010)
+
+* Added autoprefix ready for Boost 1.43
+
 1.0.0 (August 1, 2008) :
 
 * Initial release with Boost 1.36
 
 0.7.1 (March 14, 2007) :
 
-* Boost.Typeof emulation support
+* Boost.Typeof emulation support.
 * attempting to rebind a heterogeneous_system to a different set of dimensions now fails.
-* cmath.hpp now works with como-win32
-* minor changes to the tests and examples to make msvc 7.1 happy
+* cmath.hpp now works with como-win32.
+* minor changes to the tests and examples to make msvc 7.1 happy.
 
 0.7.0 (March 13, 2007) :
 
-* heterogeneous and mixed system functionality added
-* added fine-grained implicit unit conversion on a per fundamental dimension basis
-* added a number of utility metafunction classes and predicates
-* [headerref boost/units/operators.hpp] now uses `BOOST_TYPEOF` when possible
-* angular units added in [headerref boost/units/systems/trig.hpp] - implicit conversion
- of radians between trigonometric, SI, and CGS systems allowed
-* a variety of [___unit] and [___quantity] tests added
-* examples now provide self-tests
+* heterogeneous and mixed system functionality added.
+* added fine-grained implicit unit conversion on a per fundamental dimension basis.
+* added a number of utility metafunction classes and predicates.
+* [headerref boost/units/operators.hpp] now uses `BOOST_TYPEOF` when possible.
+* angular units added in [headerref boost/units/systems/angle/gradians.hpp]
+ and [headerref boost/units/systems/angle/gradians.hpp].
+ Implicit conversion of radians between trigonometric, SI, and CGS systems is allowed.
+* a variety of [___unit] and [___quantity] tests added.
+* examples now provide self-tests.
 
 0.6.2 (February 22, 2007) :
 
@@ -1395,4 +1471,4 @@
 * Implementation of I/O is rudimentary; consider methods of i18n using facets
 * Consider runtime variant, perhaps using overload like `quantity<runtime,Y>`
 
-[endsect]
+[endsect] [/section:TODO TODO]

Modified: branches/release/libs/units/example/complex.cpp
==============================================================================
--- branches/release/libs/units/example/complex.cpp (original)
+++ branches/release/libs/units/example/complex.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief complex.cpp
 
-\detailed
+\details
 Demonstrate a complex number class that functions correctly with quantities.
 
 Output:

Modified: branches/release/libs/units/example/composite_output.cpp
==============================================================================
--- branches/release/libs/units/example/composite_output.cpp (original)
+++ branches/release/libs/units/example/composite_output.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief composite_output.cpp
 
-\detailed An example of textual representations of units.
+\details An example of textual representations of units.
 
 Output:
 @verbatim

Modified: branches/release/libs/units/example/conversion.cpp
==============================================================================
--- branches/release/libs/units/example/conversion.cpp (original)
+++ branches/release/libs/units/example/conversion.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief conversion.cpp
 
-\detailed
+\details
 Test explicit and implicit unit conversion.
 
 Output:

Modified: branches/release/libs/units/example/conversion_factor.cpp
==============================================================================
--- branches/release/libs/units/example/conversion_factor.cpp (original)
+++ branches/release/libs/units/example/conversion_factor.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief conversion_factor.cpp
 
-\detailed An example of using conversion_factor.
+\details An example of using conversion_factor.
 
 Output:
 @verbatim

Modified: branches/release/libs/units/example/dimension.cpp
==============================================================================
--- branches/release/libs/units/example/dimension.cpp (original)
+++ branches/release/libs/units/example/dimension.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief dimension.cpp
 
-\detailed
+\details
 Test dimension list manipulation.
 
 Output:

Modified: branches/release/libs/units/example/heterogeneous_unit.cpp
==============================================================================
--- branches/release/libs/units/example/heterogeneous_unit.cpp (original)
+++ branches/release/libs/units/example/heterogeneous_unit.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief heterogeneous_unit.cpp
 
-\detailed
+\details
 Test heterogeneous units and quantities.
 
 Output:

Modified: branches/release/libs/units/example/kitchen_sink.cpp
==============================================================================
--- branches/release/libs/units/example/kitchen_sink.cpp (original)
+++ branches/release/libs/units/example/kitchen_sink.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief kitchen_sink.cpp
 
-\detailed
+\details
 More extensive quantity tests.
 
 Output:

Modified: branches/release/libs/units/example/non_base_dimension.cpp
==============================================================================
--- branches/release/libs/units/example/non_base_dimension.cpp (original)
+++ branches/release/libs/units/example/non_base_dimension.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief non_base_dimension.cpp
 
-\detailed
+\details
 Another example of user-defined units with conversions.
 
 Output:

Modified: branches/release/libs/units/example/performance.cpp
==============================================================================
--- branches/release/libs/units/example/performance.cpp (original)
+++ branches/release/libs/units/example/performance.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief performance.cpp
 
-\detailed
+\details
 Test runtime performance.
 
 Output:

Modified: branches/release/libs/units/example/quantity.cpp
==============================================================================
--- branches/release/libs/units/example/quantity.cpp (original)
+++ branches/release/libs/units/example/quantity.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief quantity.cpp
 
-\detailed
+\details
 Test quantity algebra.
 
 Output:

Modified: branches/release/libs/units/example/quaternion.cpp
==============================================================================
--- branches/release/libs/units/example/quaternion.cpp (original)
+++ branches/release/libs/units/example/quaternion.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief quaternion.cpp
 
-\detailed
+\details
 Demonstrate interoperability with Boost.Quaternion.
 
 Output:

Modified: branches/release/libs/units/example/radar_beam_height.cpp
==============================================================================
--- branches/release/libs/units/example/radar_beam_height.cpp (original)
+++ branches/release/libs/units/example/radar_beam_height.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief radar_beam_height.cpp
 
-\detailed
+\details
 Demonstrate library usage for user test cases suggested by Michael Fawcett.
 
 Output:

Modified: branches/release/libs/units/example/systems.cpp
==============================================================================
--- branches/release/libs/units/example/systems.cpp (original)
+++ branches/release/libs/units/example/systems.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief systems.cpp
 
-\detailed
+\details
 Test various non-si units
 
 Output:

Modified: branches/release/libs/units/example/temperature.cpp
==============================================================================
--- branches/release/libs/units/example/temperature.cpp (original)
+++ branches/release/libs/units/example/temperature.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief temperature.cpp
 
-\detailed
+\details
 Conversions between Fahrenheit and Kelvin for absolute temperatures and
 temperature differences.
 

Modified: branches/release/libs/units/example/tutorial.cpp
==============================================================================
--- branches/release/libs/units/example/tutorial.cpp (original)
+++ branches/release/libs/units/example/tutorial.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -8,17 +8,22 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-/**
-\file
+/**
+\file tutorial.cpp
     
-\brief tutorial.cpp
+\brief Basic tutorial using SI units.
 
-\detailed
-Basic tutorial using si units.
+\details
+Tutorial
+Defines a function that computes the work, in joules,
+done by exerting a force in newtons over a specified distance
+in meters and outputs the result to std::cout.
+
+Also code for computing the complex impedance
+using std::complex<double> as the value type.
 
 Output:
 @verbatim
-
 //[tutorial_output
 F = 2 N
 dx = 2 m
@@ -30,9 +35,8 @@
 I*Z = (12.5,0) V
 I*Z == V? true
 //]
-
 @endverbatim
-**/
+*/
 
 //[tutorial_code
 #include <complex>
@@ -52,37 +56,39 @@
 using namespace boost::units::si;
 
 quantity<energy>
-work(const quantity<force>& F,const quantity<length>& dx)
+work(const quantity<force>& F, const quantity<length>& dx)
 {
- return F*dx;
+ return F * dx; // Defines the relation: work = force * distance.
 }
 
 int main()
 {
- /// test calcuation of work
- quantity<force> F(2.0*newton);
- quantity<length> dx(2.0*meter);
- quantity<energy> E(work(F,dx));
+ /// Test calculation of work.
+ quantity<force> F(2.0 * newton); // Define a quantity of force.
+ quantity<length> dx(2.0 * meter); // and a distance,
+ quantity<energy> E(work(F,dx)); // and calculate the work done.
     
     std::cout << "F = " << F << std::endl
               << "dx = " << dx << std::endl
               << "E = " << E << std::endl
               << std::endl;
 
- /// check complex quantities
- typedef std::complex<double> complex_type;
+ /// Test and check complex quantities.
+ typedef std::complex<double> complex_type; // double real and imaginary parts.
     
- quantity<electric_potential,complex_type> v = complex_type(12.5,0.0)*volts;
- quantity<current,complex_type> i = complex_type(3.0,4.0)*amperes;
- quantity<resistance,complex_type> z = complex_type(1.5,-2.0)*ohms;
+ // Define some complex electrical quantities.
+ quantity<electric_potential, complex_type> v = complex_type(12.5, 0.0) * volts;
+ quantity<current, complex_type> i = complex_type(3.0, 4.0) * amperes;
+ quantity<resistance, complex_type> z = complex_type(1.5, -2.0) * ohms;
     
     std::cout << "V = " << v << std::endl
               << "I = " << i << std::endl
- << "Z = " << z << std::endl
- << "I*Z = " << i*z << std::endl
- << "I*Z == V? " << std::boolalpha << (i*z == v) << std::endl
+ << "Z = " << z << std::endl
+ // Calculate from Ohm's law voltage = current * resistance.
+ << "I * Z = " << i * z << std::endl
+ // Check defined V is equal to calculated.
+ << "I * Z == V? " << std::boolalpha << (i * z == v) << std::endl
               << std::endl;
-
     return 0;
 }
 //]

Modified: branches/release/libs/units/example/unit.cpp
==============================================================================
--- branches/release/libs/units/example/unit.cpp (original)
+++ branches/release/libs/units/example/unit.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief unit.cpp
 
-\detailed
+\details
 Test unit algebra.
 
 Output:

Modified: branches/release/libs/units/test/Jamfile.v2
==============================================================================
--- branches/release/libs/units/test/Jamfile.v2 (original)
+++ branches/release/libs/units/test/Jamfile.v2 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -7,13 +7,26 @@
 # accompanying file LICENSE_1_0.txt or copy at
 # http://www.boost.org/LICENSE_1_0.txt
 
-project boost/units/test :
- requirements <include>$(BOOST_ROOT) <include>../../.. <toolset>msvc:<asynch-exceptions>on
+import testing ;
+
+warning-options = <warnings>all <warnings-as-errors>on ;
+warning-compilers =
+ <toolset>msvc
 ;
 
-import testing ;
+project boost/units/test :
+ requirements
+ <source>/boost//headers
+ <include>../../..
+ <toolset>msvc:<asynch-exceptions>on
+ $(warning-compilers):$(warning-options)
+ # This warning comes from the test library.
+ <toolset>msvc:<cxxflags>"/wd4701"
+ # The comes from the exception library
+ <toolset>msvc,<toolset-msvc:version>7.1:<cxxflags>"/wd4800"
+;
 
-alias test_framework : $(BOOST_ROOT)/libs/test/build//boost_unit_test_framework ;
+alias test_framework : /boost//unit_test_framework/<warnings-as-errors>off ;
 
 compile test_predicates.cpp ;
 compile test_negative_denominator.cpp ;

Modified: branches/release/libs/units/test/fail_add_temperature.cpp
==============================================================================
--- branches/release/libs/units/test/fail_add_temperature.cpp (original)
+++ branches/release/libs/units/test/fail_add_temperature.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_add_temperature.cpp
 
-\detailed
+\details
 Verify that adding two absolute temeratures fails miserably.
 
 Output:

Modified: branches/release/libs/units/test/fail_adl_detail.cpp
==============================================================================
--- branches/release/libs/units/test/fail_adl_detail.cpp (original)
+++ branches/release/libs/units/test/fail_adl_detail.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_adl_detail.cpp
 
-\detailed
+\details
 make sure that namespace detail is not pulled in by ADL.
 
 Output:

Modified: branches/release/libs/units/test/fail_base_dimension.cpp
==============================================================================
--- branches/release/libs/units/test/fail_base_dimension.cpp (original)
+++ branches/release/libs/units/test/fail_base_dimension.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_base_dimension.cpp
 
-\detailed
+\details
 make sure that trying to use the same ordinal for multiple
 base dimensions fails.
 

Modified: branches/release/libs/units/test/fail_heterogeneous_unit.cpp
==============================================================================
--- branches/release/libs/units/test/fail_heterogeneous_unit.cpp (original)
+++ branches/release/libs/units/test/fail_heterogeneous_unit.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_heterogeneous_unit.cpp
 
-\detailed
+\details
 make sure that trying to bind a heterogeneous system to a different dimension fails.
 
 Output:

Modified: branches/release/libs/units/test/fail_implicit_conversion.cpp
==============================================================================
--- branches/release/libs/units/test/fail_implicit_conversion.cpp (original)
+++ branches/release/libs/units/test/fail_implicit_conversion.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_implicit_conversion.cpp
 
-\detailed
+\details
 Test implicit conversions for quantity.
 
 Output:

Modified: branches/release/libs/units/test/fail_quantity_add.cpp
==============================================================================
--- branches/release/libs/units/test/fail_quantity_add.cpp (original)
+++ branches/release/libs/units/test/fail_quantity_add.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_quantity_add.cpp
 
-\detailed
+\details
 Test addition of quantities with different dimensions.
 
 Output:

Modified: branches/release/libs/units/test/fail_quantity_add_assign.cpp
==============================================================================
--- branches/release/libs/units/test/fail_quantity_add_assign.cpp (original)
+++ branches/release/libs/units/test/fail_quantity_add_assign.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_quantity_add_assign.cpp
 
-\detailed
+\details
 Test += of quantity from different dimensions.
 
 Output:

Modified: branches/release/libs/units/test/fail_quantity_assign.cpp
==============================================================================
--- branches/release/libs/units/test/fail_quantity_assign.cpp (original)
+++ branches/release/libs/units/test/fail_quantity_assign.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_quantity_assign.cpp
 
-\detailed
+\details
 Test assignment of quantity from different dimensions.
 
 Output:

Modified: branches/release/libs/units/test/fail_quantity_construct.cpp
==============================================================================
--- branches/release/libs/units/test/fail_quantity_construct.cpp (original)
+++ branches/release/libs/units/test/fail_quantity_construct.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_quantity_construct.cpp
 
-\detailed
+\details
 Test construction of quantity from different dimensions.
 
 Output:

Modified: branches/release/libs/units/test/fail_quantity_non_unit.cpp
==============================================================================
--- branches/release/libs/units/test/fail_quantity_non_unit.cpp (original)
+++ branches/release/libs/units/test/fail_quantity_non_unit.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -12,7 +12,7 @@
     
 \brief fail_quantity_non_unit.cpp
 
-\detailed
+\details
 
 Make sure that trying to use a base_unit as though
 it were a unit fails.

Modified: branches/release/libs/units/test/fail_quantity_scalar_add.cpp
==============================================================================
--- branches/release/libs/units/test/fail_quantity_scalar_add.cpp (original)
+++ branches/release/libs/units/test/fail_quantity_scalar_add.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_quantity_scalar_add.cpp
 
-\detailed
+\details
 Test addition of quantity and scalar.
 
 Output:

Modified: branches/release/libs/units/test/fail_quantity_scalar_sub.cpp
==============================================================================
--- branches/release/libs/units/test/fail_quantity_scalar_sub.cpp (original)
+++ branches/release/libs/units/test/fail_quantity_scalar_sub.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_quantity_scalar_sub.cpp
 
-\detailed
+\details
 Test subtraction of quantity and scalar.
 
 Output:

Modified: branches/release/libs/units/test/fail_quantity_sub_assign.cpp
==============================================================================
--- branches/release/libs/units/test/fail_quantity_sub_assign.cpp (original)
+++ branches/release/libs/units/test/fail_quantity_sub_assign.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_quantity_sub_assign.cpp
 
-\detailed
+\details
 Test -= of quantity from different dimensions.
 
 Output:

Modified: branches/release/libs/units/test/fail_quantity_subtract.cpp
==============================================================================
--- branches/release/libs/units/test/fail_quantity_subtract.cpp (original)
+++ branches/release/libs/units/test/fail_quantity_subtract.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_quantity_subtract.cpp
 
-\detailed
+\details
 Test subtraction of quantities with different dimensions.
 
 Output:

Modified: branches/release/libs/units/test/fail_quantity_unit_add.cpp
==============================================================================
--- branches/release/libs/units/test/fail_quantity_unit_add.cpp (original)
+++ branches/release/libs/units/test/fail_quantity_unit_add.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_quantity_unit_add.cpp
 
-\detailed
+\details
 Test addition of quantity and unit.
 
 Output:

Modified: branches/release/libs/units/test/fail_quantity_unit_subtract.cpp
==============================================================================
--- branches/release/libs/units/test/fail_quantity_unit_subtract.cpp (original)
+++ branches/release/libs/units/test/fail_quantity_unit_subtract.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_quantity_unit_subtract.cpp
 
-\detailed
+\details
 Test subtraction of quantity and unit.
 
 Output:

Modified: branches/release/libs/units/test/fail_scalar_quantity_add.cpp
==============================================================================
--- branches/release/libs/units/test/fail_scalar_quantity_add.cpp (original)
+++ branches/release/libs/units/test/fail_scalar_quantity_add.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_scalar_quantity_add.cpp
 
-\detailed
+\details
 Test addition of scalar and quantity.
 
 Output:

Modified: branches/release/libs/units/test/fail_scalar_quantity_sub.cpp
==============================================================================
--- branches/release/libs/units/test/fail_scalar_quantity_sub.cpp (original)
+++ branches/release/libs/units/test/fail_scalar_quantity_sub.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_scalar_quantity_sub.cpp
 
-\detailed
+\details
 Test subtraction of scalar and quantity.
 
 Output:

Modified: branches/release/libs/units/test/fail_unit_quantity_add.cpp
==============================================================================
--- branches/release/libs/units/test/fail_unit_quantity_add.cpp (original)
+++ branches/release/libs/units/test/fail_unit_quantity_add.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_unit_quantity_add.cpp
 
-\detailed
+\details
 Test addition of unit and quantity.
 
 Output:

Modified: branches/release/libs/units/test/fail_unit_quantity_subtract.cpp
==============================================================================
--- branches/release/libs/units/test/fail_unit_quantity_subtract.cpp (original)
+++ branches/release/libs/units/test/fail_unit_quantity_subtract.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief fail_unit_quantity_add.cpp
 
-\detailed
+\details
 Test addition of unit and quantity.
 
 Output:

Modified: branches/release/libs/units/test/test_absolute.cpp
==============================================================================
--- branches/release/libs/units/test/test_absolute.cpp (original)
+++ branches/release/libs/units/test/test_absolute.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief test_absolute.cpp
 
-\detailed
+\details
 Test absolute units.
 
 Output:

Modified: branches/release/libs/units/test/test_base_dimension.cpp
==============================================================================
--- branches/release/libs/units/test/test_base_dimension.cpp (original)
+++ branches/release/libs/units/test/test_base_dimension.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief test_base_dimension.cpp
 
-\detailed
+\details
 Test base_dimension class.
 
 Output:

Modified: branches/release/libs/units/test/test_cmath.cpp
==============================================================================
--- branches/release/libs/units/test/test_cmath.cpp (original)
+++ branches/release/libs/units/test/test_cmath.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief test_units_1.cpp
 
-\detailed
+\details
 Test unit class.
 
 Output:

Modified: branches/release/libs/units/test/test_constants.cpp
==============================================================================
--- branches/release/libs/units/test/test_constants.cpp (original)
+++ branches/release/libs/units/test/test_constants.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief test_constants.cpp
 
-\detailed
+\details
 Test all combinations of operators with the constants.
 
 **/

Modified: branches/release/libs/units/test/test_conversion.cpp
==============================================================================
--- branches/release/libs/units/test/test_conversion.cpp (original)
+++ branches/release/libs/units/test/test_conversion.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief test_conversion.cpp
 
-\detailed
+\details
 Test conversion between quantities.
 
 Output:

Modified: branches/release/libs/units/test/test_custom_unit.cpp
==============================================================================
--- branches/release/libs/units/test/test_custom_unit.cpp (original)
+++ branches/release/libs/units/test/test_custom_unit.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief test_custom_unit.cpp
 
-\detailed
+\details
 Make sure that a minimal + - * / unit class is fully functional.
 
 Output:
@@ -34,11 +34,17 @@
 
 template<int Mass, int Length, int Time>
 simple_unit<Mass, Length, Time> operator+(const simple_unit<Mass, Length, Time>&,
- const simple_unit<Mass, Length, Time>&) {}
+ const simple_unit<Mass, Length, Time>&)
+{
+ return simple_unit<Mass, Length, Time>();
+}
 
 template<int Mass, int Length, int Time>
 simple_unit<Mass, Length, Time> operator-(const simple_unit<Mass, Length, Time>&,
- const simple_unit<Mass, Length, Time>&) {}
+ const simple_unit<Mass, Length, Time>&)
+{
+ return simple_unit<Mass, Length, Time>();
+}
 
 template<int Mass1, int Length1, int Time1, int Mass2, int Length2, int Time2>
 simple_unit<Mass1 + Mass2, Length1 + Length2, Time1 + Time2>

Modified: branches/release/libs/units/test/test_dimensionless_quantity.cpp
==============================================================================
--- branches/release/libs/units/test/test_dimensionless_quantity.cpp (original)
+++ branches/release/libs/units/test/test_dimensionless_quantity.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief test_dimensionless_quantity.cpp
 
-\detailed
+\details
 Test unit class.
 
 Output:

Modified: branches/release/libs/units/test/test_header.hpp
==============================================================================
--- branches/release/libs/units/test/test_header.hpp (original)
+++ branches/release/libs/units/test/test_header.hpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief test_header.hpp
 
-\detailed
+\details
 Unit system for test purposes.
 
 Output:

Modified: branches/release/libs/units/test/test_implicit_conversion.cpp
==============================================================================
--- branches/release/libs/units/test/test_implicit_conversion.cpp (original)
+++ branches/release/libs/units/test/test_implicit_conversion.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief test_implicit_conversion.cpp
 
-\detailed
+\details
 Test implicit conversions for quantity.
 
 Output:

Modified: branches/release/libs/units/test/test_limits.cpp
==============================================================================
--- branches/release/libs/units/test/test_limits.cpp (original)
+++ branches/release/libs/units/test/test_limits.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief test_limits.cpp
 
-\detailed
+\details
 Test numeric_limits specialization.
 
 Output:

Modified: branches/release/libs/units/test/test_negative_denominator.cpp
==============================================================================
--- branches/release/libs/units/test/test_negative_denominator.cpp (original)
+++ branches/release/libs/units/test/test_negative_denominator.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief test_negative_denominator.cpp
 
-\detailed
+\details
 Test negative denominator for static_rational class.
 
 Output:

Modified: branches/release/libs/units/test/test_output.cpp
==============================================================================
--- branches/release/libs/units/test/test_output.cpp (original)
+++ branches/release/libs/units/test/test_output.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -2,19 +2,19 @@
 // unit/quantity manipulation and conversion
 //
 // Copyright (C) 2009 Steven Watanabe
+// Copyright Paul A. Bristow 2010
 //
 // 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
+\file test_output.cpp
     
-\brief test_output.cpp
-
-\detailed
+\brief
 Test unit and quantity printing
-
+\details
+Tests for output from various units, name, symbol and raw formats, and automatic prefixing in engineering and binary units.
 **/
 
 #include <boost/units/quantity.hpp>
@@ -35,6 +35,7 @@
 
 #include <sstream>
 #include <boost/config.hpp>
+#include <limits>
 
 #define BOOST_TEST_MAIN
 #include <boost/test/unit_test.hpp>
@@ -44,11 +45,16 @@
     static const char* symbol() { return("m"); }
 };
 
-struct second_base_unit : boost::units::base_unit<meter_base_unit, boost::units::time_dimension, 2> {
+struct second_base_unit : boost::units::base_unit<second_base_unit, boost::units::time_dimension, 2> {
     static const char* name() { return("second"); }
     static const char* symbol() { return("s"); }
 };
 
+struct byte_base_unit : boost::units::base_unit<byte_base_unit, boost::units::dimensionless_type, 3> {
+ static const char* name() { return("byte"); }
+ static const char* symbol() { return("b"); }
+};
+
 typedef boost::units::make_system<meter_base_unit, second_base_unit>::type my_system;
 
 typedef boost::units::unit<boost::units::length_dimension, my_system> length;
@@ -120,7 +126,8 @@
 
 #endif
 
-BOOST_AUTO_TEST_CASE(test_output_unit_symbol) {
+BOOST_AUTO_TEST_CASE(test_output_unit_symbol)
+{ // base units using default symbol_format (no format specified) and no auto prefixing.
 #define FORMATTERS
     BOOST_UNITS_TEST_OUTPUT(meter_base_unit::unit_type(), "m");
     BOOST_UNITS_TEST_OUTPUT(velocity(), "m s^-1");
@@ -141,7 +148,8 @@
 #undef FORMATTERS
 }
 
-BOOST_AUTO_TEST_CASE(test_output_unit_raw) {
+BOOST_AUTO_TEST_CASE(test_output_unit_raw)
+{ // raw format specified
 #define FORMATTERS << boost::units::raw_format
     BOOST_UNITS_TEST_OUTPUT(meter_base_unit::unit_type(), "m");
     BOOST_UNITS_TEST_OUTPUT(velocity(), "m s^-1");
@@ -163,7 +171,8 @@
 #undef FORMATTERS
 }
 
-BOOST_AUTO_TEST_CASE(test_output_unit_name) {
+BOOST_AUTO_TEST_CASE(test_output_unit_name)
+{ // name format specified.
 #define FORMATTERS << boost::units::name_format
     BOOST_UNITS_TEST_OUTPUT(meter_base_unit::unit_type(), "meter");
     BOOST_UNITS_TEST_OUTPUT(velocity(), "meter second^-1");
@@ -185,7 +194,8 @@
 }
 
 
-BOOST_AUTO_TEST_CASE(test_output_quantity_symbol) {
+BOOST_AUTO_TEST_CASE(test_output_quantity_symbol)
+{ // quantity symbols using default format.
 #define FORMATTERS
     BOOST_UNITS_TEST_OUTPUT(1.5*meter_base_unit::unit_type(), "1.5 m");
     BOOST_UNITS_TEST_OUTPUT(1.5*velocity(), "1.5 m s^-1");
@@ -203,10 +213,13 @@
     BOOST_UNITS_TEST_OUTPUT(1.5*scaled_custom1(), "1.5 kc1");
     BOOST_UNITS_TEST_OUTPUT(1.5*scaled_custom2(), "1.5 kc2");
     BOOST_UNITS_TEST_OUTPUT(1.5*boost::units::absolute<meter_base_unit::unit_type>(), "1.5 absolute m");
+ BOOST_UNITS_TEST_OUTPUT(pow(2., 10) * byte_base_unit::unit_type(), "1024 b");
+
 #undef FORMATTERS
 }
 
-BOOST_AUTO_TEST_CASE(test_output_quantity_raw) {
+BOOST_AUTO_TEST_CASE(test_output_quantity_raw)
+{ // quantity symbols using raw format.
 #define FORMATTERS << boost::units::raw_format
     BOOST_UNITS_TEST_OUTPUT(1.5*meter_base_unit::unit_type(), "1.5 m");
     BOOST_UNITS_TEST_OUTPUT(1.5*velocity(), "1.5 m s^-1");
@@ -228,7 +241,8 @@
 #undef FORMATTERS
 }
 
-BOOST_AUTO_TEST_CASE(test_output_quantity_name) {
+BOOST_AUTO_TEST_CASE(test_output_quantity_name)
+{ // // quantity symbols using name format.
 #define FORMATTERS << boost::units::name_format
     BOOST_UNITS_TEST_OUTPUT(1.5*meter_base_unit::unit_type(), "1.5 meter");
     BOOST_UNITS_TEST_OUTPUT(1.5*velocity(), "1.5 meter second^-1");
@@ -249,3 +263,170 @@
 #undef FORMATTERS
 }
 
+BOOST_AUTO_TEST_CASE(test_output_autoprefixed_quantity_name)
+{ // Engineering autoprefix, with name format.
+#define FORMATTERS << boost::units::name_format << boost::units::engineering_prefix
+ // Single base unit like meter.
+ BOOST_UNITS_TEST_OUTPUT(1.5*meter_base_unit::unit_type(), "1.5 meter");
+ BOOST_UNITS_TEST_OUTPUT(1500.0*meter_base_unit::unit_type(), "1.5 kilometer");
+ BOOST_UNITS_TEST_OUTPUT(1.5e7*meter_base_unit::unit_type(), "15 megameter");
+ BOOST_UNITS_TEST_OUTPUT(1.5e-3*meter_base_unit::unit_type(), "1.5 millimeter");
+ BOOST_UNITS_TEST_OUTPUT(1.5e-9*meter_base_unit::unit_type(), "1.5 nanometer");
+ BOOST_UNITS_TEST_OUTPUT(1.5e-8*meter_base_unit::unit_type(), "15 nanometer");
+ BOOST_UNITS_TEST_OUTPUT(1.5e-10*meter_base_unit::unit_type(), "150 picometer");
+ BOOST_UNITS_TEST_OUTPUT(0.0000000012345 * meter_base_unit::unit_type(), "1.2345 nanometer");
+
+ // Too small or large for a multiple name.
+ BOOST_UNITS_TEST_OUTPUT(9.99999e-25 * meter_base_unit::unit_type(), "9.99999e-025 meter"); // Just too small for multiple.
+ BOOST_UNITS_TEST_OUTPUT(1e+28 * meter_base_unit::unit_type(), "1e+028 meter"); // Just too large for multiple.
+ BOOST_UNITS_TEST_OUTPUT(1.5e-25 * meter_base_unit::unit_type(), "1.5e-025 meter"); // Too small for multiple.
+ BOOST_UNITS_TEST_OUTPUT(1.5e+28 * meter_base_unit::unit_type(), "1.5e+028 meter"); // Too large for multiple.
+ // Too 'biggest or too smallest'.
+ BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<float>::max()*meter_base_unit::unit_type(), "3.40282e+038 meter");
+ BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<float>::min()*meter_base_unit::unit_type(), "1.17549e-038 meter");
+ BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<double>::max()*meter_base_unit::unit_type(), "1.79769e+308 meter");
+ BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<double>::min()*meter_base_unit::unit_type(), "2.22507e-308 meter");
+ // Infinity and NaN
+#if defined(_MSC_VER)
+ BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<float>::infinity()*meter_base_unit::unit_type(), "1.#INF meter");
+ BOOST_UNITS_TEST_OUTPUT(-std::numeric_limits<float>::infinity()*meter_base_unit::unit_type(), "-1.#INF meter");
+ BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<double>::quiet_NaN()*meter_base_unit::unit_type(), "1.#QNAN meter");
+ BOOST_UNITS_TEST_OUTPUT(-std::numeric_limits<double>::quiet_NaN()*meter_base_unit::unit_type(), "-1.#IND meter");
+#elif defined(__GLIBCXX__)
+ BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<float>::infinity()*meter_base_unit::unit_type(), "inf meter");
+ BOOST_UNITS_TEST_OUTPUT(-std::numeric_limits<float>::infinity()*meter_base_unit::unit_type(), "-inf meter");
+ BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<double>::quiet_NaN()*meter_base_unit::unit_type(), "nan meter");
+ BOOST_UNITS_TEST_OUTPUT(-std::numeric_limits<double>::quiet_NaN()*meter_base_unit::unit_type(), "nan meter");
+#else
+ // TODO infinity on other platforms?
+#endif
+ BOOST_UNITS_TEST_OUTPUT(1.5*velocity(), "1.5 meter second^-1");
+ BOOST_UNITS_TEST_OUTPUT(1.5*scaled_length(), "1.5 kilometer");
+ BOOST_UNITS_TEST_OUTPUT(1.5*scaled_velocity1(), "1.5 kilo(meter second^-1)");
+ BOOST_UNITS_TEST_OUTPUT(1.5*millisecond_base_unit::unit_type(), "1.5 millisecond");
+ BOOST_UNITS_TEST_OUTPUT(1.5*scaled_time(), "1.5 millisecond");
+ BOOST_UNITS_TEST_OUTPUT(1.5*scaled_velocity2(), "1.5 meter millisecond^-1");
+ BOOST_UNITS_TEST_OUTPUT(1.5*area(), "1.5 meter^2");
+ BOOST_UNITS_TEST_OUTPUT(1.5*scaled_area(), "1.5 kilo(meter^2)");
+ BOOST_UNITS_TEST_OUTPUT(1.5*double_scaled_length(), "1.536 megameter"); // 1.5 * 2^10 = 1.5 * 1024 = 1.536
+ BOOST_UNITS_TEST_OUTPUT(1.5*double_scaled_length2(), "1.5 kiloscaled_meter");
+ BOOST_UNITS_TEST_OUTPUT(1.5*custom1(), "1.5 custom1");
+ BOOST_UNITS_TEST_OUTPUT(1.5*custom2(), "1.5 custom2");
+ BOOST_UNITS_TEST_OUTPUT(1.5*scaled_custom1(), "1.5 kilocustom1");
+ BOOST_UNITS_TEST_OUTPUT(1.5*scaled_custom2(), "1.5 kilocustom2");
+ BOOST_UNITS_TEST_OUTPUT(1.5*boost::units::absolute<meter_base_unit::unit_type>(), "1.5 absolute meter");
+ BOOST_UNITS_TEST_OUTPUT(pow(2., 10) * byte_base_unit::unit_type(), "1.024 kilobyte");
+
+ BOOST_UNITS_TEST_OUTPUT(1.5, "1.5"); // scalar.
+ BOOST_UNITS_TEST_OUTPUT(1567., "1567"); // scalars are *not* autoprefixed.
+ BOOST_UNITS_TEST_OUTPUT(0.00015, "0.00015"); // scalars are *not* autoprefixed.
+ BOOST_UNITS_TEST_OUTPUT(-1.5, "-1.5"); // scalar.
+ BOOST_UNITS_TEST_OUTPUT(-1567., "-1567"); // scalars are *not* autoprefixed.
+ BOOST_UNITS_TEST_OUTPUT(-0.00015, "-0.00015"); // scalars are *not* autoprefixed.
+#undef FORMATTERS
+}
+
+BOOST_AUTO_TEST_CASE(test_output_autoprefixed_quantity_symbol)
+{ // Engineering autoprefix, with symbol format.
+#define FORMATTERS << boost::units::symbol_format << boost::units::engineering_prefix
+ // Single base unit like m.
+ BOOST_UNITS_TEST_OUTPUT(1.5*meter_base_unit::unit_type(), "1.5 m");
+ BOOST_UNITS_TEST_OUTPUT(1500.0*meter_base_unit::unit_type(), "1.5 km");
+ BOOST_UNITS_TEST_OUTPUT(1.5e7*meter_base_unit::unit_type(), "15 Mm");
+ BOOST_UNITS_TEST_OUTPUT(1.5e-3*meter_base_unit::unit_type(), "1.5 mm");
+ BOOST_UNITS_TEST_OUTPUT(1.5e-9*meter_base_unit::unit_type(), "1.5 nm");
+ BOOST_UNITS_TEST_OUTPUT(1.5e-8*meter_base_unit::unit_type(), "15 nm");
+ BOOST_UNITS_TEST_OUTPUT(1.5e-10*meter_base_unit::unit_type(), "150 pm");
+ // Too small or large for a multiple name.
+ BOOST_UNITS_TEST_OUTPUT(9.99999e-25 * meter_base_unit::unit_type(), "9.99999e-025 m"); // Just too small for multiple.
+ BOOST_UNITS_TEST_OUTPUT(1e+28 * meter_base_unit::unit_type(), "1e+028 m"); // Just too large for multiple.
+ BOOST_UNITS_TEST_OUTPUT(1.5e-25 * meter_base_unit::unit_type(), "1.5e-025 m"); // Too small for multiple.
+ BOOST_UNITS_TEST_OUTPUT(1.5e+28 * meter_base_unit::unit_type(), "1.5e+028 m"); // Too large for multiple.
+ //
+ BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<float>::max()*meter_base_unit::unit_type(), "3.40282e+038 m");
+ BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<float>::min()*meter_base_unit::unit_type(), "1.17549e-038 m");
+ BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<double>::max()*meter_base_unit::unit_type(), "1.79769e+308 m");
+ BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<double>::min()*meter_base_unit::unit_type(), "2.22507e-308 m");
+
+ BOOST_UNITS_TEST_OUTPUT(1.5*velocity(), "1.5 m s^-1");
+ BOOST_UNITS_TEST_OUTPUT(1.5*scaled_length(), "1.5 km");
+ BOOST_UNITS_TEST_OUTPUT(1.5*scaled_velocity1(), "1.5 k(m s^-1)");
+ BOOST_UNITS_TEST_OUTPUT(1.5*millisecond_base_unit::unit_type(), "1.5 ms");
+ BOOST_UNITS_TEST_OUTPUT(1.5*scaled_time(), "1.5 ms");
+ BOOST_UNITS_TEST_OUTPUT(1.5*scaled_velocity2(), "1.5 m ms^-1");
+ BOOST_UNITS_TEST_OUTPUT(1.5*area(), "1.5 m^2");
+ BOOST_UNITS_TEST_OUTPUT(1.5*scaled_area(), "1.5 k(m^2)");
+ BOOST_UNITS_TEST_OUTPUT(1.5*double_scaled_length(), "1.536 Mm"); // 1.5 * 2^10 = 1.5 * 1024 = 1.536
+ BOOST_UNITS_TEST_OUTPUT(1.5*double_scaled_length2(), "1.5 kscm");
+ BOOST_UNITS_TEST_OUTPUT(1.5*custom1(), "1.5 c1");
+ BOOST_UNITS_TEST_OUTPUT(1.5*custom2(), "1.5 c2");
+ BOOST_UNITS_TEST_OUTPUT(1.5*scaled_custom1(), "1.5 kc1");
+ BOOST_UNITS_TEST_OUTPUT(1.5*scaled_custom2(), "1.5 kc2");
+ BOOST_UNITS_TEST_OUTPUT(1.5*boost::units::absolute<meter_base_unit::unit_type>(), "1.5 absolute m");
+ BOOST_UNITS_TEST_OUTPUT(pow(2., 10) * byte_base_unit::unit_type(), "1.024 kb");
+
+#undef FORMATTERS
+}
+
+BOOST_AUTO_TEST_CASE(test_output_auto_binary_prefixed_quantity_symbol)
+{ // Binary prefix with symbol format.
+#define FORMATTERS << boost::units::symbol_format << boost::units::binary_prefix
+ BOOST_UNITS_TEST_OUTPUT(1024 * byte_base_unit::unit_type(), "1 Kib");
+ BOOST_UNITS_TEST_OUTPUT(pow(2., 20) * byte_base_unit::unit_type(), "1 Mib");
+ BOOST_UNITS_TEST_OUTPUT(pow(2., 30) * byte_base_unit::unit_type(), "1 Gib");
+ BOOST_UNITS_TEST_OUTPUT(pow(2., 40) * byte_base_unit::unit_type(), "1 Tib");
+ BOOST_UNITS_TEST_OUTPUT(pow(2., 50) * byte_base_unit::unit_type(), "1 Pib");
+ BOOST_UNITS_TEST_OUTPUT(pow(2., 60) * byte_base_unit::unit_type(), "1 Eib");
+ BOOST_UNITS_TEST_OUTPUT(42, "42"); // integer scalar.
+ BOOST_UNITS_TEST_OUTPUT(-42, "-42"); // integer scalar.
+ BOOST_UNITS_TEST_OUTPUT(1567, "1567"); // scalars are *not* autoprefixed.
+ BOOST_UNITS_TEST_OUTPUT(-1567, "-1567"); // scalars are *not* autoprefixed.
+#undef FORMATTERS
+}
+
+BOOST_AUTO_TEST_CASE(test_output_auto_binary_prefixed_quantity_name)
+{ // Binary prefix with name format.
+ // http://physics.nist.gov/cuu/Units/binary.html
+ // 1998 the International Electrotechnical Commission (IEC) approved
+ // IEC 60027-2, Second edition, 2000-11, Letter symbols to be used in electrical technology
+ // - Part 2: Telecommunications and electronics.
+#define FORMATTERS << boost::units::name_format << boost::units::binary_prefix
+ BOOST_UNITS_TEST_OUTPUT(2048 * byte_base_unit::unit_type(), "2 kibibyte");
+ BOOST_UNITS_TEST_OUTPUT(pow(2., 32) *byte_base_unit::unit_type(), "4 gibibyte");
+ BOOST_UNITS_TEST_OUTPUT(pow(2., 41) *byte_base_unit::unit_type(), "2 tebibyte"); // http://en.wikipedia.org/wiki/Tebibyte
+ BOOST_UNITS_TEST_OUTPUT(pow(2., 50) *byte_base_unit::unit_type(), "1 pebibyte");
+ BOOST_UNITS_TEST_OUTPUT(pow(2., 60) *byte_base_unit::unit_type(), "1 exbibyte");
+ BOOST_UNITS_TEST_OUTPUT(2048, "2048"); // scalars are *not* autoprefixed.
+ BOOST_UNITS_TEST_OUTPUT(-4096, "-4096"); // scalars are *not* autoprefixed.
+#undef FORMATTERS
+}
+
+// Tests on using more than one format or prefix - only the last specified should be used.
+// (This may indicate a programming mistake, but it is ignored).
+BOOST_AUTO_TEST_CASE(test_output_quantity_name_duplicate)
+{ // Ensure that if more than one format specified, only the last is used.
+#define FORMATTERS << boost::units::symbol_format << boost::units::name_format
+ BOOST_UNITS_TEST_OUTPUT(1.5*meter_base_unit::unit_type(), "1.5 meter");
+#undef FORMATTERS
+}
+
+BOOST_AUTO_TEST_CASE(test_output_quantity_symbol_duplicate)
+{ // Ensure that if more than one format specified, only the last is used.
+#define FORMATTERS << boost::units::name_format << boost::units::symbol_format
+ BOOST_UNITS_TEST_OUTPUT(1.5*meter_base_unit::unit_type(), "1.5 m");
+#undef FORMATTERS
+}
+
+BOOST_AUTO_TEST_CASE(test_output_auto_binary_prefixed_quantity_name_duplicate)
+{ // Ensure that if more than one auto prefix specified, only the last is used.
+#define FORMATTERS << boost::units::name_format << boost::units::binary_prefix << boost::units::engineering_prefix
+ BOOST_UNITS_TEST_OUTPUT(2048 * byte_base_unit::unit_type(), "2.048 kilobyte");
+#undef FORMATTERS
+}
+
+BOOST_AUTO_TEST_CASE(test_output_auto_binary_prefixed_quantity_symbol_duplicate)
+{ // Ensure that if more than one auto prefix specified, only the last is used.
+#define FORMATTERS << boost::units::symbol_format << boost::units::engineering_prefix << boost::units::binary_prefix
+ BOOST_UNITS_TEST_OUTPUT(2048 * byte_base_unit::unit_type(), "2 Kib");
+#undef FORMATTERS
+}

Modified: branches/release/libs/units/test/test_predicates.cpp
==============================================================================
--- branches/release/libs/units/test/test_predicates.cpp (original)
+++ branches/release/libs/units/test/test_predicates.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief test_predicates.cpp
 
-\detailed
+\details
 Test metafunctions is_unit, is_quantity, is_dimension_list ....
 
 Output:

Modified: branches/release/libs/units/test/test_quantity.cpp
==============================================================================
--- branches/release/libs/units/test/test_quantity.cpp (original)
+++ branches/release/libs/units/test/test_quantity.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief test_units_1.cpp
 
-\detailed
+\details
 Test unit class.
 
 Output:

Modified: branches/release/libs/units/test/test_reduce_unit.cpp
==============================================================================
--- branches/release/libs/units/test/test_reduce_unit.cpp (original)
+++ branches/release/libs/units/test/test_reduce_unit.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief test_reduce_unit.cpp
 
-\detailed
+\details
 Test that reduce_unit works correctly by itself to try to isolate problems.
 
 Output:

Modified: branches/release/libs/units/test/test_scaled_conversion.cpp
==============================================================================
--- branches/release/libs/units/test/test_scaled_conversion.cpp (original)
+++ branches/release/libs/units/test/test_scaled_conversion.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief test_scaled_conversion.cpp
 
-\detailed
+\details
 Test unit scaling
 
 Output:

Modified: branches/release/libs/units/test/test_scaled_unit.cpp
==============================================================================
--- branches/release/libs/units/test/test_scaled_unit.cpp (original)
+++ branches/release/libs/units/test/test_scaled_unit.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief test_scaled_conversion.cpp
 
-\detailed
+\details
 Test unit scaling
 
 Output:

Modified: branches/release/libs/units/test/test_trig.cpp
==============================================================================
--- branches/release/libs/units/test/test_trig.cpp (original)
+++ branches/release/libs/units/test/test_trig.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -12,7 +12,7 @@
     
 \brief test_trig.cpp
 
-\detailed
+\details
 Test trigonometric functions.
 
 Output:
@@ -35,6 +35,7 @@
 using boost::units::degree::degrees;
 BOOST_UNITS_STATIC_CONSTANT(degree_dimensionless, boost::units::degree::dimensionless);
 using boost::units::si::meters;
+BOOST_UNITS_STATIC_CONSTANT(heterogeneous_dimensionless, boost::units::reduce_unit<boost::units::si::dimensionless>::type);
 
 BOOST_AUTO_TEST_CASE(test_sin) {
     BOOST_CHECK_EQUAL(boost::units::sin(2.0 * radians), std::sin(2.0) * si_dimensionless);
@@ -54,20 +55,24 @@
 BOOST_AUTO_TEST_CASE(test_asin) {
     BOOST_CHECK_EQUAL(boost::units::asin(0.2 * si_dimensionless), std::asin(0.2) * radians);
     BOOST_CHECK_CLOSE_FRACTION(boost::units::asin(0.5 * degree_dimensionless).value(), 30.0, 0.0001);
+ BOOST_CHECK_EQUAL(boost::units::asin(0.2 * heterogeneous_dimensionless).value(), std::asin(0.2));
 }
 
 BOOST_AUTO_TEST_CASE(test_acos) {
     BOOST_CHECK_EQUAL(boost::units::acos(0.2 * si_dimensionless), std::acos(0.2) * radians);
     BOOST_CHECK_CLOSE_FRACTION(boost::units::acos(0.5 * degree_dimensionless).value(), 60.0, 0.0001);
+ BOOST_CHECK_EQUAL(boost::units::acos(0.2 * heterogeneous_dimensionless).value(), std::acos(0.2));
 }
 
 BOOST_AUTO_TEST_CASE(test_atan) {
     BOOST_CHECK_EQUAL(boost::units::atan(0.2 * si_dimensionless), std::atan(0.2) * radians);
     BOOST_CHECK_CLOSE_FRACTION(boost::units::atan(1.0 * degree_dimensionless).value(), 45.0, 0.0001);
+ BOOST_CHECK_EQUAL(boost::units::atan(0.2 * heterogeneous_dimensionless).value(), std::atan(0.2));
 }
 
 BOOST_AUTO_TEST_CASE(test_atan2) {
     BOOST_CHECK_EQUAL(boost::units::atan2(0.2 * si_dimensionless, 0.3 * si_dimensionless), std::atan2(0.2, 0.3) * radians);
     BOOST_CHECK_EQUAL(boost::units::atan2(0.2 * meters, 0.3 * meters), std::atan2(0.2, 0.3) * radians);
     BOOST_CHECK_CLOSE_FRACTION(boost::units::atan2(0.8660*degree_dimensionless,0.5*degree_dimensionless).value(), 60., 0.0002);
+ BOOST_CHECK_EQUAL(boost::units::atan2(0.2 * heterogeneous_dimensionless, 0.3 * heterogeneous_dimensionless).value(), std::atan2(0.2, 0.3));
 }

Modified: branches/release/libs/units/test/test_unit.cpp
==============================================================================
--- branches/release/libs/units/test/test_unit.cpp (original)
+++ branches/release/libs/units/test/test_unit.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -13,7 +13,7 @@
     
 \brief test_units_1.cpp
 
-\detailed
+\details
 Test unit class.
 
 Output:

Modified: branches/release/libs/units/test/test_unscale.cpp
==============================================================================
--- branches/release/libs/units/test/test_unscale.cpp (original)
+++ branches/release/libs/units/test/test_unscale.cpp 2010-10-11 10:55:01 EDT (Mon, 11 Oct 2010)
@@ -1,4 +1,4 @@
-// Boost.Units - A C++ library for zero-overhead dimensional analysis and
+// Boost.Units - A C++ library for zero-overhead dimensional analysis and
 // unit/quantity manipulation and conversion
 //
 // Copyright (C) 2003-2008 Matthias Christian Schabel
@@ -13,7 +13,7 @@
     
 \brief test_unscale.cpp
 
-\detailed
+\details
 Test that unscale works in an attempt to isolate the sun problems.
 
 Output:


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