]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Boost.Units - A C++ library for zero-overhead dimensional analysis and |
2 | // unit/quantity manipulation and conversion | |
3 | // | |
4 | // Copyright (C) 2003-2008 Matthias Christian Schabel | |
5 | // Copyright (C) 2008 Steven Watanabe | |
6 | // | |
7 | // Distributed under the Boost Software License, Version 1.0. (See | |
8 | // accompanying file LICENSE_1_0.txt or copy at | |
9 | // http://www.boost.org/LICENSE_1_0.txt) | |
10 | ||
11 | #ifndef BOOST_UNITS_ABSTRACT_HPP | |
12 | #define BOOST_UNITS_ABSTRACT_HPP | |
13 | ||
14 | #include <string> | |
15 | ||
16 | #include <boost/units/conversion.hpp> | |
17 | #include <boost/units/unit.hpp> | |
18 | ||
19 | #include <boost/units/make_system.hpp> | |
20 | #include <boost/units/base_unit.hpp> | |
21 | ||
22 | #include <boost/units/physical_dimensions/amount.hpp> | |
23 | #include <boost/units/physical_dimensions/current.hpp> | |
24 | #include <boost/units/physical_dimensions/length.hpp> | |
25 | #include <boost/units/physical_dimensions/luminous_intensity.hpp> | |
26 | #include <boost/units/physical_dimensions/mass.hpp> | |
27 | #include <boost/units/physical_dimensions/plane_angle.hpp> | |
28 | #include <boost/units/physical_dimensions/solid_angle.hpp> | |
29 | #include <boost/units/physical_dimensions/temperature.hpp> | |
30 | #include <boost/units/physical_dimensions/time.hpp> | |
31 | ||
32 | namespace boost { | |
33 | ||
34 | namespace units { | |
35 | ||
36 | namespace abstract { | |
37 | ||
38 | struct length_unit_tag : base_unit<length_unit_tag, length_dimension, -30> { }; | |
39 | struct mass_unit_tag : base_unit<mass_unit_tag, mass_dimension, -29> { }; | |
40 | struct time_unit_tag : base_unit<time_unit_tag, time_dimension, -28> { }; | |
41 | struct current_unit_tag : base_unit<current_unit_tag, current_dimension, -27> { }; | |
42 | struct temperature_unit_tag : base_unit<temperature_unit_tag, temperature_dimension, -26> { }; | |
43 | struct amount_unit_tag : base_unit<amount_unit_tag, amount_dimension, -25> { }; | |
44 | struct luminous_intensity_unit_tag : base_unit<luminous_intensity_unit_tag, luminous_intensity_dimension, -24> { }; | |
45 | struct plane_angle_unit_tag : base_unit<plane_angle_unit_tag, plane_angle_dimension, -23> { }; | |
46 | struct solid_angle_unit_tag : base_unit<solid_angle_unit_tag, solid_angle_dimension, -22> { }; | |
47 | ||
48 | typedef make_system< | |
49 | length_unit_tag, | |
50 | mass_unit_tag, | |
51 | time_unit_tag, | |
52 | current_unit_tag, | |
53 | temperature_unit_tag, | |
54 | amount_unit_tag, | |
55 | luminous_intensity_unit_tag, | |
56 | plane_angle_unit_tag, | |
57 | solid_angle_unit_tag | |
58 | >::type system; | |
59 | ||
60 | typedef unit<length_dimension,system> length; ///< abstract unit of length | |
61 | typedef unit<mass_dimension,system> mass; ///< abstract unit of mass | |
62 | typedef unit<time_dimension,system> time; ///< abstract unit of time | |
63 | typedef unit<current_dimension,system> current; ///< abstract unit of current | |
64 | typedef unit<temperature_dimension,system> temperature; ///< abstract unit of temperature | |
65 | typedef unit<amount_dimension,system> amount; ///< abstract unit of amount | |
66 | typedef unit<luminous_intensity_dimension,system> luminous_intensity; ///< abstract unit of luminous intensity | |
67 | typedef unit<plane_angle_dimension,system> plane_angle; ///< abstract unit of plane angle | |
68 | typedef unit<solid_angle_dimension,system> solid_angle; ///< abstract unit of solid angle | |
69 | ||
70 | } // namespace abstract | |
71 | ||
72 | template<> | |
73 | struct base_unit_info<abstract::length_unit_tag> | |
74 | { | |
75 | static std::string name() { return "[Length]"; } | |
76 | static std::string symbol() { return "[L]"; } | |
77 | }; | |
78 | ||
79 | template<> | |
80 | struct base_unit_info<abstract::mass_unit_tag> | |
81 | { | |
82 | static std::string name() { return "[Mass]"; } | |
83 | static std::string symbol() { return "[M]"; } | |
84 | }; | |
85 | ||
86 | template<> | |
87 | struct base_unit_info<abstract::time_unit_tag> | |
88 | { | |
89 | static std::string name() { return "[Time]"; } | |
90 | static std::string symbol() { return "[T]"; } | |
91 | }; | |
92 | ||
93 | template<> | |
94 | struct base_unit_info<abstract::current_unit_tag> | |
95 | { | |
96 | static std::string name() { return "[Electric Current]"; } | |
97 | static std::string symbol() { return "[I]"; } | |
98 | }; | |
99 | ||
100 | template<> | |
101 | struct base_unit_info<abstract::temperature_unit_tag> | |
102 | { | |
103 | static std::string name() { return "[Temperature]"; } | |
104 | static std::string symbol() { return "[Theta]"; } | |
105 | }; | |
106 | ||
107 | template<> | |
108 | struct base_unit_info<abstract::amount_unit_tag> | |
109 | { | |
110 | static std::string name() { return "[Amount]"; } | |
111 | static std::string symbol() { return "[N]"; } | |
112 | }; | |
113 | ||
114 | template<> | |
115 | struct base_unit_info<abstract::luminous_intensity_unit_tag> | |
116 | { | |
117 | static std::string name() { return "[Luminous Intensity]"; } | |
118 | static std::string symbol() { return "[J]"; } | |
119 | }; | |
120 | ||
121 | template<> | |
122 | struct base_unit_info<abstract::plane_angle_unit_tag> | |
123 | { | |
124 | static std::string name() { return "[Plane Angle]"; } | |
125 | static std::string symbol() { return "[QP]"; } | |
126 | }; | |
127 | ||
128 | template<> | |
129 | struct base_unit_info<abstract::solid_angle_unit_tag> | |
130 | { | |
131 | static std::string name() { return "[Solid Angle]"; } | |
132 | static std::string symbol() { return "[QS]"; } | |
133 | }; | |
134 | ||
135 | } // namespace units | |
136 | ||
137 | } // namespace boost | |
138 | ||
139 | #endif // BOOST_UNITS_ABSTRACT_HPP |