24 #ifndef LARDATAALG_UTILITIES_QUANTITIES_FREQUENCY_H 25 #define LARDATAALG_UTILITIES_QUANTITIES_FREQUENCY_H 33 #include <string_view> 45 static constexpr
auto symbol =
"Hz"sv;
46 static constexpr
auto name =
"hertz"sv;
70 template <
typename R,
typename T =
double>
77 template <
typename T =
double>
87 template <
typename T =
double>
97 template <
typename T =
double>
107 template <
typename T =
double>
130 namespace frequency_literals {
134 constexpr
hertz operator""_Hz (
long double v)
135 {
return hertz{
static_cast<double>(v) }; }
136 constexpr
hertz operator""_Hz (
unsigned long long int v)
137 {
return hertz{
static_cast<double>(v) }; }
143 {
return kilohertz{
static_cast<double>(v) }; }
144 constexpr
kilohertz operator""_kHz (
unsigned long long int v)
145 {
return kilohertz{
static_cast<double>(v) }; }
151 {
return megahertz{
static_cast<double>(v) }; }
152 constexpr
megahertz operator""_MHz (
unsigned long long int v)
153 {
return megahertz{
static_cast<double>(v) }; }
159 {
return gigahertz{
static_cast<double>(v) }; }
160 constexpr
gigahertz operator""_GHz (
unsigned long long int v)
161 {
return gigahertz{
static_cast<double>(v) }; }
197 template <
typename TR,
typename TT,
typename FR,
typename FT>
199 scaled_quantity<util::quantities::units::Second, TR, TT>
t,
200 scaled_quantity<util::quantities::units::Hertz, FR, FT>
f 202 -> decltype(std::declval<TT>() * std::declval<FT>())
204 template <
typename FR,
typename FT,
typename TR,
typename TT>
226 template <
typename T,
typename TR,
typename TT>
229 std::is_convertible_v<T, TT>,
232 decltype(std::declval<T>() / std::declval<TT>())
251 template <
typename T,
typename FR,
typename FT>
254 std::is_convertible_v<T, FT>,
257 decltype(std::declval<T>() / std::declval<FT>())
273 template <
typename TR,
typename TT,
typename FR,
typename FT>
278 -> decltype(std::declval<TT>() * std::declval<FT>())
280 return details::applyRatioToValue<simplified_ratio_multiply<TR, FR> >
281 (
t.value() *
f.value());
286 template <
typename T,
typename TR,
typename TT>
287 constexpr
auto util::quantities::concepts::operator/
290 std::is_convertible_v<T, TT>,
297 ::castFrom(v /
t.value());
302 template <
typename T,
typename FR,
typename FT>
303 constexpr
auto util::quantities::concepts::operator/
306 std::is_convertible_v<T, FT>,
313 ::castFrom( v /
f.value() );
323 #endif // LARDATAALG_UTILITIES_QUANTITIES_FREQUENCY_H
A value measured in the specified unit.
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.
Numeric variable proxies with embedded unit of measurement.
Dimensioned variables representing space or time quantities.
typename invert_ratio< R >::type invert_t
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)