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