Physical Quantities  v1.0.0
C++ library of physical quantities, physical models, and units of measure for scientific computing. https://github.com/acodcha/phq
Memory.hpp
Go to the documentation of this file.
1 // Copyright © 2020-2024 Alexandre Coderre-Chabot
2 //
3 // This file is part of Physical Quantities (PhQ), a C++ library of physical quantities, physical
4 // models, and units of measure for scientific computing.
5 //
6 // Physical Quantities is hosted at:
7 // https://github.com/acodcha/phq
8 //
9 // Physical Quantities is licensed under the MIT License:
10 // https://mit-license.org
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
13 // associated documentation files (the "Software"), to deal in the Software without restriction,
14 // including without limitation the rights to use, copy, modify, merge, publish, distribute,
15 // sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
16 // furnished to do so, subject to the following conditions:
17 // - The above copyright notice and this permission notice shall be included in all copies or
18 // substantial portions of the Software.
19 // - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
20 // BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
22 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM
23 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 
25 #ifndef PHQ_UNIT_MEMORY_HPP
26 #define PHQ_UNIT_MEMORY_HPP
27 
28 #include <cstddef>
29 #include <cstdint>
30 #include <functional>
31 #include <map>
32 #include <ostream>
33 #include <string_view>
34 #include <unordered_map>
35 
36 #include "../Base.hpp"
37 #include "../Dimension/ElectricCurrent.hpp"
38 #include "../Dimension/Length.hpp"
39 #include "../Dimension/LuminousIntensity.hpp"
40 #include "../Dimension/Mass.hpp"
41 #include "../Dimension/SubstanceAmount.hpp"
42 #include "../Dimension/Temperature.hpp"
43 #include "../Dimension/Time.hpp"
44 #include "../Dimensions.hpp"
45 #include "../Unit.hpp"
46 #include "../UnitSystem.hpp"
47 
48 namespace PhQ {
49 
50 namespace Unit {
51 
52 /// \brief Computer memory units.
53 enum class Memory : int8_t {
54  /// \brief Bit (b) memory unit.
55  Bit,
56 
57  /// \brief Byte (B) memory unit.
58  Byte,
59 
60  /// \brief Kilobit (kb) memory unit.
61  Kilobit,
62 
63  /// \brief Kibibit (kib) memory unit.
64  Kibibit,
65 
66  /// \brief Kilobyte (kB) memory unit.
67  Kilobyte,
68 
69  /// \brief Kibibyte (kiB) memory unit.
70  Kibibyte,
71 
72  /// \brief Megabit (Mb) memory unit.
73  Megabit,
74 
75  /// \brief Mebibit (Mib) memory unit.
76  Mebibit,
77 
78  /// \brief Megabyte (MB) memory unit.
79  Megabyte,
80 
81  /// \brief Mebibyte (MiB) memory unit.
82  Mebibyte,
83 
84  /// \brief Gigabit (Gb) memory unit.
85  Gigabit,
86 
87  /// \brief Gibibit (Gib) memory unit.
88  Gibibit,
89 
90  /// \brief Gigabyte (GB) memory unit.
91  Gigabyte,
92 
93  /// \brief Gibibyte (GiB) memory unit.
94  Gibibyte,
95 
96  /// \brief Terabit (Tb) memory unit.
97  Terabit,
98 
99  /// \brief Tebibit (Tib) memory unit.
100  Tebibit,
101 
102  /// \brief Terabyte (TB) memory unit.
103  Terabyte,
104 
105  /// \brief Tebibyte (TiB) memory unit.
106  Tebibyte,
107 
108  /// \brief Petabit (Pb) memory unit.
109  Petabit,
110 
111  /// \brief Pebibit (Pib) memory unit.
112  Pebibit,
113 
114  /// \brief Petabyte (PB) memory unit.
115  Petabyte,
116 
117  /// \brief Pebibyte (PiB) memory unit.
118  Pebibyte,
119 };
120 
121 } // namespace Unit
122 
123 /// \brief Standard computer memory unit: bit (b).
124 template <>
125 inline constexpr const Unit::Memory Standard<Unit::Memory>{Unit::Memory::Bit};
126 
127 /// \brief Physical dimension set of computer memory units.
128 template <>
129 inline constexpr const Dimensions RelatedDimensions<Unit::Memory>{Dimensionless};
130 
131 inline std::ostream& operator<<(std::ostream& stream, const Unit::Memory unit) {
132  stream << Abbreviation(unit);
133  return stream;
134 }
135 
136 namespace Internal {
137 
138 template <>
139 inline const std::map<UnitSystem, Unit::Memory> ConsistentUnits<Unit::Memory>{
144 };
145 
146 template <>
147 inline const std::map<Unit::Memory, UnitSystem> RelatedUnitSystems<Unit::Memory>{};
148 
149 template <>
150 inline const std::map<Unit::Memory, std::string_view> Abbreviations<Unit::Memory>{
151  {Unit::Memory::Bit, "b" },
152  {Unit::Memory::Byte, "B" },
153  {Unit::Memory::Kilobit, "kb" },
154  {Unit::Memory::Kibibit, "kib"},
155  {Unit::Memory::Kilobyte, "kB" },
156  {Unit::Memory::Kibibyte, "kiB"},
157  {Unit::Memory::Megabit, "Mb" },
158  {Unit::Memory::Mebibit, "Mib"},
159  {Unit::Memory::Megabyte, "MB" },
160  {Unit::Memory::Mebibyte, "MiB"},
161  {Unit::Memory::Gigabit, "Gb" },
162  {Unit::Memory::Gibibit, "Gib"},
163  {Unit::Memory::Gigabyte, "GB" },
164  {Unit::Memory::Gibibyte, "GiB"},
165  {Unit::Memory::Terabit, "Tb" },
166  {Unit::Memory::Tebibit, "Tib"},
167  {Unit::Memory::Terabyte, "TB" },
168  {Unit::Memory::Tebibyte, "TiB"},
169  {Unit::Memory::Petabit, "Pb" },
170  {Unit::Memory::Pebibit, "Pib"},
171  {Unit::Memory::Petabyte, "PB" },
172  {Unit::Memory::Pebibyte, "PiB"},
173 };
174 
175 template <>
176 inline const std::unordered_map<std::string_view, Unit::Memory> Spellings<Unit::Memory>{
177  {"b", Unit::Memory::Bit },
178  {"bit", Unit::Memory::Bit },
179  {"bits", Unit::Memory::Bit },
180  {"B", Unit::Memory::Byte },
181  {"byte", Unit::Memory::Byte },
182  {"bytes", Unit::Memory::Byte },
183  {"kb", Unit::Memory::Kilobit },
184  {"kilobit", Unit::Memory::Kilobit },
185  {"kilobits", Unit::Memory::Kilobit },
186  {"kib", Unit::Memory::Kibibit },
187  {"kibibit", Unit::Memory::Kibibit },
188  {"kibibits", Unit::Memory::Kibibit },
189  {"kB", Unit::Memory::Kilobyte},
190  {"kilobyte", Unit::Memory::Kilobyte},
191  {"kilobytes", Unit::Memory::Kilobyte},
192  {"kiB", Unit::Memory::Kibibyte},
193  {"kibibyte", Unit::Memory::Kibibyte},
194  {"kibibytes", Unit::Memory::Kibibyte},
195  {"Mb", Unit::Memory::Megabit },
196  {"megabit", Unit::Memory::Megabit },
197  {"megabits", Unit::Memory::Megabit },
198  {"Mib", Unit::Memory::Mebibit },
199  {"mebibit", Unit::Memory::Mebibit },
200  {"mebibits", Unit::Memory::Mebibit },
201  {"MB", Unit::Memory::Megabyte},
202  {"megabyte", Unit::Memory::Megabyte},
203  {"megabytes", Unit::Memory::Megabyte},
204  {"MiB", Unit::Memory::Mebibyte},
205  {"mebibyte", Unit::Memory::Mebibyte},
206  {"mebibytes", Unit::Memory::Mebibyte},
207  {"Gb", Unit::Memory::Gigabit },
208  {"gigabit", Unit::Memory::Gigabit },
209  {"gigabits", Unit::Memory::Gigabit },
210  {"Gib", Unit::Memory::Gibibit },
211  {"gibibit", Unit::Memory::Gibibit },
212  {"gibibits", Unit::Memory::Gibibit },
213  {"GB", Unit::Memory::Gigabyte},
214  {"gigabyte", Unit::Memory::Gigabyte},
215  {"gigabytes", Unit::Memory::Gigabyte},
216  {"GiB", Unit::Memory::Gibibyte},
217  {"gibibyte", Unit::Memory::Gibibyte},
218  {"gibibytes", Unit::Memory::Gibibyte},
219  {"Tb", Unit::Memory::Terabit },
220  {"terabit", Unit::Memory::Terabit },
221  {"terabits", Unit::Memory::Terabit },
222  {"Tib", Unit::Memory::Tebibit },
223  {"tebibit", Unit::Memory::Tebibit },
224  {"tebibits", Unit::Memory::Tebibit },
225  {"TB", Unit::Memory::Terabyte},
226  {"terabyte", Unit::Memory::Terabyte},
227  {"terabytes", Unit::Memory::Terabyte},
228  {"TiB", Unit::Memory::Tebibyte},
229  {"tebibyte", Unit::Memory::Tebibyte},
230  {"tebibytes", Unit::Memory::Tebibyte},
231  {"Pb", Unit::Memory::Petabit },
232  {"petabit", Unit::Memory::Petabit },
233  {"petabits", Unit::Memory::Petabit },
234  {"Pib", Unit::Memory::Pebibit },
235  {"pebibit", Unit::Memory::Pebibit },
236  {"pebibits", Unit::Memory::Pebibit },
237  {"PB", Unit::Memory::Petabyte},
238  {"petabyte", Unit::Memory::Petabyte},
239  {"petabytes", Unit::Memory::Petabyte},
240  {"PiB", Unit::Memory::Pebibyte},
241  {"pebibyte", Unit::Memory::Pebibyte},
242  {"pebibytes", Unit::Memory::Pebibyte},
243 };
244 
245 template <>
246 template <typename NumericType>
247 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Bit>::FromStandard(
248  NumericType& /*value*/) noexcept {}
249 
250 template <>
251 template <typename NumericType>
252 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Bit>::ToStandard(
253  NumericType& /*value*/) noexcept {}
254 
255 template <>
256 template <typename NumericType>
257 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Byte>::FromStandard(
258  NumericType& value) noexcept {
259  value *= static_cast<NumericType>(0.125L);
260 }
261 
262 template <>
263 template <typename NumericType>
264 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Byte>::ToStandard(
265  NumericType& value) noexcept {
266  value *= static_cast<NumericType>(8.0L);
267 }
268 
269 template <>
270 template <typename NumericType>
271 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Kilobit>::FromStandard(
272  NumericType& value) noexcept {
273  value *= static_cast<NumericType>(0.001L);
274 }
275 
276 template <>
277 template <typename NumericType>
278 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Kilobit>::ToStandard(
279  NumericType& value) noexcept {
280  value *= static_cast<NumericType>(1000.0L);
281 }
282 
283 template <>
284 template <typename NumericType>
285 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Kibibit>::FromStandard(
286  NumericType& value) noexcept {
287  value /= static_cast<NumericType>(1024.0L);
288 }
289 
290 template <>
291 template <typename NumericType>
292 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Kibibit>::ToStandard(
293  NumericType& value) noexcept {
294  value *= static_cast<NumericType>(1024.0L);
295 }
296 
297 template <>
298 template <typename NumericType>
299 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Kilobyte>::FromStandard(
300  NumericType& value) noexcept {
301  value /= static_cast<NumericType>(8000.0L);
302 }
303 
304 template <>
305 template <typename NumericType>
306 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Kilobyte>::ToStandard(
307  NumericType& value) noexcept {
308  value *= static_cast<NumericType>(8000.0L);
309 }
310 
311 template <>
312 template <typename NumericType>
313 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Kibibyte>::FromStandard(
314  NumericType& value) noexcept {
315  value /= (static_cast<NumericType>(8.0L) * static_cast<NumericType>(1024.0L));
316 }
317 
318 template <>
319 template <typename NumericType>
320 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Kibibyte>::ToStandard(
321  NumericType& value) noexcept {
322  value *= static_cast<NumericType>(8.0L) * static_cast<NumericType>(1024.0L);
323 }
324 
325 template <>
326 template <typename NumericType>
327 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Megabit>::FromStandard(
328  NumericType& value) noexcept {
329  value *= static_cast<NumericType>(0.000001L);
330 }
331 
332 template <>
333 template <typename NumericType>
334 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Megabit>::ToStandard(
335  NumericType& value) noexcept {
336  value *= static_cast<NumericType>(1000000.0L);
337 }
338 
339 template <>
340 template <typename NumericType>
341 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Mebibit>::FromStandard(
342  NumericType& value) noexcept {
343  value /= (static_cast<NumericType>(1024.0L) * static_cast<NumericType>(1024.0L));
344 }
345 
346 template <>
347 template <typename NumericType>
348 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Mebibit>::ToStandard(
349  NumericType& value) noexcept {
350  value *= static_cast<NumericType>(1024.0L) * static_cast<NumericType>(1024.0L);
351 }
352 
353 template <>
354 template <typename NumericType>
355 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Megabyte>::FromStandard(
356  NumericType& value) noexcept {
357  value /= static_cast<NumericType>(8000000.0L);
358 }
359 
360 template <>
361 template <typename NumericType>
362 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Megabyte>::ToStandard(
363  NumericType& value) noexcept {
364  value *= static_cast<NumericType>(8000000.0L);
365 }
366 
367 template <>
368 template <typename NumericType>
369 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Mebibyte>::FromStandard(
370  NumericType& value) noexcept {
371  value /= (static_cast<NumericType>(8.0L) * static_cast<NumericType>(1024.0L)
372  * static_cast<NumericType>(1024.0L));
373 }
374 
375 template <>
376 template <typename NumericType>
377 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Mebibyte>::ToStandard(
378  NumericType& value) noexcept {
379  value *= static_cast<NumericType>(8.0L) * static_cast<NumericType>(1024.0L)
380  * static_cast<NumericType>(1024.0L);
381 }
382 
383 template <>
384 template <typename NumericType>
385 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Gigabit>::FromStandard(
386  NumericType& value) noexcept {
387  value *= static_cast<NumericType>(1.0E-9L);
388 }
389 
390 template <>
391 template <typename NumericType>
392 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Gigabit>::ToStandard(
393  NumericType& value) noexcept {
394  value *= static_cast<NumericType>(1000000000.0L);
395 }
396 
397 template <>
398 template <typename NumericType>
399 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Gibibit>::FromStandard(
400  NumericType& value) noexcept {
401  value /= (static_cast<NumericType>(1024.0L) * static_cast<NumericType>(1024.0L)
402  * static_cast<NumericType>(1024.0L));
403 }
404 
405 template <>
406 template <typename NumericType>
407 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Gibibit>::ToStandard(
408  NumericType& value) noexcept {
409  value *= static_cast<NumericType>(1024.0L) * static_cast<NumericType>(1024.0L)
410  * static_cast<NumericType>(1024.0L);
411 }
412 
413 template <>
414 template <typename NumericType>
415 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Gigabyte>::FromStandard(
416  NumericType& value) noexcept {
417  value /= static_cast<NumericType>(8.0E9L);
418 }
419 
420 template <>
421 template <typename NumericType>
422 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Gigabyte>::ToStandard(
423  NumericType& value) noexcept {
424  value *= static_cast<NumericType>(8.0E9L);
425 }
426 
427 template <>
428 template <typename NumericType>
429 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Gibibyte>::FromStandard(
430  NumericType& value) noexcept {
431  value /= (static_cast<NumericType>(8.0L) * static_cast<NumericType>(1024.0L)
432  * static_cast<NumericType>(1024.0L) * static_cast<NumericType>(1024.0L));
433 }
434 
435 template <>
436 template <typename NumericType>
437 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Gibibyte>::ToStandard(
438  NumericType& value) noexcept {
439  value *= static_cast<NumericType>(8.0L) * static_cast<NumericType>(1024.0L)
440  * static_cast<NumericType>(1024.0L) * static_cast<NumericType>(1024.0L);
441 }
442 
443 template <>
444 template <typename NumericType>
445 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Terabit>::FromStandard(
446  NumericType& value) noexcept {
447  value *= static_cast<NumericType>(1.0E-12L);
448 }
449 
450 template <>
451 template <typename NumericType>
452 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Terabit>::ToStandard(
453  NumericType& value) noexcept {
454  value *= static_cast<NumericType>(1.0E12L);
455 }
456 
457 template <>
458 template <typename NumericType>
459 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Tebibit>::FromStandard(
460  NumericType& value) noexcept {
461  value /= (static_cast<NumericType>(1024.0L) * static_cast<NumericType>(1024.0L)
462  * static_cast<NumericType>(1024.0L) * static_cast<NumericType>(1024.0L));
463 }
464 
465 template <>
466 template <typename NumericType>
467 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Tebibit>::ToStandard(
468  NumericType& value) noexcept {
469  value *= static_cast<NumericType>(1024.0L) * static_cast<NumericType>(1024.0L)
470  * static_cast<NumericType>(1024.0L) * static_cast<NumericType>(1024.0L);
471 }
472 
473 template <>
474 template <typename NumericType>
475 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Terabyte>::FromStandard(
476  NumericType& value) noexcept {
477  value /= static_cast<NumericType>(8.0E12L);
478 }
479 
480 template <>
481 template <typename NumericType>
482 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Terabyte>::ToStandard(
483  NumericType& value) noexcept {
484  value *= static_cast<NumericType>(8.0E12L);
485 }
486 
487 template <>
488 template <typename NumericType>
489 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Tebibyte>::FromStandard(
490  NumericType& value) noexcept {
491  value /= (static_cast<NumericType>(8.0L) * static_cast<NumericType>(1024.0L)
492  * static_cast<NumericType>(1024.0L) * static_cast<NumericType>(1024.0L)
493  * static_cast<NumericType>(1024.0L));
494 }
495 
496 template <>
497 template <typename NumericType>
498 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Tebibyte>::ToStandard(
499  NumericType& value) noexcept {
500  value *= static_cast<NumericType>(8.0L) * static_cast<NumericType>(1024.0L)
501  * static_cast<NumericType>(1024.0L) * static_cast<NumericType>(1024.0L)
502  * static_cast<NumericType>(1024.0L);
503 }
504 
505 template <>
506 template <typename NumericType>
507 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Petabit>::FromStandard(
508  NumericType& value) noexcept {
509  value *= static_cast<NumericType>(1.0E-15L);
510 }
511 
512 template <>
513 template <typename NumericType>
514 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Petabit>::ToStandard(
515  NumericType& value) noexcept {
516  value *= static_cast<NumericType>(1.0E15L);
517 }
518 
519 template <>
520 template <typename NumericType>
521 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Pebibit>::FromStandard(
522  NumericType& value) noexcept {
523  value /= (static_cast<NumericType>(1024.0L) * static_cast<NumericType>(1024.0L)
524  * static_cast<NumericType>(1024.0L) * static_cast<NumericType>(1024.0L)
525  * static_cast<NumericType>(1024.0L));
526 }
527 
528 template <>
529 template <typename NumericType>
530 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Pebibit>::ToStandard(
531  NumericType& value) noexcept {
532  value *= static_cast<NumericType>(1024.0L) * static_cast<NumericType>(1024.0L)
533  * static_cast<NumericType>(1024.0L) * static_cast<NumericType>(1024.0L)
534  * static_cast<NumericType>(1024.0L);
535 }
536 
537 template <>
538 template <typename NumericType>
539 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Petabyte>::FromStandard(
540  NumericType& value) noexcept {
541  value /= static_cast<NumericType>(8.0E15L);
542 }
543 
544 template <>
545 template <typename NumericType>
546 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Petabyte>::ToStandard(
547  NumericType& value) noexcept {
548  value *= static_cast<NumericType>(8.0E15L);
549 }
550 
551 template <>
552 template <typename NumericType>
553 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Pebibyte>::FromStandard(
554  NumericType& value) noexcept {
555  value /= (static_cast<NumericType>(8.0L) * static_cast<NumericType>(1024.0L)
556  * static_cast<NumericType>(1024.0L) * static_cast<NumericType>(1024.0L)
557  * static_cast<NumericType>(1024.0L) * static_cast<NumericType>(1024.0L));
558 }
559 
560 template <>
561 template <typename NumericType>
562 inline constexpr void Conversion<Unit::Memory, Unit::Memory::Pebibyte>::ToStandard(
563  NumericType& value) noexcept {
564  value *= static_cast<NumericType>(8.0L) * static_cast<NumericType>(1024.0L)
565  * static_cast<NumericType>(1024.0L) * static_cast<NumericType>(1024.0L)
566  * static_cast<NumericType>(1024.0L) * static_cast<NumericType>(1024.0L);
567 }
568 
569 template <typename NumericType>
570 inline const std::map<Unit::Memory,
571  std::function<void(NumericType* values, const std::size_t size)>>
572  MapOfConversionsFromStandard<Unit::Memory, NumericType>{
574  Conversions<Unit::Memory, Unit::Memory::Bit>::FromStandard<NumericType> },
576  Conversions<Unit::Memory, Unit::Memory::Byte>::FromStandard<NumericType> },
578  Conversions<Unit::Memory, Unit::Memory::Kilobit>::FromStandard<NumericType> },
580  Conversions<Unit::Memory, Unit::Memory::Kibibit>::FromStandard<NumericType> },
582  Conversions<Unit::Memory, Unit::Memory::Kilobyte>::FromStandard<NumericType>},
584  Conversions<Unit::Memory, Unit::Memory::Kibibyte>::FromStandard<NumericType>},
586  Conversions<Unit::Memory, Unit::Memory::Megabit>::FromStandard<NumericType> },
588  Conversions<Unit::Memory, Unit::Memory::Mebibit>::FromStandard<NumericType> },
590  Conversions<Unit::Memory, Unit::Memory::Megabyte>::FromStandard<NumericType>},
592  Conversions<Unit::Memory, Unit::Memory::Mebibyte>::FromStandard<NumericType>},
594  Conversions<Unit::Memory, Unit::Memory::Gigabit>::FromStandard<NumericType> },
596  Conversions<Unit::Memory, Unit::Memory::Gibibit>::FromStandard<NumericType> },
598  Conversions<Unit::Memory, Unit::Memory::Gigabyte>::FromStandard<NumericType>},
600  Conversions<Unit::Memory, Unit::Memory::Gibibyte>::FromStandard<NumericType>},
602  Conversions<Unit::Memory, Unit::Memory::Terabit>::FromStandard<NumericType> },
604  Conversions<Unit::Memory, Unit::Memory::Tebibit>::FromStandard<NumericType> },
606  Conversions<Unit::Memory, Unit::Memory::Terabyte>::FromStandard<NumericType>},
608  Conversions<Unit::Memory, Unit::Memory::Tebibyte>::FromStandard<NumericType>},
610  Conversions<Unit::Memory, Unit::Memory::Petabit>::FromStandard<NumericType> },
612  Conversions<Unit::Memory, Unit::Memory::Pebibit>::FromStandard<NumericType> },
614  Conversions<Unit::Memory, Unit::Memory::Petabyte>::FromStandard<NumericType>},
616  Conversions<Unit::Memory, Unit::Memory::Pebibyte>::FromStandard<NumericType>},
617 };
618 
619 template <typename NumericType>
620 inline const std::map<Unit::Memory,
621  std::function<void(NumericType* const values, const std::size_t size)>>
622  MapOfConversionsToStandard<Unit::Memory, NumericType>{
623  {Unit::Memory::Bit, Conversions<Unit::Memory, Unit::Memory::Bit>::ToStandard<NumericType> },
625  Conversions<Unit::Memory, Unit::Memory::Byte>::ToStandard<NumericType> },
627  Conversions<Unit::Memory, Unit::Memory::Kilobit>::ToStandard<NumericType> },
629  Conversions<Unit::Memory, Unit::Memory::Kibibit>::ToStandard<NumericType> },
631  Conversions<Unit::Memory, Unit::Memory::Kilobyte>::ToStandard<NumericType>},
633  Conversions<Unit::Memory, Unit::Memory::Kibibyte>::ToStandard<NumericType>},
635  Conversions<Unit::Memory, Unit::Memory::Megabit>::ToStandard<NumericType> },
637  Conversions<Unit::Memory, Unit::Memory::Mebibit>::ToStandard<NumericType> },
639  Conversions<Unit::Memory, Unit::Memory::Megabyte>::ToStandard<NumericType>},
641  Conversions<Unit::Memory, Unit::Memory::Mebibyte>::ToStandard<NumericType>},
643  Conversions<Unit::Memory, Unit::Memory::Gigabit>::ToStandard<NumericType> },
645  Conversions<Unit::Memory, Unit::Memory::Gibibit>::ToStandard<NumericType> },
647  Conversions<Unit::Memory, Unit::Memory::Gigabyte>::ToStandard<NumericType>},
649  Conversions<Unit::Memory, Unit::Memory::Gibibyte>::ToStandard<NumericType>},
651  Conversions<Unit::Memory, Unit::Memory::Terabit>::ToStandard<NumericType> },
653  Conversions<Unit::Memory, Unit::Memory::Tebibit>::ToStandard<NumericType> },
655  Conversions<Unit::Memory, Unit::Memory::Terabyte>::ToStandard<NumericType>},
657  Conversions<Unit::Memory, Unit::Memory::Tebibyte>::ToStandard<NumericType>},
659  Conversions<Unit::Memory, Unit::Memory::Petabit>::ToStandard<NumericType> },
661  Conversions<Unit::Memory, Unit::Memory::Pebibit>::ToStandard<NumericType> },
663  Conversions<Unit::Memory, Unit::Memory::Petabyte>::ToStandard<NumericType>},
665  Conversions<Unit::Memory, Unit::Memory::Pebibyte>::ToStandard<NumericType>},
666 };
667 
668 } // namespace Internal
669 
670 } // namespace PhQ
671 
672 #endif // PHQ_UNIT_MEMORY_HPP
Memory
Computer memory units.
Definition: Memory.hpp:53
@ Gigabit
Gigabit (Gb) memory unit.
@ Tebibyte
Tebibyte (TiB) memory unit.
@ Gigabyte
Gigabyte (GB) memory unit.
@ Tebibit
Tebibit (Tib) memory unit.
@ Pebibyte
Pebibyte (PiB) memory unit.
@ Pebibit
Pebibit (Pib) memory unit.
@ Megabyte
Megabyte (MB) memory unit.
@ Megabit
Megabit (Mb) memory unit.
@ Terabit
Terabit (Tb) memory unit.
@ Terabyte
Terabyte (TB) memory unit.
@ Gibibit
Gibibit (Gib) memory unit.
@ Petabit
Petabit (Pb) memory unit.
@ Kibibit
Kibibit (kib) memory unit.
@ Kibibyte
Kibibyte (kiB) memory unit.
@ Mebibit
Mebibit (Mib) memory unit.
@ Byte
Byte (B) memory unit.
@ Mebibyte
Mebibyte (MiB) memory unit.
@ Kilobit
Kilobit (kb) memory unit.
@ Petabyte
Petabyte (PB) memory unit.
@ Gibibyte
Gibibyte (GiB) memory unit.
@ Kilobyte
Kilobyte (kB) memory unit.
@ Bit
Bit (b) memory unit.
Namespace that encompasses all of the Physical Quantities library's content.
@ FootPoundSecondRankine
Foot-pound-second-rankine (ft·lbf·s·°R) system.
@ MillimetreGramSecondKelvin
Millimetre-gram-second-kelvin (mm·g·s·K) system.
@ MetreKilogramSecondKelvin
Metre-kilogram-second-kelvin (m·kg·s·K) system.
@ InchPoundSecondRankine
Inch-pound-second-rankine (in·lbf·s·°R) system.
constexpr Dimensions Dimensionless
Dimensionless physical dimension set. This dimension set has all base dimensions of zero....
Definition: Dimensions.hpp:406
std::string_view Abbreviation(const Enumeration enumeration)
Returns the abbreviation of a given enumeration value. For example, PhQ::Abbreviation(PhQ::Unit::Time...
Definition: Base.hpp:89
std::ostream & operator<<(std::ostream &stream, const Acceleration< NumericType > &acceleration)