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.
pressure.h
Go to the documentation of this file.
1 
12 #pragma once
13 
14 #include "area.h"
15 #include "detail/number_parser.h"
17 #include "detail/unit.h"
18 #include "force.h"
19 
20 namespace SI {
21 template <typename _type, class _ratio = std::ratio<1>>
23 
25 template <typename _type> using atto_pascal_t = pressure_t<_type, std::atto>;
26 template <typename _type> using femto_pascal_t = pressure_t<_type, std::femto>;
27 template <typename _type> using pico_pascal_t = pressure_t<_type, std::pico>;
28 template <typename _type> using nano_pascal_t = pressure_t<_type, std::nano>;
29 template <typename _type> using micro_pascal_t = pressure_t<_type, std::micro>;
30 template <typename _type> using milli_pascal_t = pressure_t<_type, std::milli>;
31 template <typename _type> using pascal_t = pressure_t<_type, std::ratio<1>>;
32 template <typename _type> using kilo_pascal_t = pressure_t<_type, std::kilo>;
33 template <typename _type> using mega_pascal_t = pressure_t<_type, std::mega>;
34 template <typename _type> using giga_pascal_t = pressure_t<_type, std::giga>;
35 template <typename _type> using tera_pascal_t = pressure_t<_type, std::tera>;
36 template <typename _type> using peta_pascal_t = pressure_t<_type, std::peta>;
37 template <typename _type> using exa_pascal_t = pressure_t<_type, std::exa>;
38 
39 // specialize unit_symbol for usage with stream operators
40 template <>
41 struct unit_symbol<'p', std::ratio<1>>
42  : SI::detail::unit_symbol_impl<'p', 'a'> {};
43 
44 template <typename _ratio>
45 struct unit_symbol<'p', _ratio>
46  : SI::detail::unit_symbol_impl<SI::detail::ratio_prefix<_ratio>::value, 'p',
47  'a'> {};
48 
49 namespace detail {
50 
52 }
53 
54 inline namespace literals {
55 template <char... _digits> constexpr atto_pascal_t<int64_t> operator""_apa() {
56  return atto_pascal_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
57 }
58 
59 template <char... _digits> constexpr femto_pascal_t<int64_t> operator""_fpa() {
61  SI::detail::parsing::Number<_digits...>::value};
62 }
63 
64 template <char... _digits> constexpr pico_pascal_t<int64_t> operator""_ppa() {
65  return pico_pascal_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
66 }
67 
68 template <char... _digits> constexpr nano_pascal_t<int64_t> operator""_npa() {
69  return nano_pascal_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
70 }
71 
72 template <char... _digits> constexpr micro_pascal_t<int64_t> operator""_upa() {
74  SI::detail::parsing::Number<_digits...>::value};
75 }
76 
77 template <char... _digits> constexpr milli_pascal_t<int64_t> operator""_mpa() {
79  SI::detail::parsing::Number<_digits...>::value};
80 }
81 
82 template <char... _digits> constexpr pascal_t<int64_t> operator""_pa() {
83  return pascal_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
84 }
85 
86 template <char... _digits> constexpr kilo_pascal_t<int64_t> operator""_kpa() {
87  return kilo_pascal_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
88 }
89 
90 template <char... _digits> constexpr mega_pascal_t<int64_t> operator""_Mpa() {
91  return mega_pascal_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
92 }
93 
94 template <char... _digits> constexpr giga_pascal_t<int64_t> operator""_Gpa() {
95  return giga_pascal_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
96 }
97 
98 template <char... _digits> constexpr tera_pascal_t<int64_t> operator""_Tpa() {
99  return tera_pascal_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
100 }
101 
102 template <char... _digits> constexpr peta_pascal_t<int64_t> operator""_Ppa() {
103  return peta_pascal_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
104 }
105 
106 template <char... _digits> constexpr exa_pascal_t<int64_t> operator""_Epa() {
107  return exa_pascal_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
108 }
109 
110 constexpr atto_pascal_t<long double> operator""_apa(long double value) {
111  return atto_pascal_t<long double>{value};
112 }
113 
114 constexpr femto_pascal_t<long double> operator""_fpa(long double value) {
115  return femto_pascal_t<long double>{value};
116 }
117 
118 constexpr pico_pascal_t<long double> operator""_ppa(long double value) {
119  return pico_pascal_t<long double>{value};
120 }
121 
122 constexpr nano_pascal_t<long double> operator""_npa(long double value) {
123  return nano_pascal_t<long double>{value};
124 }
125 
126 constexpr micro_pascal_t<long double> operator""_upa(long double value) {
127  return micro_pascal_t<long double>{value};
128 }
129 
130 constexpr milli_pascal_t<long double> operator""_mpa(long double value) {
131  return milli_pascal_t<long double>{value};
132 }
133 
134 constexpr pascal_t<long double> operator""_pa(long double value) {
135  return pascal_t<long double>{value};
136 }
137 
138 constexpr kilo_pascal_t<long double> operator""_kpa(long double value) {
139  return kilo_pascal_t<long double>{value};
140 }
141 
142 constexpr mega_pascal_t<long double> operator""_Mpa(long double value) {
143  return mega_pascal_t<long double>{value};
144 }
145 
146 constexpr giga_pascal_t<long double> operator""_Gpa(long double value) {
147  return giga_pascal_t<long double>{value};
148 }
149 
150 constexpr tera_pascal_t<long double> operator""_Tpa(long double value) {
151  return tera_pascal_t<long double>{value};
152 }
153 
154 constexpr peta_pascal_t<long double> operator""_Ppa(long double value) {
155  return peta_pascal_t<long double>{value};
156 }
157 
158 constexpr exa_pascal_t<long double> operator""_Epa(long double value) {
159  return exa_pascal_t<long double>{value};
160 }
161 
162 } // namespace literals
163 } // 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