|
Boost-Commit : |
From: steven_at_[hidden]
Date: 2008-05-28 23:54:30
Author: steven_watanabe
Date: 2008-05-28 23:54:30 EDT (Wed, 28 May 2008)
New Revision: 45896
URL: http://svn.boost.org/trac/boost/changeset/45896
Log:
Added comment to io.hpp
Text files modified:
sandbox/units/boost/units/io.hpp | 25 ++++++++++++++++++++++++-
1 files changed, 24 insertions(+), 1 deletions(-)
Modified: sandbox/units/boost/units/io.hpp
==============================================================================
--- sandbox/units/boost/units/io.hpp (original)
+++ sandbox/units/boost/units/io.hpp 2008-05-28 23:54:30 EDT (Wed, 28 May 2008)
@@ -338,6 +338,9 @@
namespace io_impl {
+// These two overloads of symbol_string and name_string will
+// will pick up homogeneous_systems. They simply call the
+// appropriate function with a heterogeneous_system.
template<class Dimension,class System>
inline std::string
symbol_string(const unit<Dimension,System>&)
@@ -353,6 +356,7 @@
}
/// INTERNAL ONLY
+// this overload picks up heterogeneous units that are not scaled.
template<class Dimension,class Units>
inline std::string
symbol_string(const unit<Dimension, heterogeneous_system<heterogeneous_system_impl<Units, Dimension, dimensionless_type> > >&)
@@ -365,6 +369,8 @@
return(str);
}
+// This overload is a special case for heterogeneous_system which
+// is really unitless
/// INTERNAL ONLY
inline std::string
symbol_string(const unit<dimensionless_type, heterogeneous_system<heterogeneous_system_impl<dimensionless_type, dimensionless_type, dimensionless_type> > >&)
@@ -372,6 +378,8 @@
return("dimensionless");
}
+// this overload deals with heterogeneous_systems which are unitless
+// but scaled.
/// INTERNAL ONLY
template<class Scale>
inline std::string
@@ -385,6 +393,7 @@
return(str);
}
+// this overload deals with scaled units.
/// INTERNAL ONLY
template<class Dimension,class Units,class Scale>
inline std::string
@@ -411,6 +420,9 @@
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>
inline std::string
@@ -426,6 +438,10 @@
return(str);
}
+// 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.
/// INTERNAL ONLY
template<class Dimension,class Unit>
inline std::string
@@ -439,6 +455,12 @@
return(str);
}
+
+// 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
+//
/// INTERNAL ONLY
template<class Dimension,class Unit,class UnitScale, class Scale>
inline std::string
@@ -457,8 +479,9 @@
>()));
}
+// this overload disambuguates between the overload for an unscaled unit
+// and the overload for a scaled base unit raised to the first power.
/// INTERNAL ONLY
-// disambiguate
template<class Dimension,class Unit,class UnitScale>
inline std::string
symbol_string(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> > >&)
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