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_potential.h
Go to the documentation of this file.
1 
12 #pragma once
13 
14 #include "detail/number_parser.h"
16 #include "detail/unit.h"
17 #include "detail/unit_symbol.h"
18 #include "electric_charge.h"
19 #include "electric_current.h"
20 #include "energy.h"
21 #include "power.h"
22 
23 namespace SI {
24 template <typename _type, class _ratio = std::ratio<1>>
26 
28 template <typename _type>
30 template <typename _type>
32 template <typename _type>
34 template <typename _type>
36 template <typename _type>
38 template <typename _type>
40 template <typename _type>
42 template <typename _type>
44 template <typename _type>
46 template <typename _type>
48 template <typename _type>
50 template <typename _type>
52 template <typename _type>
54 
55 // specialize unit_symbol for usage with stream operators
56 template <>
57 struct unit_symbol<'U', std::ratio<1>> : SI::detail::unit_symbol_impl<'V'> {};
58 
59 template <typename _ratio>
60 struct unit_symbol<'U', _ratio>
61  : SI::detail::unit_symbol_impl<SI::detail::ratio_prefix<_ratio>::value,
62  'V'> {};
63 
64 namespace detail {
67 } // namespace detail
68 
69 inline namespace literals {
70 template <char... _digits> constexpr atto_volt_t<int64_t> operator""_aV() {
71  return atto_volt_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
72 }
73 
74 template <char... _digits> constexpr femto_volt_t<int64_t> operator""_fV() {
75  return femto_volt_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
76 }
77 
78 template <char... _digits> constexpr pico_volt_t<int64_t> operator""_pV() {
79  return pico_volt_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
80 }
81 
82 template <char... _digits> constexpr nano_volt_t<int64_t> operator""_nV() {
83  return nano_volt_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
84 }
85 
86 template <char... _digits> constexpr micro_volt_t<int64_t> operator""_uV() {
87  return micro_volt_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
88 }
89 
90 template <char... _digits> constexpr milli_volt_t<int64_t> operator""_mV() {
91  return milli_volt_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
92 }
93 
94 template <char... _digits> constexpr volt_t<int64_t> operator""_V() {
95  return volt_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
96 }
97 
98 template <char... _digits> constexpr kilo_volt_t<int64_t> operator""_kV() {
99  return kilo_volt_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
100 }
101 
102 template <char... _digits> constexpr mega_volt_t<int64_t> operator""_MV() {
103  return mega_volt_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
104 }
105 
106 template <char... _digits> constexpr giga_volt_t<int64_t> operator""_GV() {
107  return giga_volt_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
108 }
109 
110 template <char... _digits> constexpr tera_volt_t<int64_t> operator""_TV() {
111  return tera_volt_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
112 }
113 
114 template <char... _digits> constexpr peta_volt_t<int64_t> operator""_PV() {
115  return peta_volt_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
116 }
117 
118 template <char... _digits> constexpr exa_volt_t<int64_t> operator""_EV() {
119  return exa_volt_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
120 }
121 
122 constexpr atto_volt_t<long double> operator""_aV(long double value) {
123  return atto_volt_t<long double>{value};
124 }
125 
126 constexpr femto_volt_t<long double> operator""_fV(long double value) {
127  return femto_volt_t<long double>{value};
128 }
129 
130 constexpr pico_volt_t<long double> operator""_pV(long double value) {
131  return pico_volt_t<long double>{value};
132 }
133 
134 constexpr nano_volt_t<long double> operator""_nV(long double value) {
135  return nano_volt_t<long double>{value};
136 }
137 
138 constexpr micro_volt_t<long double> operator""_uV(long double value) {
139  return micro_volt_t<long double>{value};
140 }
141 
142 constexpr milli_volt_t<long double> operator""_mV(long double value) {
143  return milli_volt_t<long double>{value};
144 }
145 
146 constexpr volt_t<long double> operator""_V(long double value) {
147  return volt_t<long double>{value};
148 }
149 
150 constexpr kilo_volt_t<long double> operator""_kV(long double value) {
151  return kilo_volt_t<long double>{value};
152 }
153 
154 constexpr mega_volt_t<long double> operator""_MV(long double value) {
155  return mega_volt_t<long double>{value};
156 }
157 
158 constexpr giga_volt_t<long double> operator""_GV(long double value) {
159  return giga_volt_t<long double>{value};
160 }
161 
162 constexpr tera_volt_t<long double> operator""_TV(long double value) {
163  return tera_volt_t<long double>{value};
164 }
165 
166 constexpr peta_volt_t<long double> operator""_PV(long double value) {
167  return peta_volt_t<long double>{value};
168 }
169 
170 constexpr exa_volt_t<long double> operator""_EV(long double value) {
171  return exa_volt_t<long double>{value};
172 }
173 
174 } // namespace literals
175 } // namespace SI
BUILD_UNIT_FROM_DIVISION(electric_conductance_t, electric_current_t, electric_potential_t) template< typename _type
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