LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
spacetime.h File Reference

Dimensioned variables representing space or time quantities. More...

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

Go to the source code of this file.

Classes

struct  util::quantities::units::Second
 
struct  util::quantities::units::Meter
 

Namespaces

 util::quantities
 Types of variables with a unit.
 
 util::quantities::units
 Definitions of actual units.
 
 util::quantities::time_literals
 Literal constants for time quantities.
 
 util::quantities::intervals
 
 util::quantities::points
 
 util::quantities::space_literals
 Literal constants for space quantities.
 

Typedefs

template<typename R , typename T = double>
using util::quantities::intervals::scaled_seconds = concepts::Interval< util::quantities::scaled_second< R, T >>
 The most generic units::Second-based interval. More...
 
template<typename T = double>
using util::quantities::intervals::seconds_as = scaled_seconds< std::ratio< 1 >, T >
 Type of time interval stored in seconds. More...
 
using util::quantities::intervals::seconds = seconds_as<>
 Type of time stored in seconds, in double precision. More...
 
template<typename T = double>
using util::quantities::intervals::milliseconds_as = scaled_seconds< std::milli, T >
 Type of time interval stored in milliseconds. More...
 
using util::quantities::intervals::milliseconds = milliseconds_as<>
 Type of time interval stored in milliseconds, in double precision. More...
 
template<typename T = double>
using util::quantities::intervals::microseconds_as = scaled_seconds< std::micro, T >
 Type of time interval stored in microseconds. More...
 
using util::quantities::intervals::microseconds = microseconds_as<>
 Type of time interval stored in microseconds, in double precision. More...
 
template<typename T = double>
using util::quantities::intervals::nanoseconds_as = scaled_seconds< std::nano, T >
 Type of time interval stored in nanoseconds. More...
 
using util::quantities::intervals::nanoseconds = nanoseconds_as<>
 Type of time interval stored in nanoseconds, in double precision. More...
 
template<typename T = double>
using util::quantities::intervals::picoseconds_as = scaled_seconds< std::pico, T >
 Type of time interval stored in picoseconds. More...
 
using util::quantities::intervals::picoseconds = picoseconds_as<>
 Type of time interval stored in picoseconds, in double precision. More...
 
template<typename R , typename T = double, typename Cat = NoCategory>
using util::quantities::points::scaled_second = concepts::Point< util::quantities::scaled_second< R, T >, Cat >
 The most generic units::Second-based point. More...
 
template<typename T = double, typename Cat = NoCategory>
using util::quantities::points::second_as = scaled_second< std::ratio< 1 >, T, Cat >
 Type of time point stored in seconds. More...
 
using util::quantities::points::second = second_as<>
 Type of time point stored in seconds, in double precision. More...
 
template<typename T = double, typename Cat = NoCategory>
using util::quantities::points::millisecond_as = scaled_second< std::milli, T, Cat >
 Type of time point stored in milliseconds. More...
 
using util::quantities::points::millisecond = millisecond_as<>
 Type of time point stored in milliseconds, in double precision. More...
 
template<typename T = double, typename Cat = NoCategory>
using util::quantities::points::microsecond_as = scaled_second< std::micro, T, Cat >
 Type of time point stored in microseconds. More...
 
using util::quantities::points::microsecond = microsecond_as<>
 Type of time point stored in microseconds, in double precision. More...
 
template<typename T = double, typename Cat = NoCategory>
using util::quantities::points::nanosecond_as = scaled_second< std::nano, T, Cat >
 Type of time point stored in nanoseconds. More...
 
using util::quantities::points::nanosecond = nanosecond_as<>
 Type of time point stored in nanoseconds, in double precision. More...
 
template<typename T = double, typename Cat = NoCategory>
using util::quantities::points::picosecond_as = scaled_second< std::pico, T, Cat >
 Type of time point stored in picoseconds. More...
 
using util::quantities::points::picosecond = picosecond_as<>
 Type of time point stored in picoseconds, in double precision. More...
 
