// Boost.Units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2008 Matthias Christian Schabel // Copyright (C) 2007-2008 Steven Watanabe // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_UNITS_DETAIL_UNSCALE_HPP_INCLUDED #define BOOST_UNITS_DETAIL_UNSCALE_HPP_INCLUDED #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace boost { namespace units { template struct heterogeneous_system; template struct heterogeneous_system_impl; template struct heterogeneous_system_dim; template struct scaled_base_unit; /// removes all scaling from a unit or a base unit. template struct unscale { #ifndef BOOST_UNITS_DOXYGEN typedef T type; #else typedef detail::unspecified type; #endif }; /// INTERNAL ONLY template struct unscale > { typedef typename unscale::type type; }; /// INTERNAL ONLY template struct unscale > { typedef unit::type> type; }; /// INTERNAL ONLY template struct scale_list_dim; /// INTERNAL ONLY template struct get_scale_list { typedef dimensionless_type type; }; /// INTERNAL ONLY template struct get_scale_list > { typedef typename mpl::times, dimensionless_type>, typename get_scale_list::type>::type type; }; /// INTERNAL ONLY template struct get_scale_list > { typedef typename get_scale_list::type type; }; /// INTERNAL ONLY struct scale_dim_tag {}; /// INTERNAL ONLY template struct scale_list_dim : Scale { typedef scale_dim_tag tag; typedef scale_list_dim type; }; } // namespace units #ifndef BOOST_UNITS_DOXYGEN namespace mpl { /// INTERNAL ONLY template<> struct less_impl { template struct apply : mpl::bool_<((T0::base) < (T1::base))> {}; }; } #endif namespace units { namespace detail { template struct is_empty_dim > : mpl::false_ {}; template struct is_empty_dim > > > : mpl::true_ {}; template struct eval_scale_list_impl { template struct apply { typedef typename eval_scale_list_impl::template apply next_iteration; typedef typename multiply_typeof_helper::type type; static type value() { return(next_iteration::value() * Begin::item::value()); } }; }; template<> struct eval_scale_list_impl<0> { template struct apply { typedef one type; static one value() { one result; return(result); } }; }; } /// INTERNAL ONLY template struct eval_scale_list : detail::eval_scale_list_impl::template apply {}; } // namespace units #ifndef BOOST_UNITS_DOXYGEN namespace mpl { /// INTERNAL ONLY template<> struct plus_impl { template struct apply { typedef boost::units::scale_list_dim< boost::units::scale< (T0::base), typename mpl::plus::type > > type; }; }; /// INTERNAL ONLY template<> struct negate_impl { template struct apply { typedef boost::units::scale_list_dim< boost::units::scale< (T0::base), typename mpl::negate::type > > type; }; }; /// INTERNAL ONLY template<> struct times_impl { template struct apply { typedef boost::units::scale_list_dim< boost::units::scale< (T0::base), typename mpl::times::type > > type; }; }; } // namespace mpl #endif } // namespace boost #endif