WPILibC++ 2023.4.3
|
Defines a series of classes used to manipulate unit types, such as inverse<>
, squared<>
, and metric prefixes.
More...
Typedefs | |
template<class U > | |
using | units::inverse = typename units::detail::inverse_impl< U >::type |
represents the inverse unit type of class U . More... | |
template<class U > | |
using | units::squared = typename units::detail::squared_impl< U >::type |
represents the unit type of class U squared More... | |
template<class U > | |
using | units::cubed = typename units::detail::cubed_impl< U >::type |
represents the type of class U cubed. More... | |
template<class U , std::intmax_t Eps = 10000000000> | |
using | units::square_root = typename units::detail::sqrt_impl< U, Eps >::type |
represents the square root of type class U . More... | |
template<class U > | |
using | units::atto = typename units::detail::prefix< std::atto, U >::type |
Represents the type of class U with the metric 'atto' prefix appended. More... | |
template<class U > | |
using | units::femto = typename units::detail::prefix< std::femto, U >::type |
Represents the type of class U with the metric 'femto' prefix appended. More... | |
template<class U > | |
using | units::pico = typename units::detail::prefix< std::pico, U >::type |
Represents the type of class U with the metric 'pico' prefix appended. More... | |
template<class U > | |
using | units::nano = typename units::detail::prefix< std::nano, U >::type |
Represents the type of class U with the metric 'nano' prefix appended. More... | |
template<class U > | |
using | units::micro = typename units::detail::prefix< std::micro, U >::type |
Represents the type of class U with the metric 'micro' prefix appended. More... | |
template<class U > | |
using | units::milli = typename units::detail::prefix< std::milli, U >::type |
Represents the type of class U with the metric 'milli' prefix appended. More... | |
template<class U > | |
using | units::centi = typename units::detail::prefix< std::centi, U >::type |
Represents the type of class U with the metric 'centi' prefix appended. More... | |
template<class U > | |
using | units::deci = typename units::detail::prefix< std::deci, U >::type |
Represents the type of class U with the metric 'deci' prefix appended. More... | |
template<class U > | |
using | units::deca = typename units::detail::prefix< std::deca, U >::type |
Represents the type of class U with the metric 'deca' prefix appended. More... | |
template<class U > | |
using | units::hecto = typename units::detail::prefix< std::hecto, U >::type |
Represents the type of class U with the metric 'hecto' prefix appended. More... | |
template<class U > | |
using | units::kilo = typename units::detail::prefix< std::kilo, U >::type |
Represents the type of class U with the metric 'kilo' prefix appended. More... | |
template<class U > | |
using | units::mega = typename units::detail::prefix< std::mega, U >::type |
Represents the type of class U with the metric 'mega' prefix appended. More... | |
template<class U > | |
using | units::giga = typename units::detail::prefix< std::giga, U >::type |
Represents the type of class U with the metric 'giga' prefix appended. More... | |
template<class U > | |
using | units::tera = typename units::detail::prefix< std::tera, U >::type |
Represents the type of class U with the metric 'tera' prefix appended. More... | |
template<class U > | |
using | units::peta = typename units::detail::prefix< std::peta, U >::type |
Represents the type of class U with the metric 'peta' prefix appended. More... | |
template<class U > | |
using | units::exa = typename units::detail::prefix< std::exa, U >::type |
Represents the type of class U with the metric 'exa' prefix appended. More... | |
template<class U > | |
using | units::kibi = typename units::detail::prefix< std::ratio< 1024 >, U >::type |
Represents the type of class U with the binary 'kibi' prefix appended. More... | |
template<class U > | |
using | units::mebi = typename units::detail::prefix< std::ratio< 1048576 >, U >::type |
Represents the type of class U with the binary 'mibi' prefix appended. More... | |
template<class U > | |
using | units::gibi = typename units::detail::prefix< std::ratio< 1073741824 >, U >::type |
Represents the type of class U with the binary 'gibi' prefix appended. More... | |
template<class U > | |
using | units::tebi = typename units::detail::prefix< std::ratio< 1099511627776 >, U >::type |
Represents the type of class U with the binary 'tebi' prefix appended. More... | |
template<class U > | |
using | units::pebi = typename units::detail::prefix< std::ratio< 1125899906842624 >, U >::type |
Represents the type of class U with the binary 'pebi' prefix appended. More... | |
template<class U > | |
using | units::exbi = typename units::detail::prefix< std::ratio< 1152921504606846976 >, U >::type |
Represents the type of class U with the binary 'exbi' prefix appended. More... | |
Defines a series of classes used to manipulate unit types, such as inverse<>
, squared<>
, and metric prefixes.
Unit manipulators can be chained together, e.g. inverse<squared<pico<time::seconds>>>
to represent picoseconds^-2.
using units::atto = typedef typename units::detail::prefix<std::atto, U>::type |
Represents the type of class U
with the metric 'atto' prefix appended.
E.g. atto<meters> represents meters*10^-18
U | unit type to apply the prefix to. |
using units::centi = typedef typename units::detail::prefix<std::centi,U>::type |
Represents the type of class U
with the metric 'centi' prefix appended.
E.g. centi<meters> represents meters*10^-2
U | unit type to apply the prefix to. |
using units::cubed = typedef typename units::detail::cubed_impl<U>::type |
represents the type of class U
cubed.
U | unit type to cube. |
E.g. cubed<meters>
will represent meters^3.
using units::deca = typedef typename units::detail::prefix<std::deca, U>::type |
Represents the type of class U
with the metric 'deca' prefix appended.
E.g. deca<meters> represents meters*10^1
U | unit type to apply the prefix to. |
using units::deci = typedef typename units::detail::prefix<std::deci, U>::type |
Represents the type of class U
with the metric 'deci' prefix appended.
E.g. deci<meters> represents meters*10^-1
U | unit type to apply the prefix to. |
using units::exa = typedef typename units::detail::prefix<std::exa, U>::type |
Represents the type of class U
with the metric 'exa' prefix appended.
E.g. exa<meters> represents meters*10^18
U | unit type to apply the prefix to. |
using units::exbi = typedef typename units::detail::prefix<std::ratio<1152921504606846976>, U>::type |
Represents the type of class U
with the binary 'exbi' prefix appended.
E.g. exbi<bytes> represents bytes*2^60
U | unit type to apply the prefix to. |
using units::femto = typedef typename units::detail::prefix<std::femto,U>::type |
Represents the type of class U
with the metric 'femto' prefix appended.
E.g. femto<meters> represents meters*10^-15
U | unit type to apply the prefix to. |
using units::gibi = typedef typename units::detail::prefix<std::ratio<1073741824>, U>::type |
Represents the type of class U
with the binary 'gibi' prefix appended.
E.g. gibi<bytes> represents bytes*2^30
U | unit type to apply the prefix to. |
using units::giga = typedef typename units::detail::prefix<std::giga, U>::type |
Represents the type of class U
with the metric 'giga' prefix appended.
E.g. giga<meters> represents meters*10^9
U | unit type to apply the prefix to. |
using units::hecto = typedef typename units::detail::prefix<std::hecto,U>::type |
Represents the type of class U
with the metric 'hecto' prefix appended.
E.g. hecto<meters> represents meters*10^2
U | unit type to apply the prefix to. |
using units::inverse = typedef typename units::detail::inverse_impl<U>::type |
represents the inverse unit type of class U
.
U | unit type to invert. |
E.g. inverse<meters>
will represent meters^-1 (i.e. 1/meters).
using units::kibi = typedef typename units::detail::prefix<std::ratio<1024>, U>::type |
Represents the type of class U
with the binary 'kibi' prefix appended.
E.g. kibi<bytes> represents bytes*2^10
U | unit type to apply the prefix to. |
using units::kilo = typedef typename units::detail::prefix<std::kilo, U>::type |
Represents the type of class U
with the metric 'kilo' prefix appended.
E.g. kilo<meters> represents meters*10^3
U | unit type to apply the prefix to. |
using units::mebi = typedef typename units::detail::prefix<std::ratio<1048576>, U>::type |
Represents the type of class U
with the binary 'mibi' prefix appended.
E.g. mebi<bytes> represents bytes*2^20
U | unit type to apply the prefix to. |
using units::mega = typedef typename units::detail::prefix<std::mega, U>::type |
Represents the type of class U
with the metric 'mega' prefix appended.
E.g. mega<meters> represents meters*10^6
U | unit type to apply the prefix to. |
using units::micro = typedef typename units::detail::prefix<std::micro,U>::type |
Represents the type of class U
with the metric 'micro' prefix appended.
E.g. micro<meters> represents meters*10^-6
U | unit type to apply the prefix to. |
using units::milli = typedef typename units::detail::prefix<std::milli,U>::type |
Represents the type of class U
with the metric 'milli' prefix appended.
E.g. milli<meters> represents meters*10^-3
U | unit type to apply the prefix to. |
using units::nano = typedef typename units::detail::prefix<std::nano, U>::type |
Represents the type of class U
with the metric 'nano' prefix appended.
E.g. nano<meters> represents meters*10^-9
U | unit type to apply the prefix to. |
using units::pebi = typedef typename units::detail::prefix<std::ratio<1125899906842624>, U>::type |
Represents the type of class U
with the binary 'pebi' prefix appended.
E.g. pebi<bytes> represents bytes*2^50
U | unit type to apply the prefix to. |
using units::peta = typedef typename units::detail::prefix<std::peta, U>::type |
Represents the type of class U
with the metric 'peta' prefix appended.
E.g. peta<meters> represents meters*10^15
U | unit type to apply the prefix to. |
using units::pico = typedef typename units::detail::prefix<std::pico, U>::type |
Represents the type of class U
with the metric 'pico' prefix appended.
E.g. pico<meters> represents meters*10^-12
U | unit type to apply the prefix to. |
using units::square_root = typedef typename units::detail::sqrt_impl<U, Eps>::type |
represents the square root of type class U
.
Calculates a rational approximation of the square root of the unit. The error in the calculation is bounded by 1/epsilon (Eps). E.g. for the default value of 10000000000, the maximum error will be a/10000000000, or 1e-8, or said another way, the error will be on the order of 10^-9. Since these calculations are done at compile time, it is advisable to set epsilon to the highest value that does not cause an integer overflow in the calculation. If you can't compile ratio_sqrt
due to overflow errors, reducing the value of epsilon sufficiently will correct the problem.
ratio_sqrt
is guaranteed to converge for all values of Ratio
which do not overflow.
U | unit type to take the square root of. |
Eps | Value of epsilon, which represents the inverse of the maximum allowable error. This value should be chosen to be as high as possible before integer overflow errors occur in the compiler. |
using units::squared = typedef typename units::detail::squared_impl<U>::type |
represents the unit type of class U
squared
U | unit type to square. |
E.g. square<meters>
will represent meters^2.
using units::tebi = typedef typename units::detail::prefix<std::ratio<1099511627776>, U>::type |
Represents the type of class U
with the binary 'tebi' prefix appended.
E.g. tebi<bytes> represents bytes*2^40
U | unit type to apply the prefix to. |
using units::tera = typedef typename units::detail::prefix<std::tera, U>::type |
Represents the type of class U
with the metric 'tera' prefix appended.
E.g. tera<meters> represents meters*10^12
U | unit type to apply the prefix to. |