Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/units/homogeneous_system.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Boost.Units - A C++ library for zero-overhead dimensional analysis and 
0002 // unit/quantity manipulation and conversion
0003 //
0004 // Copyright (C) 2003-2008 Matthias Christian Schabel
0005 // Copyright (C) 2008 Steven Watanabe
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. (See
0008 // accompanying file LICENSE_1_0.txt or copy at
0009 // http://www.boost.org/LICENSE_1_0.txt)
0010 
0011 #ifndef BOOST_UNITS_HOMOGENEOUS_SYSTEM_HPP_INCLUDED
0012 #define BOOST_UNITS_HOMOGENEOUS_SYSTEM_HPP_INCLUDED
0013 
0014 #include <boost/mpl/bool.hpp>
0015 
0016 #include <boost/units/config.hpp>
0017 #include <boost/units/static_rational.hpp>
0018 
0019 #ifdef BOOST_UNITS_CHECK_HOMOGENEOUS_UNITS
0020 
0021 #include <boost/type_traits/is_same.hpp>
0022 #include <boost/mpl/not.hpp>
0023 
0024 #include <boost/units/detail/linear_algebra.hpp>
0025 
0026 #endif
0027 
0028 namespace boost {
0029 
0030 namespace units {
0031 
0032 /// A system that can uniquely represent any unit
0033 /// which can be composed from a linearly independent set
0034 /// of base units.  It is safe to rebind a unit with
0035 /// such a system to different dimensions.
0036 ///
0037 /// Do not construct this template directly.  Use
0038 /// make_system instead.
0039 template<class L>
0040 struct homogeneous_system {
0041     /// INTERNAL ONLY
0042     typedef L type;
0043 };
0044 
0045 template<class T, class E>
0046 struct static_power;
0047 
0048 template<class T, class R>
0049 struct static_root;
0050 
0051 /// INTERNAL ONLY
0052 template<class L, long N, long D>
0053 struct static_power<homogeneous_system<L>, static_rational<N,D> >
0054 {
0055     typedef homogeneous_system<L> type;
0056 };
0057 
0058 /// INTERNAL ONLY
0059 template<class L, long N, long D>
0060 struct static_root<homogeneous_system<L>, static_rational<N,D> >
0061 {
0062     typedef homogeneous_system<L> type;
0063 };
0064 
0065 namespace detail {
0066 
0067 template<class System, class Dimensions>
0068 struct check_system;
0069 
0070 #ifdef BOOST_UNITS_CHECK_HOMOGENEOUS_UNITS
0071 
0072 template<class L, class Dimensions>
0073 struct check_system<homogeneous_system<L>, Dimensions> :
0074     boost::mpl::not_<
0075         boost::is_same<
0076             typename calculate_base_unit_exponents<
0077                 L,
0078                 Dimensions
0079             >::type,
0080             inconsistent
0081         >
0082     > {};
0083 
0084 #else
0085 
0086 template<class L, class Dimensions>
0087 struct check_system<homogeneous_system<L>, Dimensions> : mpl::true_ {};
0088 
0089 #endif
0090 
0091 } // namespace detail
0092 
0093 } // namespace units
0094 
0095 } // namespace boost
0096 
0097 #if BOOST_UNITS_HAS_BOOST_TYPEOF
0098 
0099 #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
0100 
0101 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::homogeneous_system, (class))
0102 
0103 #endif
0104 
0105 #endif