Classes | Namespaces | Functions
frequency.h File Reference

Dimensioned variables representing frequency quantities. More...

#include "lardataalg/Utilities/quantities/spacetime.h"
#include "lardataalg/Utilities/quantities.h"
#include <string_view>
#include <ratio>

Go to the source code of this file.

Classes

struct  util::quantities::units::Hertz
 

Namespaces

 util::quantities
 Types of variables with a unit.
 
 util::quantities::units
 Definitions of actual units.
 
 util::quantities::frequency_literals
 Literal constants for frequency quantities.
 
 util::quantities::concepts
 Infrastructure for the quantities library.
 

Typedefs

Frequency quantities

These frequency quantities are tied to util::quantities::units::Hertz. A few options are provided:

  • most general template, scaled_hertz, allowing to choose both the scale of the unit (e.g. std::kilo for kilohertz) and the type of the numerical representation
  • generic template (e.g. hertz_as), allowing to choose which numerical representation to use
  • double precision (e.g. hertz), ready for use
template<typename R , typename T = double>
using util::quantities::scaled_hertz = concepts::scaled_quantity< units::Hertz, R, T >
 The most generic units::Hertz-based quantity. More...
 
template<typename T = double>
using util::quantities::hertz_as = scaled_hertz< std::ratio< 1 >, T >
 Type of frequency stored in hertz. More...
 
using util::quantities::hertz = hertz_as<>
 Type of frequency stored in hertz, in double precision. More...
 
template<typename T = double>
using util::quantities::kilohertz_as = concepts::rescale< hertz_as< T >, std::kilo >
 Type of frequency stored in kilohertz. More...
 
using util::quantities::kilohertz = kilohertz_as<>
 Type of frequency stored in kilohertz, in double precision. More...
 
template<typename T = double>
using util::quantities::megahertz_as = concepts::rescale< hertz_as< T >, std::mega >
 Type of frequency stored in megahertz. More...
 
using util::quantities::megahertz = megahertz_as<>
 Type of frequency stored in megahertz, in double precision. More...
 
template<typename T = double>
using util::quantities::gigahertz_as = concepts::rescale< hertz_as< T >, std::giga >
 Type of frequency stored in gigahertz. More...
 
using util::quantities::gigahertz = gigahertz_as<>
 Type of frequency stored in gigahertz, in double precision. More...
 

Functions

template<typename T , typename TR , typename TT >
constexpr auto util::quantities::concepts::operator/ (T v, scaled_second< TR, TT > t) -> std::enable_if_t< std::is_convertible_v< T, TT >, scaled_hertz< details::invert_t< TR >, decltype(std::declval< T >()/std::declval< TT >()) > >
 Returns a frequency as the inverse of a time. More...
 
template<typename T , typename FR , typename FT >
constexpr auto util::quantities::concepts::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. More...
 
constexpr hertz util::quantities::frequency_literals::operator""_Hz (long double v)
 Literal hertz value. More...
 
constexpr hertz util::quantities::frequency_literals::operator""_Hz (unsigned long long int v)
 
constexpr kilohertz util::quantities::frequency_literals::operator""_kHz (long double v)
 Literal kilohertz value. More...
 
constexpr kilohertz util::quantities::frequency_literals::operator""_kHz (unsigned long long int v)
 
constexpr megahertz util::quantities::frequency_literals::operator""_MHz (long double v)
 Literal megahertz value. More...
 
constexpr megahertz util::quantities::frequency_literals::operator""_MHz (unsigned long long int v)
 
constexpr gigahertz util::quantities::frequency_literals::operator""_GHz (long double v)
 Literal gigahertz value. More...
 
constexpr gigahertz util::quantities::frequency_literals::operator""_GHz (unsigned long long int v)
 
template<typename TR , typename TT , typename FR , typename FT >
constexpr auto util::quantities::concepts::operator* (scaled_quantity< util::quantities::units::Second, TR, TT > t, scaled_quantity< util::quantities::units::Hertz, FR, FT > f) -> decltype(std::declval< TT >()*std::declval< FT >())
 Returns the product (as scalar) of a time and a frequency. More...
 
template<typename FR , typename FT , typename TR , typename TT >
constexpr auto util::quantities::concepts::operator* (scaled_quantity< util::quantities::units::Hertz, FR, FT > f, scaled_quantity< util::quantities::units::Second, TR, TT > t)
 

Detailed Description

Dimensioned variables representing frequency quantities.

Author
Gianluca Petrillo (petri.nosp@m.llo@.nosp@m.slac..nosp@m.stan.nosp@m.ford..nosp@m.edu)
Date
October 30, 2018
See also
lardataalg/Utilities/quantities.h, lardataalg/Utilities/quantities/spacetime.h

Set of quantities related to frequency (inverse of time). Currently, quantities are defined based on the following units:

Also, special operations with units fromutil::quantities::unit::Second are supported:

This is a header-only library.

Definition in file frequency.h.