LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
util::quantities::concepts::Prefix< R > Struct Template Reference

#include "quantities.h"

Public Types

using ratio = R
 The ratio this prefix is about. More...
 

Static Public Member Functions

static constexpr auto names (bool Long=false)
 Returns the unit symbol (Long false) or name (Long true). More...
 
static constexpr auto symbol ()
 Returns the symbol of the prefix. More...
 
static constexpr auto name ()
 Returns the full name of the prefix. More...
 

Detailed Description

template<typename R>
struct util::quantities::concepts::Prefix< R >

Definition at line 367 of file quantities.h.

Member Typedef Documentation

template<typename R >
using util::quantities::concepts::Prefix< R >::ratio = R

The ratio this prefix is about.

Definition at line 368 of file quantities.h.

Member Function Documentation

template<typename R >
static constexpr auto util::quantities::concepts::Prefix< R >::name ( )
inlinestatic

Returns the full name of the prefix.

Definition at line 377 of file quantities.h.

377 { return names(true); }
static constexpr auto names(bool Long=false)
Returns the unit symbol (Long false) or name (Long true).
Definition: quantities.h:1220
template<typename R >
constexpr auto util::quantities::concepts::Prefix< R >::names ( bool  Long = false)
static

Returns the unit symbol (Long false) or name (Long true).

Definition at line 1220 of file quantities.h.

1221 {
1222  if constexpr (std::is_same<ratio, std::tera>()) return Long ? "tera"sv : "T"sv;
1223  if constexpr (std::is_same<ratio, std::giga>()) return Long ? "giga"sv : "G"sv;
1224  if constexpr (std::is_same<ratio, std::mega>()) return Long ? "mega"sv : "M"sv;
1225  if constexpr (std::is_same<ratio, std::kilo>()) return Long ? "kilo"sv : "k"sv;
1226  if constexpr (std::is_same<ratio, std::ratio<1>>()) return ""sv;
1227  if constexpr (std::is_same<ratio, std::deci>()) return Long ? "deci"sv : "d"sv;
1228  if constexpr (std::is_same<ratio, std::centi>()) return Long ? "centi"sv : "c"sv;
1229  if constexpr (std::is_same<ratio, std::milli>()) return Long ? "milli"sv : "m"sv;
1230  if constexpr (std::is_same<ratio, std::micro>()) return Long ? "micro"sv : "u"sv;
1231  if constexpr (std::is_same<ratio, std::nano>()) return Long ? "nano"sv : "n"sv;
1232  if constexpr (std::is_same<ratio, std::pico>()) return Long ? "pico"sv : "p"sv;
1233  if constexpr (std::is_same<ratio, std::femto>()) return Long ? "femto"sv : "f"sv;
1234  // TODO complete the long list of prefixes
1235 
1236  // backup; can't use `to_string()` because of `constexpr` requirement
1237  return Long ? "???"sv : "?"sv;
1238 } // util::quantities::concepts::Prefix<R>::names()
STL namespace.
TFile f
Definition: plotHisto.C:6
if(nlines<=0)
Float_t d
Definition: plot.C:235
Char_t n[5]
R ratio
The ratio this prefix is about.
Definition: quantities.h:368
template<typename R >
static constexpr auto util::quantities::concepts::Prefix< R >::symbol ( )
inlinestatic

Returns the symbol of the prefix.

Definition at line 374 of file quantities.h.

374 { return names(false); }
static constexpr auto names(bool Long=false)
Returns the unit symbol (Long false) or name (Long true).
Definition: quantities.h:1220

The documentation for this struct was generated from the following file: