Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 10:09:56

0001 // Boost.Units - A C++ library for zero-overhead dimensional analysis and 
0002 // unit/quantity manipulation and conversion
0003 //
0004 // Copyright (C) 2003-2008 Matthias Christian Schabel
0005 // Copyright (C) 2008 Steven Watanabe
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. (See
0008 // accompanying file LICENSE_1_0.txt or copy at
0009 // http://www.boost.org/LICENSE_1_0.txt)
0010 
0011 #ifndef BOOST_UNITS_SCALED_BASE_UNIT_HPP_INCLUDED
0012 #define BOOST_UNITS_SCALED_BASE_UNIT_HPP_INCLUDED
0013 
0014 #include <string>
0015 
0016 #include <boost/mpl/bool.hpp>
0017 #include <boost/mpl/less.hpp>
0018 #include <boost/type_traits/is_same.hpp>
0019 
0020 #include <boost/units/config.hpp>
0021 #include <boost/units/dimension.hpp>
0022 #include <boost/units/static_rational.hpp>
0023 #include <boost/units/units_fwd.hpp>
0024 
0025 namespace boost {
0026 
0027 namespace units {
0028 
0029 template<class T>
0030 struct heterogeneous_system;
0031 
0032 template<class T, class D, class Scale>
0033 struct heterogeneous_system_impl;
0034 
0035 template<class T, class E>
0036 struct heterogeneous_system_dim;
0037 
0038 template<class T>
0039 struct base_unit_info;
0040 
0041 /// INTERNAL ONLY
0042 struct scaled_base_unit_tag {};
0043 
0044 template<class S, class Scale>
0045 struct scaled_base_unit
0046 {
0047     /// INTERNAL ONLY
0048     typedef void boost_units_is_base_unit_type;
0049     typedef scaled_base_unit type;
0050     typedef scaled_base_unit_tag tag;
0051     typedef S system_type;
0052     typedef Scale scale_type;
0053     typedef typename S::dimension_type dimension_type;
0054 
0055 #ifdef BOOST_UNITS_DOXYGEN
0056 
0057     typedef detail::unspecified unit_type;
0058 
0059 #else
0060 
0061     typedef unit<
0062         dimension_type,
0063         heterogeneous_system<
0064             heterogeneous_system_impl<
0065                 list<
0066                     heterogeneous_system_dim<scaled_base_unit,static_rational<1> >,
0067                     dimensionless_type
0068                 >,
0069                 dimension_type,
0070                 dimensionless_type
0071             >
0072         >
0073     > unit_type;
0074 
0075 #endif
0076 
0077     static std::string symbol()
0078     {
0079         return(Scale::symbol() + base_unit_info<S>::symbol());
0080     }
0081     static std::string name()
0082     {
0083         return(Scale::name() + base_unit_info<S>::name());
0084     }
0085 };
0086 
0087 } // namespace units
0088 
0089 } // namespace boost
0090 
0091 #if BOOST_UNITS_HAS_BOOST_TYPEOF
0092 
0093 #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
0094 
0095 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::scaled_base_unit, (class)(class))
0096 
0097 #endif
0098 
0099 namespace boost {
0100 
0101 #ifndef BOOST_UNITS_DOXYGEN
0102 
0103 namespace mpl {
0104 
0105 /// INTERNAL ONLY
0106 template<class Tag>
0107 struct less_impl<boost::units::scaled_base_unit_tag, Tag>
0108 {
0109     template<class T0, class T1>
0110     struct apply : mpl::bool_<
0111         mpl::less<typename T0::system_type, T1>::value ||
0112     (boost::is_same<typename T0::system_type, T1>::value && ((T0::scale_type::exponent::Numerator) < 0)) > {};
0113 };
0114 
0115 /// INTERNAL ONLY
0116 template<class Tag>
0117 struct less_impl<Tag, boost::units::scaled_base_unit_tag>
0118 {
0119     template<class T0, class T1>
0120     struct apply : mpl::bool_<
0121         mpl::less<T0, typename T1::system_type>::value ||
0122     (boost::is_same<T0, typename T1::system_type>::value && ((T1::scale_type::exponent::Numerator) > 0)) > {};
0123 };
0124 
0125 /// INTERNAL ONLY
0126 template<>
0127 struct less_impl<boost::units::scaled_base_unit_tag, boost::units::scaled_base_unit_tag>
0128 {
0129     template<class T0, class T1>
0130     struct apply : mpl::bool_<
0131         mpl::less<typename T0::system_type, typename T1::system_type>::value ||
0132     ((boost::is_same<typename T0::system_type, typename T1::system_type>::value) &&
0133      ((T0::scale_type::base) < (T1::scale_type::base) ||
0134       ((T0::scale_type::base) == (T1::scale_type::base) &&
0135        mpl::less<typename T0::scale_type::exponent, typename T1::scale_type::exponent>::value))) > {};
0136 };
0137 
0138 } // namespace mpl
0139 
0140 #endif
0141 
0142 } // namespace boost
0143 
0144 #endif