24 #ifndef LARDATAALG_UTILITIES_QUANTITIES_FREQUENCY_H 25 #define LARDATAALG_UTILITIES_QUANTITIES_FREQUENCY_H 33 #include <string_view> 43 static constexpr
auto symbol =
"Hz"sv;
44 static constexpr
auto name =
"hertz"sv;
67 template <
typename R,
typename T =
double>
74 template <
typename T =
double>
84 template <
typename T =
double>
94 template <
typename T =
double>
104 template <
typename T =
double>
126 namespace frequency_literals {
130 constexpr
hertz operator""_Hz(
long double v)
132 return hertz{
static_cast<double>(v)};
134 constexpr
hertz operator""_Hz(
unsigned long long int v)
136 return hertz{
static_cast<double>(v)};
144 return kilohertz{
static_cast<double>(v)};
146 constexpr
kilohertz operator""_kHz(
unsigned long long int v)
148 return kilohertz{
static_cast<double>(v)};
156 return megahertz{
static_cast<double>(v)};
158 constexpr
megahertz operator""_MHz(
unsigned long long int v)
160 return megahertz{
static_cast<double>(v)};
168 return gigahertz{
static_cast<double>(v)};
170 constexpr
gigahertz operator""_GHz(
unsigned long long int v)
172 return gigahertz{
static_cast<double>(v)};
207 template <
typename TR,
typename TT,
typename FR,
typename FT>
208 constexpr
auto operator*(scaled_quantity<util::quantities::units::Second, TR, TT> t,
209 scaled_quantity<util::quantities::units::Hertz, FR, FT>
f)
210 -> decltype(std::declval<TT>() * std::declval<FT>());
211 template <
typename FR,
typename FT,
typename TR,
typename TT>
232 template <
typename T,
typename TR,
typename TT>
234 std::is_convertible_v<T, TT>,
250 template <
typename T,
typename FR,
typename FT>
252 std::is_convertible_v<T, FT>,
264 template <
typename TR,
typename TT,
typename FR,
typename FT>
268 -> decltype(std::declval<TT>() * std::declval<FT>())
270 return details::applyRatioToValue<simplified_ratio_multiply<TR, FR>>(t.value() *
f.value());
274 template <
typename T,
typename TR,
typename TT>
277 std::is_convertible_v<T, TT>,
280 return scaled_hertz<details::invert_t<TR>,
281 decltype(std::declval<T>() / std::declval<TT>())>::castFrom(v / t.value());
285 template <
typename T,
typename FR,
typename FT>
288 std::is_convertible_v<T, FT>,
291 return scaled_second<details::invert_t<FR>,
292 decltype(std::declval<T>() / std::declval<FT>())>::castFrom(v /
f.value());
299 #endif // LARDATAALG_UTILITIES_QUANTITIES_FREQUENCY_H constexpr std::enable_if_t< std::is_arithmetic_v< T >, Interval< Q, Cat > > operator/(Interval< Q, Cat > const iv, T const quot)
constexpr auto operator/(T v, scaled_hertz< FR, FT > f) -> std::enable_if_t< std::is_convertible_v< T, FT >, scaled_second< details::invert_t< FR >, decltype(std::declval< T >()/std::declval< FT >())>>
Returns a time as the inverse of a frequency.
A value measured in the specified unit.
Numeric variable proxies with embedded unit of measurement.
Dimensioned variables representing space or time quantities.
constexpr std::enable_if_t< std::is_arithmetic_v< T >, Interval< Q, Cat > > operator*(Interval< Q, Cat > const iv, T const factor)
Multiplication with a scalar.
Types of variables with a unit.
QuadExpr operator*(double v, const QuadExpr &e)