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.
absorbed_dose.h
Go to the documentation of this file.
1 
12 #pragma once
13 
14 #include "detail/number_parser.h"
15 #include "detail/unit.h"
16 #include "detail/unit_symbol.h"
17 
18 namespace SI {
19 
20 template <typename _type, class _ratio = std::ratio<1>>
22 
24 template <typename _type> using atto_gray_t = absorbed_dose_t<_type, std::atto>;
25 template <typename _type>
27 template <typename _type> using pico_gray_t = absorbed_dose_t<_type, std::pico>;
28 template <typename _type> using nano_gray_t = absorbed_dose_t<_type, std::nano>;
29 template <typename _type>
31 template <typename _type>
33 template <typename _type> using gray_t = absorbed_dose_t<_type, std::ratio<1>>;
34 template <typename _type> using kilo_gray_t = absorbed_dose_t<_type, std::kilo>;
35 template <typename _type> using mega_gray_t = absorbed_dose_t<_type, std::mega>;
36 template <typename _type> using giga_gray_t = absorbed_dose_t<_type, std::giga>;
37 template <typename _type> using tera_gray_t = absorbed_dose_t<_type, std::tera>;
38 template <typename _type> using peta_gray_t = absorbed_dose_t<_type, std::peta>;
39 template <typename _type> using exa_gray_t = absorbed_dose_t<_type, std::exa>;
40 
41 // specialize unit_symbol for usage with stream operators
42 template <>
43 struct unit_symbol<'D', std::ratio<1>>
44  : SI::detail::unit_symbol_impl<'G', 'y'> {};
45 
46 template <typename _ratio>
47 struct unit_symbol<'D', _ratio>
48  : SI::detail::unit_symbol_impl<SI::detail::ratio_prefix<_ratio>::value, 'G',
49  'y'> {};
50 
51 inline namespace literals {
52 template <char... _digits> constexpr atto_gray_t<int64_t> operator""_aGy() {
53  return atto_gray_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
54 }
55 
56 template <char... _digits> constexpr femto_gray_t<int64_t> operator""_fGy() {
57  return femto_gray_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
58 }
59 
60 template <char... _digits> constexpr pico_gray_t<int64_t> operator""_pGy() {
61  return pico_gray_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
62 }
63 
64 template <char... _digits> constexpr nano_gray_t<int64_t> operator""_nGy() {
65  return nano_gray_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
66 }
67 
68 template <char... _digits> constexpr micro_gray_t<int64_t> operator""_uGy() {
69  return micro_gray_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
70 }
71 
72 template <char... _digits> constexpr milli_gray_t<int64_t> operator""_mGy() {
73  return milli_gray_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
74 }
75 
76 template <char... _digits> constexpr gray_t<int64_t> operator""_Gy() {
77  return gray_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
78 }
79 
80 template <char... _digits> constexpr kilo_gray_t<int64_t> operator""_kGy() {
81  return kilo_gray_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
82 }
83 
84 template <char... _digits> constexpr mega_gray_t<int64_t> operator""_MGy() {
85  return mega_gray_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
86 }
87 
88 template <char... _digits> constexpr giga_gray_t<int64_t> operator""_GGy() {
89  return giga_gray_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
90 }
91 
92 template <char... _digits> constexpr tera_gray_t<int64_t> operator""_TGy() {
93  return tera_gray_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
94 }
95 
96 template <char... _digits> constexpr peta_gray_t<int64_t> operator""_PGy() {
97  return peta_gray_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
98 }
99 
100 template <char... _digits> constexpr exa_gray_t<int64_t> operator""_EGy() {
101  return exa_gray_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
102 }
103 
104 constexpr atto_gray_t<long double> operator""_aGy(long double value) {
105  return atto_gray_t<long double>{value};
106 }
107 
108 constexpr femto_gray_t<long double> operator""_fGy(long double value) {
109  return femto_gray_t<long double>{value};
110 }
111 
112 constexpr pico_gray_t<long double> operator""_pGy(long double value) {
113  return pico_gray_t<long double>{value};
114 }
115 
116 constexpr nano_gray_t<long double> operator""_nGy(long double value) {
117  return nano_gray_t<long double>{value};
118 }
119 
120 constexpr micro_gray_t<long double> operator""_uGy(long double value) {
121  return micro_gray_t<long double>{value};
122 }
123 
124 constexpr milli_gray_t<long double> operator""_mGy(long double value) {
125  return milli_gray_t<long double>{value};
126 }
127 
128 constexpr gray_t<long double> operator""_Gy(long double value) {
129  return gray_t<long double>{value};
130 }
131 
132 constexpr kilo_gray_t<long double> operator""_kGy(long double value) {
133  return kilo_gray_t<long double>{value};
134 }
135 
136 constexpr mega_gray_t<long double> operator""_MGy(long double value) {
137  return mega_gray_t<long double>{value};
138 }
139 
140 constexpr giga_gray_t<long double> operator""_GGy(long double value) {
141  return giga_gray_t<long double>{value};
142 }
143 
144 constexpr tera_gray_t<long double> operator""_TGy(long double value) {
145  return tera_gray_t<long double>{value};
146 }
147 
148 constexpr peta_gray_t<long double> operator""_PGy(long double value) {
149  return peta_gray_t<long double>{value};
150 }
151 
152 constexpr exa_gray_t<long double> operator""_EGy(long double value) {
153  return exa_gray_t<long double>{value};
154 }
155 
156 } // namespace literals
157 } // namespace SI
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