Chris@16: // Boost.Units - A C++ library for zero-overhead dimensional analysis and Chris@16: // unit/quantity manipulation and conversion Chris@16: // Chris@16: // Copyright (C) 2003-2008 Matthias Christian Schabel Chris@16: // Copyright (C) 2008 Steven Watanabe Chris@16: // Chris@16: // Distributed under the Boost Software License, Version 1.0. (See Chris@16: // accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: #ifndef BOOST_UNITS_HOMOGENEOUS_SYSTEM_HPP_INCLUDED Chris@16: #define BOOST_UNITS_HOMOGENEOUS_SYSTEM_HPP_INCLUDED Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: #include Chris@16: Chris@16: #ifdef BOOST_UNITS_CHECK_HOMOGENEOUS_UNITS Chris@16: Chris@16: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: #endif Chris@16: Chris@16: namespace boost { Chris@16: Chris@16: namespace units { Chris@16: Chris@16: /// A system that can uniquely represent any unit Chris@16: /// which can be composed from a linearly independent set Chris@16: /// of base units. It is safe to rebind a unit with Chris@16: /// such a system to different dimensions. Chris@16: /// Chris@16: /// Do not construct this template directly. Use Chris@16: /// make_system instead. Chris@16: template Chris@16: struct homogeneous_system { Chris@16: /// INTERNAL ONLY Chris@16: typedef L type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct static_power; Chris@16: Chris@16: template Chris@16: struct static_root; Chris@16: Chris@16: /// INTERNAL ONLY Chris@16: template Chris@16: struct static_power, static_rational > Chris@16: { Chris@16: typedef homogeneous_system type; Chris@16: }; Chris@16: Chris@16: /// INTERNAL ONLY Chris@16: template Chris@16: struct static_root, static_rational > Chris@16: { Chris@16: typedef homogeneous_system type; Chris@16: }; Chris@16: Chris@16: namespace detail { Chris@16: Chris@16: template Chris@16: struct check_system; Chris@16: Chris@16: #ifdef BOOST_UNITS_CHECK_HOMOGENEOUS_UNITS Chris@16: Chris@16: template Chris@16: struct check_system, Dimensions> : Chris@16: boost::mpl::not_< Chris@16: boost::is_same< Chris@16: typename calculate_base_unit_exponents< Chris@16: L, Chris@16: Dimensions Chris@16: >::type, Chris@16: inconsistent Chris@16: > Chris@16: > {}; Chris@16: Chris@16: #else Chris@16: Chris@16: template Chris@16: struct check_system, Dimensions> : mpl::true_ {}; Chris@16: Chris@16: #endif Chris@16: Chris@16: } // namespace detail Chris@16: Chris@16: } // namespace units Chris@16: Chris@16: } // namespace boost Chris@16: Chris@16: #if BOOST_UNITS_HAS_BOOST_TYPEOF Chris@16: Chris@16: #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() Chris@16: Chris@16: BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::homogeneous_system, (class)) Chris@16: Chris@16: #endif Chris@16: Chris@16: #endif