| 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_SI_IO_HPP |
| 12 | #define BOOST_UNITS_SI_IO_HPP |
| 13 | |
| 14 | #include <boost/units/io.hpp> |
| 15 | #include <boost/units/reduce_unit.hpp> |
| 16 | |
| 17 | #include <boost/units/systems/si.hpp> |
| 18 | |
| 19 | namespace boost { |
| 20 | |
| 21 | namespace units { |
| 22 | |
| 23 | // gray and sievert are indistinguishable |
| 24 | inline std::string name_string(const reduce_unit<si::absorbed_dose>::type&) { return "gray"; } |
| 25 | inline std::string symbol_string(const reduce_unit<si::absorbed_dose>::type&) { return "Gy"; } |
| 26 | |
| 27 | // activity and frequency are indistinguishable - would need a "decays" base unit |
| 28 | //inline std::string name_string(const si::activity&) { return "becquerel"; } |
| 29 | //inline std::string symbol_string(const si::activity&) { return "Bq"; } |
| 30 | |
| 31 | inline std::string name_string(const reduce_unit<si::capacitance>::type&) { return "farad"; } |
| 32 | inline std::string symbol_string(const reduce_unit<si::capacitance>::type&) { return "F"; } |
| 33 | |
| 34 | inline std::string name_string(const reduce_unit<si::catalytic_activity>::type&) { return "katal"; } |
| 35 | inline std::string symbol_string(const reduce_unit<si::catalytic_activity>::type&) { return "kat"; } |
| 36 | |
| 37 | inline std::string name_string(const reduce_unit<si::conductance>::type&) { return "siemen"; } |
| 38 | inline std::string symbol_string(const reduce_unit<si::conductance>::type&) { return "S"; } |
| 39 | |
| 40 | // gray and sievert are indistinguishable |
| 41 | //inline std::string name_string(const si::dose_equivalent&) { return "sievert"; } |
| 42 | //inline std::string symbol_string(const si::dose_equivalent&) { return "Sv"; } |
| 43 | |
| 44 | inline std::string name_string(const reduce_unit<si::electric_charge>::type&) { return "coulomb"; } |
| 45 | inline std::string symbol_string(const reduce_unit<si::electric_charge>::type&) { return "C"; } |
| 46 | |
| 47 | inline std::string name_string(const reduce_unit<si::electric_potential>::type&) { return "volt"; } |
| 48 | inline std::string symbol_string(const reduce_unit<si::electric_potential>::type&) { return "V"; } |
| 49 | |
| 50 | inline std::string name_string(const reduce_unit<si::energy>::type&) { return "joule"; } |
| 51 | inline std::string symbol_string(const reduce_unit<si::energy>::type&) { return "J"; } |
| 52 | |
| 53 | inline std::string name_string(const reduce_unit<si::force>::type&) { return "newton"; } |
| 54 | inline std::string symbol_string(const reduce_unit<si::force>::type&) { return "N"; } |
| 55 | |
| 56 | inline std::string name_string(const reduce_unit<si::frequency>::type&) { return "hertz"; } |
| 57 | inline std::string symbol_string(const reduce_unit<si::frequency>::type&) { return "Hz"; } |
| 58 | |
| 59 | inline std::string name_string(const reduce_unit<si::illuminance>::type&) { return "lux"; } |
| 60 | inline std::string symbol_string(const reduce_unit<si::illuminance>::type&) { return "lx"; } |
| 61 | |
| 62 | inline std::string name_string(const reduce_unit<si::inductance>::type&) { return "henry"; } |
| 63 | inline std::string symbol_string(const reduce_unit<si::inductance>::type&) { return "H"; } |
| 64 | |
| 65 | inline std::string name_string(const reduce_unit<si::luminous_flux>::type&) { return "lumen"; } |
| 66 | inline std::string symbol_string(const reduce_unit<si::luminous_flux>::type&) { return "lm"; } |
| 67 | |
| 68 | inline std::string name_string(const reduce_unit<si::magnetic_flux>::type&) { return "weber"; } |
| 69 | inline std::string symbol_string(const reduce_unit<si::magnetic_flux>::type&) { return "Wb"; } |
| 70 | |
| 71 | inline std::string name_string(const reduce_unit<si::magnetic_flux_density>::type&) { return "tesla"; } |
| 72 | inline std::string symbol_string(const reduce_unit<si::magnetic_flux_density>::type&) { return "T"; } |
| 73 | |
| 74 | inline std::string name_string(const reduce_unit<si::power>::type&) { return "watt"; } |
| 75 | inline std::string symbol_string(const reduce_unit<si::power>::type&) { return "W"; } |
| 76 | |
| 77 | inline std::string name_string(const reduce_unit<si::pressure>::type&) { return "pascal"; } |
| 78 | inline std::string symbol_string(const reduce_unit<si::pressure>::type&) { return "Pa"; } |
| 79 | |
| 80 | inline std::string name_string(const reduce_unit<si::resistance>::type&) { return "ohm"; } |
| 81 | inline std::string symbol_string(const reduce_unit<si::resistance>::type&) { return "Ohm"; } |
| 82 | |
| 83 | |
| 84 | } // namespace units |
| 85 | |
| 86 | } // namespace boost |
| 87 | |
| 88 | #endif // BOOST_UNITS_SI_IO_HPP |
| 89 |