template<typename R , typename T = double>
using util::quantities::intervals::scaled_meters = concepts::Interval< util::quantities::scaled_meter< R, T >>
 The most generic units::Meter-based interval. More...
 
template<typename T = double>
using util::quantities::intervals::meters_as = scaled_meters< std::ratio< 1 >, T >
 Type of space interval stored in meters. More...
 
using util::quantities::intervals::meters = meters_as<>
 Type of space stored in meters, in double precision. More...
 
template<typename T = double>
using util::quantities::intervals::kilometers_as = scaled_meters< std::kilo, T >
 Type of space interval stored in kilometers. More...
 
using util::quantities::intervals::kilometers = kilometers_as<>
 Type of space interval stored in kilometers, in double precision. More...
 
template<typename T = double>
using util::quantities::intervals::centimeters_as = scaled_meters< std::centi, T >
 Type of space interval stored in centimeters. More...
 
using util::quantities::intervals::centimeters = centimeters_as<>
 Type of space interval stored in centimeters, in double precision. More...
 
template<typename T = double>
using util::quantities::intervals::millimeters_as = scaled_meters< std::milli, T >
 Type of space interval stored in millimeters. More...
 
using util::quantities::intervals::millimeters = millimeters_as<>
 Type of space interval stored in millimeters, in double precision. More...
 
template<typename T = double>
using util::quantities::intervals::micrometers_as = scaled_meters< std::micro, T >
 Type of space interval stored in micrometers. More...
 
using util::quantities::intervals::micrometers = micrometers_as<>
 Type of space interval stored in micrometers, in double precision. More...
 
template<typename T = double>
using util::quantities::intervals::nanometers_as = scaled_meters< std::nano, T >
 Type of space interval stored in nanometers. More...
 
using util::quantities::intervals::nanometers = nanometers_as<>
 Type of space interval stored in nanometers, in double precision. More...
 
template<typename T = double>
using util::quantities::intervals::picometers_as = scaled_meters< std::pico, T >
 Type of space interval stored in picometers. More...
 
using util::quantities::intervals::picometers = picometers_as<>
 Type of space interval stored in picometers, in double precision. More...
 
template<typename T = double>
using util::quantities::intervals::femtometers_as = scaled_meters< std::femto, T >
 Type of space interval stored in femtometers. More...
 
using util::quantities::intervals::femtometers = femtometers_as<>
 Type of space interval stored in femtometers, in double precision. More...
 
template<typename R , typename T = double, typename Cat = NoCategory>
using util::quantities::points::scaled_meter = concepts::Point< util::quantities::scaled_meter< R, T >, Cat >
 The most generic units::Meter-based point. More...
 
template<typename T = double, typename Cat = NoCategory>
using util::quantities::points::meter_as = scaled_meter< std::ratio< 1 >, T, Cat >
 Type of space point stored in meters. More...
 
using util::quantities::points::meter = meter_as<>
 Type of space point stored in meters, in double precision. More...
 
template<typename T = double, typename Cat = NoCategory>
using util::quantities::points::kilometer_as = scaled_meter< std::kilo, T, Cat >
 Type of space point stored in kilometers. More...
 
using util::quantities::points::kilometer = kilometer_as<>
 Type of space point stored in kilometers, in double precision. More...
 
template<typename T = double, typename Cat = NoCategory>
using util::quantities::points::centimeter_as = scaled_meter< std::centi, T, Cat >
 Type of space point stored in centimeters. More...
 
using util::quantities::points::centimeter = centimeter_as<>
 Type of space point stored in centimeters, in double precision. More...
 
template<typename T = double, typename Cat = NoCategory>
using util::quantities::points::millimeter_as = scaled_meter< std::milli, T, Cat >
 Type of space point stored in millimeters. More...
 
using util::quantities::points::millimeter = millimeter_as<>
 Type of space point stored in millimeters, in double precision. More...
 
