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.
electric_current.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>
25 template <typename _type>
27 template <typename _type>
29 template <typename _type>
31 template <typename _type>
33 template <typename _type>
35 template <typename _type>
37 template <typename _type>
39 template <typename _type>
41 template <typename _type>
43 template <typename _type>
45 template <typename _type>
47 template <typename _type>
49 
50 // specialize unit_symbol for usage with stream operators
51 template <>
52 struct unit_symbol<'I', std::ratio<1>> : SI::detail::unit_symbol_impl<'A'> {};
53 
54 template <typename _ratio>
55 struct unit_symbol<'I', _ratio>
56  : SI::detail::unit_symbol_impl<SI::detail::ratio_prefix<_ratio>::value,
57  'A'> {};
58 
59 inline namespace literals {
60 
61 template <char... _digits> constexpr atto_ampere_t<int64_t> operator""_aA() {
62  return atto_ampere_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
63 }
64 
65 template <char... _digits> constexpr femto_ampere_t<int64_t> operator""_fA() {
67  SI::detail::parsing::Number<_digits...>::value};
68 }
69 
70 template <char... _digits> constexpr pico_ampere_t<int64_t> operator""_pA() {
71  return pico_ampere_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
72 }
73 
74 template <char... _digits> constexpr nano_ampere_t<int64_t> operator""_nA() {
75  return nano_ampere_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
76 }
77 
78 template <char... _digits> constexpr micro_ampere_t<int64_t> operator""_uA() {
80  SI::detail::parsing::Number<_digits...>::value};
81 }
82 
83 template <char... _digits> constexpr milli_ampere_t<int64_t> operator""_mA() {
85  SI::detail::parsing::Number<_digits...>::value};
86 }
87 
88 template <char... _digits> constexpr ampere_t<int64_t> operator""_A() {
89  return ampere_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
90 }
91 
92 template <char... _digits> constexpr kilo_ampere_t<int64_t> operator""_kA() {
93  return kilo_ampere_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
94 }
95 
96 template <char... _digits> constexpr mega_ampere_t<int64_t> operator""_MA() {
97  return mega_ampere_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
98 }
99 
100 template <char... _digits> constexpr giga_ampere_t<int64_t> operator""_GA() {
101  return giga_ampere_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
102 }
103 
104 template <char... _digits> constexpr tera_ampere_t<int64_t> operator""_TA() {
105  return tera_ampere_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
106 }
107 
108 template <char... _digits> constexpr peta_ampere_t<int64_t> operator""_PA() {
109  return peta_ampere_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
110 }
111 
112 template <char... _digits> constexpr exa_ampere_t<int64_t> operator""_EA() {
113  return exa_ampere_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
114 }
115 
116 constexpr atto_ampere_t<long double> operator""_aA(long double value) {
117  return atto_ampere_t<long double>{value};
118 }
119 
120 constexpr femto_ampere_t<long double> operator""_fA(long double value) {
121  return femto_ampere_t<long double>{value};
122 }
123 
124 constexpr pico_ampere_t<long double> operator""_pA(long double value) {
125  return pico_ampere_t<long double>{value};
126 }
127 
128 constexpr nano_ampere_t<long double> operator""_nA(long double value) {
129  return nano_ampere_t<long double>{value};
130 }
131 
132 constexpr micro_ampere_t<long double> operator""_uA(long double value) {
133  return micro_ampere_t<long double>{value};
134 }
135 
136 constexpr milli_ampere_t<long double> operator""_mA(long double value) {
137  return milli_ampere_t<long double>{value};
138 }
139 
140 constexpr ampere_t<long double> operator""_A(long double value) {
141  return ampere_t<long double>{value};
142 }
143 
144 constexpr kilo_ampere_t<long double> operator""_kA(long double value) {
145  return kilo_ampere_t<long double>{value};
146 }
147 
148 constexpr mega_ampere_t<long double> operator""_MA(long double value) {
149  return mega_ampere_t<long double>{value};
150 }
151 
152 constexpr giga_ampere_t<long double> operator""_GA(long double value) {
153  return giga_ampere_t<long double>{value};
154 }
155 
156 constexpr tera_ampere_t<long double> operator""_TA(long double value) {
157  return tera_ampere_t<long double>{value};
158 }
159 
160 constexpr peta_ampere_t<long double> operator""_PA(long double value) {
161  return peta_ampere_t<long double>{value};
162 }
163 
164 constexpr exa_ampere_t<long double> operator""_EA(long double value) {
165  return exa_ampere_t<long double>{value};
166 }
167 
168 } // namespace literals
169 } // 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