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_conductance.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 "electric_current.h"
18 #include "electric_potential.h"
19 
20 namespace SI {
21 
22 template <typename _type, class _ratio = std::ratio<1>>
24  detail::unit_t<'G', std::ratio<1>, _type, _ratio>;
25 
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 template <typename _type>
51 template <typename _type>
53 
54 // specialize unit_symbol for usage with stream operators
55 template <>
56 struct unit_symbol<'G', std::ratio<1>> : SI::detail::unit_symbol_impl<'S'> {};
57 
58 template <typename _ratio>
59 struct unit_symbol<'G', _ratio>
60  : SI::detail::unit_symbol_impl<SI::detail::ratio_prefix<_ratio>::value,
61  'S'> {};
62 
63 namespace detail {
64 
67 
68 template <typename _type, class _ratio = std::ratio<1>>
71 constexpr auto
72 operator/(const _type scalar,
73  const unit_t<'O', std::ratio<1>, _type, _ratio> &resistance) {
75  scalar / resistance.value()};
76 }
77 } // namespace detail
78 
79 inline namespace literals {
80 template <char... _digits> constexpr atto_siemens_t<int64_t> operator""_aS() {
82  SI::detail::parsing::Number<_digits...>::value};
83 }
84 
85 template <char... _digits> constexpr femto_siemens_t<int64_t> operator""_fS() {
87  SI::detail::parsing::Number<_digits...>::value};
88 }
89 
90 template <char... _digits> constexpr pico_siemens_t<int64_t> operator""_pS() {
92  SI::detail::parsing::Number<_digits...>::value};
93 }
94 
95 template <char... _digits> constexpr nano_siemens_t<int64_t> operator""_nS() {
97  SI::detail::parsing::Number<_digits...>::value};
98 }
99 
100 template <char... _digits> constexpr micro_siemens_t<int64_t> operator""_uS() {
102  SI::detail::parsing::Number<_digits...>::value};
103 }
104 
105 template <char... _digits> constexpr milli_siemens_t<int64_t> operator""_mS() {
107  SI::detail::parsing::Number<_digits...>::value};
108 }
109 
110 template <char... _digits> constexpr siemens_t<int64_t> operator""_S() {
111  return siemens_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
112 }
113 
114 template <char... _digits> constexpr kilo_siemens_t<int64_t> operator""_kS() {
116  SI::detail::parsing::Number<_digits...>::value};
117 }
118 
119 template <char... _digits> constexpr mega_siemens_t<int64_t> operator""_MS() {
121  SI::detail::parsing::Number<_digits...>::value};
122 }
123 
124 template <char... _digits> constexpr giga_siemens_t<int64_t> operator""_GS() {
126  SI::detail::parsing::Number<_digits...>::value};
127 }
128 
129 template <char... _digits> constexpr tera_siemens_t<int64_t> operator""_TS() {
131  SI::detail::parsing::Number<_digits...>::value};
132 }
133 
134 template <char... _digits> constexpr peta_siemens_t<int64_t> operator""_PS() {
136  SI::detail::parsing::Number<_digits...>::value};
137 }
138 
139 template <char... _digits> constexpr exa_siemens_t<int64_t> operator""_ES() {
140  return exa_siemens_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
141 }
142 
143 constexpr atto_siemens_t<long double> operator""_aS(long double value) {
144  return atto_siemens_t<long double>{value};
145 }
146 
147 constexpr femto_siemens_t<long double> operator""_fS(long double value) {
148  return femto_siemens_t<long double>{value};
149 }
150 
151 constexpr pico_siemens_t<long double> operator""_pS(long double value) {
152  return pico_siemens_t<long double>{value};
153 }
154 
155 constexpr nano_siemens_t<long double> operator""_nS(long double value) {
156  return nano_siemens_t<long double>{value};
157 }
158 
159 constexpr micro_siemens_t<long double> operator""_uS(long double value) {
160  return micro_siemens_t<long double>{value};
161 }
162 
163 constexpr milli_siemens_t<long double> operator""_mS(long double value) {
164  return milli_siemens_t<long double>{value};
165 }
166 
167 constexpr siemens_t<long double> operator""_S(long double value) {
168  return siemens_t<long double>{value};
169 }
170 
171 constexpr kilo_siemens_t<long double> operator""_kS(long double value) {
172  return kilo_siemens_t<long double>{value};
173 }
174 
175 constexpr mega_siemens_t<long double> operator""_MS(long double value) {
176  return mega_siemens_t<long double>{value};
177 }
178 
179 constexpr giga_siemens_t<long double> operator""_GS(long double value) {
180  return giga_siemens_t<long double>{value};
181 }
182 
183 constexpr tera_siemens_t<long double> operator""_TS(long double value) {
184  return tera_siemens_t<long double>{value};
185 }
186 
187 constexpr peta_siemens_t<long double> operator""_PS(long double value) {
188  return peta_siemens_t<long double>{value};
189 }
190 
191 constexpr exa_siemens_t<long double> operator""_ES(long double value) {
192  return exa_siemens_t<long double>{value};
193 }
194 
195 } // namespace literals
196 } // namespace SI
BUILD_UNIT_FROM_DIVISION(electric_conductance_t, electric_current_t, electric_potential_t) template< typename _type
constexpr auto operator/(const _type &lhs, const unit_t< _symbol, _exponent, _rhs_type, _ratio > &rhs)
Definition: unit.h:491
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
constexpr _type value() const
returns the stored value as raw type
Definition: unit.h:100
Base struct. Unusable needs template overloading.
Definition: unit_symbol.h:64