template<typename T = double, typename Cat = NoCategory>
using util::quantities::points::micrometer_as = scaled_meter< std::micro, T, Cat >
 Type of space point stored in micrometers. More...
 
using util::quantities::points::micrometer = micrometer_as<>
 Type of space point stored in micrometers, in double precision. More...
 
template<typename T = double, typename Cat = NoCategory>
using util::quantities::points::nanometer_as = scaled_meter< std::nano, T, Cat >
 Type of space point stored in nanometers. More...
 
using util::quantities::points::nanometer = nanometer_as<>
 Type of space point stored in nanometers, in double precision. More...
 
template<typename T = double, typename Cat = NoCategory>
using util::quantities::points::picometer_as = scaled_meter< std::pico, T, Cat >
 Type of space point stored in picometers. More...
 
using util::quantities::points::picometer = picometer_as<>
 Type of space point stored in picometers, in double precision. More...
 
template<typename T = double, typename Cat = NoCategory>
using util::quantities::points::femtometer_as = scaled_meter< std::femto, T, Cat >
 Type of space point stored in femtometers. More...
 
using util::quantities::points::femtometer = femtometer_as<>
 Type of space point stored in femtometers, in double precision. More...
 
Time quantities

These time quantities are tied to util::quantities::units::Second. A few options are provided:

  • most general template, scaled_second, allowing to choose both the scale of the unit (e.g. std::milli for milliseconds) and the type of the numerical representation
  • generic templates (e.g. second_as), allowing to choose which numerical representation to use
  • double precision (e.g. second), ready for use

For this unit in particular, additional options are provided to accommodate the custom of using the unit in plural form: seconds_as and seconds are exactly equivalent to the singular-named counterparts.

template<typename R , typename T = double>
using util::quantities::scaled_second = concepts::scaled_quantity< units::Second, R, T >
 The most generic units::Second-based quantity. More...
 
template<typename T = double>
using util::quantities::second_as = scaled_second< std::ratio< 1 >, T >
 Type of time stored in seconds. More...
 
template<typename T = double>
using util::quantities::seconds_as = second_as< T >
 Alias for common language habits. More...
 
using util::quantities::second = second_as<>
 Type of time stored in seconds, in double precision. More...
 
using util::quantities::seconds = second
 Alias for common language habits. More...
 
template<typename T = double>
using util::quantities::millisecond_as = concepts::rescale< second_as< T >, std::milli >
 Type of time stored in milliseconds. More...
 
template<typename T = double>
using util::quantities::milliseconds_as = millisecond_as< T >
 Alias for common language habits. More...
 
using util::quantities::millisecond = millisecond_as<>
 Type of time stored in milliseconds, in double precision. More...
 
using util::quantities::milliseconds = millisecond
 Alias for common language habits. More...
 
template<typename T = double>
using util::quantities::microsecond_as = concepts::rescale< second_as< T >, std::micro >
 Type of time stored in microseconds. More...
 
template<typename T = double>
using util::quantities::microseconds_as = microsecond_as< T >
 Alias for common language habits. More...
 
using util::quantities::microsecond = microsecond_as<>
 Type of time stored in microseconds, in double precision. More...
 
using util::quantities::microseconds = microsecond
 Alias for common language habits. More...
 
template<typename T = double>
using util::quantities::nanosecond_as = concepts::rescale< second_as< T >, std::nano >
 Type of time stored in nanoseconds. More...
 
template<typename T = double>
using util::quantities::nanoseconds_as = nanosecond_as< T >
 Alias for common language habits. More...
 
using util::quantities::nanosecond = nanosecond_as<>
 Type of time stored in nanoseconds, in double precision. More...
 
using util::quantities::nanoseconds = nanosecond
 Alias for common language habits. More...
 
template<typename T = double>
using util::quantities::picosecond_as = concepts::rescale< second_as< T >, std::pico >
 Type of time stored in picoseconds. More...
 
template<typename T = double>
using util::quantities::picoseconds_as = picosecond_as< T >
 Alias for common language habits. More...
 
