annotate DEPENDENCIES/generic/include/boost/units/scaled_base_unit.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // Boost.Units - A C++ library for zero-overhead dimensional analysis and
Chris@16 2 // unit/quantity manipulation and conversion
Chris@16 3 //
Chris@16 4 // Copyright (C) 2003-2008 Matthias Christian Schabel
Chris@16 5 // Copyright (C) 2008 Steven Watanabe
Chris@16 6 //
Chris@16 7 // Distributed under the Boost Software License, Version 1.0. (See
Chris@16 8 // accompanying file LICENSE_1_0.txt or copy at
Chris@16 9 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 10
Chris@16 11 #ifndef BOOST_UNITS_SCALED_BASE_UNIT_HPP_INCLUDED
Chris@16 12 #define BOOST_UNITS_SCALED_BASE_UNIT_HPP_INCLUDED
Chris@16 13
Chris@16 14 #include <string>
Chris@16 15
Chris@16 16 #include <boost/mpl/bool.hpp>
Chris@16 17 #include <boost/mpl/less.hpp>
Chris@16 18 #include <boost/type_traits/is_same.hpp>
Chris@16 19 #include <boost/type_traits/detail/ice_and.hpp>
Chris@16 20 #include <boost/type_traits/detail/ice_or.hpp>
Chris@16 21
Chris@16 22 #include <boost/units/config.hpp>
Chris@16 23 #include <boost/units/dimension.hpp>
Chris@16 24 #include <boost/units/static_rational.hpp>
Chris@16 25 #include <boost/units/units_fwd.hpp>
Chris@16 26
Chris@16 27 namespace boost {
Chris@16 28
Chris@16 29 namespace units {
Chris@16 30
Chris@16 31 template<class T>
Chris@16 32 struct heterogeneous_system;
Chris@16 33
Chris@16 34 template<class T, class D, class Scale>
Chris@16 35 struct heterogeneous_system_impl;
Chris@16 36
Chris@16 37 template<class T, class E>
Chris@16 38 struct heterogeneous_system_dim;
Chris@16 39
Chris@16 40 template<class T>
Chris@16 41 struct base_unit_info;
Chris@16 42
Chris@16 43 /// INTERNAL ONLY
Chris@16 44 struct scaled_base_unit_tag {};
Chris@16 45
Chris@16 46 template<class S, class Scale>
Chris@16 47 struct scaled_base_unit
Chris@16 48 {
Chris@16 49 /// INTERNAL ONLY
Chris@16 50 typedef void boost_units_is_base_unit_type;
Chris@16 51 typedef scaled_base_unit type;
Chris@16 52 typedef scaled_base_unit_tag tag;
Chris@16 53 typedef S system_type;
Chris@16 54 typedef Scale scale_type;
Chris@16 55 typedef typename S::dimension_type dimension_type;
Chris@16 56
Chris@16 57 #ifdef BOOST_UNITS_DOXYGEN
Chris@16 58
Chris@16 59 typedef detail::unspecified unit_type;
Chris@16 60
Chris@16 61 #else
Chris@16 62
Chris@16 63 typedef unit<
Chris@16 64 dimension_type,
Chris@16 65 heterogeneous_system<
Chris@16 66 heterogeneous_system_impl<
Chris@16 67 list<
Chris@16 68 heterogeneous_system_dim<scaled_base_unit,static_rational<1> >,
Chris@16 69 dimensionless_type
Chris@16 70 >,
Chris@16 71 dimension_type,
Chris@16 72 dimensionless_type
Chris@16 73 >
Chris@16 74 >
Chris@16 75 > unit_type;
Chris@16 76
Chris@16 77 #endif
Chris@16 78
Chris@16 79 static std::string symbol()
Chris@16 80 {
Chris@16 81 return(Scale::symbol() + base_unit_info<S>::symbol());
Chris@16 82 }
Chris@16 83 static std::string name()
Chris@16 84 {
Chris@16 85 return(Scale::name() + base_unit_info<S>::name());
Chris@16 86 }
Chris@16 87 };
Chris@16 88
Chris@16 89 } // namespace units
Chris@16 90
Chris@16 91 } // namespace boost
Chris@16 92
Chris@16 93 #if BOOST_UNITS_HAS_BOOST_TYPEOF
Chris@16 94
Chris@16 95 #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
Chris@16 96
Chris@16 97 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::scaled_base_unit, (class)(class))
Chris@16 98
Chris@16 99 #endif
Chris@16 100
Chris@16 101 namespace boost {
Chris@16 102
Chris@16 103 #ifndef BOOST_UNITS_DOXYGEN
Chris@16 104
Chris@16 105 namespace mpl {
Chris@16 106
Chris@16 107 /// INTERNAL ONLY
Chris@16 108 template<class Tag>
Chris@16 109 struct less_impl<boost::units::scaled_base_unit_tag, Tag>
Chris@16 110 {
Chris@16 111 template<class T0, class T1>
Chris@16 112 struct apply : mpl::bool_<
Chris@16 113 boost::type_traits::ice_or<(mpl::less<typename T0::system_type, T1>::value),
Chris@16 114 (boost::type_traits::ice_and<boost::is_same<typename T0::system_type, T1>::value, (T0::scale_type::exponent::Numerator) < 0>::value)>::value> {};
Chris@16 115 };
Chris@16 116
Chris@16 117 /// INTERNAL ONLY
Chris@16 118 template<class Tag>
Chris@16 119 struct less_impl<Tag, boost::units::scaled_base_unit_tag>
Chris@16 120 {
Chris@16 121 template<class T0, class T1>
Chris@16 122 struct apply : mpl::bool_<
Chris@16 123 boost::type_traits::ice_or<(mpl::less<T0, typename T1::system_type>::value),
Chris@16 124 boost::type_traits::ice_and<(boost::is_same<T0, typename T1::system_type>::value), ((T1::scale_type::exponent::Numerator) > 0)>::value>::value> {};
Chris@16 125 };
Chris@16 126
Chris@16 127 /// INTERNAL ONLY
Chris@16 128 template<>
Chris@16 129 struct less_impl<boost::units::scaled_base_unit_tag, boost::units::scaled_base_unit_tag>
Chris@16 130 {
Chris@16 131 template<class T0, class T1>
Chris@16 132 struct apply : mpl::bool_<
Chris@16 133 boost::type_traits::ice_or<(mpl::less<typename T0::system_type, typename T1::system_type>::value),
Chris@16 134 boost::type_traits::ice_and<(boost::is_same<typename T0::system_type, typename T1::system_type>::value),
Chris@16 135 boost::type_traits::ice_or<((T0::scale_type::base) < (T1::scale_type::base)),
Chris@16 136 boost::type_traits::ice_and<((T0::scale_type::base) == (T1::scale_type::base)),
Chris@16 137 (mpl::less<typename T0::scale_type::exponent,typename T1::scale_type::exponent>::value)>::value>::value>::value>::value> {};
Chris@16 138 };
Chris@16 139
Chris@16 140 } // namespace mpl
Chris@16 141
Chris@16 142 #endif
Chris@16 143
Chris@16 144 } // namespace boost
Chris@16 145
Chris@16 146 #endif