OGLplus  (0.59.0) a C++ wrapper for rendering APIs

mass.hpp
Go to the documentation of this file.
1 
9 #ifndef EAGINE_UNITS_UNIT_SI_MASS_HPP
10 #define EAGINE_UNITS_UNIT_SI_MASS_HPP
11 
12 #include "common.hpp"
13 
14 namespace eagine::units {
15 namespace base {
16 
17 // gram
18 struct gram : unit<mass, gram> {};
19 
20 // tonne
21 using tonne = scaled_unit<scales::mega, gram>;
22 
23 } // namespace base
24 
25 template <>
26 struct name_of<base::gram> {
27  static constexpr const char mp_str[] = "gram";
28 };
29 template <>
30 struct symbol_of<base::gram> {
31  static constexpr const char mp_str[] = "g";
32 };
33 
34 template <>
35 struct name_of<base::tonne> {
36  static constexpr const char mp_str[] = "tonne";
37 };
38 
39 template <>
40 struct symbol_of<base::tonne> {
41  static constexpr const char mp_str[] = "t";
42 };
43 
44 // si::base_unit<mass>
45 template <>
46 struct si::base_unit<base::mass>
47  : base::scaled_unit<scales::kilo, base::gram> {};
48 
49 // kilogram
50 using kilogram = unit<mass, si>;
51 
52 // derived
53 using gram =
54  make_scaled_base_dim_unit_t<base::scaled_unit<scales::one, base::gram>, si>;
55 
56 using milligram =
57  make_scaled_base_dim_unit_t<base::scaled_unit<scales::milli, base::gram>, si>;
58 
59 using tonne = make_scaled_base_dim_unit_t<base::tonne, si>;
60 
61 } // namespace eagine::units
62 
63 #endif // EAGINE_UNITS_UNIT_SI_MASS_HPP

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).