// Boost.Units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2008 Matthias Christian Schabel // Copyright (C) 2008 Steven Watanabe // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) /** \file \brief test_header.hpp \details Unit system for test purposes. Output: @verbatim @endverbatim **/ #ifndef BOOST_UNITS_TEST_HEADER_HPP #define BOOST_UNITS_TEST_HEADER_HPP #include #include #include #include #include #include #include #include #include #include #include #define BOOST_UNITS_CHECK_CLOSE(a, b) (BOOST_CHECK((std::abs((a) - (b)) < .0000001))) namespace boost { namespace units { //struct length_base_dimension : boost::units::base_dimension { }; ///> base dimension of length //struct mass_base_dimension : boost::units::base_dimension { }; ///> base dimension of mass //struct time_base_dimension : boost::units::base_dimension { }; ///> base dimension of time typedef length_base_dimension::dimension_type length_dimension; typedef mass_base_dimension::dimension_type mass_dimension; typedef time_base_dimension::dimension_type time_dimension; typedef derived_dimension::type area_dimension; typedef derived_dimension::type energy_dimension; typedef derived_dimension::type inverse_energy_dim; typedef derived_dimension::type velocity_dimension; typedef derived_dimension::type volume_dimension; /// placeholder class defining test unit system struct length_unit : base_unit {}; struct mass_unit : base_unit {}; struct time_unit : base_unit {}; typedef make_system::type system; /// unit typedefs typedef unit dimensionless; typedef unit length; typedef unit mass; typedef unit time; typedef unit area; typedef unit energy; typedef unit inverse_energy; typedef unit velocity; typedef unit volume; /// unit constants BOOST_UNITS_STATIC_CONSTANT(meter,length); BOOST_UNITS_STATIC_CONSTANT(meters,length); BOOST_UNITS_STATIC_CONSTANT(kilogram,mass); BOOST_UNITS_STATIC_CONSTANT(kilograms,mass); BOOST_UNITS_STATIC_CONSTANT(second,time); BOOST_UNITS_STATIC_CONSTANT(seconds,time); BOOST_UNITS_STATIC_CONSTANT(square_meter,area); BOOST_UNITS_STATIC_CONSTANT(square_meters,area); BOOST_UNITS_STATIC_CONSTANT(joule,energy); BOOST_UNITS_STATIC_CONSTANT(joules,energy); BOOST_UNITS_STATIC_CONSTANT(meter_per_second,velocity); BOOST_UNITS_STATIC_CONSTANT(meters_per_second,velocity); BOOST_UNITS_STATIC_CONSTANT(cubic_meter,volume); BOOST_UNITS_STATIC_CONSTANT(cubic_meters,volume); template<> struct base_unit_info { static std::string name() { return "meter"; } static std::string symbol() { return "m"; } }; //] template<> struct base_unit_info { static std::string name() { return "kilogram"; } static std::string symbol() { return "kg"; } }; template<> struct base_unit_info { static std::string name() { return "second"; } static std::string symbol() { return "s"; } }; } // namespace units } // namespace boost #endif // BOOST_UNITS_TEST_HEADER_HPP