SI  2.5.4
A header only c++ library that provides type safety and user defined literals for handling physical values defined in the International System of Units.
luminosity.h
Go to the documentation of this file.
1 
12 #pragma once
13 
14 #include "detail/number_parser.h"
15 #include "detail/unit.h"
16 #include "detail/unit_symbol.h"
17 
18 namespace SI {
19 
20 template <typename _type, typename _ratio>
22 
23 template <typename _type> using atto_candela_t = luminosity_t<_type, std::atto>;
24 template <typename _type>
26 template <typename _type> using pico_candela_t = luminosity_t<_type, std::pico>;
27 template <typename _type> using nano_candela_t = luminosity_t<_type, std::nano>;
28 template <typename _type>
30 template <typename _type>
32 template <typename _type> using candela_t = luminosity_t<_type, std::ratio<1>>;
33 template <typename _type> using kilo_candela_t = luminosity_t<_type, std::kilo>;
34 template <typename _type> using mega_candela_t = luminosity_t<_type, std::mega>;
35 template <typename _type> using giga_candela_t = luminosity_t<_type, std::giga>;
36 template <typename _type> using tera_candela_t = luminosity_t<_type, std::tera>;
37 template <typename _type> using peta_candela_t = luminosity_t<_type, std::peta>;
38 template <typename _type> using exa_candela_t = luminosity_t<_type, std::exa>;
39 
40 // specialize unit_symbol for usage with stream operators
41 template <>
42 struct unit_symbol<'J', std::ratio<1>>
43  : SI::detail::unit_symbol_impl<'c', 'd'> {};
44 
45 template <typename _ratio>
46 struct unit_symbol<'J', _ratio>
47  : SI::detail::unit_symbol_impl<SI::detail::ratio_prefix<_ratio>::value, 'c',
48  'd'> {};
49 
50 inline namespace literals {
51 
52 template <char... _digits> constexpr atto_candela_t<int64_t> operator""_acd() {
54  SI::detail::parsing::Number<_digits...>::value};
55 }
56 
57 template <char... _digits> constexpr femto_candela_t<int64_t> operator""_fcd() {
59  SI::detail::parsing::Number<_digits...>::value};
60 }
61 
62 template <char... _digits> constexpr pico_candela_t<int64_t> operator""_pcd() {
64  SI::detail::parsing::Number<_digits...>::value};
65 }
66 
67 template <char... _digits> constexpr nano_candela_t<int64_t> operator""_ncd() {
69  SI::detail::parsing::Number<_digits...>::value};
70 }
71 
72 template <char... _digits> constexpr micro_candela_t<int64_t> operator""_ucd() {
74  SI::detail::parsing::Number<_digits...>::value};
75 }
76 
77 template <char... _digits> constexpr milli_candela_t<int64_t> operator""_mcd() {
79  SI::detail::parsing::Number<_digits...>::value};
80 }
81 
82 template <char... _digits> constexpr candela_t<int64_t> operator""_cd() {
83  return candela_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
84 }
85 
86 template <char... _digits> constexpr kilo_candela_t<int64_t> operator""_kcd() {
88  SI::detail::parsing::Number<_digits...>::value};
89 }
90 
91 template <char... _digits> constexpr mega_candela_t<int64_t> operator""_Mcd() {
93  SI::detail::parsing::Number<_digits...>::value};
94 }
95 
96 template <char... _digits> constexpr giga_candela_t<int64_t> operator""_Gcd() {
98  SI::detail::parsing::Number<_digits...>::value};
99 }
100 
101 template <char... _digits> constexpr tera_candela_t<int64_t> operator""_Tcd() {
103  SI::detail::parsing::Number<_digits...>::value};
104 }
105 
106 template <char... _digits> constexpr peta_candela_t<int64_t> operator""_Pcd() {
108  SI::detail::parsing::Number<_digits...>::value};
109 }
110 
111 template <char... _digits> constexpr exa_candela_t<int64_t> operator""_Ecd() {
112  return exa_candela_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
113 }
114 
115 constexpr atto_candela_t<long double> operator""_acd(long double value) {
116  return atto_candela_t<long double>{value};
117 }
118 
119 constexpr femto_candela_t<long double> operator""_fcd(long double value) {
120  return femto_candela_t<long double>{value};
121 }
122 
123 constexpr pico_candela_t<long double> operator""_pcd(long double value) {
124  return pico_candela_t<long double>{value};
125 }
126 
127 constexpr nano_candela_t<long double> operator""_ncd(long double value) {
128  return nano_candela_t<long double>{value};
129 }
130 
131 constexpr micro_candela_t<long double> operator""_ucd(long double value) {
132  return micro_candela_t<long double>{value};
133 }
134 
135 constexpr milli_candela_t<long double> operator""_mcd(long double value) {
136  return milli_candela_t<long double>{value};
137 }
138 
139 constexpr candela_t<long double> operator""_cd(long double value) {
140  return candela_t<long double>{value};
141 }
142 
143 constexpr kilo_candela_t<long double> operator""_kcd(long double value) {
144  return kilo_candela_t<long double>{value};
145 }
146 
147 constexpr mega_candela_t<long double> operator""_Mcd(long double value) {
148  return mega_candela_t<long double>{value};
149 }
150 
151 constexpr giga_candela_t<long double> operator""_Gcd(long double value) {
152  return giga_candela_t<long double>{value};
153 }
154 
155 constexpr tera_candela_t<long double> operator""_Tcd(long double value) {
156  return tera_candela_t<long double>{value};
157 }
158 
159 constexpr peta_candela_t<long double> operator""_Pcd(long double value) {
160  return peta_candela_t<long double>{value};
161 }
162 
163 constexpr exa_candela_t<long double> operator""_Ecd(long double value) {
164  return exa_candela_t<long double>{value};
165 }
166 
167 } // namespace literals
168 } // namespace SI
Definition: absorbed_dose.h:18
interface class for number
Definition: number_parser.h:111
Compile time string provider for conversion of unit types to strings.
Definition: unit_symbol.h:21
base template class for holding values of type _type to be multiplied with a ratio _ratio
Definition: unit.h:51
Base struct. Unusable needs template overloading.
Definition: unit_symbol.h:64