using util::quantities::picosecond = picosecond_as<>
 Type of time stored in picoseconds, in double precision. More...
 
using util::quantities::picoseconds = picosecond
 Alias for common language habits. More...
 
Linear space quantities

These space quantities are tied to util::quantities::units::Meter. A few options are provided:

  • most general template, scaled_meter, allowing to choose both the scale of the unit (e.g. std::milli for millimeters) and the type of the numerical representation
  • generic templates (e.g. meter_as), allowing to choose which numerical representation to use
  • double precision (e.g. meter), ready for use

For this unit in particular, additional options are provided to accommodate the custom of using the unit in plural form: meters_as and meters are exactly equivalent to the singular-named counterparts.

template<typename R , typename T = double>
using util::quantities::scaled_meter = concepts::scaled_quantity< units::Meter, R, T >
 The most generic units::Meter-based quantity. More...
 
template<typename T = double>
using util::quantities::meter_as = scaled_meter< std::ratio< 1 >, T >
 Type of space stored in meters. More...
 
template<typename T = double>
using util::quantities::meters_as = meter_as< T >
 Alias for common language habits. More...
 
using util::quantities::meter = meter_as<>
 Type of space stored in meters, in double precision. More...
 
using util::quantities::meters = meter
 Alias for common language habits. More...
 
template<typename T = double>
using util::quantities::kilometer_as = concepts::rescale< meter_as< T >, std::kilo >
 Type of space stored in kilometers. More...
 
template<typename T = double>
using util::quantities::kilometers_as = kilometer_as< T >
 Alias for common language habits. More...
 
using util::quantities::kilometer = kilometer_as<>
 Type of space stored in kilometers, in double precision. More...
 
using util::quantities::kilometers = kilometer
 Alias for common language habits. More...
 
template<typename T = double>
using util::quantities::centimeter_as = concepts::rescale< meter_as< T >, std::centi >
 Type of space stored in centimeters. More...
 
template<typename T = double>
using util::quantities::centimeters_as = centimeter_as< T >
 Alias for common language habits. More...
 
using util::quantities::centimeter = centimeter_as<>
 Type of space stored in centimeters, in double precision. More...
 
using util::quantities::centimeters = centimeter
 Alias for common language habits. More...
 
template<typename T = double>
using util::quantities::millimeter_as = concepts::rescale< meter_as< T >, std::milli >
 Type of space stored in millimeters. More...
 
template<typename T = double>
using util::quantities::millimeters_as = millimeter_as< T >
 Alias for common language habits. More...
 
using util::quantities::millimeter = millimeter_as<>
 Type of space stored in millimeters, in double precision. More...
 
using util::quantities::millimeters = millimeter
 Alias for common language habits. More...
 
template<typename T = double>
using util::quantities::micrometer_as = concepts::rescale< meter_as< T >, std::micro >
 Type of space stored in micrometers. More...
 
template<typename T = double>
using util::quantities::micrometers_as = micrometer_as< T >
 Alias for common language habits. More...
 
using util::quantities::micrometer = micrometer_as<>
 Type of space stored in micrometers, in double precision. More...
 
using util::quantities::micrometers = micrometer
 Alias for common language habits. More...
 
template<typename T = double>
using util::quantities::nanometer_as = concepts::rescale< meter_as< T >, std::nano >
 Type of space stored in nanometers. More...
 
template<typename T = double>
using util::quantities::nanometers_as = nanometer_as< T >
 Alias for common language habits. More...
 
using util::quantities::nanometer = nanometer_as<>
 Type of space stored in nanometers, in double precision. More...
 
using util::quantities::nanometers = nanometer
 Alias for common language habits. More...
 
template<typename T = double>
using util::quantities::picometer_as = concepts::rescale< meter_as< T >, std::pico >
 Type of space stored in picometers. More...
 
template<typename T = double>
using util::quantities::picometers_as = picometer_as< T >
 Alias for common language habits. More...
 
using util::quantities::picometer = picometer_as<>
 Type of space stored in picometers, in double precision. More...
 
