io.hpp 4.2 KB

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