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.
Loading...
Searching...
No Matches
electric_resistance.h
Go to the documentation of this file.
1
12#pragma once
13
16#include "detail/unit.h"
17#include "electric_current.h"
18#include "electric_potential.h"
19
20namespace SI {
21
24template <typename _type, class _ratio = std::ratio<1>>
25using electric_resistance_t = detail::unit_t<'O', std::ratio<1>, _type, _ratio>;
26
28template <typename _type>
30template <typename _type>
32template <typename _type>
34template <typename _type>
36template <typename _type>
38template <typename _type>
40template <typename _type>
42template <typename _type>
44template <typename _type>
46template <typename _type>
48template <typename _type>
50template <typename _type>
52template <typename _type>
54
55// specialize unit_symbol for usage with stream operators
56template <>
57struct unit_symbol<'O', std::ratio<1>>
58 : SI::detail::unit_symbol_impl<'O', 'h', 'm'> {};
59
60template <typename _ratio>
61struct unit_symbol<'O', _ratio>
62 : SI::detail::unit_symbol_impl<SI::detail::ratio_prefix<_ratio>::value, 'O',
63 'h', 'm'> {};
64
65namespace detail {
68
69
71template <typename _type, class _ratio = std::ratio<1>>
72constexpr auto operator/(
73 const _type scalar,
74 const detail::unit_t<'G', std::ratio<1>, _type, _ratio> &conductance) {
76 scalar / conductance.value()};
77}
78} // namespace detail
79
80inline namespace literals {
81template <char... _digits> constexpr atto_ohm_t<int64_t> operator""_aOhm() {
82 return atto_ohm_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
83}
84
85template <char... _digits> constexpr femto_ohm_t<int64_t> operator""_fOhm() {
86 return femto_ohm_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
87}
88
89template <char... _digits> constexpr pico_ohm_t<int64_t> operator""_pOhm() {
90 return pico_ohm_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
91}
92
93template <char... _digits> constexpr nano_ohm_t<int64_t> operator""_nOhm() {
94 return nano_ohm_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
95}
96
97template <char... _digits> constexpr micro_ohm_t<int64_t> operator""_uOhm() {
98 return micro_ohm_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
99}
100
101template <char... _digits> constexpr milli_ohm_t<int64_t> operator""_mOhm() {
102 return milli_ohm_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
103}
104
105template <char... _digits> constexpr ohm_t<int64_t> operator""_Ohm() {
106 return ohm_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
107}
108
109template <char... _digits> constexpr kilo_ohm_t<int64_t> operator""_kOhm() {
110 return kilo_ohm_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
111}
112
113template <char... _digits> constexpr mega_ohm_t<int64_t> operator""_MOhm() {
114 return mega_ohm_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
115}
116
117template <char... _digits> constexpr giga_ohm_t<int64_t> operator""_GOhm() {
118 return giga_ohm_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
119}
120
121template <char... _digits> constexpr tera_ohm_t<int64_t> operator""_TOhm() {
122 return tera_ohm_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
123}
124
125template <char... _digits> constexpr peta_ohm_t<int64_t> operator""_POhm() {
126 return peta_ohm_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
127}
128
129template <char... _digits> constexpr exa_ohm_t<int64_t> operator""_EOhm() {
130 return exa_ohm_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
131}
132
133constexpr atto_ohm_t<long double> operator""_aOhm(long double value) {
134 return atto_ohm_t<long double>{value};
135}
136
137constexpr femto_ohm_t<long double> operator""_fOhm(long double value) {
138 return femto_ohm_t<long double>{value};
139}
140
141constexpr pico_ohm_t<long double> operator""_pOhm(long double value) {
142 return pico_ohm_t<long double>{value};
143}
144
145constexpr nano_ohm_t<long double> operator""_nOhm(long double value) {
146 return nano_ohm_t<long double>{value};
147}
148
149constexpr micro_ohm_t<long double> operator""_uOhm(long double value) {
150 return micro_ohm_t<long double>{value};
151}
152
153constexpr milli_ohm_t<long double> operator""_mOhm(long double value) {
154 return milli_ohm_t<long double>{value};
155}
156
157constexpr ohm_t<long double> operator""_Ohm(long double value) {
158 return ohm_t<long double>{value};
159}
160
161constexpr kilo_ohm_t<long double> operator""_kOhm(long double value) {
162 return kilo_ohm_t<long double>{value};
163}
164
165constexpr mega_ohm_t<long double> operator""_MOhm(long double value) {
166 return mega_ohm_t<long double>{value};
167}
168
169constexpr giga_ohm_t<long double> operator""_GOhm(long double value) {
170 return giga_ohm_t<long double>{value};
171}
172
173constexpr tera_ohm_t<long double> operator""_TOhm(long double value) {
174 return tera_ohm_t<long double>{value};
175}
176
177constexpr peta_ohm_t<long double> operator""_POhm(long double value) {
178 return peta_ohm_t<long double>{value};
179}
180
181constexpr exa_ohm_t<long double> operator""_EOhm(long double value) {
182 return exa_ohm_t<long double>{value};
183}
184
185} // namespace literals
186} // namespace SI
constexpr auto operator/(const _type &lhs, const unit_t< _symbol, _exponent, _rhs_type, _ratio > &rhs)
Definition unit.h:491
Definition absorbed_dose.h:18
#define BUILD_UNIT_FROM_DIVISION(RESULTING_UNIT_T, DIVIDEND_UNIT_T, DIVISOR_UNIT_T)
Definition operator_helpers.h:22
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