using util::quantities::picometers = picometer
 Alias for common language habits. More...
 
template<typename T = double>
using util::quantities::femtometer_as = concepts::rescale< meter_as< T >, std::femto >
 Type of space stored in femtometers. More...
 
template<typename T = double>
using util::quantities::femtometers_as = femtometer_as< T >
 Alias for common language habits. More...
 
using util::quantities::femtometer = femtometer_as<>
 Type of space stored in femtometers, in double precision. More...
 
using util::quantities::femtometers = femtometer
 Alias for common language habits. More...
 

Functions

constexpr second util::quantities::time_literals::operator""_s (long double v)
 Literal second value. More...
 
constexpr second util::quantities::time_literals::operator""_s (unsigned long long int v)
 Literal second value. More...
 
constexpr millisecond util::quantities::time_literals::operator""_ms (long double v)
 Literal millisecond value. More...
 
constexpr millisecond util::quantities::time_literals::operator""_ms (unsigned long long int v)
 Literal millisecond value. More...
 
constexpr microsecond util::quantities::time_literals::operator""_us (long double v)
 Literal microsecond value. More...
 
constexpr microsecond util::quantities::time_literals::operator""_us (unsigned long long int v)
 Literal microsecond value. More...
 
constexpr nanosecond util::quantities::time_literals::operator""_ns (long double v)
 Literal nanosecond value. More...
 
constexpr nanosecond util::quantities::time_literals::operator""_ns (unsigned long long int v)
 Literal nanosecond value. More...
 
constexpr picosecond util::quantities::time_literals::operator""_ps (long double v)
 Literal picosecond value. More...
 
constexpr picosecond util::quantities::time_literals::operator""_ps (unsigned long long int v)
 Literal picosecond value. More...
 
constexpr meter util::quantities::space_literals::operator""_m (long double v)
 Literal meter value. More...
 
constexpr meter util::quantities::space_literals::operator""_m (unsigned long long int v)
 Literal meter value. More...
 
constexpr kilometer util::quantities::space_literals::operator""_km (long double v)
 Literal kilometer value. More...
 
constexpr kilometer util::quantities::space_literals::operator""_km (unsigned long long int v)
 Literal kilometer value. More...
 
constexpr centimeter util::quantities::space_literals::operator""_cm (long double v)
 Literal centimeter value. More...
 
constexpr centimeter util::quantities::space_literals::operator""_cm (unsigned long long int v)
 Literal centimeter value. More...
 
constexpr millimeter util::quantities::space_literals::operator""_mm (long double v)
 Literal millimeter value. More...
 
constexpr millimeter util::quantities::space_literals::operator""_mm (unsigned long long int v)
 Literal millimeter value. More...
 
constexpr micrometer util::quantities::space_literals::operator""_um (long double v)
 Literal micrometer value. More...
 
constexpr micrometer util::quantities::space_literals::operator""_um (unsigned long long int v)
 Literal micrometer value. More...
 
constexpr nanometer util::quantities::space_literals::operator""_nm (long double v)
 Literal nanometer value. More...
 
constexpr nanometer util::quantities::space_literals::operator""_nm (unsigned long long int v)
 Literal nanometer value. More...
 
constexpr picometer util::quantities::space_literals::operator""_pm (long double v)
 Literal picometer value. More...
 
constexpr picometer util::quantities::space_literals::operator""_pm (unsigned long long int v)
 Literal picometer value. More...
 
constexpr femtometer util::quantities::space_literals::operator""_fm (long double v)
 Literal femtometer value. More...
 
constexpr femtometer util::quantities::space_literals::operator""_fm (unsigned long long int v)
 Literal femtometer value. More...
 

Detailed Description

Dimensioned variables representing space or time 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

Set of basic quantities related to space and time. Currently, quantities are defined based on the following units:

  • seconds (ps, ns, us, ms, s), with intervals in intervals namespace

This is a header-only library.

Definition in file spacetime.h.