Added boost header

This commit is contained in:
Christophe Riccio
2012-01-08 01:26:07 +00:00
parent 9c3faaca40
commit c7d752cdf8
8946 changed files with 1732316 additions and 0 deletions

153
test/external/boost/units/absolute.hpp vendored Normal file
View File

@@ -0,0 +1,153 @@
// 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 Absolute units (points rather than vectors).
/// \details Operations between absolute units, and relative units like temperature differences.
///
#ifndef BOOST_UNITS_ABSOLUTE_HPP
#define BOOST_UNITS_ABSOLUTE_HPP
#include <iosfwd>
#include <boost/units/detail/absolute_impl.hpp>
namespace boost {
namespace units {
/// A wrapper to represent absolute units (points rather than vectors). Intended
/// originally for temperatures, this class implements operators for absolute units
/// so that addition of a relative unit to an absolute unit results in another
/// absolute unit : absolute<T> +/- T -> absolute<T> and subtraction of one absolute
/// unit from another results in a relative unit : absolute<T> - absolute<T> -> T.
template<class Y>
class absolute
{
public:
typedef absolute<Y> this_type;
typedef Y value_type;
absolute() : val_() { }
absolute(const value_type& val) : val_(val) { }
absolute(const this_type& source) : val_(source.val_) { }
this_type& operator=(const this_type& source) { val_ = source.val_; return *this; }
const value_type& value() const { return val_; }
const this_type& operator+=(const value_type& val) { val_ += val; return *this; }
const this_type& operator-=(const value_type& val) { val_ -= val; return *this; }
private:
value_type val_;
};
/// add a relative value to an absolute one
template<class Y>
absolute<Y> operator+(const absolute<Y>& aval,const Y& rval)
{
return absolute<Y>(aval.value()+rval);
}
/// add a relative value to an absolute one
template<class Y>
absolute<Y> operator+(const Y& rval,const absolute<Y>& aval)
{
return absolute<Y>(aval.value()+rval);
}
/// subtract a relative value from an absolute one
template<class Y>
absolute<Y> operator-(const absolute<Y>& aval,const Y& rval)
{
return absolute<Y>(aval.value()-rval);
}
/// subtracting two absolutes gives a difference
template<class Y>
Y operator-(const absolute<Y>& aval1,const absolute<Y>& aval2)
{
return Y(aval1.value()-aval2.value());
}
/// creates a quantity from an absolute unit and a raw value
template<class D, class S, class T>
quantity<absolute<unit<D, S> >, T> operator*(const T& t, const absolute<unit<D, S> >&)
{
return(quantity<absolute<unit<D, S> >, T>::from_value(t));
}
/// creates a quantity from an absolute unit and a raw value
template<class D, class S, class T>
quantity<absolute<unit<D, S> >, T> operator*(const absolute<unit<D, S> >&, const T& t)
{
return(quantity<absolute<unit<D, S> >, T>::from_value(t));
}
/// Print an absolute unit
template<class Char, class Traits, class Y>
std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os,const absolute<Y>& aval)
{
os << "absolute " << aval.value();
return os;
}
} // namespace units
} // namespace boost
#if BOOST_UNITS_HAS_BOOST_TYPEOF
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::absolute, (class))
#endif
namespace boost {
namespace units {
/// Macro to define the offset between two absolute units.
/// Requires the value to be in the destination units e.g
/// @code
/// BOOST_UNITS_DEFINE_CONVERSION_OFFSET(celsius_base_unit, fahrenheit_base_unit, double, 32.0);
/// @endcode
/// @c BOOST_UNITS_DEFINE_CONVERSION_FACTOR is also necessary to
/// specify the conversion factor. Like @c BOOST_UNITS_DEFINE_CONVERSION_FACTOR
/// this macro defines both forward and reverse conversions so
/// defining, e.g., the conversion from celsius to fahrenheit as above will also
/// define the inverse conversion from fahrenheit to celsius.
#define BOOST_UNITS_DEFINE_CONVERSION_OFFSET(From, To, type_, value_) \
namespace boost { \
namespace units { \
template<> \
struct affine_conversion_helper< \
reduce_unit<From::unit_type>::type, \
reduce_unit<To::unit_type>::type> \
{ \
static const bool is_defined = true; \
typedef type_ type; \
static type value() { return(value_); } \
}; \
} \
} \
void boost_units_require_semicolon()
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_ABSOLUTE_HPP

View File

@@ -0,0 +1,107 @@
// 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) 2007-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 base dimensions (mass, length, time...).
/// \details base dimension definition registration.
#ifndef BOOST_UNITS_BASE_DIMENSION_HPP
#define BOOST_UNITS_BASE_DIMENSION_HPP
#include <boost/units/config.hpp>
#include <boost/units/dim.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/units_fwd.hpp>
#include <boost/units/detail/dimension_list.hpp>
#include <boost/units/detail/ordinal.hpp>
#include <boost/units/detail/prevent_redefinition.hpp>
namespace boost {
namespace units {
/// This must be in namespace boost::units so that ADL
/// will work with friend functions defined inline.
/// INTERNAL ONLY
template<long N> struct base_dimension_ordinal { };
/// INTERNAL ONLY
template<class T, long N> struct base_dimension_pair { };
/// INTERNAL ONLY
template<class T, long N>
struct check_base_dimension {
enum {
value =
sizeof(boost_units_is_registered(units::base_dimension_ordinal<N>())) == sizeof(detail::yes) &&
sizeof(boost_units_is_registered(units::base_dimension_pair<T, N>())) != sizeof(detail::yes)
};
};
/// Defines a base dimension. To define a dimension you need to provide
/// the derived class (CRTP) and a unique integer.
/// @code
/// struct my_dimension : boost::units::base_dimension<my_dimension, 1> {};
/// @endcode
/// It is designed so that you will get an error message if you try
/// to use the same value in multiple definitions.
template<class Derived,
long N
#if !defined(BOOST_UNITS_DOXYGEN) && !defined(__BORLANDC__)
,
class = typename detail::ordinal_has_already_been_defined<
check_base_dimension<Derived, N>::value
>::type
#endif
>
class base_dimension :
public ordinal<N>
{
public:
/// INTERNAL ONLY
typedef base_dimension this_type;
/// A convenience typedef. Equivalent to boost::units::derived_dimension<Derived,1>::type.
#ifndef BOOST_UNITS_DOXYGEN
typedef list<dim<Derived,static_rational<1> >, dimensionless_type> dimension_type;
#else
typedef detail::unspecified dimension_type;
#endif
/// Provided for mpl compatability.
typedef Derived type;
private:
/// Check for C++0x. In C++0x, we have to have identical
/// arguments but a different return type to trigger an
/// error. Note that this is only needed for clang as
/// check_base_dimension will trigger an error earlier
/// for compilers with less strict name lookup.
/// INTERNAL ONLY
friend Derived*
check_double_register(const units::base_dimension_ordinal<N>&)
{ return(0); }
/// Register this ordinal
/// INTERNAL ONLY
friend detail::yes
boost_units_is_registered(const units::base_dimension_ordinal<N>&)
{ detail::yes result; return(result); }
/// But make sure we can identify the current instantiation!
/// INTERNAL ONLY
friend detail::yes
boost_units_is_registered(const units::base_dimension_pair<Derived, N>&)
{ detail::yes result; return(result); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_BASE_DIMENSION_HPP

128
test/external/boost/units/base_unit.hpp vendored Normal file
View File

@@ -0,0 +1,128 @@
// 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) 2007-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 base unit (meter, kg, sec...).
/// \details base unit definition registration.
#ifndef BOOST_UNITS_BASE_UNIT_HPP
#define BOOST_UNITS_BASE_UNIT_HPP
#include <boost/units/config.hpp>
#include <boost/units/heterogeneous_system.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/units_fwd.hpp>
#include <boost/units/unit.hpp>
#include <boost/units/detail/dimension_list.hpp>
#include <boost/units/detail/ordinal.hpp>
#include <boost/units/detail/prevent_redefinition.hpp>
namespace boost {
namespace units {
/// This must be in namespace boost::units so that ADL
/// will work with friend functions defined inline.
/// Base dimensions and base units are independent.
/// INTERNAL ONLY
template<long N> struct base_unit_ordinal { };
/// INTERNAL ONLY
template<class T, long N> struct base_unit_pair { };
/// INTERNAL ONLY
template<class T, long N>
struct check_base_unit {
enum {
value =
sizeof(boost_units_unit_is_registered(units::base_unit_ordinal<N>())) == sizeof(detail::yes) &&
sizeof(boost_units_unit_is_registered(units::base_unit_pair<T, N>())) != sizeof(detail::yes)
};
};
/// Defines a base unit. To define a unit you need to provide
/// the derived class (CRTP), a dimension list and a unique integer.
/// @code
/// struct my_unit : boost::units::base_unit<my_unit, length_dimension, 1> {};
/// @endcode
/// It is designed so that you will get an error message if you try
/// to use the same value in multiple definitions.
template<class Derived,
class Dim,
long N
#if !defined(BOOST_UNITS_DOXYGEN) && !defined(__BORLANDC__)
,
class = typename detail::ordinal_has_already_been_defined<
check_base_unit<Derived, N>::value
>::type
#endif
>
class base_unit :
public ordinal<N>
{
public:
/// INTERNAL ONLY
typedef void boost_units_is_base_unit_type;
/// INTERNAL ONLY
typedef base_unit this_type;
/// The dimensions of this base unit.
typedef Dim dimension_type;
/// Provided for mpl compatability.
typedef Derived type;
/// The unit corresponding to this base unit.
#ifndef BOOST_UNITS_DOXYGEN
typedef unit<
Dim,
heterogeneous_system<
heterogeneous_system_impl<
list<
heterogeneous_system_dim<Derived,static_rational<1> >,
dimensionless_type
>,
Dim,
no_scale
>
>
> unit_type;
#else
typedef detail::unspecified unit_type;
#endif
private:
/// Check for C++0x. In C++0x, we have to have identical
/// arguments but a different return type to trigger an
/// error. Note that this is only needed for clang as
/// check_base_unit will trigger an error earlier
/// for compilers with less strict name lookup.
/// INTERNAL ONLY
friend Derived*
check_double_register(const units::base_unit_ordinal<N>&)
{ return(0); }
/// Register this ordinal
/// INTERNAL ONLY
friend detail::yes
boost_units_unit_is_registered(const units::base_unit_ordinal<N>&)
{ detail::yes result; return(result); }
/// But make sure we can identify the current instantiation!
/// INTERNAL ONLY
friend detail::yes
boost_units_unit_is_registered(const units::base_unit_pair<Derived, N>&)
{ detail::yes result; return(result); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_BASE_UNIT_HPP

View File

@@ -0,0 +1,36 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_BASE_UNITS_ANGLE_ARCMINUTE_HPP_INCLUDED
#define BOOST_UNIT_BASE_UNITS_ANGLE_ARCMINUTE_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/angle/degree.hpp>
namespace boost {
namespace units {
namespace angle {
typedef scaled_base_unit<degree_base_unit, scale<60, static_rational<-1> > > arcminute_base_unit;
}
template<>
struct base_unit_info<angle::arcminute_base_unit> {
static const char* name() { return("arcminute"); }
static const char* symbol() { return("'"); }
};
}
}
#endif // BOOST_UNIT_BASE_UNITS_ANGLE_ARCMINUTE_HPP_INCLUDED

View File

@@ -0,0 +1,37 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_ANGLE_ARCSECOND_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_ANGLE_ARCSECOND_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/angle/degree.hpp>
namespace boost {
namespace units {
namespace angle {
//typedef scaled_base_unit<degree_base_unit, scale<60, static_rational<-2> > > arcsecond_base_unit;
typedef scaled_base_unit<degree_base_unit, scale<3600, static_rational<-1> > > arcsecond_base_unit;
}
template<>
struct base_unit_info<angle::arcsecond_base_unit> {
static const char* name() { return("arcsecond"); }
static const char* symbol() { return("\""); }
};
}
}
#endif // BOOST_UNIT_SYSTEMS_ANGLE_ARCSECOND_HPP_INCLUDED

View File

@@ -0,0 +1,27 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_ANGLE_DEGREE_BASE_UNIT_HPP
#define BOOST_UNITS_ANGLE_DEGREE_BASE_UNIT_HPP
#include <boost/units/conversion.hpp>
#include <boost/units/base_units/angle/radian.hpp>
BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(angle,degree,"degree","deg",6.28318530718/360.,boost::units::angle::radian_base_unit,-101);
#if BOOST_UNITS_HAS_BOOST_TYPEOF
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TYPE(boost::units::angle::degree_base_unit)
#endif
#endif // BOOST_UNITS_ANGLE_DEGREE_BASE_UNIT_HPP

View File

@@ -0,0 +1,27 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_ANGLE_GRADIAN_BASE_UNIT_HPP
#define BOOST_UNITS_ANGLE_GRADIAN_BASE_UNIT_HPP
#include <boost/units/conversion.hpp>
#include <boost/units/base_units/angle/radian.hpp>
BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(angle,gradian,"gradian","grad",6.28318530718/400.,boost::units::angle::radian_base_unit,-102);
#if BOOST_UNITS_HAS_BOOST_TYPEOF
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TYPE(boost::units::angle::gradian_base_unit)
#endif
#endif // BOOST_UNITS_ANGLE_GRADIAN_BASE_UNIT_HPP

View File

@@ -0,0 +1,48 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_ANGLE_RADIAN_BASE_UNIT_HPP
#define BOOST_UNITS_ANGLE_RADIAN_BASE_UNIT_HPP
#include <string>
#include <boost/units/config.hpp>
#include <boost/units/base_unit.hpp>
#include <boost/units/physical_dimensions/plane_angle.hpp>
namespace boost {
namespace units {
namespace angle {
struct radian_base_unit : public base_unit<radian_base_unit, plane_angle_dimension, -2>
{
static std::string name() { return("radian"); }
static std::string symbol() { return("rad"); }
};
} // namespace angle
} // namespace units
} // namespace boost
#if BOOST_UNITS_HAS_BOOST_TYPEOF
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TYPE(boost::units::angle::radian_base_unit)
#endif
//#include <boost/units/base_units/angle/conversions.hpp>
#endif // BOOST_UNITS_ANGLE_RADIAN_BASE_UNIT_HPP

View File

@@ -0,0 +1,36 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_BASE_UNITS_REVOLUTION_HPP
#define BOOST_UNITS_BASE_UNITS_REVOLUTION_HPP
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/angle/degree.hpp>
namespace boost {
namespace units {
namespace angle {
typedef scaled_base_unit<degree_base_unit, scale<360, static_rational<1> > > revolution_base_unit;
}
template<>
struct base_unit_info<angle::revolution_base_unit> {
static const char* name() { return("revolution"); }
static const char* symbol() { return("rev"); }
};
}
}
#endif // BOOST_UNITS_BASE_UNITS_REVOLUTION_HPP

View File

@@ -0,0 +1,48 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_ANGLE_STERADIAN_BASE_UNIT_HPP
#define BOOST_UNITS_ANGLE_STERADIAN_BASE_UNIT_HPP
#include <string>
#include <boost/units/config.hpp>
#include <boost/units/base_unit.hpp>
#include <boost/units/physical_dimensions/solid_angle.hpp>
namespace boost {
namespace units {
namespace angle {
struct steradian_base_unit : public base_unit<steradian_base_unit, solid_angle_dimension, -1>
{
static std::string name() { return("steradian"); }
static std::string symbol() { return("sr"); }
};
} // namespace angle
} // namespace units
} // namespace boost
#if BOOST_UNITS_HAS_BOOST_TYPEOF
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TYPE(boost::units::angle::steradian_base_unit)
#endif
//#include <boost/units/base_units/angle/conversions.hpp>
#endif // BOOST_UNITS_ANGLE_STERADIAN_BASE_UNIT_HPP

View File

@@ -0,0 +1,27 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_ASTRONOMICAL_ASTRONOMICAL_UNIT_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_ASTRONOMICAL_ASTRONOMICAL_UNIT_HPP_INCLUDED
#include <boost/units/conversion.hpp>
#include <boost/units/base_units/si/meter.hpp>
BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(astronomical, astronomical_unit, "astronomical unit", "a.u.", 149597870691.0, boost::units::si::meter_base_unit, -207);
#if BOOST_UNITS_HAS_BOOST_TYPEOF
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TYPE(boost::units::astronomical::astronomical_unit_base_unit)
#endif
#endif // BOOST_UNIT_SYSTEMS_ASTRONOMICAL_ASTRONOMICAL_UNIT_HPP_INCLUDED

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_ASTRONOMICAL_LIGHT_DAY_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_ASTRONOMICAL_LIGHT_DAY_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/astronomical/light_second.hpp>
namespace boost {
namespace units {
namespace astronomical {
typedef scaled_base_unit<boost::units::astronomical::light_second_base_unit, scale<86400, static_rational<1> > > light_day_base_unit;
} // namespace astronomical
template<>
struct base_unit_info<astronomical::light_day_base_unit> {
static const char* name() { return("light day"); }
static const char* symbol() { return("ldy"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNIT_SYSTEMS_ASTRONOMICAL_LIGHT_DAY_HPP_INCLUDED

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_ASTRONOMICAL_LIGHT_HOUR_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_ASTRONOMICAL_LIGHT_HOUR_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/astronomical/light_second.hpp>
namespace boost {
namespace units {
namespace astronomical {
typedef scaled_base_unit<boost::units::astronomical::light_second_base_unit, scale<3600, static_rational<1> > > light_hour_base_unit;
} // namespace astronomical
template<>
struct base_unit_info<astronomical::light_hour_base_unit> {
static const char* name() { return("light hour"); }
static const char* symbol() { return("lhr"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNIT_SYSTEMS_ASTRONOMICAL_LIGHT_HOUR_HPP_INCLUDED

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_ASTRONOMICAL_LIGHT_MINUTE_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_ASTRONOMICAL_LIGHT_MINUTE_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/astronomical/light_second.hpp>
namespace boost {
namespace units {
namespace astronomical {
typedef scaled_base_unit<boost::units::astronomical::light_second_base_unit, scale<60, static_rational<1> > > light_minute_base_unit;
} // namespace astronomical
template<>
struct base_unit_info<astronomical::light_minute_base_unit> {
static const char* name() { return("light minute"); }
static const char* symbol() { return("lmn"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNIT_SYSTEMS_ASTRONOMICAL_LIGHT_MINUTE_HPP_INCLUDED

View File

@@ -0,0 +1,27 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_ASTRONOMICAL_LIGHT_SECOND_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_ASTRONOMICAL_LIGHT_SECOND_HPP_INCLUDED
#include <boost/units/conversion.hpp>
#include <boost/units/base_units/si/meter.hpp>
BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(astronomical, light_second, "light second", "lsc", 2.99792458e8, boost::units::si::meter_base_unit, -201);
#if BOOST_UNITS_HAS_BOOST_TYPEOF
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TYPE(boost::units::astronomical::light_second_base_unit)
#endif
#endif // BOOST_UNIT_SYSTEMS_ASTRONOMICAL_LIGHT_SECOND_HPP_INCLUDED

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_ASTRONOMICAL_LIGHT_YEAR_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_ASTRONOMICAL_LIGHT_YEAR_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/astronomical/light_second.hpp>
namespace boost {
namespace units {
namespace astronomical {
typedef scaled_base_unit<boost::units::astronomical::light_second_base_unit, scale<31557600, static_rational<1> > > light_year_base_unit;
} // namespace astronomical
template<>
struct base_unit_info<astronomical::light_year_base_unit> {
static const char* name() { return("light year"); }
static const char* symbol() { return("ly"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNIT_SYSTEMS_ASTRONOMICAL_LIGHT_YEAR_HPP_INCLUDED

View File

@@ -0,0 +1,27 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_ASTRONOMICAL_PARSEC_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_ASTRONOMICAL_PARSEC_HPP_INCLUDED
#include <boost/units/conversion.hpp>
#include <boost/units/base_units/si/meter.hpp>
BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(astronomical, parsec, "parsec", "psc", 3.0856775813e16, boost::units::si::meter_base_unit, -206);
#if BOOST_UNITS_HAS_BOOST_TYPEOF
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TYPE(boost::units::astronomical::parsec_base_unit)
#endif
#endif // BOOST_UNIT_SYSTEMS_ASTRONOMICAL_PARSEC_HPP_INCLUDED

View File

@@ -0,0 +1,31 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_CGS_BIOT_BASE_UNIT_HPP
#define BOOST_UNITS_CGS_BIOT_BASE_UNIT_HPP
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/base_units/si/ampere.hpp>
namespace boost {
namespace units {
namespace cgs {
typedef scaled_base_unit<boost::units::si::ampere_base_unit, scale<10, static_rational<-1> > > biot_base_unit;
} // namespace cgs
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_CGS_BIOT_BASE_UNIT_HPP

View File

@@ -0,0 +1,31 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_CENTIMETER_BASE_UNIT_HPP
#define BOOST_UNITS_CENTIMETER_BASE_UNIT_HPP
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/base_units/si/meter.hpp>
namespace boost {
namespace units {
namespace cgs {
typedef scaled_base_unit<boost::units::si::meter_base_unit, scale<10, static_rational<-2> > > centimeter_base_unit;
} // namespace cgs
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_CENTIMETER_BASE_UNIT_HPP

View File

@@ -0,0 +1,49 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_CGS_GRAM_BASE_UNIT_HPP
#define BOOST_UNITS_CGS_GRAM_BASE_UNIT_HPP
#include <string>
#include <boost/units/config.hpp>
#include <boost/units/base_unit.hpp>
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/physical_dimensions/mass.hpp>
namespace boost {
namespace units {
namespace cgs {
struct gram_base_unit : public base_unit<gram_base_unit, mass_dimension, -8>
{
static std::string name() { return("gram"); }
static std::string symbol() { return("g"); }
};
} // namespace cgs
} // namespace units
} // namespace boost
#if BOOST_UNITS_HAS_BOOST_TYPEOF
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TYPE(boost::units::cgs::gram_base_unit)
#endif
//#include <boost/units/base_units/detail/conversions.hpp>
#endif // BOOST_UNITS_CGS_GRAM_BASE_UNIT_HPP

View File

@@ -0,0 +1,46 @@
// 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) 2007-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)
// No include guards. This header is intended to be included
// multiple times.
// imperial units
#if 0
#if defined(BOOST_UNITS_BASE_UNITS_IMPERIAL_PINT_HPP_INCLUDED) && defined(BOOST_UNITS_BASE_UNITS_IMPERIAL_GALLON_HPP_INCLUDED) &&\
!defined(BOOST_BOOST_UNITS_BASE_UNITS_IMPERIAL_PINT_TO_GALLON_CONVERSION_DEFINED)
#define BOOST_BOOST_UNITS_BASE_UNITS_IMPERIAL_PINT_TO_GALLON_CONVERSION_DEFINED
#include <boost/units/conversion.hpp>
BOOST_UNITS_DEFINE_CONVERSION_FACTOR(boost::units::imperial::pint_base_unit,boost::units::imperial::gallon_base_unit, double, 1./8.);
#endif
#if defined(BOOST_UNITS_BASE_UNITS_IMPERIAL_PINT_HPP_INCLUDED) && defined(BOOST_UNITS_BASE_UNITS_IMPERIAL_QUART_HPP_INCLUDED) &&\
!defined(BOOST_BOOST_UNITS_BASE_UNITS_IMPERIAL_PINT_TO_QUART_CONVERSION_DEFINED)
#define BOOST_BOOST_UNITS_BASE_UNITS_IMPERIAL_PINT_TO_QUART_CONVERSION_DEFINED
#include <boost/units/conversion.hpp>
BOOST_UNITS_DEFINE_CONVERSION_FACTOR(boost::units::imperial::pint_base_unit,boost::units::imperial::quart_base_unit, double, 1./2.);
#endif
#if defined(BOOST_UNITS_BASE_UNITS_IMPERIAL_PINT_HPP_INCLUDED) && defined(BOOST_UNITS_BASE_UNITS_IMPERIAL_GILL_HPP_INCLUDED) &&\
!defined(BOOST_BOOST_UNITS_BASE_UNITS_IMPERIAL_PINT_TO_GILL_CONVERSION_DEFINED)
#define BOOST_BOOST_UNITS_BASE_UNITS_IMPERIAL_PINT_TO_GILL_CONVERSION_DEFINED
#include <boost/units/conversion.hpp>
BOOST_UNITS_DEFINE_CONVERSION_FACTOR(boost::units::imperial::pint_base_unit,boost::units::imperial::gill_base_unit, double, 4.);
#endif
#if defined(BOOST_UNITS_BASE_UNITS_IMPERIAL_PINT_HPP_INCLUDED) && defined(BOOST_UNITS_BASE_UNITS_IMPERIAL_FLUID_OUNCE_HPP_INCLUDED) &&\
!defined(BOOST_BOOST_UNITS_BASE_UNITS_IMPERIAL_PINT_TO_FLUID_OUNCE_CONVERSION_DEFINED)
#define BOOST_BOOST_UNITS_BASE_UNITS_IMPERIAL_PINT_TO_FLUID_OUNCE_CONVERSION_DEFINED
#include <boost/units/conversion.hpp>
BOOST_UNITS_DEFINE_CONVERSION_FACTOR(boost::units::imperial::pint_base_unit,boost::units::imperial::fluid_ounce_base_unit, double, 20.);
#endif
#endif

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_IMPERIAL_DRACHM_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_IMPERIAL_DRACHM_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/imperial/pound.hpp>
namespace boost {
namespace units {
namespace imperial {
typedef scaled_base_unit<pound_base_unit, scale<16, static_rational<-2> > > drachm_base_unit;
} // namespace imperial
template<>
struct base_unit_info<imperial::drachm_base_unit> {
static const char* name() { return("drachm"); }
static const char* symbol() { return("drachm"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNIT_SYSTEMS_IMPERIAL_DRACHM_HPP_INCLUDED

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_BASE_UNITS_IMPERIAL_FLUID_OUNCE_HPP_INCLUDED
#define BOOST_UNITS_BASE_UNITS_IMPERIAL_FLUID_OUNCE_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/imperial/pint.hpp>
namespace boost {
namespace units {
namespace imperial {
typedef scaled_base_unit<pint_base_unit, scale<20, static_rational<-1> > > fluid_ounce_base_unit;
} // namespace imperial
template<>
struct base_unit_info<imperial::fluid_ounce_base_unit> {
static const char* name() { return("fluid ounce (imp.)"); }
static const char* symbol() { return("fl oz"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_BASE_UNITS_IMPERIAL_FLUID_OUNCE_HPP_INCLUDED

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_IMPERIAL_FOOT_BASE_UNIT_HPP
#define BOOST_UNITS_IMPERIAL_FOOT_BASE_UNIT_HPP
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/imperial/yard.hpp>
namespace boost {
namespace units {
namespace imperial {
typedef scaled_base_unit<yard_base_unit, scale<3, static_rational<-1> > > foot_base_unit;
} // namespace imperial
template<>
struct base_unit_info<imperial::foot_base_unit> {
static const char* name() { return("foot"); }
static const char* symbol() { return("ft"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_IMPERIAL_FOOT_BASE_UNIT_HPP

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_IMPERIAL_FURLONG_BASE_UNIT_HPP
#define BOOST_UNITS_IMPERIAL_FURLONG_BASE_UNIT_HPP
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/imperial/yard.hpp>
namespace boost {
namespace units {
namespace imperial {
typedef scaled_base_unit<yard_base_unit, scale<220, static_rational<1> > > furlong_base_unit;
} // namespace imperial
template<>
struct base_unit_info<imperial::furlong_base_unit> {
static const char* name() { return("furlong"); }
static const char* symbol() { return("furlong"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_IMPERIAL_FURLONG_BASE_UNIT_HPP

View File

@@ -0,0 +1,40 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_BASE_UNITS_IMPERIAL_GALLON_HPP_INCLUDED
#define BOOST_UNITS_BASE_UNITS_IMPERIAL_GALLON_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/imperial/pint.hpp>
namespace boost {
namespace units {
namespace imperial {
//typedef scaled_base_unit<pint_base_unit, scale<2, static_rational<3> > > gallon_base_unit;
typedef scaled_base_unit<pint_base_unit, scale<8, static_rational<1> > > gallon_base_unit;
} // namespace imperial
template<>
struct base_unit_info<imperial::gallon_base_unit> {
static const char* name() { return("gallon (imp.)"); }
static const char* symbol() { return("gal"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_BASE_UNITS_IMPERIAL_GALLON_HPP_INCLUDED

View File

@@ -0,0 +1,40 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_BASE_UNITS_IMPERIAL_GILL_HPP_INCLUDED
#define BOOST_UNITS_BASE_UNITS_IMPERIAL_GILL_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/imperial/pint.hpp>
namespace boost {
namespace units {
namespace imperial {
//typedef scaled_base_unit<pint_base_unit, scale<2, static_rational<-2> > > gill_base_unit;
typedef scaled_base_unit<pint_base_unit, scale<4, static_rational<-1> > > gill_base_unit;
} // namespace imperial
template<>
struct base_unit_info<imperial::gill_base_unit> {
static const char* name() { return("gill (imp.)"); }
static const char* symbol() { return("gill"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_BASE_UNITS_IMPERIAL_GILL_HPP_INCLUDED

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_IMPERIAL_GRAIN_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_IMPERIAL_GRAIN_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/imperial/pound.hpp>
namespace boost {
namespace units {
namespace imperial {
typedef scaled_base_unit<pound_base_unit, scale<7000, static_rational<-1> > > grain_base_unit;
} // namespace imperial
template<>
struct base_unit_info<imperial::grain_base_unit> {
static const char* name() { return("grain"); }
static const char* symbol() { return("grain"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNIT_SYSTEMS_IMPERIAL_GRAIN_HPP_INCLUDED

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_IMPERIAL_HUNDREDWEIGHT_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_IMPERIAL_HUNDREDWEIGHT_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/imperial/pound.hpp>
namespace boost {
namespace units {
namespace imperial {
typedef scaled_base_unit<pound_base_unit, scale<112, static_rational<1> > > hundredweight_base_unit;
} // namespace imperial
template<>
struct base_unit_info<imperial::hundredweight_base_unit> {
static const char* name() { return("hundredweight"); }
static const char* symbol() { return("cwt"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNIT_SYSTEMS_IMPERIAL_HUNDREDWEIGHT_HPP_INCLUDED

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_IMPERIAL_INCH_BASE_UNIT_HPP
#define BOOST_UNITS_IMPERIAL_INCH_BASE_UNIT_HPP
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/imperial/yard.hpp>
namespace boost {
namespace units {
namespace imperial {
typedef scaled_base_unit<yard_base_unit, scale<36, static_rational<-1> > > inch_base_unit;
} // namespace imperial
template<>
struct base_unit_info<imperial::inch_base_unit> {
static const char* name() { return("inch"); }
static const char* symbol() { return("in"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_IMPERIAL_INCH_BASE_UNIT_HPP

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_IMPERIAL_LEAGUE_BASE_UNIT_HPP
#define BOOST_UNITS_IMPERIAL_LEAGUE_BASE_UNIT_HPP
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/imperial/yard.hpp>
namespace boost {
namespace units {
namespace imperial {
typedef scaled_base_unit<yard_base_unit, scale<5280, static_rational<1> > > league_base_unit;
} // namespace imperial
template<>
struct base_unit_info<imperial::league_base_unit> {
static const char* name() { return("league"); }
static const char* symbol() { return("league"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_IMPERIAL_LEAGUE_BASE_UNIT_HPP

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_IMPERIAL_MILE_BASE_UNIT_HPP
#define BOOST_UNITS_IMPERIAL_MILE_BASE_UNIT_HPP
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/imperial/yard.hpp>
namespace boost {
namespace units {
namespace imperial {
typedef scaled_base_unit<yard_base_unit, scale<1760, static_rational<1> > > mile_base_unit;
} // namespace imperial
template<>
struct base_unit_info<imperial::mile_base_unit> {
static const char* name() { return("mile"); }
static const char* symbol() { return("mi"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_IMPERIAL_MILE_BASE_UNIT_HPP

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_IMPERIAL_OUNCE_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_IMPERIAL_OUNCE_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/imperial/pound.hpp>
namespace boost {
namespace units {
namespace imperial {
typedef scaled_base_unit<pound_base_unit, scale<2, static_rational<-4> > > ounce_base_unit;
} // namespace imperial
template<>
struct base_unit_info<imperial::ounce_base_unit> {
static const char* name() { return("ounce"); }
static const char* symbol() { return("oz"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNIT_SYSTEMS_IMPERIAL_OUNCE_HPP_INCLUDED

View File

@@ -0,0 +1,29 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_BASE_UNITS_IMPERIAL_PINT_HPP_INCLUDED
#define BOOST_UNITS_BASE_UNITS_IMPERIAL_PINT_HPP_INCLUDED
#include <string>
#include <boost/units/systems/si/volume.hpp>
#include <boost/units/conversion.hpp>
BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(imperial, pint, "pint (imp.)", "pt", 4.54609e-3/8., si::volume, -303); // exact conversion
#if BOOST_UNITS_HAS_BOOST_TYPEOF
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TYPE(boost::units::imperial::pint_base_unit)
#endif
#endif // BOOST_UNITS_BASE_UNITS_IMPERIAL_PINT_HPP_INCLUDED

View File

@@ -0,0 +1,34 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_IMPERIAL_POUND_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_IMPERIAL_POUND_HPP_INCLUDED
#include <string>
#include <boost/units/config.hpp>
#include <boost/units/base_unit.hpp>
#include <boost/units/physical_dimensions/mass.hpp>
#include <boost/units/base_units/cgs/gram.hpp>
#include <boost/units/conversion.hpp>
// can't define in terms of kilogram because it is a scaled_base_unit
//BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(imperial, pound, "pound", "lb", 0.45359237, si::kilogram_base_unit, -302); // exact conversion
BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(imperial, pound, "pound", "lb", 453.59237, cgs::gram_base_unit, -302); // exact conversion
#if BOOST_UNITS_HAS_BOOST_TYPEOF
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TYPE(boost::units::imperial::pound_base_unit)
#endif
#endif // BOOST_UNIT_SYSTEMS_IMPERIAL_POUND_HPP_INCLUDED

View File

@@ -0,0 +1,40 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_BASE_UNITS_IMPERIAL_QUART_HPP_INCLUDED
#define BOOST_UNITS_BASE_UNITS_IMPERIAL_QUART_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/imperial/pint.hpp>
namespace boost {
namespace units {
namespace imperial {
//typedef scaled_base_unit<pint_base_unit, scale<2, static_rational<1> > > quart_base_unit;
typedef scaled_base_unit<pint_base_unit, scale<2, static_rational<1> > > quart_base_unit;
} // namespace imperial
template<>
struct base_unit_info<imperial::quart_base_unit> {
static const char* name() { return("quart (imp.)"); }
static const char* symbol() { return("qt"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_BASE_UNITS_IMPERIAL_QUART_HPP_INCLUDED

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_IMPERIAL_QUARTER_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_IMPERIAL_QUARTER_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/imperial/pound.hpp>
namespace boost {
namespace units {
namespace imperial {
typedef scaled_base_unit<pound_base_unit, scale<28, static_rational<1> > > quarter_base_unit;
} // namespace imperial
template<>
struct base_unit_info<imperial::quarter_base_unit> {
static const char* name() { return("quarter"); }
static const char* symbol() { return("quarter"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNIT_SYSTEMS_IMPERIAL_QUARTER_HPP_INCLUDED

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_IMPERIAL_STONE_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_IMPERIAL_STONE_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/imperial/pound.hpp>
namespace boost {
namespace units {
namespace imperial {
typedef scaled_base_unit<pound_base_unit, scale<14, static_rational<1> > > stone_base_unit;
} // namespace imperial
template<>
struct base_unit_info<imperial::stone_base_unit> {
static const char* name() { return("stone"); }
static const char* symbol() { return("st"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNIT_SYSTEMS_IMPERIAL_STONE_HPP_INCLUDED

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_IMPERIAL_THOU_BASE_UNIT_HPP
#define BOOST_UNITS_IMPERIAL_THOU_BASE_UNIT_HPP
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/imperial/yard.hpp>
namespace boost {
namespace units {
namespace imperial {
typedef scaled_base_unit<yard_base_unit, scale<36000, static_rational<-1> > > thou_base_unit;
} // namespace imperial
template<>
struct base_unit_info<imperial::thou_base_unit> {
static const char* name() { return("thou"); }
static const char* symbol() { return("thou"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_IMPERIAL_THOU_BASE_UNIT_HPP

View File

@@ -0,0 +1,40 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_IMPERIAL_TON_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_IMPERIAL_TON_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/imperial/pound.hpp>
namespace boost {
namespace units {
namespace imperial {
typedef scaled_base_unit<pound_base_unit, scale<2240, static_rational<1> > > ton_base_unit;
} // namespace imperial
template<>
struct base_unit_info<imperial::ton_base_unit> {
static const char* name() { return("long ton"); }
static const char* symbol() { return("t"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNIT_SYSTEMS_IMPERIAL_TON_HPP_INCLUDED

View File

@@ -0,0 +1,32 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_SYSTEMS_IMPERIAL_YARD_BASE_UNIT_HPP
#define BOOST_UNITS_SYSTEMS_IMPERIAL_YARD_BASE_UNIT_HPP
#include <string>
#include <boost/units/config.hpp>
#include <boost/units/base_unit.hpp>
#include <boost/units/physical_dimensions/length.hpp>
#include <boost/units/base_units/si/meter.hpp>
#include <boost/units/conversion.hpp>
BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(imperial, yard, "yard", "yd", 0.9144, si::meter_base_unit, -301); // exact conversion
#if BOOST_UNITS_HAS_BOOST_TYPEOF
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TYPE(boost::units::imperial::yard_base_unit)
#endif
#endif // BOOST_UNITS_SYSTEMS_IMPERIAL_YARD_BASE_UNIT_HPP

View File

@@ -0,0 +1,37 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_METRIC_ANGSTROM_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_METRIC_ANGSTROM_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/units_fwd.hpp>
#include <boost/units/base_units/si/meter.hpp>
namespace boost {
namespace units {
namespace metric {
typedef scaled_base_unit<boost::units::si::meter_base_unit, scale<10, static_rational<-10> > > angstrom_base_unit;
}
template<>
struct base_unit_info<metric::angstrom_base_unit> {
static const char* name() { return("angstrom"); }
static const char* symbol() { return("A"); }
};
}
}
#endif // BOOST_UNIT_SYSTEMS_METRIC_ANGSTROM_HPP_INCLUDED

View File

@@ -0,0 +1,19 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_METRIC_ARE_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_METRIC_ARE_HPP_INCLUDED
#include <boost/units/conversion.hpp>
#include <boost/units/systems/si/area.hpp>
BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(metric, are, "are", "a", 1.0e2, si::area, 10);
#endif // BOOST_UNIT_SYSTEMS_METRIC_ARE_HPP_INCLUDED

View File

@@ -0,0 +1,19 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_METRIC_ATMOSPHERE_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_METRIC_ATMOSPHERE_HPP_INCLUDED
#include <boost/units/conversion.hpp>
#include <boost/units/systems/si/pressure.hpp>
BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(metric, atmosphere, "atmosphere", "atm", 1.01325e5, si::pressure, 33);
#endif // BOOST_UNIT_SYSTEMS_METRIC_ATMOSPHERE_HPP_INCLUDED

View File

@@ -0,0 +1,19 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_METRIC_BAR_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_METRIC_BAR_HPP_INCLUDED
#include <boost/units/conversion.hpp>
#include <boost/units/systems/si/pressure.hpp>
BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(metric, bar, "bar", "bar", 1.0e5, si::pressure, 14);
#endif // BOOST_UNIT_SYSTEMS_METRIC_BAR_HPP_INCLUDED

View File

@@ -0,0 +1,19 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_METRIC_BARN_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_METRIC_BARN_HPP_INCLUDED
#include <boost/units/conversion.hpp>
#include <boost/units/systems/si/area.hpp>
BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(metric, barn, "barn", "b", 1.0e-28, si::area, 11);
#endif // BOOST_UNIT_SYSTEMS_METRIC_BARN_HPP_INCLUDED

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_OTHER_DAY_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_OTHER_DAY_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/si/second.hpp>
namespace boost {
namespace units {
namespace metric {
typedef scaled_base_unit<boost::units::si::second_base_unit, scale<86400, static_rational<1> > > day_base_unit;
} // namespace metric
template<>
struct base_unit_info<metric::day_base_unit> {
static const char* name() { return("day"); }
static const char* symbol() { return("d"); }
};
} // namespace units
} // namespace boost
#endif

View File

@@ -0,0 +1,36 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_METRIC_FERMI_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_METRIC_FERMI_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/si/meter.hpp>
namespace boost {
namespace units {
namespace metric {
typedef scaled_base_unit<boost::units::si::meter_base_unit, scale<10, static_rational<-15> > > fermi_base_unit;
}
template<>
struct base_unit_info<metric::fermi_base_unit> {
static const char* name() { return("fermi"); }
static const char* symbol() { return("fm"); }
};
}
}
#endif // BOOST_UNIT_SYSTEMS_METRIC_FERMI_HPP_INCLUDED

View File

@@ -0,0 +1,19 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_METRIC_HECTARE_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_METRIC_HECTARE_HPP_INCLUDED
#include <boost/units/conversion.hpp>
#include <boost/units/systems/si/area.hpp>
BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(metric, hectare, "hectare", "ha", 1.0e4, si::area, 12);
#endif // BOOST_UNIT_SYSTEMS_METRIC_HECTARE_HPP_INCLUDED

View File

@@ -0,0 +1,37 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_METRIC_HOUR_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_METRIC_HOUR_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/units_fwd.hpp>
#include <boost/units/base_units/si/second.hpp>
namespace boost {
namespace units {
namespace metric {
typedef scaled_base_unit<boost::units::si::second_base_unit, scale<60, static_rational<2> > > hour_base_unit;
}
template<>
struct base_unit_info<metric::hour_base_unit> {
static const char* name() { return("hour"); }
static const char* symbol() { return("h"); }
};
}
}
#endif // BOOST_UNIT_SYSTEMS_METRIC_HOUR_HPP_INCLUDED

View File

@@ -0,0 +1,19 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_METRIC_KNOT_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_METRIC_KNOT_HPP_INCLUDED
#include <boost/units/conversion.hpp>
#include <boost/units/systems/si/velocity.hpp>
BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(metric, knot, "knot", "kt", 1852./3600., boost::units::si::velocity, -403);
#endif // BOOST_UNIT_SYSTEMS_METRIC_KNOT_HPP_INCLUDED

View File

@@ -0,0 +1,19 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_METRIC_LITER_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_METRIC_LITER_HPP_INCLUDED
#include <boost/units/conversion.hpp>
#include <boost/units/systems/si/volume.hpp>
BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(metric, liter, "liter", "L", 1.0e-3, si::volume, 13);
#endif // BOOST_UNIT_SYSTEMS_METRIC_LITER_HPP_INCLUDED

View File

@@ -0,0 +1,36 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_METRIC_MICRON_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_METRIC_MICRON_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/si/meter.hpp>
namespace boost {
namespace units {
namespace metric {
typedef scaled_base_unit<boost::units::si::meter_base_unit, scale<10, static_rational<-6> > > micron_base_unit;
}
template<>
struct base_unit_info<metric::micron_base_unit> {
static const char* name() { return("micron"); }
static const char* symbol() { return("u"); }
};
}
}
#endif // BOOST_UNIT_SYSTEMS_METRIC_MICRON_HPP_INCLUDED

View File

@@ -0,0 +1,37 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_METRIC_MINUTE_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_METRIC_MINUTE_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/units_fwd.hpp>
#include <boost/units/base_units/si/second.hpp>
namespace boost {
namespace units {
namespace metric {
typedef scaled_base_unit<boost::units::si::second_base_unit, scale<60, static_rational<1> > > minute_base_unit;
}
template<>
struct base_unit_info<metric::minute_base_unit> {
static const char* name() { return("minute"); }
static const char* symbol() { return("min"); }
};
}
}
#endif // BOOST_UNIT_SYSTEMS_METRIC_MINUTE_HPP_INCLUDED

View File

@@ -0,0 +1,19 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_METRIC_MMHG_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_METRIC_MMHG_HPP_INCLUDED
#include <boost/units/conversion.hpp>
#include <boost/units/systems/si/pressure.hpp>
BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(metric, mmHg, "millimeters mercury", "mmHg", 133.322, si::pressure, -404);
#endif // BOOST_UNIT_SYSTEMS_METRIC_MMHG_HPP_INCLUDED

View File

@@ -0,0 +1,36 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_METRIC_NAUTICAL_MILE_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_METRIC_NAUTICAL_MILE_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/si/meter.hpp>
namespace boost {
namespace units {
namespace metric {
typedef scaled_base_unit<boost::units::si::meter_base_unit, scale<1852, static_rational<1> > > nautical_mile_base_unit;
}
template<>
struct base_unit_info<metric::nautical_mile_base_unit> {
static const char* name() { return("nautical mile"); }
static const char* symbol() { return("nmi"); }
};
}
}
#endif // BOOST_UNIT_SYSTEMS_METRIC_NAUTICAL_MILE_HPP_INCLUDED

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_METRIC_TON_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_METRIC_TON_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/units_fwd.hpp>
#include <boost/units/base_units/si/kilogram.hpp>
//#include <boost/units/base_units/cgs/gram.hpp>
namespace boost {
namespace units {
namespace metric {
//typedef scaled_base_unit<boost::units::cgs::gram_base_unit, scale<10, static_rational<6> > > ton_base_unit;
typedef scaled_base_unit<boost::units::si::kilogram_base_unit, scale<1000, static_rational<1> > > ton_base_unit;
}
template<>
struct base_unit_info<metric::ton_base_unit> {
static const char* name() { return("metric ton"); }
static const char* symbol() { return("t"); }
};
}
}
#endif // BOOST_UNIT_SYSTEMS_METRIC_TON_HPP_INCLUDED

View File

@@ -0,0 +1,19 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_METRIC_TORR_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_METRIC_TORR_HPP_INCLUDED
#include <boost/units/conversion.hpp>
#include <boost/units/systems/si/pressure.hpp>
BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(metric, torr, "torr", "Torr", 1.01325e5/760.0, si::pressure, -401);
#endif

View File

@@ -0,0 +1,38 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_OTHER_YEAR_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_OTHER_YEAR_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/si/second.hpp>
// Julian year = 365.25 days exactly = 8766 hours exactly
namespace boost {
namespace units {
namespace metric {
typedef scaled_base_unit<boost::units::si::second_base_unit, scale<31557600, static_rational<1> > > year_base_unit;
}
template<>
struct base_unit_info<metric::year_base_unit> {
static const char* name() { return("Julian year"); }
static const char* symbol() { return("yr"); }
};
}
}
#endif

View File

@@ -0,0 +1,48 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_SI_AMPERE_BASE_UNIT_HPP
#define BOOST_UNITS_SI_AMPERE_BASE_UNIT_HPP
#include <string>
#include <boost/units/config.hpp>
#include <boost/units/base_unit.hpp>
#include <boost/units/physical_dimensions/current.hpp>
namespace boost {
namespace units {
namespace si {
struct ampere_base_unit : public base_unit<ampere_base_unit, current_dimension, -6>
{
static std::string name() { return("ampere"); }
static std::string symbol() { return("A"); }
};
} // namespace si
} // namespace units
} // namespace boost
#if BOOST_UNITS_HAS_BOOST_TYPEOF
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TYPE(boost::units::si::ampere_base_unit)
#endif
//#include <boost/units/base_units/detail/conversions.hpp>
#endif // BOOST_UNITS_SI_AMPERE_BASE_UNIT_HPP

View File

@@ -0,0 +1,48 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_SI_CANDELA_BASE_UNIT_HPP
#define BOOST_UNITS_SI_CANDELA_BASE_UNIT_HPP
#include <string>
#include <boost/units/config.hpp>
#include <boost/units/base_unit.hpp>
#include <boost/units/physical_dimensions/luminous_intensity.hpp>
namespace boost {
namespace units {
namespace si {
struct candela_base_unit : public base_unit<candela_base_unit, luminous_intensity_dimension, -3>
{
static std::string name() { return("candela"); }
static std::string symbol() { return("cd"); }
};
} // namespace si
} // namespace units
} // namespace boost
#if BOOST_UNITS_HAS_BOOST_TYPEOF
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TYPE(boost::units::si::candela_base_unit)
#endif
//#include <boost/units/base_units/detail/conversions.hpp>
#endif // BOOST_UNITS_SI_CANDELA_BASE_UNIT_HPP

View File

@@ -0,0 +1,48 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_SI_KELVIN_BASE_UNIT_HPP
#define BOOST_UNITS_SI_KELVIN_BASE_UNIT_HPP
#include <string>
#include <boost/units/config.hpp>
#include <boost/units/base_unit.hpp>
#include <boost/units/physical_dimensions/temperature.hpp>
namespace boost {
namespace units {
namespace si {
struct kelvin_base_unit : public base_unit<kelvin_base_unit, temperature_dimension, -5>
{
static std::string name() { return("kelvin"); }
static std::string symbol() { return("K"); }
};
} // namespace si
} // namespace units
} // namespace boost
#if BOOST_UNITS_HAS_BOOST_TYPEOF
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TYPE(boost::units::si::kelvin_base_unit)
#endif
//#include <boost/units/base_units/detail/conversions.hpp>
#endif // BOOST_UNITS_SI_KELVIN_BASE_UNIT_HPP

View File

@@ -0,0 +1,31 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_SI_KILOGRAM_BASE_UNIT_HPP
#define BOOST_UNITS_SI_KILOGRAM_BASE_UNIT_HPP
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/base_units/cgs/gram.hpp>
namespace boost {
namespace units {
namespace si {
typedef scaled_base_unit<boost::units::cgs::gram_base_unit, scale<10, static_rational<3> > > kilogram_base_unit;
} // namespace si
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_SI_KILOGRAM_BASE_UNIT_HPP

View File

@@ -0,0 +1,50 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_SI_METER_BASE_UNIT_HPP
#define BOOST_UNITS_SI_METER_BASE_UNIT_HPP
#include <string>
#include <boost/units/config.hpp>
#include <boost/units/base_unit.hpp>
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/physical_dimensions/length.hpp>
namespace boost {
namespace units {
namespace si {
struct meter_base_unit : public base_unit<meter_base_unit, length_dimension, -9>
{
static std::string name() { return("meter"); }
static std::string symbol() { return("m"); }
};
} // namespace si
} // namespace units
} // namespace boost
#if BOOST_UNITS_HAS_BOOST_TYPEOF
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TYPE(boost::units::si::meter_base_unit)
#endif
//#include <boost/units/base_units/detail/conversions.hpp>
#endif // BOOST_UNITS_SI_METER_BASE_UNIT_HPP

View File

@@ -0,0 +1,48 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_SI_MOLE_BASE_UNIT_HPP
#define BOOST_UNITS_SI_MOLE_BASE_UNIT_HPP
#include <string>
#include <boost/units/config.hpp>
#include <boost/units/base_unit.hpp>
#include <boost/units/physical_dimensions/amount.hpp>
namespace boost {
namespace units {
namespace si {
struct mole_base_unit : public base_unit<mole_base_unit, amount_dimension, -4>
{
static std::string name() { return("mole"); }
static std::string symbol() { return("mol"); }
};
} // namespace si
} // namespace units
} // namespace boost
#if BOOST_UNITS_HAS_BOOST_TYPEOF
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TYPE(boost::units::si::mole_base_unit)
#endif
//#include <boost/units/base_units/detail/conversions.hpp>
#endif // BOOST_UNITS_SI_MOLE_BASE_UNIT_HPP

View File

@@ -0,0 +1,48 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_SI_SECOND_BASE_UNIT_HPP
#define BOOST_UNITS_SI_SECOND_BASE_UNIT_HPP
#include <string>
#include <boost/units/config.hpp>
#include <boost/units/base_unit.hpp>
#include <boost/units/physical_dimensions/time.hpp>
namespace boost {
namespace units {
namespace si {
struct second_base_unit : public base_unit<second_base_unit, time_dimension, -7>
{
static std::string name() { return("second"); }
static std::string symbol() { return("s"); }
};
} // namespace si
} // namespace units
} // namespace boost
#if BOOST_UNITS_HAS_BOOST_TYPEOF
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TYPE(boost::units::si::second_base_unit)
#endif
//#include <boost/units/base_units/detail/conversions.hpp>
#endif // BOOST_UNITS_SI_SECOND_BASE_UNIT_HPP

View File

@@ -0,0 +1,48 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_TEMPERATURE_CELSIUS_BASE_UNIT_HPP
#define BOOST_UNITS_TEMPERATURE_CELSIUS_BASE_UNIT_HPP
#include <string>
#include <boost/units/config.hpp>
#include <boost/units/base_unit.hpp>
#include <boost/units/physical_dimensions/temperature.hpp>
namespace boost {
namespace units {
namespace temperature {
struct celsius_base_unit : public base_unit<celsius_base_unit, temperature_dimension, -1008>
{
static std::string name() { return("celsius"); }
static std::string symbol() { return("C"); }
};
} // namespace temperature
} // namespace units
} // namespace boost
#if BOOST_UNITS_HAS_BOOST_TYPEOF
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TYPE(boost::units::temperature::celsius_base_unit)
#endif
#include <boost/units/base_units/temperature/conversions.hpp>
#endif // BOOST_UNITS_TEMPERATURE_CELSIUS_BASE_UNIT_HPP

View File

@@ -0,0 +1,42 @@
// 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) 2007-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)
// No include guards. This header is intended to be included
// multiple times.
// units of temperature
#if defined(BOOST_UNITS_SI_KELVIN_BASE_UNIT_HPP) && defined(BOOST_UNITS_TEMPERATURE_CELSIUS_BASE_UNIT_HPP) &&\
!defined(BOOST_UNITS_SYSTEMS_KELVIN_TO_CELSIUS_CONVERSION_DEFINED)
#define BOOST_UNITS_SYSTEMS_KELVIN_TO_CELSIUS_CONVERSION_DEFINED
#include <boost/units/conversion.hpp>
#include <boost/units/absolute.hpp>
BOOST_UNITS_DEFINE_CONVERSION_FACTOR(boost::units::si::kelvin_base_unit, boost::units::temperature::celsius_base_unit, one, make_one());
BOOST_UNITS_DEFINE_CONVERSION_OFFSET(boost::units::si::kelvin_base_unit, boost::units::temperature::celsius_base_unit, double, -273.15);
#endif
#if defined(BOOST_UNITS_SI_KELVIN_BASE_UNIT_HPP) && defined(BOOST_UNITS_TEMPERATURE_FAHRENHEIT_BASE_UNIT_HPP) &&\
!defined(BOOST_UNITS_SYSTEMS_KELVIN_TO_FAHRENHEIT_CONVERSION_DEFINED)
#define BOOST_UNITS_SYSTEMS_KELVIN_TO_FAHRENHEIT_CONVERSION_DEFINED
#include <boost/units/conversion.hpp>
#include <boost/units/absolute.hpp>
BOOST_UNITS_DEFINE_CONVERSION_FACTOR(boost::units::si::kelvin_base_unit, boost::units::temperature::fahrenheit_base_unit, double, 9.0/5.0);
BOOST_UNITS_DEFINE_CONVERSION_OFFSET(boost::units::si::kelvin_base_unit, boost::units::temperature::fahrenheit_base_unit, double, -273.15 * 9.0 / 5.0 + 32.0);
#endif
#if defined(BOOST_UNITS_TEMPERATURE_CELSIUS_BASE_UNIT_HPP) && defined(BOOST_UNITS_TEMPERATURE_FAHRENHEIT_BASE_UNIT_HPP) &&\
!defined(BOOST_UNITS_SYSTEMS_CELSUIS_TO_FAHRENHEIT_CONVERSION_DEFINED)
#define BOOST_UNITS_SYSTEMS_CELSUIS_TO_FAHRENHEIT_CONVERSION_DEFINED
#include <boost/units/conversion.hpp>
#include <boost/units/absolute.hpp>
BOOST_UNITS_DEFINE_CONVERSION_FACTOR(boost::units::temperature::celsius_base_unit, boost::units::temperature::fahrenheit_base_unit, double, 9.0/5.0);
BOOST_UNITS_DEFINE_CONVERSION_OFFSET(boost::units::temperature::celsius_base_unit, boost::units::temperature::fahrenheit_base_unit, double, 32.0);
#endif

View File

@@ -0,0 +1,48 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_TEMPERATURE_FAHRENHEIT_BASE_UNIT_HPP
#define BOOST_UNITS_TEMPERATURE_FAHRENHEIT_BASE_UNIT_HPP
#include <string>
#include <boost/units/config.hpp>
#include <boost/units/base_unit.hpp>
#include <boost/units/physical_dimensions/temperature.hpp>
namespace boost {
namespace units {
namespace temperature {
struct fahrenheit_base_unit : public base_unit<fahrenheit_base_unit, temperature_dimension, -1007>
{
static std::string name() { return("fahrenheit"); }
static std::string symbol() { return("F"); }
};
} // namespace temperature
} // namespace units
} // namespace boost
#if BOOST_UNITS_HAS_BOOST_TYPEOF
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TYPE(boost::units::temperature::fahrenheit_base_unit)
#endif
#include <boost/units/base_units/temperature/conversions.hpp>
#endif // BOOST_UNITS_TEMPERATURE_FAHRENHEIT_BASE_UNIT_HPP

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_BASE_UNITS_US_CUP_HPP_INCLUDED
#define BOOST_UNITS_BASE_UNITS_US_CUP_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/us/pint.hpp>
namespace boost {
namespace units {
namespace us {
typedef scaled_base_unit<pint_base_unit, scale<2, static_rational<-1> > > cup_base_unit;
} // namespace us
template<>
struct base_unit_info<us::cup_base_unit> {
static const char* name() { return("cup"); }
static const char* symbol() { return("c"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_BASE_UNITS_US_CUP_HPP_INCLUDED

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_BASE_UNITS_US_DRAM_HPP_INCLUDED
#define BOOST_UNIT_BASE_UNITS_US_DRAM_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/us/pound.hpp>
namespace boost {
namespace units {
namespace us {
typedef scaled_base_unit<pound_base_unit, scale<16, static_rational<-2> > > dram_base_unit;
} // namespace us
template<>
struct base_unit_info<us::dram_base_unit> {
static const char* name() { return("dram (U.S.)"); }
static const char* symbol() { return("dr"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNIT_BASE_UNITS_US_DRAM_HPP_INCLUDED

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_BASE_UNITS_US_FLUID_DRAM_HPP_INCLUDED
#define BOOST_UNITS_BASE_UNITS_US_FLUID_DRAM_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/us/pint.hpp>
namespace boost {
namespace units {
namespace us {
typedef scaled_base_unit<pint_base_unit, scale<2, static_rational<-7> > > fluid_dram_base_unit;
} // namespace us
template<>
struct base_unit_info<us::fluid_dram_base_unit> {
static const char* name() { return("fluid dram (U.S.)"); }
static const char* symbol() { return("fl dr"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_BASE_UNITS_US_FLUID_DRAM_HPP_INCLUDED

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_BASE_UNITS_US_FLUID_OUNCE_HPP_INCLUDED
#define BOOST_UNITS_BASE_UNITS_US_FLUID_OUNCE_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/us/pint.hpp>
namespace boost {
namespace units {
namespace us {
typedef scaled_base_unit<pint_base_unit, scale<16, static_rational<-1> > > fluid_ounce_base_unit;
} // namespace us
template<>
struct base_unit_info<us::fluid_ounce_base_unit> {
static const char* name() { return("fluid ounce (U.S.)"); }
static const char* symbol() { return("fl oz"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_BASE_UNITS_US_FLUID_OUNCE_HPP_INCLUDED

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_US_FOOT_BASE_UNIT_HPP
#define BOOST_UNITS_US_FOOT_BASE_UNIT_HPP
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/us/yard.hpp>
namespace boost {
namespace units {
namespace us {
typedef scaled_base_unit<yard_base_unit, scale<3, static_rational<-1> > > foot_base_unit;
} // namespace us
template<>
struct base_unit_info<us::foot_base_unit> {
static const char* name() { return("foot"); }
static const char* symbol() { return("ft"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_US_FOOT_BASE_UNIT_HPP

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_BASE_UNITS_US_GALLON_HPP_INCLUDED
#define BOOST_UNITS_BASE_UNITS_US_GALLON_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/us/pint.hpp>
namespace boost {
namespace units {
namespace us {
typedef scaled_base_unit<pint_base_unit, scale<2, static_rational<3> > > gallon_base_unit;
} // namespace us
template<>
struct base_unit_info<us::gallon_base_unit> {
static const char* name() { return("gallon (U.S.)"); }
static const char* symbol() { return("gal"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_BASE_UNITS_US_GALLON_HPP_INCLUDED

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_BASE_UNITS_US_GILL_HPP_INCLUDED
#define BOOST_UNITS_BASE_UNITS_US_GILL_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/us/pint.hpp>
namespace boost {
namespace units {
namespace us {
typedef scaled_base_unit<pint_base_unit, scale<2, static_rational<-2> > > gill_base_unit;
} // namespace us
template<>
struct base_unit_info<us::gill_base_unit> {
static const char* name() { return("gill (U.S.)"); }
static const char* symbol() { return("gi"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_BASE_UNITS_US_GILL_HPP_INCLUDED

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_BASE_UNITS_US_GRAIN_HPP_INCLUDED
#define BOOST_UNIT_BASE_UNITS_US_GRAIN_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/us/pound.hpp>
namespace boost {
namespace units {
namespace us {
typedef scaled_base_unit<pound_base_unit, scale<7000, static_rational<-1> > > grain_base_unit;
} // namespace us
template<>
struct base_unit_info<us::grain_base_unit> {
static const char* name() { return("grain"); }
static const char* symbol() { return("gr"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNIT_BASE_UNITS_US_GRAIN_HPP_INCLUDED

View File

@@ -0,0 +1,40 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_BASE_UNITS_US_HUNDREDWEIGHT_HPP_INCLUDED
#define BOOST_UNIT_BASE_UNITS_US_HUNDREDWEIGHT_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/us/pound.hpp>
namespace boost {
namespace units {
namespace us {
//typedef scaled_base_unit<pound_base_unit, scale<10, static_rational<2> > > hundredweight_base_unit;
typedef scaled_base_unit<pound_base_unit, scale<100, static_rational<1> > > hundredweight_base_unit;
} // namespace us
template<>
struct base_unit_info<us::hundredweight_base_unit> {
static const char* name() { return("hundredweight (U.S.)"); }
static const char* symbol() { return("cwt"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNIT_BASE_UNITS_US_HUNDREDWEIGHT_HPP_INCLUDED

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_US_INCH_BASE_UNIT_HPP
#define BOOST_UNITS_US_INCH_BASE_UNIT_HPP
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/us/yard.hpp>
namespace boost {
namespace units {
namespace us {
typedef scaled_base_unit<yard_base_unit, scale<36, static_rational<-1> > > inch_base_unit;
} // namespace us
template<>
struct base_unit_info<us::inch_base_unit> {
static const char* name() { return("inch"); }
static const char* symbol() { return("in"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_US_INCH_BASE_UNIT_HPP

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_US_MIL_BASE_UNIT_HPP
#define BOOST_UNITS_US_MIL_BASE_UNIT_HPP
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/us/yard.hpp>
namespace boost {
namespace units {
namespace us {
typedef scaled_base_unit<yard_base_unit, scale<36000, static_rational<-1> > > mil_base_unit;
} // namespace us
template<>
struct base_unit_info<us::mil_base_unit> {
static const char* name() { return("mil"); }
static const char* symbol() { return("mil"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_US_MIL_BASE_UNIT_HPP

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_US_MILE_BASE_UNIT_HPP
#define BOOST_UNITS_US_MILE_BASE_UNIT_HPP
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/us/yard.hpp>
namespace boost {
namespace units {
namespace us {
typedef scaled_base_unit<yard_base_unit, scale<1760, static_rational<1> > > mile_base_unit;
} // namespace us
template<>
struct base_unit_info<us::mile_base_unit> {
static const char* name() { return("mile"); }
static const char* symbol() { return("mi"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_US_MILE_BASE_UNIT_HPP

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_BASE_UNITS_US_MINIM_HPP_INCLUDED
#define BOOST_UNITS_BASE_UNITS_US_MINIM_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/us/pint.hpp>
namespace boost {
namespace units {
namespace us {
typedef scaled_base_unit<pint_base_unit, scale<7680, static_rational<-1> > > minim_base_unit;
} // namespace us
template<>
struct base_unit_info<us::minim_base_unit> {
static const char* name() { return("minim (U.S.)"); }
static const char* symbol() { return("minim"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_BASE_UNITS_US_MINIM_HPP_INCLUDED

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_US_OUNCE_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_US_OUNCE_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/us/pound.hpp>
namespace boost {
namespace units {
namespace us {
typedef scaled_base_unit<pound_base_unit, scale<2, static_rational<-4> > > ounce_base_unit;
} // namespace us
template<>
struct base_unit_info<us::ounce_base_unit> {
static const char* name() { return("ounce"); }
static const char* symbol() { return("oz"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNIT_SYSTEMS_US_OUNCE_HPP_INCLUDED

View File

@@ -0,0 +1,28 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_BASE_UNITS_US_PINT_HPP_INCLUDED
#define BOOST_UNITS_BASE_UNITS_US_PINT_HPP_INCLUDED
#include <boost/units/config.hpp>
#include <boost/units/systems/si/volume.hpp>
#include <boost/units/conversion.hpp>
BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(us, pint, "pint (U.S.)", "pt", 0.4731765e-3, si::volume, -503);
#if BOOST_UNITS_HAS_BOOST_TYPEOF
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TYPE(boost::units::us::pint_base_unit)
#endif
#endif // BOOST_UNITS_BASE_UNITS_US_PINT_HPP_INCLUDED

View File

@@ -0,0 +1,32 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_SYSTEMS_US_POUND_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_US_POUND_HPP_INCLUDED
#include <string>
#include <boost/units/config.hpp>
#include <boost/units/base_unit.hpp>
#include <boost/units/physical_dimensions/mass.hpp>
#include <boost/units/base_units/cgs/gram.hpp>
#include <boost/units/conversion.hpp>
BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(us, pound, "pound", "lb", 453.59237, cgs::gram_base_unit, -502); // exact conversion
#if BOOST_UNITS_HAS_BOOST_TYPEOF
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TYPE(boost::units::us::pound_base_unit)
#endif
#endif // BOOST_UNIT_SYSTEMS_US_POUND_HPP_INCLUDED

View File

@@ -0,0 +1,32 @@
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
// unit/quantity manipulation and conversion
//
// Copyright (C) 2003-2009 Matthias Christian Schabel
// Copyright (C) 2007-2009 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)
#ifndef BOOST_UNIT_SYSTEMS_US_POUND_FORCE_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_US_POUND_FORCE_HPP_INCLUDED
#include <string>
#include <boost/units/config.hpp>
#include <boost/units/base_unit.hpp>
//#include <boost/units/physical_dimensions/mass.hpp>
#include <boost/units/systems/si/force.hpp>
#include <boost/units/conversion.hpp>
BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(us, pound_force, "pound-force", "lbf", 4.4482216152605, si::force, -600); // exact conversion
#if BOOST_UNITS_HAS_BOOST_TYPEOF
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TYPE(boost::units::us::pound_force_base_unit)
#endif
#endif // BOOST_UNIT_SYSTEMS_US_POUND_FORCE_HPP_INCLUDED

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_BASE_UNITS_US_QUART_HPP_INCLUDED
#define BOOST_UNITS_BASE_UNITS_US_QUART_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/us/pint.hpp>
namespace boost {
namespace units {
namespace us {
typedef scaled_base_unit<pint_base_unit, scale<2, static_rational<1> > > quart_base_unit;
} // namespace us
template<>
struct base_unit_info<us::quart_base_unit> {
static const char* name() { return("quart (U.S.)"); }
static const char* symbol() { return("qt"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_BASE_UNITS_US_QUART_HPP_INCLUDED

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_BASE_UNITS_US_TABLESPOON_HPP_INCLUDED
#define BOOST_UNITS_BASE_UNITS_US_TABLESPOON_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/us/pint.hpp>
namespace boost {
namespace units {
namespace us {
typedef scaled_base_unit<pint_base_unit, scale<2, static_rational<-5> > > tablespoon_base_unit;
} // namespace us
template<>
struct base_unit_info<us::tablespoon_base_unit> {
static const char* name() { return("tablespoon"); }
static const char* symbol() { return("tbsp"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_BASE_UNITS_US_TABLESPOON_HPP_INCLUDED

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_BASE_UNITS_US_TEASPOON_HPP_INCLUDED
#define BOOST_UNITS_BASE_UNITS_US_TEASPOON_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/us/pint.hpp>
namespace boost {
namespace units {
namespace us {
typedef scaled_base_unit<pint_base_unit, scale<96, static_rational<-1> > > teaspoon_base_unit;
} // namespace us
template<>
struct base_unit_info<us::teaspoon_base_unit> {
static const char* name() { return("teaspoon"); }
static const char* symbol() { return("tsp"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_BASE_UNITS_US_TEASPOON_HPP_INCLUDED

View File

@@ -0,0 +1,39 @@
// 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) 2007-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)
#ifndef BOOST_UNIT_BASE_UNITS_US_TON_HPP_INCLUDED
#define BOOST_UNIT_BASE_UNITS_US_TON_HPP_INCLUDED
#include <boost/units/scaled_base_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/base_units/us/pound.hpp>
namespace boost {
namespace units {
namespace us {
typedef scaled_base_unit<pound_base_unit, scale<2000, static_rational<1> > > ton_base_unit;
} // namespace us
template<>
struct base_unit_info<us::ton_base_unit> {
static const char* name() { return("short ton"); }
static const char* symbol() { return("t"); }
};
} // namespace units
} // namespace boost
#endif // BOOST_UNIT_BASE_UNITS_US_TON_HPP_INCLUDED

View File

@@ -0,0 +1,32 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_SYSTEMS_US_YARD_BASE_UNIT_HPP
#define BOOST_UNITS_SYSTEMS_US_YARD_BASE_UNIT_HPP
#include <string>
#include <boost/units/config.hpp>
#include <boost/units/base_unit.hpp>
#include <boost/units/physical_dimensions/length.hpp>
#include <boost/units/base_units/si/meter.hpp>
#include <boost/units/conversion.hpp>
BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(us, yard, "yard", "yd", 0.9144, si::meter_base_unit, -501); // exact conversion
#if BOOST_UNITS_HAS_BOOST_TYPEOF
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
BOOST_TYPEOF_REGISTER_TYPE(boost::units::us::yard_base_unit)
#endif
#endif // BOOST_UNITS_SYSTEMS_US_YARD_BASE_UNIT_HPP

676
test/external/boost/units/cmath.hpp vendored Normal file
View File

@@ -0,0 +1,676 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_CMATH_HPP
#define BOOST_UNITS_CMATH_HPP
#include <boost/config/no_tr1/cmath.hpp>
#include <cstdlib>
#include <boost/math/special_functions/fpclassify.hpp>
#include <boost/math/special_functions/hypot.hpp>
#include <boost/math/special_functions/next.hpp>
#include <boost/math/special_functions/round.hpp>
#include <boost/math/special_functions/sign.hpp>
#include <boost/units/dimensionless_quantity.hpp>
#include <boost/units/pow.hpp>
#include <boost/units/quantity.hpp>
#include <boost/units/detail/cmath_impl.hpp>
#include <boost/units/detail/dimensionless_unit.hpp>
#include <boost/units/systems/si/plane_angle.hpp>
/// \file
/// \brief Overloads of functions in \<cmath\> for quantities.
/// \details Only functions for which a dimensionally-correct result type
/// can be determined are overloaded.
/// All functions work with dimensionless quantities.
// BOOST_PREVENT_MACRO_SUBSTITUTION is needed on certain compilers that define
// some <cmath> functions as macros; it is used for all functions even though it
// isn't necessary -- I didn't want to think :)
//
// the form using namespace detail; return(f(x)); is used
// to enable ADL for UDTs.
namespace boost {
namespace units {
template<class Unit,class Y>
inline
bool
isfinite BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
{
using boost::math::isfinite;
return isfinite BOOST_PREVENT_MACRO_SUBSTITUTION (q.value());
}
template<class Unit,class Y>
inline
bool
isinf BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
{
using boost::math::isinf;
return isinf BOOST_PREVENT_MACRO_SUBSTITUTION (q.value());
}
template<class Unit,class Y>
inline
bool
isnan BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
{
using boost::math::isnan;
return isnan BOOST_PREVENT_MACRO_SUBSTITUTION (q.value());
}
template<class Unit,class Y>
inline
bool
isnormal BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
{
using boost::math::isnormal;
return isnormal BOOST_PREVENT_MACRO_SUBSTITUTION (q.value());
}
template<class Unit,class Y>
inline
bool
isgreater BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
const quantity<Unit,Y>& q2)
{
using namespace detail;
return isgreater BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value());
}
template<class Unit,class Y>
inline
bool
isgreaterequal BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
const quantity<Unit,Y>& q2)
{
using namespace detail;
return isgreaterequal BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value());
}
template<class Unit,class Y>
inline
bool
isless BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
const quantity<Unit,Y>& q2)
{
using namespace detail;
return isless BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value());
}
template<class Unit,class Y>
inline
bool
islessequal BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
const quantity<Unit,Y>& q2)
{
using namespace detail;
return islessequal BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value());
}
template<class Unit,class Y>
inline
bool
islessgreater BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
const quantity<Unit,Y>& q2)
{
using namespace detail;
return islessgreater BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value());
}
template<class Unit,class Y>
inline
bool
isunordered BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
const quantity<Unit,Y>& q2)
{
using namespace detail;
return isunordered BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value());
}
template<class Unit,class Y>
inline
quantity<Unit,Y>
abs BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
{
using std::abs;
typedef quantity<Unit,Y> quantity_type;
return quantity_type::from_value(abs BOOST_PREVENT_MACRO_SUBSTITUTION (q.value()));
}
template<class Unit,class Y>
inline
quantity<Unit,Y>
ceil BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
{
using std::ceil;
typedef quantity<Unit,Y> quantity_type;
return quantity_type::from_value(ceil BOOST_PREVENT_MACRO_SUBSTITUTION (q.value()));
}
template<class Unit,class Y>
inline
quantity<Unit,Y>
copysign BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
const quantity<Unit,Y>& q2)
{
using boost::math::copysign;
typedef quantity<Unit,Y> quantity_type;
return quantity_type::from_value(copysign BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value()));
}
template<class Unit,class Y>
inline
quantity<Unit,Y>
fabs BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
{
using std::fabs;
typedef quantity<Unit,Y> quantity_type;
return quantity_type::from_value(fabs BOOST_PREVENT_MACRO_SUBSTITUTION (q.value()));
}
template<class Unit,class Y>
inline
quantity<Unit,Y>
floor BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
{
using std::floor;
typedef quantity<Unit,Y> quantity_type;
return quantity_type::from_value(floor BOOST_PREVENT_MACRO_SUBSTITUTION (q.value()));
}
template<class Unit,class Y>
inline
quantity<Unit,Y>
fdim BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
const quantity<Unit,Y>& q2)
{
using namespace detail;
typedef quantity<Unit,Y> quantity_type;
return quantity_type::from_value(fdim BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value()));
}
#if 0
template<class Unit1,class Unit2,class Unit3,class Y>
inline
typename add_typeof_helper<
typename multiply_typeof_helper<quantity<Unit1,Y>,
quantity<Unit2,Y> >::type,
quantity<Unit3,Y> >::type
fma BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit1,Y>& q1,
const quantity<Unit2,Y>& q2,
const quantity<Unit3,Y>& q3)
{
using namespace detail;
typedef quantity<Unit1,Y> type1;
typedef quantity<Unit2,Y> type2;
typedef quantity<Unit3,Y> type3;
typedef typename multiply_typeof_helper<type1,type2>::type prod_type;
typedef typename add_typeof_helper<prod_type,type3>::type quantity_type;
return quantity_type::from_value(fma BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value(),q3.value()));
}
#endif
template<class Unit,class Y>
inline
quantity<Unit,Y>
fmax BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
const quantity<Unit,Y>& q2)
{
using namespace detail;
typedef quantity<Unit,Y> quantity_type;
return quantity_type::from_value(fmax BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value()));
}
template<class Unit,class Y>
inline
quantity<Unit,Y>
fmin BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
const quantity<Unit,Y>& q2)
{
using namespace detail;
typedef quantity<Unit,Y> quantity_type;
return quantity_type::from_value(fmin BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value()));
}
template<class Unit,class Y>
inline
int
fpclassify BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
{
using boost::math::fpclassify;
return fpclassify BOOST_PREVENT_MACRO_SUBSTITUTION (q.value());
}
template<class Unit,class Y>
inline
typename root_typeof_helper<
typename add_typeof_helper<
typename power_typeof_helper<quantity<Unit,Y>,
static_rational<2> >::type,
typename power_typeof_helper<quantity<Unit,Y>,
static_rational<2> >::type>::type,
static_rational<2> >::type
hypot BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,const quantity<Unit,Y>& q2)
{
using boost::math::hypot;
typedef quantity<Unit,Y> type1;
typedef typename power_typeof_helper<type1,static_rational<2> >::type pow_type;
typedef typename add_typeof_helper<pow_type,pow_type>::type add_type;
typedef typename root_typeof_helper<add_type,static_rational<2> >::type quantity_type;
return quantity_type::from_value(hypot BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value()));
}
// does ISO C++ support long long? g++ claims not
//template<class Unit,class Y>
//inline
//quantity<Unit,long long>
//llrint BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
//{
// using namespace detail;
//
// typedef quantity<Unit,long long> quantity_type;
//
// return quantity_type::from_value(llrint BOOST_PREVENT_MACRO_SUBSTITUTION (q.value()));
//}
// does ISO C++ support long long? g++ claims not
//template<class Unit,class Y>
//inline
//quantity<Unit,long long>
//llround BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
//{
// using namespace detail;
//
// typedef quantity<Unit,long long> quantity_type;
//
// return quantity_type::from_value(llround BOOST_PREVENT_MACRO_SUBSTITUTION (q.value()));
//}
#if 0
template<class Unit,class Y>
inline
quantity<Unit,Y>
nearbyint BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
{
using namespace detail;
typedef quantity<Unit,Y> quantity_type;
return quantity_type::from_value(nearbyint BOOST_PREVENT_MACRO_SUBSTITUTION (q.value()));
}
#endif
template<class Unit,class Y>
inline
quantity<Unit,Y> nextafter BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
const quantity<Unit,Y>& q2)
{
using boost::math::nextafter;
typedef quantity<Unit,Y> quantity_type;
return quantity_type::from_value(nextafter BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value()));
}
template<class Unit,class Y>
inline
quantity<Unit,Y> nexttoward BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
const quantity<Unit,Y>& q2)
{
// the only difference between nextafter and nexttowards is
// in the argument types. Since we are requiring identical
// argument types, there is no difference.
using boost::math::nextafter;
typedef quantity<Unit,Y> quantity_type;
return quantity_type::from_value(nextafter BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value()));
}
#if 0
template<class Unit,class Y>
inline
quantity<Unit,Y>
rint BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
{
using namespace detail;
typedef quantity<Unit,Y> quantity_type;
return quantity_type::from_value(rint BOOST_PREVENT_MACRO_SUBSTITUTION (q.value()));
}
#endif
template<class Unit,class Y>
inline
quantity<Unit,Y>
round BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
{
using boost::math::round;
typedef quantity<Unit,Y> quantity_type;
return quantity_type::from_value(round BOOST_PREVENT_MACRO_SUBSTITUTION (q.value()));
}
template<class Unit,class Y>
inline
int
signbit BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
{
using boost::math::signbit;
return signbit BOOST_PREVENT_MACRO_SUBSTITUTION (q.value());
}
template<class Unit,class Y>
inline
quantity<Unit,Y>
trunc BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
{
using namespace detail;
typedef quantity<Unit,Y> quantity_type;
return quantity_type::from_value(trunc BOOST_PREVENT_MACRO_SUBSTITUTION (q.value()));
}
template<class Unit,class Y>
inline
quantity<Unit, Y>
fmod(const quantity<Unit,Y>& q1, const quantity<Unit,Y>& q2)
{
using std::fmod;
typedef quantity<Unit,Y> quantity_type;
return quantity_type::from_value(fmod(q1.value(), q2.value()));
}
template<class Unit, class Y>
inline
quantity<Unit, Y>
modf(const quantity<Unit, Y>& q1, quantity<Unit, Y>* q2)
{
using std::modf;
typedef quantity<Unit,Y> quantity_type;
return quantity_type::from_value(modf(q1.value(), &quantity_cast<Y&>(*q2)));
}
template<class Unit, class Y, class Int>
inline
quantity<Unit, Y>
frexp(const quantity<Unit, Y>& q,Int* ex)
{
using std::frexp;
typedef quantity<Unit,Y> quantity_type;
return quantity_type::from_value(frexp(q.value(),ex));
}
/// For non-dimensionless quantities, integral and rational powers
/// and roots can be computed by @c pow<Ex> and @c root<Rt> respectively.
template<class S, class Y>
inline
quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>
pow(const quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>& q1,
const quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>& q2)
{
using std::pow;
typedef quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S),Y> quantity_type;
return quantity_type::from_value(pow(q1.value(), q2.value()));
}
template<class S, class Y>
inline
quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>
exp(const quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>& q)
{
using std::exp;
typedef quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y> quantity_type;
return quantity_type::from_value(exp(q.value()));
}
template<class Unit, class Y, class Int>
inline
quantity<Unit, Y>
ldexp(const quantity<Unit, Y>& q,const Int& ex)
{
using std::ldexp;
typedef quantity<Unit,Y> quantity_type;
return quantity_type::from_value(ldexp(q.value(), ex));
}
template<class S, class Y>
inline
quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>
log(const quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>& q)
{
using std::log;
typedef quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y> quantity_type;
return quantity_type::from_value(log(q.value()));
}
template<class S, class Y>
inline
quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>
log10(const quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>& q)
{
using std::log10;
typedef quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y> quantity_type;
return quantity_type::from_value(log10(q.value()));
}
template<class Unit,class Y>
inline
typename root_typeof_helper<
quantity<Unit,Y>,
static_rational<2>
>::type
sqrt(const quantity<Unit,Y>& q)
{
using std::sqrt;
typedef typename root_typeof_helper<
quantity<Unit,Y>,
static_rational<2>
>::type quantity_type;
return quantity_type::from_value(sqrt(q.value()));
}
} // namespace units
} // namespace boost
namespace boost {
namespace units {
// trig functions with si argument/return types
/// cos of theta in radians
template<class Y>
typename dimensionless_quantity<si::system,Y>::type
cos(const quantity<si::plane_angle,Y>& theta)
{
using std::cos;
return cos(theta.value());
}
/// sin of theta in radians
template<class Y>
typename dimensionless_quantity<si::system,Y>::type
sin(const quantity<si::plane_angle,Y>& theta)
{
using std::sin;
return sin(theta.value());
}
/// tan of theta in radians
template<class Y>
typename dimensionless_quantity<si::system,Y>::type
tan(const quantity<si::plane_angle,Y>& theta)
{
using std::tan;
return tan(theta.value());
}
/// cos of theta in other angular units
template<class System,class Y>
typename dimensionless_quantity<System,Y>::type
cos(const quantity<unit<plane_angle_dimension,System>,Y>& theta)
{
return cos(quantity<si::plane_angle,Y>(theta));
}
/// sin of theta in other angular units
template<class System,class Y>
typename dimensionless_quantity<System,Y>::type
sin(const quantity<unit<plane_angle_dimension,System>,Y>& theta)
{
return sin(quantity<si::plane_angle,Y>(theta));
}
/// tan of theta in other angular units
template<class System,class Y>
typename dimensionless_quantity<System,Y>::type
tan(const quantity<unit<plane_angle_dimension,System>,Y>& theta)
{
return tan(quantity<si::plane_angle,Y>(theta));
}
/// acos of dimensionless quantity returning angle in same system
template<class Y,class System>
quantity<unit<plane_angle_dimension, homogeneous_system<System> >,Y>
acos(const quantity<unit<dimensionless_type, homogeneous_system<System> >,Y>& val)
{
using std::acos;
return quantity<unit<plane_angle_dimension, homogeneous_system<System> >,Y>(acos(val.value())*si::radians);
}
/// acos of dimensionless quantity returning angle in radians
template<class Y>
quantity<angle::radian_base_unit::unit_type,Y>
acos(const quantity<unit<dimensionless_type, heterogeneous_dimensionless_system>,Y>& val)
{
using std::acos;
return quantity<angle::radian_base_unit::unit_type,Y>::from_value(acos(val.value()));
}
/// asin of dimensionless quantity returning angle in same system
template<class Y,class System>
quantity<unit<plane_angle_dimension, homogeneous_system<System> >,Y>
asin(const quantity<unit<dimensionless_type, homogeneous_system<System> >,Y>& val)
{
using std::asin;
return quantity<unit<plane_angle_dimension, homogeneous_system<System> >,Y>(asin(val.value())*si::radians);
}
/// asin of dimensionless quantity returning angle in radians
template<class Y>
quantity<angle::radian_base_unit::unit_type,Y>
asin(const quantity<unit<dimensionless_type, heterogeneous_dimensionless_system>,Y>& val)
{
using std::asin;
return quantity<angle::radian_base_unit::unit_type,Y>::from_value(asin(val.value()));
}
/// atan of dimensionless quantity returning angle in same system
template<class Y,class System>
quantity<unit<plane_angle_dimension, homogeneous_system<System> >,Y>
atan(const quantity<unit<dimensionless_type, homogeneous_system<System> >, Y>& val)
{
using std::atan;
return quantity<unit<plane_angle_dimension, homogeneous_system<System> >,Y>(atan(val.value())*si::radians);
}
/// atan of dimensionless quantity returning angle in radians
template<class Y>
quantity<angle::radian_base_unit::unit_type,Y>
atan(const quantity<unit<dimensionless_type, heterogeneous_dimensionless_system>, Y>& val)
{
using std::atan;
return quantity<angle::radian_base_unit::unit_type,Y>::from_value(atan(val.value()));
}
/// atan2 of @c value_type returning angle in radians
template<class Y, class Dimension, class System>
quantity<unit<plane_angle_dimension, homogeneous_system<System> >, Y>
atan2(const quantity<unit<Dimension, homogeneous_system<System> >, Y>& y,
const quantity<unit<Dimension, homogeneous_system<System> >, Y>& x)
{
using std::atan2;
return quantity<unit<plane_angle_dimension, homogeneous_system<System> >, Y>(atan2(y.value(),x.value())*si::radians);
}
/// atan2 of @c value_type returning angle in radians
template<class Y, class Dimension, class System>
quantity<angle::radian_base_unit::unit_type,Y>
atan2(const quantity<unit<Dimension, heterogeneous_system<System> >, Y>& y,
const quantity<unit<Dimension, heterogeneous_system<System> >, Y>& x)
{
using std::atan2;
return quantity<angle::radian_base_unit::unit_type,Y>::from_value(atan2(y.value(),x.value()));
}
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_CMATH_HPP

105
test/external/boost/units/config.hpp vendored Normal file
View File

@@ -0,0 +1,105 @@
// 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)
#ifndef BOOST_UNITS_CONFIG_HPP
#define BOOST_UNITS_CONFIG_HPP
#include <boost/config.hpp>
#include <boost/version.hpp>
#ifndef BOOST_UNITS_HAS_BOOST_TYPEOF
#if (BOOST_VERSION >= 103400)
///INTERNAL ONLY
#define BOOST_UNITS_HAS_BOOST_TYPEOF 1
#else
///INTERNAL ONLY
#define BOOST_UNITS_HAS_BOOST_TYPEOF 0
#endif
#endif
#if (BOOST_UNITS_HAS_BOOST_TYPEOF)
#include <boost/typeof/typeof.hpp>
///INTERNAL ONLY
#define BOOST_UNITS_HAS_TYPEOF 1
#else
#if (__GNUC__ && __cplusplus && __GNUC__ >= 3)
///INTERNAL ONLY
#define BOOST_UNITS_HAS_TYPEOF 1
///INTERNAL ONLY
#define BOOST_UNITS_HAS_GNU_TYPEOF 1
#elif defined(__MWERKS__)
///INTERNAL ONLY
#define BOOST_UNITS_HAS_TYPEOF 1
///INTERNAL ONLY
#define BOOST_UNITS_HAS_MWERKS_TYPEOF 1
#else
///INTERNAL ONLY
#define BOOST_UNITS_HAS_TYPEOF 0
#endif
#endif
// uncomment this to test without typeof support at all
//#undef BOOST_UNITS_HAS_TYPEOF
//#define BOOST_UNITS_HAS_TYPEOF 0
#ifndef BOOST_UNITS_NO_COMPILER_CHECK
#ifdef BOOST_NO_MEMBER_TEMPLATES
#error Boost.Units requires member template
#endif
#ifdef BOOST_NO_MEMBER_TEMPLATE_KEYWORD
#error Boost.Units requires member template keyword
#endif
#ifdef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
#error Boost.Units requires in class member initialization
#endif
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
#error Boost.Units requires function template partial ordering
#endif
#ifdef BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
#error Boost.Units requires explicit function template arguments
#endif
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
#error Boost.Units requires partial specialization
#endif
#endif
#ifdef BOOST_UNITS_REQUIRE_LAYOUT_COMPATIBILITY
///INTERNAL ONLY
#define BOOST_UNITS_CHECK_LAYOUT_COMPATIBILITY(a, b) BOOST_STATIC_ASSERT((sizeof(a) == sizeof(b)))
#else
///INTERNAL ONLY
#define BOOST_UNITS_CHECK_LAYOUT_COMPATIBILITY(a, b) ((void)0)
#endif
#ifdef BOOST_UNITS_DOXYGEN
/// If defined will trigger a static assertion if quantity<Unit, T>
/// is not layout compatible with T
#define BOOST_UNITS_REQUIRE_LAYOUT_COMPATIBILITY
/// If defined will disable a preprocessor check that the
/// compiler is able to handle the library.
#define BOOST_UNITS_NO_COMPILER_CHECK
/// Enable checking to verify that a homogeneous system
/// is actually capable of representing all the dimensions
/// that it is used with. Off by default.
#define BOOST_UNITS_CHECK_HOMOGENEOUS_UNITS
#endif
#endif

183
test/external/boost/units/conversion.hpp vendored Normal file
View File

@@ -0,0 +1,183 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_CONVERSION_HPP
#define BOOST_UNITS_CONVERSION_HPP
/// \file
/// \brief Template for defining conversions between quantities.
#include <boost/units/detail/conversion_impl.hpp>
namespace boost {
namespace units {
template<class From, class To>
struct conversion_helper;
#ifdef BOOST_UNITS_DOXYGEN
/// Template for defining conversions between
/// quantities. This template should be specialized
/// for every quantity that allows conversions.
/// For example, if you have a two units
/// called pair and dozen you would write
/// @code
/// namespace boost {
/// namespace units {
/// template<class T0, class T1>
/// struct conversion_helper<quantity<dozen, T0>, quantity<pair, T1> >
/// {
/// static quantity<pair, T1> convert(const quantity<dozen, T0>& source)
/// {
/// return(quantity<pair, T1>::from_value(6 * source.value()));
/// }
/// };
/// }
/// }
/// @endcode
///
/// In most cases, the predefined specializations for @c unit
/// and @c absolute should be sufficient, so users should rarely
/// need to use this.
template<class From, class To>
struct conversion_helper
{
static To convert(const From&);
};
#endif
/// Defines the conversion factor from a base unit to any unit
/// or to another base unit with the correct dimensions. Uses
/// of this macro must appear at global scope.
/// If the destination unit is a base unit or a unit that contains
/// only one base unit which is raised to the first power (e.g. feet->meters)
/// the reverse (meters->feet in this example) need not be defined explicitly.
#define BOOST_UNITS_DEFINE_CONVERSION_FACTOR(Source, Destination, type_, value_) \
namespace boost { \
namespace units { \
template<> \
struct select_base_unit_converter< \
unscale<Source>::type, \
unscale<reduce_unit<Destination::unit_type>::type>::type \
> \
{ \
typedef Source source_type; \
typedef reduce_unit<Destination::unit_type>::type destination_type; \
}; \
template<> \
struct base_unit_converter<Source, reduce_unit<Destination::unit_type>::type> \
{ \
static const bool is_defined = true; \
typedef type_ type; \
static type value() { return(value_); } \
}; \
} \
} \
void boost_units_require_semicolon()
/// Defines the conversion factor from a base unit to any other base
/// unit with the same dimensions. Params should be a Boost.Preprocessor
/// Seq of template parameters, such as (class T1)(class T2)
/// All uses of must appear at global scope. The reverse conversion will
/// be defined automatically. This macro is a little dangerous, because,
/// unlike the non-template form, it will silently fail if either base
/// unit is scaled. This is probably not an issue if both the source
/// and destination types depend on the template parameters, but be aware
/// that a generic conversion to kilograms is not going to work.
#define BOOST_UNITS_DEFINE_CONVERSION_FACTOR_TEMPLATE(Params, Source, Destination, type_, value_) \
namespace boost { \
namespace units { \
template<BOOST_PP_SEQ_ENUM(Params)> \
struct base_unit_converter< \
Source, \
BOOST_UNITS_MAKE_HETEROGENEOUS_UNIT(Destination, typename Source::dimension_type)\
> \
{ \
static const bool is_defined = true; \
typedef type_ type; \
static type value() { return(value_); } \
}; \
} \
} \
void boost_units_require_semicolon()
/// Specifies the default conversion to be applied when
/// no direct conversion is available.
/// Source is a base unit. Dest is any unit with the
/// same dimensions.
#define BOOST_UNITS_DEFAULT_CONVERSION(Source, Dest) \
namespace boost { \
namespace units { \
template<> \
struct unscaled_get_default_conversion<unscale<Source>::type> \
{ \
static const bool is_defined = true; \
typedef Dest::unit_type type; \
}; \
} \
} \
void boost_units_require_semicolon()
/// Specifies the default conversion to be applied when
/// no direct conversion is available.
/// Params is a PP Sequence of template arguments.
/// Source is a base unit. Dest is any unit with the
/// same dimensions. The source must not be a scaled
/// base unit.
#define BOOST_UNITS_DEFAULT_CONVERSION_TEMPLATE(Params, Source, Dest) \
namespace boost { \
namespace units { \
template<BOOST_PP_SEQ_ENUM(Params)> \
struct unscaled_get_default_conversion<Source> \
{ \
static const bool is_defined = true; \
typedef typename Dest::unit_type type; \
}; \
} \
} \
void boost_units_require_semicolon()
/// INTERNAL ONLY
/// Users should not create their units in namespace boost::units.
/// If we want to make this public it needs to allow better control over
/// the namespaces. --SJW.
/// template that defines a base_unit and conversion to another dimensionally-consistent unit
#define BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(namespace_, name_, name_string_, symbol_string_, factor, unit, id)\
namespace boost { \
namespace units { \
namespace namespace_ { \
struct name_ ## _base_unit \
: base_unit<name_ ## _base_unit, unit::dimension_type, id> { \
static const char* name() { return(name_string_); } \
static const char* symbol() { return(symbol_string_); }; \
}; \
} \
} \
} \
BOOST_UNITS_DEFINE_CONVERSION_FACTOR(namespace_::name_ ## _base_unit, unit, double, factor); \
BOOST_UNITS_DEFAULT_CONVERSION(namespace_::name_ ## _base_unit, unit)
/// Find the conversion factor between two units.
template<class FromUnit,class ToUnit>
inline
typename detail::conversion_factor_helper<FromUnit, ToUnit>::type
conversion_factor(const FromUnit&,const ToUnit&)
{
return(detail::conversion_factor_helper<FromUnit, ToUnit>::value());
}
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_CONVERSION_HPP

View File

@@ -0,0 +1,208 @@
// 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)
#ifndef BOOST_UNITS_DERIVED_DIMENSION_HPP
#define BOOST_UNITS_DERIVED_DIMENSION_HPP
#include <boost/units/dim.hpp>
#include <boost/units/dimension.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/units_fwd.hpp>
#include <boost/units/detail/dimension_list.hpp>
namespace boost {
namespace units {
/// A utility class for defining composite dimensions with integer powers.
template<class DT1 = dimensionless_type,long E1 = 0,
class DT2 = dimensionless_type,long E2 = 0,
class DT3 = dimensionless_type,long E3 = 0,
class DT4 = dimensionless_type,long E4 = 0,
class DT5 = dimensionless_type,long E5 = 0,
class DT6 = dimensionless_type,long E6 = 0,
class DT7 = dimensionless_type,long E7 = 0,
class DT8 = dimensionless_type,long E8 = 0>
struct derived_dimension
{
#ifdef BOOST_UNITS_DOXYGEN
typedef detail::unspecified type;
#else
typedef typename
make_dimension_list< list< dim< DT1,static_rational<E1> >,
list< dim< DT2,static_rational<E2> >,
list< dim< DT3,static_rational<E3> >,
list< dim< DT4,static_rational<E4> >,
list< dim< DT5,static_rational<E5> >,
list< dim< DT6,static_rational<E6> >,
list< dim< DT7,static_rational<E7> >,
list< dim< DT8,static_rational<E8> >, dimensionless_type > > > > > > > > >::type type;
#endif
};
/// INTERNAL ONLY
template<class DT1,long E1>
struct derived_dimension<
DT1, E1,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0>
{
typedef typename
make_dimension_list< list< dim< DT1,static_rational<E1> >, dimensionless_type > >::type type;
};
/// INTERNAL ONLY
template<class DT1,long E1,
class DT2,long E2>
struct derived_dimension<
DT1, E1,
DT2, E2,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0>
{
typedef typename
make_dimension_list< list< dim< DT1,static_rational<E1> >,
list< dim< DT2,static_rational<E2> >, dimensionless_type > > >::type type;
};
/// INTERNAL ONLY
template<class DT1,long E1,
class DT2,long E2,
class DT3,long E3>
struct derived_dimension<
DT1, E1,
DT2, E2,
DT3, E3,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0>
{
typedef typename
make_dimension_list< list< dim< DT1,static_rational<E1> >,
list< dim< DT2,static_rational<E2> >,
list< dim< DT3,static_rational<E3> >, dimensionless_type > > > >::type type;
};
/// INTERNAL ONLY
template<class DT1,long E1,
class DT2,long E2,
class DT3,long E3,
class DT4,long E4>
struct derived_dimension<
DT1, E1,
DT2, E2,
DT3, E3,
DT4, E4,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0>
{
typedef typename
make_dimension_list< list< dim< DT1,static_rational<E1> >,
list< dim< DT2,static_rational<E2> >,
list< dim< DT3,static_rational<E3> >,
list< dim< DT4,static_rational<E4> >, dimensionless_type > > > > >::type type;
};
/// INTERNAL ONLY
template<class DT1,long E1,
class DT2,long E2,
class DT3,long E3,
class DT4,long E4,
class DT5,long E5>
struct derived_dimension<
DT1, E1,
DT2, E2,
DT3, E3,
DT4, E4,
DT5, E5,
dimensionless_type,0,
dimensionless_type,0,
dimensionless_type,0>
{
typedef typename
make_dimension_list< list< dim< DT1,static_rational<E1> >,
list< dim< DT2,static_rational<E2> >,
list< dim< DT3,static_rational<E3> >,
list< dim< DT4,static_rational<E4> >,
list< dim< DT5,static_rational<E5> >, dimensionless_type > > > > > >::type type;
};
/// INTERNAL ONLY
template<class DT1,long E1,
class DT2,long E2,
class DT3,long E3,
class DT4,long E4,
class DT5,long E5,
class DT6,long E6>
struct derived_dimension<
DT1, E1,
DT2, E2,
DT3, E3,
DT4, E4,
DT5, E5,
DT6, E6,
dimensionless_type,0,
dimensionless_type,0>
{
typedef typename
make_dimension_list< list< dim< DT1,static_rational<E1> >,
list< dim< DT2,static_rational<E2> >,
list< dim< DT3,static_rational<E3> >,
list< dim< DT4,static_rational<E4> >,
list< dim< DT5,static_rational<E5> >,
list< dim< DT6,static_rational<E6> >, dimensionless_type > > > > > > >::type type;
};
/// INTERNAL ONLY
template<class DT1,long E1,
class DT2,long E2,
class DT3,long E3,
class DT4,long E4,
class DT5,long E5,
class DT6,long E6,
class DT7,long E7>
struct derived_dimension<
DT1, E1,
DT2, E2,
DT3, E3,
DT4, E4,
DT5, E5,
DT6, E6,
DT7, E7,
dimensionless_type,0>
{
typedef typename
make_dimension_list< list< dim< DT1,static_rational<E1> >,
list< dim< DT2,static_rational<E2> >,
list< dim< DT3,static_rational<E3> >,
list< dim< DT4,static_rational<E4> >,
list< dim< DT5,static_rational<E5> >,
list< dim< DT6,static_rational<E6> >,
list< dim< DT7,static_rational<E7> >, dimensionless_type > > > > > > > >::type type;
};
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_DERIVED_DIMENSION_HPP

View File

@@ -0,0 +1,104 @@
// 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)
#ifndef BOOST_UNITS_ABSOLUTE_IMPL_HPP
#define BOOST_UNITS_ABSOLUTE_IMPL_HPP
#include <iosfwd>
#include <boost/units/config.hpp>
#include <boost/units/conversion.hpp>
#include <boost/units/heterogeneous_system.hpp>
#include <boost/units/units_fwd.hpp>
namespace boost {
namespace units {
/// INTERNAL ONLY
template<class D, class S>
struct reduce_unit<absolute<unit<D, S> > >
{
typedef absolute<typename reduce_unit<unit<D, S> >::type> type;
};
namespace detail {
struct undefined_affine_conversion_base {
static const bool is_defined = false;
};
} // namespace detail
/// INTERNAL ONLY
template<class From, class To>
struct affine_conversion_helper : detail::undefined_affine_conversion_base { };
namespace detail {
template<bool IsDefined, bool ReverseIsDefined>
struct affine_conversion_impl;
template<bool ReverseIsDefined>
struct affine_conversion_impl<true, ReverseIsDefined>
{
template<class Unit1, class Unit2, class T0, class T1>
struct apply {
static T1 value(const T0& t0)
{
return(
t0 *
conversion_factor(Unit1(), Unit2()) +
affine_conversion_helper<typename reduce_unit<Unit1>::type, typename reduce_unit<Unit2>::type>::value());
}
};
};
template<>
struct affine_conversion_impl<false, true>
{
template<class Unit1, class Unit2, class T0, class T1>
struct apply
{
static T1 value(const T0& t0)
{
return(
(t0 - affine_conversion_helper<typename reduce_unit<Unit2>::type, typename reduce_unit<Unit1>::type>::value()) *
conversion_factor(Unit1(), Unit2()));
}
};
};
} // namespace detail
/// INTERNAL ONLY
template<class Unit1, class T1, class Unit2, class T2>
struct conversion_helper<quantity<absolute<Unit1>, T1>, quantity<absolute<Unit2>, T2> >
{
typedef quantity<absolute<Unit1>, T1> from_quantity_type;
typedef quantity<absolute<Unit2>, T2> to_quantity_type;
static to_quantity_type convert(const from_quantity_type& source)
{
return(
to_quantity_type::from_value(
detail::affine_conversion_impl<
affine_conversion_helper<typename reduce_unit<Unit1>::type, typename reduce_unit<Unit2>::type>::is_defined,
affine_conversion_helper<typename reduce_unit<Unit2>::type, typename reduce_unit<Unit1>::type>::is_defined
>::template apply<Unit1, Unit2, T1, T2>::value(source.value())
)
);
}
};
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_ABSOLUTE_IMPL_HPP

View File

@@ -0,0 +1,154 @@
// 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)
#ifndef BOOST_UNITS_CMATH_IMPL_HPP
#define BOOST_UNITS_CMATH_IMPL_HPP
#include <boost/config.hpp>
#include <boost/math/special_functions/fpclassify.hpp>
namespace boost {
namespace units {
namespace detail {
template<class Y>
inline bool isgreater BOOST_PREVENT_MACRO_SUBSTITUTION(const Y& v1,const Y& v2)
{
if((boost::math::isnan)(v1) || (boost::math::isnan)(v2)) return false;
else return v1 > v2;
}
template<class Y>
inline bool isgreaterequal BOOST_PREVENT_MACRO_SUBSTITUTION(const Y& v1,const Y& v2)
{
if((boost::math::isnan)(v1) || (boost::math::isnan)(v2)) return false;
else return v1 >= v2;
}
template<class Y>
inline bool isless BOOST_PREVENT_MACRO_SUBSTITUTION(const Y& v1,const Y& v2)
{
if((boost::math::isnan)(v1) || (boost::math::isnan)(v2)) return false;
else return v1 < v2;
}
template<class Y>
inline bool islessequal BOOST_PREVENT_MACRO_SUBSTITUTION(const Y& v1,const Y& v2)
{
if((boost::math::isnan)(v1) || (boost::math::isnan)(v2)) return false;
else return v1 <= v2;
}
template<class Y>
inline bool islessgreater BOOST_PREVENT_MACRO_SUBSTITUTION(const Y& v1,const Y& v2)
{
if((boost::math::isnan)(v1) || (boost::math::isnan)(v2)) return false;
else return v1 < v2 || v1 > v2;
}
template<class Y>
inline bool isunordered BOOST_PREVENT_MACRO_SUBSTITUTION(const Y& v1,const Y& v2)
{
return (boost::math::isnan)(v1) || (boost::math::isnan)(v2);
}
template<class Y>
inline Y fdim BOOST_PREVENT_MACRO_SUBSTITUTION(const Y& v1,const Y& v2)
{
if((boost::math::isnan)(v1)) return v1;
else if((boost::math::isnan)(v2)) return v2;
else if(v1 > v2) return(v1 - v2);
else return(Y(0));
}
#if 0
template<class T>
struct fma_issue_warning {
enum { value = false };
};
template<class Y>
inline Y fma(const Y& v1,const Y& v2,const Y& v3)
{
//this implementation does *not* meet the
//requirement of infinite intermediate precision
BOOST_STATIC_WARNING((fma_issue_warning<Y>::value));
return v1 * v2 + v3;
}
#endif
template<class Y>
inline Y fmax BOOST_PREVENT_MACRO_SUBSTITUTION(const Y& v1,const Y& v2)
{
if((boost::math::isnan)(v1)) return(v2);
else if((boost::math::isnan)(v2)) return(v1);
else if(v1 > v2) return(v1);
else return(v2);
}
template<class Y>
inline Y fmin BOOST_PREVENT_MACRO_SUBSTITUTION(const Y& v1,const Y& v2)
{
if((boost::math::isnan)(v1)) return(v2);
else if((boost::math::isnan)(v2)) return(v1);
else if(v1 < v2) return(v1);
else return(v2);
}
//template<class Y>
//inline long long llrint(const Y& val)
//{
// return static_cast<long long>(rint(val));
//}
//
//template<class Y>
//inline long long llround(const Y& val)
//{
// return static_cast<long long>(round(val));
//}
#if 0
template<class Y>
inline Y nearbyint(const Y& val)
{
//this is not really correct.
//the result should be according to the
//current rounding mode.
using boost::math::round;
return round(val);
}
template<class Y>
inline Y rint(const Y& val)
{
//I don't feel like trying to figure out
//how to raise a floating pointer exception
return nearbyint(val);
}
#endif
template<class Y>
inline Y trunc BOOST_PREVENT_MACRO_SUBSTITUTION(const Y& val)
{
if(val > 0) return std::floor(val);
else if(val < 0) return std::ceil(val);
else return val;
}
}
}
}
#endif // BOOST_UNITS_CMATH_IMPL_HPP

View File

@@ -0,0 +1,458 @@
// 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) 2007-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)
#ifndef BOOST_UNITS_DETAIL_CONVERSION_IMPL_HPP
#define BOOST_UNITS_DETAIL_CONVERSION_IMPL_HPP
#include <boost/mpl/bool.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/divides.hpp>
#include <boost/preprocessor/seq/enum.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/units/heterogeneous_system.hpp>
#include <boost/units/homogeneous_system.hpp>
#include <boost/units/reduce_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/units_fwd.hpp>
#include <boost/units/detail/dimension_list.hpp>
#include <boost/units/detail/heterogeneous_conversion.hpp>
#include <boost/units/detail/one.hpp>
#include <boost/units/detail/static_rational_power.hpp>
#include <boost/units/detail/unscale.hpp>
#include <boost/units/units_fwd.hpp>
namespace boost {
namespace units {
namespace detail {
template<class Source, class Dest>
struct conversion_factor_helper;
template<class Source, class Dest>
struct call_base_unit_converter;
}
/// INTERNAL ONLY
struct undefined_base_unit_converter_base {
static const bool is_defined = false;
};
/// INTERNAL ONLY
struct no_default_conversion {
static const bool is_defined = false;
};
/// INTERNAL ONLY
template<class BaseUnit>
struct unscaled_get_default_conversion : no_default_conversion { };
/// INTERNAL ONLY
template<bool is_defined>
struct unscaled_get_default_conversion_impl;
/// INTERNAL ONLY
template<>
struct unscaled_get_default_conversion_impl<true>
{
template<class T>
struct apply
{
typedef typename unscaled_get_default_conversion<typename unscale<T>::type>::type type;
};
};
/// INTERNAL ONLY
template<>
struct unscaled_get_default_conversion_impl<false>
{
template<class T>
struct apply
{
typedef typename T::unit_type type;
};
};
/// INTERNAL ONLY
template<class BaseUnit>
struct get_default_conversion
{
typedef typename unscaled_get_default_conversion_impl<
unscaled_get_default_conversion<typename unscale<BaseUnit>::type>::is_defined
>::template apply<BaseUnit>::type type;
};
/// INTERNAL ONLY
template<class Source, class Destination>
struct select_base_unit_converter
{
typedef Source source_type;
typedef Destination destination_type;
};
/// INTERNAL ONLY
template<class Source, class Dest>
struct base_unit_converter_base : undefined_base_unit_converter_base {
};
/// INTERNAL ONLY
template<class Source>
struct base_unit_converter_base<Source, BOOST_UNITS_MAKE_HETEROGENEOUS_UNIT(Source, typename Source::dimension_type)>
{
static const bool is_defined = true;
typedef one type;
static type value() {
one result;
return(result);
}
};
/// INTERNAL ONLY
template<class Source, class Dest>
struct base_unit_converter : base_unit_converter_base<Source, Dest> { };
namespace detail {
template<class Source, class Dest>
struct do_call_base_unit_converter {
typedef select_base_unit_converter<typename unscale<Source>::type, typename unscale<Dest>::type> selector;
typedef typename selector::source_type source_type;
typedef typename selector::destination_type destination_type;
typedef base_unit_converter<source_type, destination_type> converter;
typedef typename mpl::divides<typename get_scale_list<Source>::type, typename get_scale_list<source_type>::type>::type source_factor;
typedef typename mpl::divides<typename get_scale_list<Dest>::type, typename get_scale_list<destination_type>::type>::type destination_factor;
typedef typename mpl::divides<source_factor, destination_factor>::type factor;
typedef eval_scale_list<factor> eval_factor;
typedef typename multiply_typeof_helper<typename converter::type, typename eval_factor::type>::type type;
static type value()
{
return(converter::value() * eval_factor::value());
}
};
template<bool forward_is_defined, bool reverse_is_defined>
struct call_base_unit_converter_base_unit_impl;
template<>
struct call_base_unit_converter_base_unit_impl<true, true>
{
template<class Source, class Dest>
struct apply
: do_call_base_unit_converter<Source, typename Dest::unit_type>
{
};
};
template<>
struct call_base_unit_converter_base_unit_impl<true, false>
{
template<class Source, class Dest>
struct apply
: do_call_base_unit_converter<Source, typename Dest::unit_type>
{
};
};
template<>
struct call_base_unit_converter_base_unit_impl<false, true>
{
template<class Source, class Dest>
struct apply
{
typedef do_call_base_unit_converter<Dest, typename Source::unit_type> converter;
typedef typename divide_typeof_helper<one, typename converter::type>::type type;
static type value() {
one numerator;
return(numerator / converter::value());
}
};
};
template<>
struct call_base_unit_converter_base_unit_impl<false, false>
{
template<class Source, class Dest>
struct apply
{
typedef typename reduce_unit<typename get_default_conversion<Source>::type>::type new_source;
typedef typename reduce_unit<typename get_default_conversion<Dest>::type>::type new_dest;
typedef call_base_unit_converter<Source, new_source> start;
typedef detail::conversion_factor_helper<
new_source,
new_dest
> conversion;
typedef call_base_unit_converter<Dest, new_dest> end;
typedef typename divide_typeof_helper<
typename multiply_typeof_helper<
typename start::type,
typename conversion::type
>::type,
typename end::type
>::type type;
static type value() {
return(start::value() * conversion::value() / end::value());
}
};
};
template<int N>
struct get_default_conversion_impl
{
template<class Begin>
struct apply
{
typedef typename Begin::item source_pair;
typedef typename source_pair::value_type exponent;
typedef typename source_pair::tag_type source;
typedef typename reduce_unit<typename get_default_conversion<source>::type>::type new_source;
typedef typename get_default_conversion_impl<N-1>::template apply<typename Begin::next> next_iteration;
typedef typename multiply_typeof_helper<typename power_typeof_helper<new_source, exponent>::type, typename next_iteration::unit_type>::type unit_type;
typedef call_base_unit_converter<source, new_source> conversion;
typedef typename multiply_typeof_helper<typename conversion::type, typename next_iteration::type>::type type;
static type value() {
return(static_rational_power<exponent>(conversion::value()) * next_iteration::value());
}
};
};
template<>
struct get_default_conversion_impl<0>
{
template<class Begin>
struct apply
{
typedef unit<dimensionless_type, heterogeneous_system<heterogeneous_system_impl<dimensionless_type, dimensionless_type, no_scale> > > unit_type;
typedef one type;
static one value() {
one result;
return(result);
}
};
};
template<bool is_defined>
struct call_base_unit_converter_impl;
template<>
struct call_base_unit_converter_impl<true>
{
template<class Source, class Dest>
struct apply
: do_call_base_unit_converter<Source, Dest>
{
};
};
template<>
struct call_base_unit_converter_impl<false>
{
template<class Source, class Dest>
struct apply {
typedef typename reduce_unit<typename get_default_conversion<Source>::type>::type new_source;
typedef typename Dest::system_type::type system_list;
typedef typename get_default_conversion_impl<system_list::size::value>::template apply<system_list> impl;
typedef typename impl::unit_type new_dest;
typedef call_base_unit_converter<Source, new_source> start;
typedef conversion_factor_helper<new_source, new_dest> conversion;
typedef typename divide_typeof_helper<
typename multiply_typeof_helper<
typename start::type,
typename conversion::type
>::type,
typename impl::type
>::type type;
static type value() {
return(start::value() * conversion::value() / impl::value());
}
};
};
#define BOOST_UNITS_DETAIL_BASE_UNIT_CONVERTER_IS_DEFINED(Source, Dest)\
base_unit_converter<\
typename select_base_unit_converter<typename unscale<Source>::type, typename unscale<Dest>::type>::source_type,\
typename select_base_unit_converter<typename unscale<Source>::type, typename unscale<Dest>::type>::destination_type\
>::is_defined
template<class Source, class Dest>
struct call_base_unit_converter : call_base_unit_converter_impl<BOOST_UNITS_DETAIL_BASE_UNIT_CONVERTER_IS_DEFINED(Source, Dest)>::template apply<Source, Dest>
{
};
template<class Source, class Dest>
struct call_base_unit_converter<Source, BOOST_UNITS_MAKE_HETEROGENEOUS_UNIT(Dest, typename Source::dimension_type)> :
call_base_unit_converter_base_unit_impl<
BOOST_UNITS_DETAIL_BASE_UNIT_CONVERTER_IS_DEFINED(Source, typename Dest::unit_type),
BOOST_UNITS_DETAIL_BASE_UNIT_CONVERTER_IS_DEFINED(Dest, typename Source::unit_type)
>::template apply<Source, Dest>
{
};
template<int N>
struct conversion_impl
{
template<class Begin, class DestinationSystem>
struct apply
{
typedef typename conversion_impl<N-1>::template apply<
typename Begin::next,
DestinationSystem
> next_iteration;
typedef typename Begin::item unit_pair;
typedef typename unit_pair::tag_type unit;
typedef typename unit::dimension_type dimensions;
typedef typename reduce_unit<units::unit<dimensions, DestinationSystem> >::type reduced_unit;
typedef detail::call_base_unit_converter<unit, reduced_unit> converter;
typedef typename multiply_typeof_helper<typename converter::type, typename next_iteration::type>::type type;
static type value() { return(static_rational_power<typename unit_pair::value_type>(converter::value()) * next_iteration::value()); }
};
};
template<>
struct conversion_impl<0>
{
template<class Begin, class DestinationSystem>
struct apply
{
typedef one type;
static type value() { one result; return(result); }
};
};
} // namespace detail
/// forward to conversion_factor (intentionally allowing ADL)
/// INTERNAL ONLY
template<class Unit1, class T1, class Unit2, class T2>
struct conversion_helper<quantity<Unit1, T1>, quantity<Unit2, T2> >
{
/// INTERNAL ONLY
typedef quantity<Unit2, T2> destination_type;
static destination_type convert(const quantity<Unit1, T1>& source)
{
Unit1 u1;
Unit2 u2;
return(destination_type::from_value(static_cast<T2>(source.value() * conversion_factor(u1, u2))));
}
};
namespace detail {
template<class Source, class Dest>
struct conversion_factor_helper;
template<class D, class L1, class L2>
struct conversion_factor_helper<unit<D, homogeneous_system<L1> >, unit<D, homogeneous_system<L2> > >
: conversion_factor_helper<
typename reduce_unit<unit<D, homogeneous_system<L1> > >::type,
typename reduce_unit<unit<D, homogeneous_system<L2> > >::type
>
{
//typedef typename reduce_unit<unit<D, homogeneous_system<L1> > >::type source_unit;
//typedef typename source_unit::system_type::type unit_list;
//typedef typename detail::conversion_impl<unit_list::size::value>::template apply<
// unit_list,
// homogeneous_system<L2>
//> impl;
//typedef typename impl::type type;
//static type value()
//{
// return(impl::value());
//}
};
template<class D, class L1, class L2>
struct conversion_factor_helper<unit<D, heterogeneous_system<L1> >, unit<D, homogeneous_system<L2> > >
: conversion_factor_helper<
typename reduce_unit<unit<D, heterogeneous_system<L1> > >::type,
typename reduce_unit<unit<D, homogeneous_system<L2> > >::type
>
{
//typedef typename detail::conversion_impl<L1::type::size::value>::template apply<
// typename L1::type,
// homogeneous_system<L2>
//> impl;
//typedef eval_scale_list<typename L1::scale> scale;
//typedef typename multiply_typeof_helper<typename impl::type, typename scale::type>::type type;
//static type value()
//{
// return(impl::value() * scale::value());
//}
};
// There is no simple algorithm for doing this conversion
// other than just defining it as the reverse of the
// heterogeneous->homogeneous case
template<class D, class L1, class L2>
struct conversion_factor_helper<unit<D, homogeneous_system<L1> >, unit<D, heterogeneous_system<L2> > >
: conversion_factor_helper<
typename reduce_unit<unit<D, homogeneous_system<L1> > >::type,
typename reduce_unit<unit<D, heterogeneous_system<L2> > >::type
>
{
//typedef typename detail::conversion_impl<L2::type::size::value>::template apply<
// typename L2::type,
// homogeneous_system<L1>
//> impl;
//typedef eval_scale_list<typename L2::scale> scale;
//typedef typename multiply_typeof_helper<typename impl::type, typename scale::type>::type type;
//static type value()
//{
// one numerator;
// return(numerator / (impl::value() * scale::value()));
//}
};
/// Requires that all possible conversions
/// between base units are defined.
template<class D, class S1, class S2>
struct conversion_factor_helper<unit<D, heterogeneous_system<S1> >, unit<D, heterogeneous_system<S2> > >
{
/// INTERNAL ONLY
typedef typename detail::extract_base_units<S1::type::size::value>::template apply<
typename S1::type,
dimensionless_type
>::type from_base_units;
/// INTERNAL ONLY
typedef typename detail::extract_base_units<S2::type::size::value>::template apply<
typename S2::type,
from_base_units
>::type all_base_units;
/// INTERNAL ONLY
typedef typename detail::make_homogeneous_system<all_base_units>::type system;
typedef typename detail::conversion_impl<S1::type::size::value>::template apply<
typename S1::type,
system
> conversion1;
typedef typename detail::conversion_impl<S2::type::size::value>::template apply<
typename S2::type,
system
> conversion2;
typedef eval_scale_list<typename mpl::divides<typename S1::scale, typename S2::scale>::type> scale;
typedef typename multiply_typeof_helper<
typename conversion1::type,
typename divide_typeof_helper<typename scale::type, typename conversion2::type>::type
>::type type;
static type value()
{
return(conversion1::value() * (scale::value() / conversion2::value()));
}
};
} // namespace detail
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_CONVERSION_IMPL_HPP

View File

@@ -0,0 +1,90 @@
// 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)
#ifndef BOOST_UNITS_DIM_IMPL_HPP
#define BOOST_UNITS_DIM_IMPL_HPP
#include <boost/mpl/bool.hpp>
#include <boost/mpl/less.hpp>
#include <boost/units/units_fwd.hpp>
/// \file
/// \brief Class encapsulating a dimension tag/value pair
namespace boost {
namespace units {
namespace detail {
struct dim_tag;
}
}
namespace mpl {
/// Less than comparison for sorting @c dim.
template<>
struct less_impl<boost::units::detail::dim_tag, boost::units::detail::dim_tag>
{
template<class T0, class T1>
struct apply : mpl::less<typename T0::tag_type, typename T1::tag_type> {};
};
}
namespace units {
template<class Tag, class Exponent>
struct dim;
template<long N, long D>
class static_rational;
namespace detail {
/// Extract @c tag_type from a @c dim.
template<typename T>
struct get_tag
{
typedef typename T::tag_type type;
};
/// Extract @c value_type from a @c dim.
template<typename T>
struct get_value
{
typedef typename T::value_type type;
};
/// Determine if a @c dim is empty (has a zero exponent).
template<class T>
struct is_empty_dim;
template<typename T>
struct is_empty_dim< dim<T, static_rational<0, 1> > > :
mpl::true_
{ };
template<typename T, typename V>
struct is_empty_dim< dim<T, V> > :
mpl::false_
{ };
} // namespace detail
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_DIM_IMPL_HPP

View File

@@ -0,0 +1,347 @@
// 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)
#ifndef BOOST_UNITS_DIMENSION_IMPL_HPP
#define BOOST_UNITS_DIMENSION_IMPL_HPP
#include <boost/mpl/begin_end.hpp>
#include <boost/mpl/deref.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/list.hpp>
#include <boost/mpl/next.hpp>
#include <boost/mpl/size.hpp>
#include <boost/mpl/less.hpp>
#include <boost/units/config.hpp>
#include <boost/units/dimensionless_type.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/units_fwd.hpp>
#include <boost/units/detail/dimension_list.hpp>
#include <boost/units/detail/push_front_if.hpp>
#include <boost/units/detail/push_front_or_add.hpp>
/// \file
/// \brief Core class and metaprogramming utilities for compile-time dimensional analysis.
namespace boost {
namespace units {
namespace detail {
template<int N>
struct insertion_sort_dims_insert;
template<bool is_greater>
struct insertion_sort_dims_comparison_impl;
// have to recursively add the element to the next sequence.
template<>
struct insertion_sort_dims_comparison_impl<true> {
template<class Begin, int N, class T>
struct apply {
typedef list<
typename Begin::item,
typename insertion_sort_dims_insert<N - 1>::template apply<
typename Begin::next,
T
>::type
> type;
};
};
// either prepend the current element or join it to
// the first remaining element of the sequence.
template<>
struct insertion_sort_dims_comparison_impl<false> {
template<class Begin, int N, class T>
struct apply {
typedef typename push_front_or_add<Begin, T>::type type;
};
};
template<int N>
struct insertion_sort_dims_insert {
template<class Begin, class T>
struct apply {
typedef typename insertion_sort_dims_comparison_impl<mpl::less<typename Begin::item, T>::value>::template apply<
Begin,
N,
T
>::type type;
};
};
template<>
struct insertion_sort_dims_insert<0> {
template<class Begin, class T>
struct apply {
typedef list<T, dimensionless_type> type;
};
};
template<int N>
struct insertion_sort_dims_mpl_sequence {
template<class Begin>
struct apply {
typedef typename insertion_sort_dims_mpl_sequence<N - 1>::template apply<typename mpl::next<Begin>::type>::type next;
typedef typename insertion_sort_dims_insert<(next::size::value)>::template apply<next, typename mpl::deref<Begin>::type>::type type;
};
};
template<>
struct insertion_sort_dims_mpl_sequence<0> {
template<class Begin>
struct apply {
typedef dimensionless_type type;
};
};
template<int N>
struct insertion_sort_dims_impl {
template<class Begin>
struct apply {
typedef typename insertion_sort_dims_impl<N - 1>::template apply<typename Begin::next>::type next;
typedef typename insertion_sort_dims_insert<(next::size::value)>::template apply<next, typename Begin::item>::type type;
};
};
template<>
struct insertion_sort_dims_impl<0> {
template<class Begin>
struct apply {
typedef dimensionless_type type;
};
};
template<class T>
struct sort_dims
{
typedef typename insertion_sort_dims_mpl_sequence<mpl::size<T>::value>::template apply<typename mpl::begin<T>::type>::type type;
};
template<class T, class Next>
struct sort_dims<list<T, Next> >
{
typedef typename insertion_sort_dims_impl<list<T, Next>::size::value>::template apply<list<T, Next> >::type type;
};
/// sorted sequences can be merged in linear time
template<bool less, bool greater>
struct merge_dimensions_func;
template<int N1, int N2>
struct merge_dimensions_impl;
template<>
struct merge_dimensions_func<true, false>
{
template<typename Begin1, typename Begin2, int N1, int N2>
struct apply
{
typedef list<
typename Begin1::item,
typename merge_dimensions_impl<N1 - 1, N2>::template apply<
typename Begin1::next,
Begin2
>::type
> type;
};
};
template<>
struct merge_dimensions_func<false, true> {
template<typename Begin1, typename Begin2, int N1, int N2>
struct apply
{
typedef list<
typename Begin2::item,
typename merge_dimensions_impl<N2 - 1, N1>::template apply<
typename Begin2::next,
Begin1
>::type
> type;
};
};
template<>
struct merge_dimensions_func<false, false> {
template<typename Begin1, typename Begin2, int N1, int N2>
struct apply
{
typedef typename mpl::plus<typename Begin1::item, typename Begin2::item>::type combined;
typedef typename push_front_if<!is_empty_dim<combined>::value>::template apply<
typename merge_dimensions_impl<N1 - 1, N2 - 1>::template apply<
typename Begin1::next,
typename Begin2::next
>::type,
combined
>::type type;
};
};
template<int N1, int N2>
struct merge_dimensions_impl {
template<typename Begin1, typename Begin2>
struct apply
{
typedef typename Begin1::item dim1;
typedef typename Begin2::item dim2;
typedef typename merge_dimensions_func<(mpl::less<dim1,dim2>::value == true),
(mpl::less<dim2,dim1>::value == true)>::template apply<
Begin1,
Begin2,
N1,
N2
>::type type;
};
};
template<typename Sequence1, typename Sequence2>
struct merge_dimensions
{
typedef typename detail::merge_dimensions_impl<Sequence1::size::value,
Sequence2::size::value>::template
apply<
Sequence1,
Sequence2
>::type type;
};
template<int N>
struct iterator_to_list
{
template<typename Begin>
struct apply
{
typedef list<
typename Begin::item,
typename iterator_to_list<N - 1>::template apply<
typename Begin::next
>::type
> type;
};
};
template<>
struct iterator_to_list<0>
{
template<typename Begin>
struct apply {
typedef dimensionless_type type;
};
};
template<int N>
struct merge_dimensions_impl<N, 0>
{
template<typename Begin1, typename Begin2>
struct apply
{
typedef typename iterator_to_list<N>::template apply<Begin1>::type type;
};
};
template<int N>
struct merge_dimensions_impl<0, N>
{
template<typename Begin1, typename Begin2>
struct apply
{
typedef typename iterator_to_list<N>::template apply<Begin2>::type type;
};
};
template<>
struct merge_dimensions_impl<0, 0>
{
template<typename Begin1, typename Begin2>
struct apply
{
typedef dimensionless_type type;
};
};
template<int N>
struct static_inverse_impl
{
template<typename Begin>
struct apply {
typedef list<
typename mpl::negate<typename Begin::item>::type,
typename static_inverse_impl<N - 1>::template apply<
typename Begin::next
>::type
> type;
};
};
template<>
struct static_inverse_impl<0>
{
template<typename Begin>
struct apply
{
typedef dimensionless_type type;
};
};
template<int N>
struct static_power_impl
{
template<typename Begin, typename Ex>
struct apply
{
typedef list<
typename mpl::times<typename Begin::item, Ex>::type,
typename detail::static_power_impl<N - 1>::template apply<typename Begin::next, Ex>::type
> type;
};
};
template<>
struct static_power_impl<0>
{
template<typename Begin, typename Ex>
struct apply
{
typedef dimensionless_type type;
};
};
template<int N>
struct static_root_impl {
template<class Begin, class Ex>
struct apply {
typedef list<
typename mpl::divides<typename Begin::item, Ex>::type,
typename detail::static_root_impl<N - 1>::template apply<typename Begin::next, Ex>::type
> type;
};
};
template<>
struct static_root_impl<0> {
template<class Begin, class Ex>
struct apply
{
typedef dimensionless_type type;
};
};
} // namespace detail
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_DIMENSION_IMPL_HPP

Some files were not shown because too many files have changed in this diff Show More