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
inductance.h
Go to the documentation of this file.
1
12#pragma once
13
16#include "detail/unit.h"
17#include "detail/unit_symbol.h"
18#include "electric_current.h"
19#include "magnetic_flux.h"
20
21namespace SI {
22template <typename _type, class _ratio = std::ratio<1>>
23using inductance_t = detail::unit_t<'l', std::ratio<1>, _type, _ratio>;
24
26template <typename _type> using atto_henry_t = inductance_t<_type, std::atto>;
27template <typename _type> using femto_henry_t = inductance_t<_type, std::femto>;
28template <typename _type> using pico_henry_t = inductance_t<_type, std::pico>;
29template <typename _type> using nano_henry_t = inductance_t<_type, std::nano>;
30template <typename _type> using micro_henry_t = inductance_t<_type, std::micro>;
31template <typename _type> using milli_henry_t = inductance_t<_type, std::milli>;
32template <typename _type> using henry_t = inductance_t<_type, std::ratio<1>>;
33template <typename _type> using kilo_henry_t = inductance_t<_type, std::kilo>;
34template <typename _type> using mega_henry_t = inductance_t<_type, std::mega>;
35template <typename _type> using giga_henry_t = inductance_t<_type, std::giga>;
36template <typename _type> using tera_henry_t = inductance_t<_type, std::tera>;
37template <typename _type> using peta_henry_t = inductance_t<_type, std::peta>;
38template <typename _type> using exa_henry_t = inductance_t<_type, std::exa>;
39
40// specialize unit_symbol for usage with stream operators
41template <>
42struct unit_symbol<'l', std::ratio<1>> : SI::detail::unit_symbol_impl<'H'> {};
43
44template <typename _ratio>
45struct unit_symbol<'l', _ratio>
46 : SI::detail::unit_symbol_impl<SI::detail::ratio_prefix<_ratio>::value,
47 'H'> {};
48
49namespace detail {
51} // namespace detail
52
53inline namespace literals {
54template <char... _digits> constexpr atto_henry_t<int64_t> operator""_aH() {
55 return atto_henry_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
56}
57
58template <char... _digits> constexpr femto_henry_t<int64_t> operator""_fH() {
59 return femto_henry_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
60}
61
62template <char... _digits> constexpr pico_henry_t<int64_t> operator""_pH() {
63 return pico_henry_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
64}
65
66template <char... _digits> constexpr nano_henry_t<int64_t> operator""_nH() {
67 return nano_henry_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
68}
69
70template <char... _digits> constexpr micro_henry_t<int64_t> operator""_uH() {
71 return micro_henry_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
72}
73
74template <char... _digits> constexpr milli_henry_t<int64_t> operator""_mH() {
75 return milli_henry_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
76}
77
78template <char... _digits> constexpr henry_t<int64_t> operator""_H() {
79 return henry_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
80}
81
82template <char... _digits> constexpr kilo_henry_t<int64_t> operator""_kH() {
83 return kilo_henry_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
84}
85
86template <char... _digits> constexpr mega_henry_t<int64_t> operator""_MH() {
87 return mega_henry_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
88}
89
90template <char... _digits> constexpr giga_henry_t<int64_t> operator""_GH() {
91 return giga_henry_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
92}
93
94template <char... _digits> constexpr tera_henry_t<int64_t> operator""_TH() {
95 return tera_henry_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
96}
97
98template <char... _digits> constexpr peta_henry_t<int64_t> operator""_PH() {
99 return peta_henry_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
100}
101
102template <char... _digits> constexpr exa_henry_t<int64_t> operator""_EH() {
103 return exa_henry_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
104}
105
106constexpr atto_henry_t<long double> operator""_aH(long double value) {
107 return atto_henry_t<long double>{value};
108}
109
110constexpr femto_henry_t<long double> operator""_fH(long double value) {
111 return femto_henry_t<long double>{value};
112}
113
114constexpr pico_henry_t<long double> operator""_pH(long double value) {
115 return pico_henry_t<long double>{value};
116}
117
118constexpr nano_henry_t<long double> operator""_nH(long double value) {
119 return nano_henry_t<long double>{value};
120}
121
122constexpr micro_henry_t<long double> operator""_uH(long double value) {
123 return micro_henry_t<long double>{value};
124}
125
126constexpr milli_henry_t<long double> operator""_mH(long double value) {
127 return milli_henry_t<long double>{value};
128}
129
130constexpr henry_t<long double> operator""_H(long double value) {
131 return henry_t<long double>{value};
132}
133
134constexpr kilo_henry_t<long double> operator""_kH(long double value) {
135 return kilo_henry_t<long double>{value};
136}
137
138constexpr mega_henry_t<long double> operator""_MH(long double value) {
139 return mega_henry_t<long double>{value};
140}
141
142constexpr giga_henry_t<long double> operator""_GH(long double value) {
143 return giga_henry_t<long double>{value};
144}
145
146constexpr tera_henry_t<long double> operator""_TH(long double value) {
147 return tera_henry_t<long double>{value};
148}
149
150constexpr peta_henry_t<long double> operator""_PH(long double value) {
151 return peta_henry_t<long double>{value};
152}
153
154constexpr exa_henry_t<long double> operator""_EH(long double value) {
155 return exa_henry_t<long double>{value};
156}
157
158} // namespace literals
159} // namespace SI
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
Base struct. Unusable needs template overloading.
Definition unit_symbol.h:64