Initial Commit
This commit is contained in:
@@ -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) 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_CURRENT_BASE_DIMENSION_HPP
|
||||
#define BOOST_UNITS_CURRENT_BASE_DIMENSION_HPP
|
||||
|
||||
#include <boost/units/config.hpp>
|
||||
#include <boost/units/base_dimension.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace units {
|
||||
|
||||
/// base dimension of current
|
||||
struct current_base_dimension :
|
||||
boost::units::base_dimension<current_base_dimension,-6>
|
||||
{ };
|
||||
|
||||
} // namespace units
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#if BOOST_UNITS_HAS_BOOST_TYPEOF
|
||||
|
||||
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
|
||||
|
||||
BOOST_TYPEOF_REGISTER_TYPE(boost::units::current_base_dimension)
|
||||
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace units {
|
||||
|
||||
/// dimension of electric current (I)
|
||||
typedef current_base_dimension::dimension_type current_dimension;
|
||||
|
||||
} // namespace units
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_UNITS_CURRENT_BASE_DIMENSION_HPP
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
Copyright Rene Rivera 2008-2015
|
||||
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)
|
||||
*/
|
||||
#include <boost/predef/detail/test.h>
|
||||
|
||||
#ifndef BOOST_PREDEF_MAKE_H
|
||||
#define BOOST_PREDEF_MAKE_H
|
||||
|
||||
/*
|
||||
Shorthands for the common version number formats used by vendors...
|
||||
*/
|
||||
|
||||
/*`
|
||||
[heading `BOOST_PREDEF_MAKE_..` macros]
|
||||
|
||||
These set of macros decompose common vendor version number
|
||||
macros which are composed version, revision, and patch digits.
|
||||
The naming convention indicates:
|
||||
|
||||
* The base of the specified version number. "`BOOST_PREDEF_MAKE_0X`" for
|
||||
hexadecimal digits, and "`BOOST_PREDEF_MAKE_10`" for decimal digits.
|
||||
* The format of the vendor version number. Where "`V`" indicates the version digits,
|
||||
"`R`" indicates the revision digits, "`P`" indicates the patch digits, and "`0`"
|
||||
indicates an ignored digit.
|
||||
|
||||
Macros are:
|
||||
*/
|
||||
/*` `BOOST_PREDEF_MAKE_0X_VRP(V)` */
|
||||
#define BOOST_PREDEF_MAKE_0X_VRP(V) BOOST_VERSION_NUMBER((V&0xF00)>>8,(V&0xF0)>>4,(V&0xF))
|
||||
/*` `BOOST_PREDEF_MAKE_0X_VVRP(V)` */
|
||||
#define BOOST_PREDEF_MAKE_0X_VVRP(V) BOOST_VERSION_NUMBER((V&0xFF00)>>8,(V&0xF0)>>4,(V&0xF))
|
||||
/*` `BOOST_PREDEF_MAKE_0X_VRPP(V)` */
|
||||
#define BOOST_PREDEF_MAKE_0X_VRPP(V) BOOST_VERSION_NUMBER((V&0xF000)>>12,(V&0xF00)>>8,(V&0xFF))
|
||||
/*` `BOOST_PREDEF_MAKE_0X_VVRR(V)` */
|
||||
#define BOOST_PREDEF_MAKE_0X_VVRR(V) BOOST_VERSION_NUMBER((V&0xFF00)>>8,(V&0xFF),0)
|
||||
/*` `BOOST_PREDEF_MAKE_0X_VRRPPPP(V)` */
|
||||
#define BOOST_PREDEF_MAKE_0X_VRRPPPP(V) BOOST_VERSION_NUMBER((V&0xF000000)>>24,(V&0xFF0000)>>16,(V&0xFFFF))
|
||||
/*` `BOOST_PREDEF_MAKE_0X_VVRRP(V)` */
|
||||
#define BOOST_PREDEF_MAKE_0X_VVRRP(V) BOOST_VERSION_NUMBER((V&0xFF000)>>12,(V&0xFF0)>>4,(V&0xF))
|
||||
/*` `BOOST_PREDEF_MAKE_0X_VRRPP000(V)` */
|
||||
#define BOOST_PREDEF_MAKE_0X_VRRPP000(V) BOOST_VERSION_NUMBER((V&0xF0000000)>>28,(V&0xFF00000)>>20,(V&0xFF000)>>12)
|
||||
/*` `BOOST_PREDEF_MAKE_0X_VVRRPP(V)` */
|
||||
#define BOOST_PREDEF_MAKE_0X_VVRRPP(V) BOOST_VERSION_NUMBER((V&0xFF0000)>>16,(V&0xFF00)>>8,(V&0xFF))
|
||||
/*` `BOOST_PREDEF_MAKE_10_VPPP(V)` */
|
||||
#define BOOST_PREDEF_MAKE_10_VPPP(V) BOOST_VERSION_NUMBER(((V)/1000)%10,0,(V)%1000)
|
||||
/*` `BOOST_PREDEF_MAKE_10_VRP(V)` */
|
||||
#define BOOST_PREDEF_MAKE_10_VRP(V) BOOST_VERSION_NUMBER(((V)/100)%10,((V)/10)%10,(V)%10)
|
||||
/*` `BOOST_PREDEF_MAKE_10_VRP000(V)` */
|
||||
#define BOOST_PREDEF_MAKE_10_VRP000(V) BOOST_VERSION_NUMBER(((V)/100000)%10,((V)/10000)%10,((V)/1000)%10)
|
||||
/*` `BOOST_PREDEF_MAKE_10_VRPP(V)` */
|
||||
#define BOOST_PREDEF_MAKE_10_VRPP(V) BOOST_VERSION_NUMBER(((V)/1000)%10,((V)/100)%10,(V)%100)
|
||||
/*` `BOOST_PREDEF_MAKE_10_VRR(V)` */
|
||||
#define BOOST_PREDEF_MAKE_10_VRR(V) BOOST_VERSION_NUMBER(((V)/100)%10,(V)%100,0)
|
||||
/*` `BOOST_PREDEF_MAKE_10_VRRPP(V)` */
|
||||
#define BOOST_PREDEF_MAKE_10_VRRPP(V) BOOST_VERSION_NUMBER(((V)/10000)%10,((V)/100)%100,(V)%100)
|
||||
/*` `BOOST_PREDEF_MAKE_10_VRR000(V)` */
|
||||
#define BOOST_PREDEF_MAKE_10_VRR000(V) BOOST_VERSION_NUMBER(((V)/100000)%10,((V)/1000)%100,0)
|
||||
/*` `BOOST_PREDEF_MAKE_10_VV00(V)` */
|
||||
#define BOOST_PREDEF_MAKE_10_VV00(V) BOOST_VERSION_NUMBER(((V)/100)%100,0,0)
|
||||
/*` `BOOST_PREDEF_MAKE_10_VVRR(V)` */
|
||||
#define BOOST_PREDEF_MAKE_10_VVRR(V) BOOST_VERSION_NUMBER(((V)/100)%100,(V)%100,0)
|
||||
/*` `BOOST_PREDEF_MAKE_10_VVRRPP(V)` */
|
||||
#define BOOST_PREDEF_MAKE_10_VVRRPP(V) BOOST_VERSION_NUMBER(((V)/10000)%100,((V)/100)%100,(V)%100)
|
||||
/*` `BOOST_PREDEF_MAKE_10_VVRR0PP00(V)` */
|
||||
#define BOOST_PREDEF_MAKE_10_VVRR0PP00(V) BOOST_VERSION_NUMBER(((V)/10000000)%100,((V)/100000)%100,((V)/100)%100)
|
||||
/*` `BOOST_PREDEF_MAKE_10_VVRR0PPPP(V)` */
|
||||
#define BOOST_PREDEF_MAKE_10_VVRR0PPPP(V) BOOST_VERSION_NUMBER(((V)/10000000)%100,((V)/100000)%100,(V)%10000)
|
||||
/*` `BOOST_PREDEF_MAKE_10_VVRR00PP00(V)` */
|
||||
#define BOOST_PREDEF_MAKE_10_VVRR00PP00(V) BOOST_VERSION_NUMBER(((V)/100000000)%100,((V)/1000000)%100,((V)/100)%100)
|
||||
/*`
|
||||
[heading `BOOST_PREDEF_MAKE_*..` date macros]
|
||||
|
||||
Date decomposition macros return a date in the relative to the 1970
|
||||
Epoch date. If the month is not available, January 1st is used as the month and day.
|
||||
If the day is not available, but the month is, the 1st of the month is used as the day.
|
||||
*/
|
||||
/*` `BOOST_PREDEF_MAKE_DATE(Y,M,D)` */
|
||||
#define BOOST_PREDEF_MAKE_DATE(Y,M,D) BOOST_VERSION_NUMBER((Y)%10000-1970,(M)%100,(D)%100)
|
||||
/*` `BOOST_PREDEF_MAKE_YYYYMMDD(V)` */
|
||||
#define BOOST_PREDEF_MAKE_YYYYMMDD(V) BOOST_PREDEF_MAKE_DATE(((V)/10000)%10000,((V)/100)%100,(V)%100)
|
||||
/*` `BOOST_PREDEF_MAKE_YYYY(V)` */
|
||||
#define BOOST_PREDEF_MAKE_YYYY(V) BOOST_PREDEF_MAKE_DATE(V,1,1)
|
||||
/*` `BOOST_PREDEF_MAKE_YYYYMM(V)` */
|
||||
#define BOOST_PREDEF_MAKE_YYYYMM(V) BOOST_PREDEF_MAKE_DATE((V)/100,(V)%100,1)
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,469 @@
|
||||
/*==============================================================================
|
||||
Copyright (c) 2005-2010 Joel de Guzman
|
||||
Copyright (c) 2010-2011 Thomas Heller
|
||||
|
||||
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_PHOENIX_CORE_ENVIRONMENT_HPP
|
||||
#define BOOST_PHOENIX_CORE_ENVIRONMENT_HPP
|
||||
|
||||
#include <boost/phoenix/core/limits.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/at.hpp>
|
||||
#include <boost/fusion/support/is_sequence.hpp>
|
||||
#include <boost/phoenix/support/vector.hpp>
|
||||
#include <boost/proto/transform/impl.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
#include <typeinfo>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
struct unused {};
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Env, typename Actions>
|
||||
struct context
|
||||
{
|
||||
typedef vector2<Env, Actions> type;
|
||||
};
|
||||
|
||||
template <typename Env, typename Actions>
|
||||
struct make_context
|
||||
: context<Env, Actions>
|
||||
{};
|
||||
|
||||
template <typename Context>
|
||||
struct env
|
||||
{
|
||||
typedef
|
||||
typename fusion::result_of::at_c<
|
||||
typename boost::remove_reference<Context>::type
|
||||
, 0
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
|
||||
template <typename Context>
|
||||
struct actions
|
||||
{
|
||||
typedef
|
||||
typename fusion::result_of::at_c<
|
||||
typename boost::remove_reference<Context>::type
|
||||
, 1
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
}
|
||||
|
||||
namespace functional
|
||||
{
|
||||
struct context
|
||||
{
|
||||
BOOST_PROTO_CALLABLE()
|
||||
|
||||
template <typename Sig>
|
||||
struct result;
|
||||
|
||||
template <typename This, typename Env, typename Actions>
|
||||
struct result<This(Env, Actions)>
|
||||
: result<This(Env const &, Actions const &)>
|
||||
{};
|
||||
|
||||
template <typename This, typename Env, typename Actions>
|
||||
struct result<This(Env &, Actions)>
|
||||
: result<This(Env &, Actions const &)>
|
||||
{};
|
||||
|
||||
template <typename This, typename Env, typename Actions>
|
||||
struct result<This(Env, Actions &)>
|
||||
: result<This(Env const &, Actions &)>
|
||||
{};
|
||||
|
||||
template <typename This, typename Env, typename Actions>
|
||||
struct result<This(Env &, Actions &)>
|
||||
: result_of::context<Env &, Actions &>
|
||||
{};
|
||||
|
||||
template <typename Env, typename Actions>
|
||||
typename result_of::context<Env &, Actions &>::type
|
||||
operator()(Env & env, Actions & actions) const
|
||||
{
|
||||
vector2<Env &, Actions &> e = {env, actions};
|
||||
return e;
|
||||
}
|
||||
|
||||
template <typename Env, typename Actions>
|
||||
typename result_of::context<Env const &, Actions &>::type
|
||||
operator()(Env const & env, Actions & actions) const
|
||||
{
|
||||
vector2<Env const &, Actions &> e = {env, actions};
|
||||
return e;
|
||||
}
|
||||
|
||||
template <typename Env, typename Actions>
|
||||
typename result_of::context<Env &, Actions const &>::type
|
||||
operator()(Env & env, Actions const & actions) const
|
||||
{
|
||||
vector2<Env &, Actions const &> e = {env, actions};
|
||||
return e;
|
||||
}
|
||||
|
||||
template <typename Env, typename Actions>
|
||||
typename result_of::context<Env const &, Actions const &>::type
|
||||
operator()(Env const & env, Actions const & actions) const
|
||||
{
|
||||
vector2<Env const&, Actions const &> e = {env, actions};
|
||||
return e;
|
||||
}
|
||||
};
|
||||
|
||||
struct make_context
|
||||
: context
|
||||
{};
|
||||
|
||||
struct env
|
||||
{
|
||||
BOOST_PROTO_CALLABLE()
|
||||
|
||||
template <typename Sig>
|
||||
struct result;
|
||||
|
||||
template <typename This, typename Context>
|
||||
struct result<This(Context)>
|
||||
: result<This(Context const &)>
|
||||
{};
|
||||
|
||||
template <typename This, typename Context>
|
||||
struct result<This(Context &)>
|
||||
: result_of::env<Context>
|
||||
{};
|
||||
|
||||
template <typename Context>
|
||||
typename result_of::env<Context const>::type
|
||||
operator()(Context const & ctx) const
|
||||
{
|
||||
return fusion::at_c<0>(ctx);
|
||||
}
|
||||
|
||||
template <typename Context>
|
||||
typename result_of::env<Context>::type
|
||||
operator()(Context & ctx) const
|
||||
{
|
||||
return fusion::at_c<0>(ctx);
|
||||
}
|
||||
};
|
||||
|
||||
struct actions
|
||||
{
|
||||
BOOST_PROTO_CALLABLE()
|
||||
|
||||
template <typename Sig>
|
||||
struct result;
|
||||
|
||||
template <typename This, typename Context>
|
||||
struct result<This(Context)>
|
||||
: result<This(Context const &)>
|
||||
{};
|
||||
|
||||
template <typename This, typename Context>
|
||||
struct result<This(Context &)>
|
||||
: result_of::actions<Context>
|
||||
{};
|
||||
|
||||
template <typename Context>
|
||||
typename result_of::actions<Context const>::type
|
||||
operator()(Context const & ctx) const
|
||||
{
|
||||
return fusion::at_c<1>(ctx);
|
||||
}
|
||||
|
||||
template <typename Context>
|
||||
typename result_of::actions<Context>::type
|
||||
operator()(Context & ctx) const
|
||||
{
|
||||
return fusion::at_c<1>(ctx);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
struct _context
|
||||
: proto::transform<_context>
|
||||
{
|
||||
template <typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: proto::transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef vector2<State, Data> result_type;
|
||||
|
||||
result_type operator()(
|
||||
typename impl::expr_param
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
vector2<State, Data> e = {s, d};
|
||||
return e;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template <typename Env, typename Actions>
|
||||
inline
|
||||
typename result_of::context<Env const &, Actions const&>::type const
|
||||
context(Env const& env, Actions const& actions)
|
||||
{
|
||||
vector2<Env const&, Actions const &> e = {env, actions};
|
||||
return e;
|
||||
}
|
||||
|
||||
template <typename Env, typename Actions>
|
||||
inline
|
||||
typename result_of::context<Env const &, Actions const&>::type const
|
||||
make_context(Env const& env, Actions const& actions)
|
||||
{
|
||||
return context(env, actions);
|
||||
}
|
||||
|
||||
template <typename Env, typename Actions>
|
||||
inline
|
||||
typename result_of::context<Env &, Actions const&>::type const
|
||||
context(Env & env, Actions const& actions)
|
||||
{
|
||||
vector2<Env &, Actions const &> e = {env, actions};
|
||||
return e;
|
||||
}
|
||||
|
||||
template <typename Env, typename Actions>
|
||||
inline
|
||||
typename result_of::context<Env &, Actions const&>::type const
|
||||
make_context(Env & env, Actions const& actions)
|
||||
{
|
||||
return context(env, actions);
|
||||
}
|
||||
|
||||
template <typename Env, typename Actions>
|
||||
inline
|
||||
typename result_of::context<Env const &, Actions &>::type const
|
||||
context(Env const& env, Actions & actions)
|
||||
{
|
||||
vector2<Env const&, Actions &> e = {env, actions};
|
||||
return e;
|
||||
}
|
||||
|
||||
template <typename Env, typename Actions>
|
||||
inline
|
||||
typename result_of::context<Env const &, Actions &>::type const
|
||||
make_context(Env const& env, Actions & actions)
|
||||
{
|
||||
return context(env, actions);
|
||||
}
|
||||
|
||||
template <typename Env, typename Actions>
|
||||
inline
|
||||
typename result_of::context<Env &, Actions &>::type const
|
||||
context(Env & env, Actions & actions)
|
||||
{
|
||||
vector2<Env &, Actions &> e = {env, actions};
|
||||
return e;
|
||||
}
|
||||
|
||||
template <typename Env, typename Actions>
|
||||
inline
|
||||
typename result_of::context<Env &, Actions &>::type const
|
||||
make_context(Env & env, Actions & actions)
|
||||
{
|
||||
return context(env, actions);
|
||||
}
|
||||
|
||||
struct _env
|
||||
: proto::transform<_env>
|
||||
{
|
||||
template <typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: proto::transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef State result_type;
|
||||
|
||||
result_type operator()(
|
||||
typename impl::expr_param
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param
|
||||
) const
|
||||
{
|
||||
return s;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template <typename Expr, typename State>
|
||||
struct _env::impl<Expr, State, proto::empty_env>
|
||||
: proto::transform_impl<Expr, State, proto::empty_env>
|
||||
{
|
||||
typedef
|
||||
typename fusion::result_of::at_c<
|
||||
typename boost::remove_reference<State>::type
|
||||
, 0
|
||||
>::type
|
||||
result_type;
|
||||
|
||||
result_type operator()(
|
||||
typename impl::expr_param
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param
|
||||
) const
|
||||
{
|
||||
return fusion::at_c<0>(s);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Expr, typename State>
|
||||
struct _env::impl<Expr, State, unused>
|
||||
: _env::impl<Expr, State, proto::empty_env>
|
||||
{};
|
||||
|
||||
template <typename Context>
|
||||
inline
|
||||
typename fusion::result_of::at_c<Context, 0>::type
|
||||
env(Context & ctx)
|
||||
{
|
||||
return fusion::at_c<0>(ctx);
|
||||
}
|
||||
|
||||
template <typename Context>
|
||||
inline
|
||||
typename fusion::result_of::at_c<Context const, 0>::type
|
||||
env(Context const & ctx)
|
||||
{
|
||||
return fusion::at_c<0>(ctx);
|
||||
}
|
||||
|
||||
struct _actions
|
||||
: proto::transform<_actions>
|
||||
{
|
||||
template <typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: proto::transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef Data result_type;
|
||||
|
||||
result_type operator()(
|
||||
typename impl::expr_param
|
||||
, typename impl::state_param
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
return d;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template <typename Expr, typename State>
|
||||
struct _actions::impl<Expr, State, proto::empty_env>
|
||||
: proto::transform_impl<Expr, State, proto::empty_env>
|
||||
{
|
||||
typedef
|
||||
typename fusion::result_of::at_c<
|
||||
typename boost::remove_reference<State>::type
|
||||
, 1
|
||||
>::type
|
||||
result_type;
|
||||
|
||||
result_type operator()(
|
||||
typename impl::expr_param
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param
|
||||
) const
|
||||
{
|
||||
return fusion::at_c<1>(s);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Expr, typename State>
|
||||
struct _actions::impl<Expr, State, unused>
|
||||
: _actions::impl<Expr, State, proto::empty_env>
|
||||
{};
|
||||
|
||||
template <typename Context>
|
||||
inline
|
||||
typename fusion::result_of::at_c<Context, 1>::type
|
||||
actions(Context & ctx)
|
||||
{
|
||||
return fusion::at_c<1>(ctx);
|
||||
}
|
||||
|
||||
template <typename Context>
|
||||
inline
|
||||
typename fusion::result_of::at_c<Context const, 1>::type
|
||||
actions(Context const & ctx)
|
||||
{
|
||||
return fusion::at_c<1>(ctx);
|
||||
}
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template <
|
||||
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
|
||||
BOOST_PHOENIX_LIMIT
|
||||
, typename A
|
||||
, mpl::void_
|
||||
)
|
||||
, typename Dummy = void
|
||||
>
|
||||
struct make_env;
|
||||
|
||||
#define M0(Z, N, D) \
|
||||
template <BOOST_PHOENIX_typename_A(N)> \
|
||||
struct make_env<BOOST_PHOENIX_A(N)> \
|
||||
{ \
|
||||
typedef BOOST_PP_CAT(vector, N)<BOOST_PHOENIX_A(N)> type; \
|
||||
}; \
|
||||
/**/
|
||||
BOOST_PP_REPEAT_FROM_TO(1, BOOST_PHOENIX_LIMIT, M0, _)
|
||||
#undef M0
|
||||
}
|
||||
|
||||
inline
|
||||
result_of::make_env<>::type
|
||||
make_env()
|
||||
{
|
||||
return result_of::make_env<>::type();
|
||||
}
|
||||
#define M0(Z, N, D) \
|
||||
template <BOOST_PHOENIX_typename_A(N)> \
|
||||
inline \
|
||||
typename result_of::make_env<BOOST_PHOENIX_A_ref(N)>::type \
|
||||
make_env(BOOST_PHOENIX_A_ref_a(N)) \
|
||||
{ \
|
||||
typename result_of::make_env<BOOST_PHOENIX_A_ref(N)>::type \
|
||||
env = \
|
||||
{ \
|
||||
BOOST_PHOENIX_a(N) \
|
||||
}; \
|
||||
return env; \
|
||||
} \
|
||||
template <BOOST_PHOENIX_typename_A(N)> \
|
||||
inline \
|
||||
typename result_of::make_env<BOOST_PHOENIX_A_const_ref(N)>::type \
|
||||
make_env(BOOST_PHOENIX_A_const_ref_a(N)) \
|
||||
{ \
|
||||
typename result_of::make_env<BOOST_PHOENIX_A_const_ref(N)>::type \
|
||||
env = \
|
||||
{ \
|
||||
BOOST_PHOENIX_a(N) \
|
||||
}; \
|
||||
return env; \
|
||||
} \
|
||||
/**/
|
||||
BOOST_PP_REPEAT_FROM_TO(1, BOOST_PHOENIX_LIMIT, M0, _)
|
||||
#undef M0
|
||||
|
||||
template <typename T, typename Enable = void>
|
||||
struct is_environment : fusion::traits::is_sequence<T> {};
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Thorsten Ottosen 2003-2004. Use, modification and
|
||||
// distribution is subject to 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)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
|
||||
#ifndef BOOST_RANGE_SIZE_HPP
|
||||
#define BOOST_RANGE_SIZE_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/range/config.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/size_type.hpp>
|
||||
#include <boost/range/detail/has_member_size.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range_detail
|
||||
{
|
||||
|
||||
template<class SinglePassRange>
|
||||
inline typename ::boost::enable_if<
|
||||
has_member_size<SinglePassRange>,
|
||||
typename range_size<const SinglePassRange>::type
|
||||
>::type
|
||||
range_calculate_size(const SinglePassRange& rng)
|
||||
{
|
||||
return rng.size();
|
||||
}
|
||||
|
||||
template<class SinglePassRange>
|
||||
inline typename disable_if<
|
||||
has_member_size<SinglePassRange>,
|
||||
typename range_size<const SinglePassRange>::type
|
||||
>::type
|
||||
range_calculate_size(const SinglePassRange& rng)
|
||||
{
|
||||
return std::distance(boost::begin(rng), boost::end(rng));
|
||||
}
|
||||
}
|
||||
|
||||
template<class SinglePassRange>
|
||||
inline typename range_size<const SinglePassRange>::type
|
||||
size(const SinglePassRange& rng)
|
||||
{
|
||||
// Very strange things happen on some compilers that have the range concept
|
||||
// asserts disabled. This preprocessor condition is clearly redundant on a
|
||||
// working compiler but is vital for at least some compilers such as clang 4.2
|
||||
// but only on the Mac!
|
||||
#if BOOST_RANGE_ENABLE_CONCEPT_ASSERT == 1
|
||||
BOOST_RANGE_CONCEPT_ASSERT((boost::SinglePassRangeConcept<SinglePassRange>));
|
||||
#endif
|
||||
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
|
||||
!BOOST_WORKAROUND(__GNUC__, < 3) \
|
||||
/**/
|
||||
using namespace range_detail;
|
||||
#endif
|
||||
|
||||
return range_calculate_size(rng);
|
||||
}
|
||||
|
||||
} // namespace 'boost'
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,278 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright (C) 2009 Sebastian Redl
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
// For more information, see www.boost.org
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifndef BOOST_PROPERTY_TREE_STRING_PATH_HPP_INCLUDED
|
||||
#define BOOST_PROPERTY_TREE_STRING_PATH_HPP_INCLUDED
|
||||
|
||||
#include <boost/property_tree/ptree_fwd.hpp>
|
||||
#include <boost/property_tree/id_translator.hpp>
|
||||
#include <boost/property_tree/exceptions.hpp>
|
||||
#include <boost/property_tree/detail/ptree_utils.hpp>
|
||||
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <iterator>
|
||||
|
||||
namespace boost { namespace property_tree
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template <typename Sequence, typename Iterator>
|
||||
void append_and_preserve_iter(Sequence &s, const Sequence &r,
|
||||
Iterator &, std::forward_iterator_tag)
|
||||
{
|
||||
// Here we boldly assume that anything that is not random-access
|
||||
// preserves validity. This is valid for the STL sequences.
|
||||
s.insert(s.end(), r.begin(), r.end());
|
||||
}
|
||||
template <typename Sequence, typename Iterator>
|
||||
void append_and_preserve_iter(Sequence &s, const Sequence &r,
|
||||
Iterator &it,
|
||||
std::random_access_iterator_tag)
|
||||
{
|
||||
// Convert the iterator to an index, and later back.
|
||||
typename std::iterator_traits<Iterator>::difference_type idx =
|
||||
it - s.begin();
|
||||
s.insert(s.end(), r.begin(), r.end());
|
||||
it = s.begin() + idx;
|
||||
}
|
||||
|
||||
template <typename Sequence>
|
||||
inline std::string dump_sequence(const Sequence &)
|
||||
{
|
||||
return "<undumpable sequence>";
|
||||
}
|
||||
inline std::string dump_sequence(const std::string &s)
|
||||
{
|
||||
return s;
|
||||
}
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
inline std::string dump_sequence(const std::wstring &s)
|
||||
{
|
||||
return narrow<std::string>(s.c_str());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Default path class. A path is a sequence of values. Groups of values
|
||||
/// are separated by the separator value, which defaults to '.' cast to
|
||||
/// the sequence's value type. The group of values is then passed to the
|
||||
/// translator to get a key.
|
||||
///
|
||||
/// If instantiated with std::string and id_translator\<std::string\>,
|
||||
/// it accepts paths of the form "one.two.three.four".
|
||||
///
|
||||
/// @tparam String Any Sequence. If the sequence does not support random-
|
||||
/// access iteration, concatenation of paths assumes that
|
||||
/// insertions at the end preserve iterator validity.
|
||||
/// @tparam Translator A translator with internal_type == String.
|
||||
template <typename String, typename Translator>
|
||||
class string_path
|
||||
{
|
||||
BOOST_STATIC_ASSERT((is_same<String,
|
||||
typename Translator::internal_type>::value));
|
||||
public:
|
||||
typedef typename Translator::external_type key_type;
|
||||
typedef typename String::value_type char_type;
|
||||
|
||||
/// Create an empty path.
|
||||
explicit string_path(char_type separator = char_type('.'));
|
||||
/// Create a path by parsing the given string.
|
||||
/// @param value A sequence, possibly with separators, that describes
|
||||
/// the path, e.g. "one.two.three".
|
||||
/// @param separator The separator used in parsing. Defaults to '.'.
|
||||
/// @param tr The translator used by this path to convert the individual
|
||||
/// parts to keys.
|
||||
string_path(const String &value, char_type separator = char_type('.'),
|
||||
Translator tr = Translator());
|
||||
/// Create a path by parsing the given string.
|
||||
/// @param value A zero-terminated array of values. Only use if zero-
|
||||
/// termination makes sense for your type, and your
|
||||
/// sequence supports construction from it. Intended for
|
||||
/// string literals.
|
||||
/// @param separator The separator used in parsing. Defaults to '.'.
|
||||
/// @param tr The translator used by this path to convert the individual
|
||||
/// parts to keys.
|
||||
string_path(const char_type *value,
|
||||
char_type separator = char_type('.'),
|
||||
Translator tr = Translator());
|
||||
|
||||
// Default copying doesn't do the right thing with the iterator
|
||||
string_path(const string_path &o);
|
||||
string_path& operator =(const string_path &o);
|
||||
|
||||
/// Take a single element off the path at the front and return it.
|
||||
key_type reduce();
|
||||
|
||||
/// Test if the path is empty.
|
||||
bool empty() const;
|
||||
|
||||
/// Test if the path contains a single element, i.e. no separators.
|
||||
bool single() const;
|
||||
|
||||
/// Get the separator used by this path.
|
||||
char_type separator() const { return m_separator; }
|
||||
|
||||
std::string dump() const {
|
||||
return detail::dump_sequence(m_value);
|
||||
}
|
||||
|
||||
/// Append a second path to this one.
|
||||
/// @pre o's separator is the same as this one's, or o has no separators
|
||||
string_path& operator /=(const string_path &o) {
|
||||
// If it's single, there's no separator. This allows to do
|
||||
// p /= "piece";
|
||||
// even for non-default separators.
|
||||
BOOST_ASSERT((m_separator == o.m_separator
|
||||
|| o.empty()
|
||||
|| o.single())
|
||||
&& "Incompatible paths.");
|
||||
if(!o.empty()) {
|
||||
String sub;
|
||||
if(!this->empty()) {
|
||||
sub.push_back(m_separator);
|
||||
}
|
||||
sub.insert(sub.end(), o.cstart(), o.m_value.end());
|
||||
detail::append_and_preserve_iter(m_value, sub, m_start,
|
||||
typename std::iterator_traits<s_iter>::iterator_category());
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
typedef typename String::iterator s_iter;
|
||||
typedef typename String::const_iterator s_c_iter;
|
||||
String m_value;
|
||||
char_type m_separator;
|
||||
Translator m_tr;
|
||||
s_iter m_start;
|
||||
s_c_iter cstart() const { return m_start; }
|
||||
};
|
||||
|
||||
template <typename String, typename Translator> inline
|
||||
string_path<String, Translator>::string_path(char_type separator)
|
||||
: m_separator(separator), m_start(m_value.begin())
|
||||
{}
|
||||
|
||||
template <typename String, typename Translator> inline
|
||||
string_path<String, Translator>::string_path(const String &value,
|
||||
char_type separator,
|
||||
Translator tr)
|
||||
: m_value(value), m_separator(separator),
|
||||
m_tr(tr), m_start(m_value.begin())
|
||||
{}
|
||||
|
||||
template <typename String, typename Translator> inline
|
||||
string_path<String, Translator>::string_path(const char_type *value,
|
||||
char_type separator,
|
||||
Translator tr)
|
||||
: m_value(value), m_separator(separator),
|
||||
m_tr(tr), m_start(m_value.begin())
|
||||
{}
|
||||
|
||||
template <typename String, typename Translator> inline
|
||||
string_path<String, Translator>::string_path(const string_path &o)
|
||||
: m_value(o.m_value), m_separator(o.m_separator),
|
||||
m_tr(o.m_tr), m_start(m_value.begin())
|
||||
{
|
||||
std::advance(m_start, std::distance(o.m_value.begin(), o.cstart()));
|
||||
}
|
||||
|
||||
template <typename String, typename Translator> inline
|
||||
string_path<String, Translator>&
|
||||
string_path<String, Translator>::operator =(const string_path &o)
|
||||
{
|
||||
m_value = o.m_value;
|
||||
m_separator = o.m_separator;
|
||||
m_tr = o.m_tr;
|
||||
m_start = m_value.begin();
|
||||
std::advance(m_start, std::distance(o.m_value.begin(), o.cstart()));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename String, typename Translator>
|
||||
typename Translator::external_type string_path<String, Translator>::reduce()
|
||||
{
|
||||
BOOST_ASSERT(!empty() && "Reducing empty path");
|
||||
|
||||
s_iter next_sep = std::find(m_start, m_value.end(), m_separator);
|
||||
String part(m_start, next_sep);
|
||||
m_start = next_sep;
|
||||
if(!empty()) {
|
||||
// Unless we're at the end, skip the separator we found.
|
||||
++m_start;
|
||||
}
|
||||
|
||||
if(optional<key_type> key = m_tr.get_value(part)) {
|
||||
return *key;
|
||||
}
|
||||
BOOST_PROPERTY_TREE_THROW(ptree_bad_path("Path syntax error", *this));
|
||||
}
|
||||
|
||||
template <typename String, typename Translator> inline
|
||||
bool string_path<String, Translator>::empty() const
|
||||
{
|
||||
return m_start == m_value.end();
|
||||
}
|
||||
|
||||
template <typename String, typename Translator> inline
|
||||
bool string_path<String, Translator>::single() const
|
||||
{
|
||||
return std::find(static_cast<s_c_iter>(m_start),
|
||||
m_value.end(), m_separator)
|
||||
== m_value.end();
|
||||
}
|
||||
|
||||
// By default, this is the path for strings. You can override this by
|
||||
// specializing path_of for a more specific form of std::basic_string.
|
||||
template <typename Ch, typename Traits, typename Alloc>
|
||||
struct path_of< std::basic_string<Ch, Traits, Alloc> >
|
||||
{
|
||||
typedef std::basic_string<Ch, Traits, Alloc> _string;
|
||||
typedef string_path< _string, id_translator<_string> > type;
|
||||
};
|
||||
|
||||
template <typename String, typename Translator> inline
|
||||
string_path<String, Translator> operator /(
|
||||
string_path<String, Translator> p1,
|
||||
const string_path<String, Translator> &p2)
|
||||
{
|
||||
p1 /= p2;
|
||||
return p1;
|
||||
}
|
||||
|
||||
// These shouldn't be necessary, but GCC won't find the one above.
|
||||
template <typename String, typename Translator> inline
|
||||
string_path<String, Translator> operator /(
|
||||
string_path<String, Translator> p1,
|
||||
const typename String::value_type *p2)
|
||||
{
|
||||
p1 /= p2;
|
||||
return p1;
|
||||
}
|
||||
|
||||
template <typename String, typename Translator> inline
|
||||
string_path<String, Translator> operator /(
|
||||
const typename String::value_type *p1,
|
||||
const string_path<String, Translator> &p2)
|
||||
{
|
||||
string_path<String, Translator> t(p1);
|
||||
t /= p2;
|
||||
return t;
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,202 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2002
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to 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)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex.cpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Declares boost::basic_regex<> and associated
|
||||
* functions and classes. This header is the main
|
||||
* entry point for the template regex code.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_RE_REGEX_HPP_INCLUDED
|
||||
#define BOOST_RE_REGEX_HPP_INCLUDED
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
// what follows is all C++ don't include in C builds!!
|
||||
|
||||
#ifndef BOOST_REGEX_CONFIG_HPP
|
||||
#include <boost/regex/config.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_WORKAROUND_HPP
|
||||
#include <boost/regex/v4/regex_workaround.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_REGEX_FWD_HPP
|
||||
#include <boost/regex_fwd.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_TRAITS_HPP
|
||||
#include <boost/regex/regex_traits.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_RAW_BUFFER_HPP
|
||||
#include <boost/regex/v4/error_type.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_V4_MATCH_FLAGS
|
||||
#include <boost/regex/v4/match_flags.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_RAW_BUFFER_HPP
|
||||
#include <boost/regex/v4/regex_raw_buffer.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_RE_PAT_EXCEPT_HPP
|
||||
#include <boost/regex/pattern_except.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_REGEX_V4_CHAR_REGEX_TRAITS_HPP
|
||||
#include <boost/regex/v4/char_regex_traits.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_V4_STATES_HPP
|
||||
#include <boost/regex/v4/states.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_V4_REGBASE_HPP
|
||||
#include <boost/regex/v4/regbase.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_V4_ITERATOR_TRAITS_HPP
|
||||
#include <boost/regex/v4/iterator_traits.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_V4_BASIC_REGEX_HPP
|
||||
#include <boost/regex/v4/basic_regex.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_V4_BASIC_REGEX_CREATOR_HPP
|
||||
#include <boost/regex/v4/basic_regex_creator.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_V4_BASIC_REGEX_PARSER_HPP
|
||||
#include <boost/regex/v4/basic_regex_parser.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_V4_SUB_MATCH_HPP
|
||||
#include <boost/regex/v4/sub_match.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_FORMAT_HPP
|
||||
#include <boost/regex/v4/regex_format.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_V4_MATCH_RESULTS_HPP
|
||||
#include <boost/regex/v4/match_results.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_V4_PROTECTED_CALL_HPP
|
||||
#include <boost/regex/v4/protected_call.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_MATCHER_HPP
|
||||
#include <boost/regex/v4/perl_matcher.hpp>
|
||||
#endif
|
||||
//
|
||||
// template instances:
|
||||
//
|
||||
#define BOOST_REGEX_CHAR_T char
|
||||
#ifdef BOOST_REGEX_NARROW_INSTANTIATE
|
||||
# define BOOST_REGEX_INSTANTIATE
|
||||
#endif
|
||||
#include <boost/regex/v4/instances.hpp>
|
||||
#undef BOOST_REGEX_CHAR_T
|
||||
#ifdef BOOST_REGEX_INSTANTIATE
|
||||
# undef BOOST_REGEX_INSTANTIATE
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
#define BOOST_REGEX_CHAR_T wchar_t
|
||||
#ifdef BOOST_REGEX_WIDE_INSTANTIATE
|
||||
# define BOOST_REGEX_INSTANTIATE
|
||||
#endif
|
||||
#include <boost/regex/v4/instances.hpp>
|
||||
#undef BOOST_REGEX_CHAR_T
|
||||
#ifdef BOOST_REGEX_INSTANTIATE
|
||||
# undef BOOST_REGEX_INSTANTIATE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_WREGEX) && defined(BOOST_REGEX_HAS_OTHER_WCHAR_T)
|
||||
#define BOOST_REGEX_CHAR_T unsigned short
|
||||
#ifdef BOOST_REGEX_US_INSTANTIATE
|
||||
# define BOOST_REGEX_INSTANTIATE
|
||||
#endif
|
||||
#include <boost/regex/v4/instances.hpp>
|
||||
#undef BOOST_REGEX_CHAR_T
|
||||
#ifdef BOOST_REGEX_INSTANTIATE
|
||||
# undef BOOST_REGEX_INSTANTIATE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
namespace boost{
|
||||
#ifdef BOOST_REGEX_NO_FWD
|
||||
typedef basic_regex<char, regex_traits<char> > regex;
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
typedef basic_regex<wchar_t, regex_traits<wchar_t> > wregex;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef match_results<const char*> cmatch;
|
||||
typedef match_results<std::string::const_iterator> smatch;
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
typedef match_results<const wchar_t*> wcmatch;
|
||||
typedef match_results<std::wstring::const_iterator> wsmatch;
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
#ifndef BOOST_REGEX_MATCH_HPP
|
||||
#include <boost/regex/v4/regex_match.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_V4_REGEX_SEARCH_HPP
|
||||
#include <boost/regex/v4/regex_search.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_ITERATOR_HPP
|
||||
#include <boost/regex/v4/regex_iterator.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_TOKEN_ITERATOR_HPP
|
||||
#include <boost/regex/v4/regex_token_iterator.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_V4_REGEX_GREP_HPP
|
||||
#include <boost/regex/v4/regex_grep.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_V4_REGEX_REPLACE_HPP
|
||||
#include <boost/regex/v4/regex_replace.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_V4_REGEX_MERGE_HPP
|
||||
#include <boost/regex/v4/regex_merge.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_SPLIT_HPP
|
||||
#include <boost/regex/v4/regex_split.hpp>
|
||||
#endif
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // include
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,746 @@
|
||||
/*
|
||||
main.c
|
||||
QRA64 mode encode/decode tests
|
||||
|
||||
(c) 2016 - Nico Palermo, IV3NWV
|
||||
|
||||
Thanks to Andrea Montefusco IW0HDV for his help on adapting the sources
|
||||
to OSs other than MS Windows
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
This file is part of the qracodes project, a Forward Error Control
|
||||
encoding/decoding package based on Q-ary RA (Repeat and Accumulate) LDPC codes.
|
||||
|
||||
Files in this package:
|
||||
main.c - this file
|
||||
qra64.c/.h - qra64 mode encode/decoding functions
|
||||
|
||||
../qracodes/normrnd.{c,h} - random gaussian number generator
|
||||
../qracodes/npfwht.{c,h} - Fast Walsh-Hadamard Transforms
|
||||
../qracodes/pdmath.{c,h} - Elementary math on probability distributions
|
||||
../qracodes/qra12_63_64_irr_b.{c,h} - Tables for a QRA(12,63) irregular RA
|
||||
code over GF(64)
|
||||
../qracodes/qra13_64_64_irr_e.{c,h} - Tables for a QRA(13,64) irregular RA
|
||||
code over GF(64)
|
||||
../qracodes/qracodes.{c,h} - QRA codes encoding/decoding functions
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
qracodes is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
qracodes is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with qracodes source distribution.
|
||||
If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
The code used by the QRA64 mode is the code: QRA13_64_64_IRR_E: K=13
|
||||
N=64 Q=64 irregular QRA code (defined in qra13_64_64_irr_e.{h,c}).
|
||||
|
||||
This code has been designed to include a CRC as the 13th information
|
||||
symbol and improve the code UER (Undetected Error Rate). The CRC
|
||||
symbol is not sent along the channel (the codes are punctured) and the
|
||||
resulting code is still a (12,63) code with an effective code rate of
|
||||
R = 12/63.
|
||||
*/
|
||||
|
||||
// OS dependent defines and includes ------------------------------------------
|
||||
|
||||
#if _WIN32 // note the underscore: without it, it's not msdn official!
|
||||
// Windows (x64 and x86)
|
||||
#include <windows.h> // required only for GetTickCount(...)
|
||||
#include <process.h> // _beginthread
|
||||
#endif
|
||||
|
||||
#if __linux__
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
|
||||
unsigned GetTickCount(void) {
|
||||
struct timespec ts;
|
||||
unsigned theTick = 0U;
|
||||
clock_gettime( CLOCK_REALTIME, &ts );
|
||||
theTick = ts.tv_nsec / 1000000;
|
||||
theTick += ts.tv_sec * 1000;
|
||||
return theTick;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if __APPLE__
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "qra64.h"
|
||||
#include "../qracodes/normrnd.h" // gaussian numbers generator
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// channel types
|
||||
#define CHANNEL_AWGN 0
|
||||
#define CHANNEL_RAYLEIGH 1
|
||||
#define CHANNEL_FASTFADE 2
|
||||
|
||||
#define JT65_SNR_EBNO_OFFSET 29.1f // with the synch used in JT65
|
||||
#define QRA64_SNR_EBNO_OFFSET 31.0f // with the costas array synch
|
||||
|
||||
void printwordd(char *msg, int *x, int size)
|
||||
{
|
||||
int k;
|
||||
printf("\n%s ",msg);
|
||||
for (k=0;k<size;k++)
|
||||
printf("%2d ",x[k]);
|
||||
printf("\n");
|
||||
}
|
||||
void printwordh(char *msg, int *x, int size)
|
||||
{
|
||||
int k;
|
||||
printf("\n%s ",msg);
|
||||
for (k=0;k<size;k++)
|
||||
printf("%02hx ",x[k]);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
#define NSAMPLES (QRA64_N*QRA64_M)
|
||||
|
||||
static float rp[NSAMPLES];
|
||||
static float rq[NSAMPLES];
|
||||
static float chp[NSAMPLES];
|
||||
static float chq[NSAMPLES];
|
||||
static float r[NSAMPLES];
|
||||
|
||||
float *mfskchannel(int *x, int channel_type, float EbNodB)
|
||||
{
|
||||
/*
|
||||
Simulate an MFSK channel, either AWGN or Rayleigh.
|
||||
|
||||
x is a pointer to the transmitted codeword, an array of QRA64_N
|
||||
integers in the range 0..63.
|
||||
|
||||
Returns the received symbol energies (squared amplitudes) as an array of
|
||||
(QRA64_M*QRA64_N) floats. The first QRA64_M entries of this array are
|
||||
the energies of the first symbol in the codeword. The second QRA64_M
|
||||
entries are those of the second symbol, and so on up to the last codeword
|
||||
symbol.
|
||||
*/
|
||||
const float No = 1.0f; // noise spectral density
|
||||
const float sigma = (float)sqrt(No/2.0f); // std dev of noise I/Q components
|
||||
const float sigmach = (float)sqrt(1/2.0f); // std dev of channel I/Q gains
|
||||
const float R = 1.0f*QRA64_K/QRA64_N;
|
||||
|
||||
float EbNo = (float)pow(10,EbNodB/10);
|
||||
float EsNo = 1.0f*QRA64_m*R*EbNo;
|
||||
float Es = EsNo*No;
|
||||
float A = (float)sqrt(Es);
|
||||
int k;
|
||||
|
||||
normrnd_s(rp,NSAMPLES,0,sigma);
|
||||
normrnd_s(rq,NSAMPLES,0,sigma);
|
||||
|
||||
if(EbNodB>-15)
|
||||
if (channel_type == CHANNEL_AWGN)
|
||||
for (k=0;k<QRA64_N;k++)
|
||||
rp[k*QRA64_M+x[k]]+=A;
|
||||
else
|
||||
if (channel_type == CHANNEL_RAYLEIGH) {
|
||||
normrnd_s(chp,QRA64_N,0,sigmach);
|
||||
normrnd_s(chq,QRA64_N,0,sigmach);
|
||||
for (k=0;k<QRA64_N;k++) {
|
||||
rp[k*QRA64_M+x[k]]+=A*chp[k];
|
||||
rq[k*QRA64_M+x[k]]+=A*chq[k];
|
||||
}
|
||||
}
|
||||
else {
|
||||
return 0; // unknown channel type
|
||||
}
|
||||
|
||||
// compute the squares of the amplitudes of the received samples
|
||||
for (k=0;k<NSAMPLES;k++)
|
||||
r[k] = rp[k]*rp[k] + rq[k]*rq[k];
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
// These defines are some packed fields as computed by JT65
|
||||
#define CALL_IV3NWV 0x7F85AE7
|
||||
#define CALL_K1JT 0xF70DDD7
|
||||
#define GRID_JN66 0x3AE4 // JN66
|
||||
#define GRID_73 0x7ED0 // 73
|
||||
|
||||
char decode_type[12][32] = {
|
||||
"[? ? ?] AP0",
|
||||
"[CQ ? ?] AP27",
|
||||
"[CQ ? ] AP42",
|
||||
"[CALL ? ?] AP29",
|
||||
"[CALL ? ] AP44",
|
||||
"[CALL CALL ?] AP57",
|
||||
"[? CALL ?] AP29",
|
||||
"[? CALL ] AP44",
|
||||
"[CALL CALL G] AP72",
|
||||
"[CQ CALL ?] AP55",
|
||||
"[CQ CALL ] AP70",
|
||||
"[CQ CALL G] AP70"
|
||||
};
|
||||
char apmode_type[3][32] = {
|
||||
"NO AP",
|
||||
"AUTO AP",
|
||||
"USER AP"
|
||||
};
|
||||
|
||||
int test_proc_1(int channel_type, float EbNodB, int mode)
|
||||
{
|
||||
/*
|
||||
Here we simulate the following (dummy) QSO:
|
||||
|
||||
1) CQ IV3NWV
|
||||
2) IV3NWV K1JT
|
||||
3) K1JT IV3NWV 73
|
||||
4) IV3NWV K1JT 73
|
||||
|
||||
No message repetition is attempted
|
||||
|
||||
The QSO is counted as successfull if IV3NWV received the last message
|
||||
When mode=QRA_AUTOAP each decoder attempts to decode the message sent
|
||||
by the other station using the a-priori information derived by what
|
||||
has been already decoded in a previous phase of the QSO if decoding
|
||||
with no a-priori information has not been successful.
|
||||
|
||||
Step 1) K1JT's decoder first attempts to decode msgs of type [? ? ?]
|
||||
and if this attempt fails, it attempts to decode [CQ/QRZ ? ?] or
|
||||
[CQ/QRZ ?] msgs
|
||||
|
||||
Step 2) if IV3NWV's decoder is unable to decode K1JT's without AP it
|
||||
attempts to decode messages of the type [IV3NWV ? ?] and [IV3NWV ?].
|
||||
|
||||
Step 3) K1JT's decoder attempts to decode [? ? ?] and [K1JT IV3NWV ?]
|
||||
(this last decode type has been enabled by K1JT's encoder at step 2)
|
||||
|
||||
Step 4) IV3NWV's decoder attempts to decode [? ? ?] and [IV3NWV K1JT
|
||||
?] (this last decode type has been enabled by IV3NWV's encoder at step
|
||||
3)
|
||||
|
||||
At each step the simulation reports if a decode was successful. In
|
||||
this case it also reports the type of decode (see table decode_type
|
||||
above)
|
||||
|
||||
When mode=QRA_NOAP, only [? ? ?] decodes are attempted and no a-priori
|
||||
information is used by the decoder
|
||||
|
||||
The function returns 0 if all of the four messages have been decoded
|
||||
by their recipients (with no retries) and -1 if any of them could not
|
||||
be decoded
|
||||
*/
|
||||
|
||||
int x[QRA64_K], xdec[QRA64_K];
|
||||
int y[QRA64_N];
|
||||
float *rx;
|
||||
int rc;
|
||||
|
||||
// Each simulated station must use its own codec since it might work with
|
||||
// different a-priori information.
|
||||
qra64codec *codec_iv3nwv = qra64_init(mode); // codec for IV3NWV
|
||||
qra64codec *codec_k1jt = qra64_init(mode); // codec for K1JT
|
||||
|
||||
// Step 1a: IV3NWV makes a CQ call (with no grid)
|
||||
printf("IV3NWV tx: CQ IV3NWV\n");
|
||||
encodemsg_jt65(x,CALL_CQ,CALL_IV3NWV,GRID_BLANK);
|
||||
qra64_encode(codec_iv3nwv, y, x);
|
||||
rx = mfskchannel(y,channel_type,EbNodB);
|
||||
|
||||
// Step 1b: K1JT attempts to decode [? ? ?], [CQ/QRZ ? ?] or [CQ/QRZ ?]
|
||||
rc = qra64_decode(codec_k1jt, 0, xdec,rx);
|
||||
if (rc>=0) { // decoded
|
||||
printf("K1JT rx: received with apcode=%d %s\n",rc, decode_type[rc]);
|
||||
|
||||
// Step 2a: K1JT replies to IV3NWV (with no grid)
|
||||
printf("K1JT tx: IV3NWV K1JT\n");
|
||||
encodemsg_jt65(x,CALL_IV3NWV,CALL_K1JT, GRID_BLANK);
|
||||
qra64_encode(codec_k1jt, y, x);
|
||||
rx = mfskchannel(y,channel_type,EbNodB);
|
||||
|
||||
// Step 2b: IV3NWV attempts to decode [? ? ?], [IV3NWV ? ?] or [IV3NWV ?]
|
||||
rc = qra64_decode(codec_iv3nwv, 0, xdec,rx);
|
||||
if (rc>=0) { // decoded
|
||||
printf("IV3NWV rx: received with apcode=%d %s\n",rc, decode_type[rc]);
|
||||
|
||||
// Step 3a: IV3NWV replies to K1JT with a 73
|
||||
printf("IV3NWV tx: K1JT IV3NWV 73\n");
|
||||
encodemsg_jt65(x,CALL_K1JT,CALL_IV3NWV, GRID_73);
|
||||
qra64_encode(codec_iv3nwv, y, x);
|
||||
rx = mfskchannel(y,channel_type,EbNodB);
|
||||
|
||||
// Step 3b: K1JT attempts to decode [? ? ?] or [K1JT IV3NWV ?]
|
||||
rc = qra64_decode(codec_k1jt, 0, xdec,rx);
|
||||
if (rc>=0) { // decoded
|
||||
printf("K1JT rx: received with apcode=%d %s\n",rc, decode_type[rc]);
|
||||
|
||||
// Step 4a: K1JT replies to IV3NWV with a 73
|
||||
printf("K1JT tx: IV3NWV K1JT 73\n");
|
||||
encodemsg_jt65(x,CALL_IV3NWV,CALL_K1JT, GRID_73);
|
||||
qra64_encode(codec_k1jt, y, x);
|
||||
rx = mfskchannel(y,channel_type,EbNodB);
|
||||
|
||||
// Step 4b: IV3NWV attempts to decode [? ? ?], [IV3NWV ? ?], or [IV3NWV ?]
|
||||
rc = qra64_decode(codec_iv3nwv, 0, xdec,rx);
|
||||
if (rc>=0) { // decoded
|
||||
printf("IV3NWV rx: received with apcode=%d %s\n",rc, decode_type[rc]);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("no decode\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
int test_proc_2(int channel_type, float EbNodB, int mode)
|
||||
{
|
||||
/*
|
||||
Here we simulate the decoder of K1JT after K1JT has sent a msg [IV3NWV K1JT]
|
||||
and IV3NWV sends him the msg [K1JT IV3NWV JN66].
|
||||
|
||||
If mode=QRA_NOAP, K1JT decoder attempts to decode only msgs of type [? ? ?].
|
||||
|
||||
If mode=QRA_AUTOP, K1JT decoder will attempt to decode also the msgs
|
||||
[K1JT IV3NWV] and [K1JT IV3NWV ?].
|
||||
|
||||
In the case a decode is successful the return code of the qra64_decode function
|
||||
indicates the amount of a-priori information required to decode the received
|
||||
message according to this table:
|
||||
|
||||
rc=0 [? ? ?] AP0
|
||||
rc=1 [CQ ? ?] AP27
|
||||
rc=2 [CQ ? ] AP42
|
||||
rc=3 [CALL ? ?] AP29
|
||||
rc=4 [CALL ? ] AP44
|
||||
rc=5 [CALL CALL ?] AP57
|
||||
rc=6 [? CALL ?] AP29
|
||||
rc=7 [? CALL ] AP44
|
||||
rc=8 [CALL CALL GRID] AP72
|
||||
rc=9 [CQ CALL ?] AP55
|
||||
rc=10 [CQ CALL ] AP70
|
||||
rc=11 [CQ CALL GRID] AP70
|
||||
|
||||
The return code is <0 when decoding is unsuccessful
|
||||
|
||||
This test simulates the situation ntx times and reports how many times
|
||||
a particular type decode among the above 6 cases succeded.
|
||||
*/
|
||||
|
||||
int x[QRA64_K], xdec[QRA64_K];
|
||||
int y[QRA64_N];
|
||||
float *rx;
|
||||
float ebnodbest, ebnodbavg=0;
|
||||
int rc,k;
|
||||
|
||||
int ndecok[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
int nundet = 0;
|
||||
int ntx = 200,ndec=0;
|
||||
|
||||
qra64codec *codec_iv3nwv = qra64_init(mode); // codec for IV3NWV
|
||||
qra64codec *codec_k1jt = qra64_init(mode); // codec for K1JT
|
||||
|
||||
printf("\nQRA64 Test #2 - Decoding with AP knowledge (SNR-Eb/No offset = %.1f dB)\n\n",
|
||||
QRA64_SNR_EBNO_OFFSET);
|
||||
|
||||
// This will enable K1JT's decoder to look for calls directed to him [K1JT ? ?/b]
|
||||
// printf("K1JT decoder enabled for [K1JT ? ?/blank]\n");
|
||||
// qra64_apset(codec_k1jt, CALL_K1JT,0,0,APTYPE_MYCALL);
|
||||
|
||||
// This will enable K1JT's decoder to look for IV3NWV calls directed to him [K1JT IV3NWV ?/b]
|
||||
// printf("K1JT decoder enabled for [K1JT IV3NWV ?]\n");
|
||||
// qra64_apset(codec_k1jt, CALL_CQ,CALL_IV3NWV,0,APTYPE_BOTHCALLS);
|
||||
|
||||
// This will enable K1JT's decoder to look for msges sent by IV3NWV [? IV3NWV ?]
|
||||
// printf("K1JT decoder enabled for [? IV3NWV ?/blank]\n");
|
||||
// qra64_apset(codec_k1jt, 0,CALL_IV3NWV,GRID_BLANK,APTYPE_HISCALL);
|
||||
|
||||
// This will enable K1JT's decoder to look for full-knowledge [K1JT IV3NWV JN66] msgs
|
||||
printf("K1JT decoder enabled for [K1JT IV3NWV JN66]\n");
|
||||
qra64_apset(codec_k1jt, CALL_K1JT,CALL_IV3NWV,GRID_JN66,APTYPE_FULL);
|
||||
|
||||
// This will enable K1JT's decoder to look for calls from IV3NWV [CQ IV3NWV ?/b] msgs
|
||||
printf("K1JT decoder enabled for [CQ IV3NWV ?/b/JN66]\n");
|
||||
qra64_apset(codec_k1jt, 0,CALL_IV3NWV,GRID_JN66,APTYPE_CQHISCALL);
|
||||
|
||||
|
||||
// Dx station IV3NWV calls
|
||||
printf("\nIV3NWV encoder sends msg: [K1JT IV3NWV JN66]\n\n");
|
||||
encodemsg_jt65(x,CALL_CQ,CALL_IV3NWV,GRID_JN66);
|
||||
|
||||
// printf("\nIV3NWV encoder sends msg: [CQ IV3NWV JN66]\n\n");
|
||||
// encodemsg_jt65(x,CALL_CQ,CALL_IV3NWV,GRID_JN66);
|
||||
|
||||
// printf("\nIV3NWV encoder sends msg: [CQ IV3NWV]\n\n");
|
||||
// encodemsg_jt65(x,CALL_CQ,CALL_IV3NWV,GRID_BLANK);
|
||||
qra64_encode(codec_iv3nwv, y, x);
|
||||
|
||||
printf("Simulating K1JT decoder up to AP72\n");
|
||||
|
||||
for (k=0;k<ntx;k++) {
|
||||
printf(".");
|
||||
rx = mfskchannel(y,channel_type,EbNodB);
|
||||
rc = qra64_decode(codec_k1jt, &ebnodbest, xdec,rx);
|
||||
if (rc>=0) {
|
||||
ebnodbavg +=ebnodbest;
|
||||
if (memcmp(xdec,x,12*sizeof(int))==0)
|
||||
ndecok[rc]++;
|
||||
else
|
||||
nundet++;
|
||||
}
|
||||
}
|
||||
printf("\n\n");
|
||||
|
||||
|
||||
printf("Transimtted msgs:%d\nDecoded msgs:\n\n",ntx);
|
||||
for (k=0;k<12;k++) {
|
||||
printf("%3d with %s\n",ndecok[k],decode_type[k]);
|
||||
ndec += ndecok[k];
|
||||
}
|
||||
printf("\nTotal: %d/%d (%d undetected errors)\n\n",ndec,ntx,nundet);
|
||||
printf("");
|
||||
|
||||
ebnodbavg/=(ndec+nundet);
|
||||
printf("Estimated SNR (average in dB) = %.2f dB\n\n",ebnodbavg-QRA64_SNR_EBNO_OFFSET);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_fastfading(float EbNodB, float B90, int fadingModel, int submode, int apmode, int olddec, int channel_type, int ntx)
|
||||
{
|
||||
int x[QRA64_K], xdec[QRA64_K];
|
||||
int y[QRA64_N];
|
||||
float *rx;
|
||||
float ebnodbest, ebnodbavg=0;
|
||||
int rc,k;
|
||||
float rxolddec[QRA64_N*QRA64_M]; // holds the energies at nominal tone freqs
|
||||
|
||||
int ndecok[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
int nundet = 0;
|
||||
int ndec=0;
|
||||
|
||||
qra64codec *codec_iv3nwv;
|
||||
qra64codec *codec_k1jt;
|
||||
|
||||
codec_iv3nwv=qra64_init(QRA_NOAP);
|
||||
codec_k1jt =qra64_init(apmode);
|
||||
|
||||
if (channel_type==2) { // fast-fading case
|
||||
printf("Simulating the fast-fading channel\n");
|
||||
printf("B90=%.2f Hz - Fading Model=%s - Submode=QRA64%c\n",B90,fadingModel?"Lorentz":"Gauss",submode+'A');
|
||||
printf("Decoder metric = %s\n",olddec?"AWGN":"Matched to fast-fading signal");
|
||||
}
|
||||
else {
|
||||
printf("Simulating the %s channel\n",channel_type?"Rayleigh block fading":"AWGN");
|
||||
printf("Decoder metric = AWGN\n");
|
||||
}
|
||||
|
||||
|
||||
printf("\nEncoding msg [K1JT IV3NWV JN66]\n");
|
||||
encodemsg_jt65(x,CALL_K1JT,CALL_IV3NWV,GRID_JN66);
|
||||
// printf("[");
|
||||
// for (k=0;k<11;k++) printf("%02hX ",x[k]); printf("%02hX]\n",x[11]);
|
||||
|
||||
qra64_encode(codec_iv3nwv, y, x);
|
||||
printf("%d transmissions will be simulated\n\n",ntx);
|
||||
|
||||
if (apmode==QRA_USERAP) {
|
||||
// This will enable K1JT's decoder to look for cq/qrz calls [CQ/QRZ ? ?/b]
|
||||
printf("K1JT decoder enabled for [CQ ? ?/blank]\n");
|
||||
qra64_apset(codec_k1jt, CALL_K1JT,0,0,APTYPE_CQQRZ);
|
||||
|
||||
// This will enable K1JT's decoder to look for calls directed to him [K1JT ? ?/b]
|
||||
printf("K1JT decoder enabled for [K1JT ? ?/blank]\n");
|
||||
qra64_apset(codec_k1jt, CALL_K1JT,0,0,APTYPE_MYCALL);
|
||||
|
||||
// This will enable K1JT's decoder to look for msges sent by IV3NWV [? IV3NWV ?]
|
||||
printf("K1JT decoder enabled for [? IV3NWV ?/blank]\n");
|
||||
qra64_apset(codec_k1jt, 0,CALL_IV3NWV,GRID_BLANK,APTYPE_HISCALL);
|
||||
|
||||
// This will enable K1JT's decoder to look for IV3NWV calls directed to him [K1JT IV3NWV ?/b]
|
||||
printf("K1JT decoder enabled for [K1JT IV3NWV ?]\n");
|
||||
qra64_apset(codec_k1jt, CALL_K1JT,CALL_IV3NWV,0,APTYPE_BOTHCALLS);
|
||||
|
||||
// This will enable K1JT's decoder to look for full-knowledge [K1JT IV3NWV JN66] msgs
|
||||
printf("K1JT decoder enabled for [K1JT IV3NWV JN66]\n");
|
||||
qra64_apset(codec_k1jt, CALL_K1JT,CALL_IV3NWV,GRID_JN66,APTYPE_FULL);
|
||||
|
||||
// This will enable K1JT's decoder to look for calls from IV3NWV [CQ IV3NWV ?/b] msgs
|
||||
printf("K1JT decoder enabled for [CQ IV3NWV ?/b/JN66]\n");
|
||||
qra64_apset(codec_k1jt, 0,CALL_IV3NWV,GRID_JN66,APTYPE_CQHISCALL);
|
||||
|
||||
}
|
||||
|
||||
printf("\nNow decoding with K1JT's decoder...\n");
|
||||
/*
|
||||
if (channel_type==2) // simulate a fast-faded signal
|
||||
printf("Simulating a fast-fading channel with given B90 and spread type\n");
|
||||
else
|
||||
printf("Simulating a %s channel\n",channel_type?"Rayleigh block fading":"AWGN");
|
||||
*/
|
||||
for (k=0;k<ntx;k++) {
|
||||
|
||||
if ((k%10)==0)
|
||||
printf(" %5.1f %%\r",100.0*k/ntx);
|
||||
// printf("."); // work in progress
|
||||
|
||||
if (channel_type==2) {
|
||||
// generate a fast-faded signal
|
||||
rc = qra64_fastfading_channel(&rx,y,submode,EbNodB,B90,fadingModel);
|
||||
if (rc<0) {
|
||||
printf("\nqra64_fastfading_channel error. rc=%d\n",rc);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else // generate a awgn or Rayleigh block fading signal
|
||||
rx = mfskchannel(y, channel_type, EbNodB);
|
||||
|
||||
|
||||
if (channel_type==2) // fast-fading case
|
||||
if (olddec==1) {
|
||||
int k, j;
|
||||
int jj = 1<<submode;
|
||||
int bps = QRA64_M*(2+jj);
|
||||
float *rxbase;
|
||||
float *out = rxolddec;
|
||||
// calc energies at nominal freqs
|
||||
for (k=0;k<QRA64_N;k++) {
|
||||
rxbase = rx + QRA64_M + k*bps;
|
||||
for (j=0;j<QRA64_M;j++) {
|
||||
*out++=*rxbase;
|
||||
rxbase+=jj;
|
||||
}
|
||||
}
|
||||
// decode with awgn decoder
|
||||
rc = qra64_decode(codec_k1jt,&ebnodbest,xdec,rxolddec);
|
||||
}
|
||||
else // use fast-fading decoder
|
||||
rc = qra64_decode_fastfading(codec_k1jt,&ebnodbest,xdec,rx,submode,B90,fadingModel);
|
||||
else // awgn or rayleigh channel. use the old decoder whatever the olddec option is
|
||||
rc = qra64_decode(codec_k1jt,&ebnodbest,xdec,rx);
|
||||
|
||||
|
||||
|
||||
if (rc>=0) {
|
||||
ebnodbavg +=ebnodbest;
|
||||
if (memcmp(xdec,x,12*sizeof(int))==0)
|
||||
ndecok[rc]++;
|
||||
else {
|
||||
fprintf(stderr,"\nUndetected error with rc=%d\n",rc);
|
||||
nundet++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
printf(" %5.1f %%\r",100.0*k/ntx);
|
||||
|
||||
printf("\n\n");
|
||||
|
||||
printf("Msgs transmitted:%d\nMsg decoded:\n\n",ntx);
|
||||
for (k=0;k<12;k++) {
|
||||
printf("rc=%2d %3d with %s\n",k,ndecok[k],decode_type[k]);
|
||||
ndec += ndecok[k];
|
||||
}
|
||||
printf("\nTotal: %d/%d (%d undetected errors)\n\n",ndec,ntx,nundet);
|
||||
printf("");
|
||||
|
||||
if (ndec>0) {
|
||||
ebnodbavg/=(ndec+nundet);
|
||||
printf("Estimated SNR (average in dB) = %.2f dB\n\n",ebnodbavg-QRA64_SNR_EBNO_OFFSET);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void syntax(void)
|
||||
{
|
||||
|
||||
printf("\nQRA64 Mode Tests\n");
|
||||
printf("2016, Nico Palermo - IV3NWV\n\n");
|
||||
printf("---------------------------\n\n");
|
||||
printf("Syntax: qra64 [-s<snrdb>] [-c<channel>] [-a<ap-type>] [-t<testtype>] [-h]\n");
|
||||
printf("Options: \n");
|
||||
printf(" -s<snrdb> : set simulation SNR in 2500 Hz BW (default:-27.5 dB)\n");
|
||||
printf(" -c<channel> : set channel type 0=AWGN (default) 1=Rayleigh 2=Fast-fading\n");
|
||||
printf(" -a<ap-type> : set decode type 0=NOAP 1=AUTOAP (default) 2=USERAP\n");
|
||||
printf(" -t<testtype>: 0=simulate seq of msgs between IV3NWV and K1JT (default)\n");
|
||||
printf(" 1=simulate K1JT receiving K1JT IV3NWV JN66\n");
|
||||
printf(" 2=simulate fast-fading/awgn/rayliegh decoders performance\n");
|
||||
printf(" -n<ntx> : simulate the transmission of ntx codewords (default=100)\n");
|
||||
|
||||
printf("Options used only for fast-fading simulations (-c2):\n");
|
||||
printf(" -b : 90%% fading bandwidth in Hz [1..230 Hz] (default = 2.5 Hz)\n");
|
||||
printf(" -m : fading model. 0=Gauss, 1=Lorentz (default = Lorentz)\n");
|
||||
printf(" -q : qra64 submode. 0=QRA64A,... 4=QRA64E (default = QRA64A)\n");
|
||||
printf(" -d : use the old awgn decoder\n");
|
||||
printf(" -h: this help\n");
|
||||
printf("Example:\n");
|
||||
printf(" qra64 -t2 -c2 -a2 -b50 -m1 -q2 -n10000 -s-26\n");
|
||||
printf(" runs the error performance test (-t2)\n");
|
||||
printf(" with USER_AP (-a2)\n");
|
||||
printf(" simulating a fast fading channel (-c2)\n");
|
||||
printf(" with B90 = 50 Hz (-b50), Lorentz Doppler (-m1), mode QRA64C (-q2)\n");
|
||||
printf(" ntx = 10000 codewords (-n10000) and SNR = -26 dB (-s-26)\n");
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int k, rc, nok=0;
|
||||
float SNRdB = -27.5f;
|
||||
unsigned int channel = CHANNEL_AWGN;
|
||||
unsigned int mode = QRA_AUTOAP;
|
||||
unsigned int testtype=0;
|
||||
int nqso = 100;
|
||||
float EbNodB;
|
||||
float B90 = 2.5;
|
||||
int fadingModel = 1;
|
||||
int submode = 0;
|
||||
int olddec = 0;
|
||||
int ntx = 100;
|
||||
|
||||
// Parse the command line
|
||||
while(--argc) {
|
||||
argv++;
|
||||
|
||||
if (strncmp(*argv,"-h",2)==0) {
|
||||
syntax();
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
if (strncmp(*argv,"-n",2)==0) {
|
||||
ntx = ( int)atoi((*argv)+2);
|
||||
if (ntx<100 || ntx>1000000) {
|
||||
printf("Invalid -n option. ntx must be in the range [100..1000000]\n");
|
||||
syntax();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (strncmp(*argv,"-a",2)==0) {
|
||||
mode = ( int)atoi((*argv)+2);
|
||||
if (mode>2) {
|
||||
printf("Invalid decoding mode\n");
|
||||
syntax();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (strncmp(*argv,"-s",2)==0) {
|
||||
SNRdB = (float)atof((*argv)+2);
|
||||
if (SNRdB>20 || SNRdB<-50) {
|
||||
printf("SNR should be in the range [-50..20]\n");
|
||||
syntax();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (strncmp(*argv,"-t",2)==0) {
|
||||
testtype = ( int)atoi((*argv)+2);
|
||||
if (testtype>2) {
|
||||
printf("Invalid test type\n");
|
||||
syntax();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (strncmp(*argv,"-c",2)==0) {
|
||||
channel = ( int)atoi((*argv)+2);
|
||||
if (channel>CHANNEL_FASTFADE) {
|
||||
printf("Invalid channel type\n");
|
||||
syntax();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (strncmp(*argv,"-b",2)==0) {
|
||||
B90 = (float)atof((*argv)+2);
|
||||
if (B90<1 || B90>230) {
|
||||
printf("Invalid B90\n");
|
||||
syntax();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (strncmp(*argv,"-m",2)==0) {
|
||||
fadingModel = (int)atoi((*argv)+2);
|
||||
if (fadingModel<0 || fadingModel>1) {
|
||||
printf("Invalid fading model\n");
|
||||
syntax();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (strncmp(*argv,"-q",2)==0) {
|
||||
submode = (int)atoi((*argv)+2);
|
||||
if (submode<0 || submode>4) {
|
||||
printf("Invalid submode\n");
|
||||
syntax();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (strncmp(*argv,"-d",2)==0) {
|
||||
olddec = 1;
|
||||
}
|
||||
else {
|
||||
printf("Invalid option\n");
|
||||
syntax();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (testtype<2) // old tests
|
||||
if (channel==CHANNEL_FASTFADE) {
|
||||
printf("Invalid Option. Test type 0 and 1 supports only AWGN or Rayleigh Channel model\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
EbNodB = SNRdB+QRA64_SNR_EBNO_OFFSET;
|
||||
|
||||
#if defined(__linux__) || defined(__unix__)
|
||||
srand48(GetTickCount());
|
||||
#endif
|
||||
|
||||
if (testtype==0) {
|
||||
for (k=0;k<nqso;k++) {
|
||||
printf("\n\n------------------------\n");
|
||||
rc = test_proc_1(channel, EbNodB, mode);
|
||||
if (rc==0)
|
||||
nok++;
|
||||
}
|
||||
printf("\n\n%d/%d QSOs to end without repetitions\n",nok,nqso);
|
||||
printf("Input SNR = %.1fdB channel=%s ap-mode=%s\n\n",
|
||||
SNRdB,
|
||||
channel==CHANNEL_AWGN?"AWGN":"RAYLEIGH",
|
||||
apmode_type[mode]
|
||||
);
|
||||
}
|
||||
else if (testtype==1) {
|
||||
test_proc_2(channel, EbNodB, mode);
|
||||
printf("Input SNR = %.1fdB channel=%s ap-mode=%s\n\n",
|
||||
SNRdB,
|
||||
channel==CHANNEL_AWGN?"AWGN":"RAYLEIGH",
|
||||
apmode_type[mode]
|
||||
);
|
||||
}
|
||||
else {
|
||||
printf("Input SNR = %.1fdB ap-mode=%s\n\n",
|
||||
SNRdB,
|
||||
apmode_type[mode]
|
||||
);
|
||||
test_fastfading(EbNodB,B90,fadingModel,submode,mode,olddec, channel, ntx);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
subroutine shell(n,a)
|
||||
integer n
|
||||
real a(n)
|
||||
integer i,j,inc
|
||||
real v
|
||||
|
||||
inc=1
|
||||
1 inc=3*inc+1
|
||||
if(inc.le.n) go to 1
|
||||
2 inc=inc/3
|
||||
|
||||
do i=inc+1,n
|
||||
v=a(i)
|
||||
j=i
|
||||
3 if(a(j-inc).gt.v) then
|
||||
a(j)=a(j-inc)
|
||||
j=j-inc
|
||||
if(j.le.inc) go to 4
|
||||
go to 3
|
||||
endif
|
||||
4 a(j)=v
|
||||
enddo
|
||||
|
||||
if(inc.gt.1) go to 2
|
||||
|
||||
return
|
||||
end subroutine shell
|
||||
@@ -0,0 +1,50 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2005-2012. 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)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef BOOST_INTERPROCESS_CONFIG_INCLUDED
|
||||
#define BOOST_INTERPROCESS_CONFIG_INCLUDED
|
||||
#include <boost/config.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning (push)
|
||||
#pragma warning (disable : 4702) // unreachable code
|
||||
#pragma warning (disable : 4706) // assignment within conditional expression
|
||||
#pragma warning (disable : 4127) // conditional expression is constant
|
||||
#pragma warning (disable : 4146) // unary minus operator applied to unsigned type, result still unsigned
|
||||
#pragma warning (disable : 4284) // odd return type for operator->
|
||||
#pragma warning (disable : 4244) // possible loss of data
|
||||
#pragma warning (disable : 4251) // "identifier" : class "type" needs to have dll-interface to be used by clients of class "type2"
|
||||
#pragma warning (disable : 4267) // conversion from "X" to "Y", possible loss of data
|
||||
#pragma warning (disable : 4275) // non DLL-interface classkey "identifier" used as base for DLL-interface classkey "identifier"
|
||||
#pragma warning (disable : 4355) // "this" : used in base member initializer list
|
||||
#pragma warning (disable : 4345) // behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized
|
||||
#pragma warning (disable : 4503) // "identifier" : decorated name length exceeded, name was truncated
|
||||
#pragma warning (disable : 4511) // copy constructor could not be generated
|
||||
#pragma warning (disable : 4512) // assignment operator could not be generated
|
||||
#pragma warning (disable : 4514) // unreferenced inline removed
|
||||
#pragma warning (disable : 4521) // Disable "multiple copy constructors specified"
|
||||
#pragma warning (disable : 4522) // "class" : multiple assignment operators specified
|
||||
#pragma warning (disable : 4675) // "method" should be declared "static" and have exactly one parameter
|
||||
#pragma warning (disable : 4710) // function not inlined
|
||||
#pragma warning (disable : 4711) // function selected for automatic inline expansion
|
||||
#pragma warning (disable : 4786) // identifier truncated in debug info
|
||||
#pragma warning (disable : 4996) // "function": was declared deprecated
|
||||
#pragma warning (disable : 4197) // top-level volatile in cast is ignored
|
||||
#pragma warning (disable : 4541) // 'typeid' used on polymorphic type 'boost::exception'
|
||||
// with /GR-; unpredictable behavior may result
|
||||
#pragma warning (disable : 4673) // throwing '' the following types will not be considered at the catch site
|
||||
#pragma warning (disable : 4671) // the copy constructor is inaccessible
|
||||
#pragma warning (disable : 4250) // inherits 'x' via dominance
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_GCC) && (BOOST_GCC >= 40600)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 84 KiB |
@@ -0,0 +1,60 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 1999-2003 Jaakko Jarvi
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_AS_FUSION_ELEMENT_05052005_0338)
|
||||
#define FUSION_AS_FUSION_ELEMENT_05052005_0338
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
|
||||
#ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
|
||||
#include <functional>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
template <typename T>
|
||||
struct as_fusion_element
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct as_fusion_element<reference_wrapper<T> >
|
||||
{
|
||||
typedef T& type;
|
||||
};
|
||||
|
||||
#ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
|
||||
template <typename T>
|
||||
struct as_fusion_element<std::reference_wrapper<T> >
|
||||
{
|
||||
typedef T& type;
|
||||
};
|
||||
#endif
|
||||
|
||||
template <typename T, int N>
|
||||
struct as_fusion_element<T[N]>
|
||||
{
|
||||
typedef const T(&type)[N];
|
||||
};
|
||||
|
||||
template <typename T, int N>
|
||||
struct as_fusion_element<volatile T[N]>
|
||||
{
|
||||
typedef const volatile T(&type)[N];
|
||||
};
|
||||
|
||||
template <typename T, int N>
|
||||
struct as_fusion_element<const volatile T[N]>
|
||||
{
|
||||
typedef const volatile T(&type)[N];
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,148 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See http://boostorg.github.com/compute for more information.
|
||||
//---------------------------------------------------------------------------//
|
||||
|
||||
#ifndef BOOST_COMPUTE_LAMBDA_GET_HPP
|
||||
#define BOOST_COMPUTE_LAMBDA_GET_HPP
|
||||
|
||||
#include <boost/preprocessor/repetition.hpp>
|
||||
|
||||
#include <boost/compute/config.hpp>
|
||||
#include <boost/compute/functional/get.hpp>
|
||||
#include <boost/compute/lambda/placeholder.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
namespace lambda {
|
||||
namespace detail {
|
||||
|
||||
// function wrapper for get<N>() in lambda expressions
|
||||
template<size_t N>
|
||||
struct get_func
|
||||
{
|
||||
template<class Expr, class Args>
|
||||
struct lambda_result
|
||||
{
|
||||
typedef typename proto::result_of::child_c<Expr, 1>::type Arg;
|
||||
typedef typename ::boost::compute::lambda::result_of<Arg, Args>::type T;
|
||||
typedef typename ::boost::compute::detail::get_result_type<N, T>::type type;
|
||||
};
|
||||
|
||||
template<class Context, class Arg>
|
||||
struct make_get_result_type
|
||||
{
|
||||
typedef typename boost::remove_cv<
|
||||
typename boost::compute::lambda::result_of<
|
||||
Arg, typename Context::args_tuple
|
||||
>::type
|
||||
>::type type;
|
||||
};
|
||||
|
||||
// returns the suffix string for get<N>() in lambda expressions
|
||||
// (e.g. ".x" for get<0>() with float4)
|
||||
template<class T>
|
||||
struct make_get_suffix
|
||||
{
|
||||
static std::string value()
|
||||
{
|
||||
BOOST_STATIC_ASSERT(N < 16);
|
||||
|
||||
std::stringstream stream;
|
||||
|
||||
if(N < 10){
|
||||
stream << ".s" << uint_(N);
|
||||
}
|
||||
else if(N < 16){
|
||||
stream << ".s" << char('a' + (N - 10));
|
||||
}
|
||||
|
||||
return stream.str();
|
||||
}
|
||||
};
|
||||
|
||||
// get<N>() specialization for std::pair<T1, T2>
|
||||
template<class T1, class T2>
|
||||
struct make_get_suffix<std::pair<T1, T2> >
|
||||
{
|
||||
static std::string value()
|
||||
{
|
||||
BOOST_STATIC_ASSERT(N < 2);
|
||||
|
||||
if(N == 0){
|
||||
return ".first";
|
||||
}
|
||||
else {
|
||||
return ".second";
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// get<N>() specialization for boost::tuple<T...>
|
||||
#define BOOST_COMPUTE_LAMBDA_GET_MAKE_TUPLE_SUFFIX(z, n, unused) \
|
||||
template<BOOST_PP_ENUM_PARAMS(n, class T)> \
|
||||
struct make_get_suffix<boost::tuple<BOOST_PP_ENUM_PARAMS(n, T)> > \
|
||||
{ \
|
||||
static std::string value() \
|
||||
{ \
|
||||
BOOST_STATIC_ASSERT(N < n); \
|
||||
return ".v" + boost::lexical_cast<std::string>(N); \
|
||||
} \
|
||||
};
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(1, BOOST_COMPUTE_MAX_ARITY, BOOST_COMPUTE_LAMBDA_GET_MAKE_TUPLE_SUFFIX, ~)
|
||||
|
||||
#undef BOOST_COMPUTE_LAMBDA_GET_MAKE_TUPLE_SUFFIX
|
||||
|
||||
template<class Context, class Arg>
|
||||
static void dispatch_apply_terminal(Context &ctx, const Arg &arg)
|
||||
{
|
||||
typedef typename make_get_result_type<Context, Arg>::type T;
|
||||
|
||||
proto::eval(arg, ctx);
|
||||
ctx.stream << make_get_suffix<T>::value();
|
||||
}
|
||||
|
||||
template<class Context, int I>
|
||||
static void dispatch_apply_terminal(Context &ctx, placeholder<I>)
|
||||
{
|
||||
ctx.stream << ::boost::compute::get<N>()(::boost::get<I>(ctx.args));
|
||||
}
|
||||
|
||||
template<class Context, class Arg>
|
||||
static void dispatch_apply(Context &ctx, const Arg &arg, proto::tag::terminal)
|
||||
{
|
||||
dispatch_apply_terminal(ctx, proto::value(arg));
|
||||
}
|
||||
|
||||
template<class Context, class Arg>
|
||||
static void apply(Context &ctx, const Arg &arg)
|
||||
{
|
||||
dispatch_apply(ctx, arg, typename proto::tag_of<Arg>::type());
|
||||
}
|
||||
};
|
||||
|
||||
} // end detail namespace
|
||||
|
||||
// get<N>()
|
||||
template<size_t N, class Arg>
|
||||
inline typename proto::result_of::make_expr<
|
||||
proto::tag::function, detail::get_func<N>, const Arg&
|
||||
>::type const
|
||||
get(const Arg &arg)
|
||||
{
|
||||
return proto::make_expr<proto::tag::function>(
|
||||
detail::get_func<N>(), ::boost::ref(arg)
|
||||
);
|
||||
}
|
||||
|
||||
} // end lambda namespace
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_LAMBDA_GET_HPP
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -0,0 +1,122 @@
|
||||
// (C) Copyright Gennadiy Rozental 2001.
|
||||
// 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)
|
||||
|
||||
// See http://www.boost.org/libs/test for the library home page.
|
||||
//
|
||||
/// @file
|
||||
/// @brief defines testing result reporter interfaces
|
||||
///
|
||||
/// This file defines interfaces that are responsible for results reporting. Interface is presented in a form of
|
||||
/// free standing function implemented in namespace result_reporter
|
||||
// ***************************************************************************
|
||||
|
||||
#ifndef BOOST_TEST_RESULTS_REPORTER_HPP_021205GER
|
||||
#define BOOST_TEST_RESULTS_REPORTER_HPP_021205GER
|
||||
|
||||
// Boost.Test
|
||||
#include <boost/test/detail/global_typedef.hpp>
|
||||
#include <boost/test/detail/fwd_decl.hpp>
|
||||
|
||||
// STL
|
||||
#include <iosfwd> // for std::ostream&
|
||||
|
||||
#include <boost/test/detail/suppress_warnings.hpp>
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
namespace boost {
|
||||
namespace unit_test {
|
||||
|
||||
/// Namespace for results reporter interfaces
|
||||
namespace results_reporter {
|
||||
|
||||
// ************************************************************************** //
|
||||
/// @brief Results report formatter interface
|
||||
///
|
||||
/// This is abstract interface for the report formatter used by results reporter routines.
|
||||
/// You can define a custom formatter by implementing this interface and setting the formatter using set_format function.
|
||||
/// This is usually done during test module initialization
|
||||
// ************************************************************************** //
|
||||
|
||||
class BOOST_TEST_DECL format {
|
||||
public:
|
||||
// Destructor
|
||||
virtual ~format() {}
|
||||
|
||||
virtual void results_report_start( std::ostream& ostr ) = 0;
|
||||
virtual void results_report_finish( std::ostream& ostr ) = 0;
|
||||
|
||||
virtual void test_unit_report_start( test_unit const&, std::ostream& ostr ) = 0;
|
||||
virtual void test_unit_report_finish( test_unit const&, std::ostream& ostr ) = 0;
|
||||
|
||||
virtual void do_confirmation_report( test_unit const&, std::ostream& ostr ) = 0;
|
||||
};
|
||||
|
||||
// ************************************************************************** //
|
||||
/// @name report configuration
|
||||
// ************************************************************************** //
|
||||
|
||||
/// Sets reporting level
|
||||
|
||||
/// There are only four possible levels for results report:
|
||||
/// - confirmation report (boost::unit_test::CONFIRMATION_REPORT). This report level only produces short confirmation
|
||||
/// message about test module pass/fail status
|
||||
/// - short report (boost::unit_test::SHORT_REPORT). This report level produces short summary report for failed/passed
|
||||
/// assertions and test units.
|
||||
/// - detailed report (boost::unit_test::DETAILED_REPORT). This report level produces detailed report per test unit for
|
||||
/// passed/failed assertions and uncaught exceptions
|
||||
/// - no report (boost::unit_test::NO_REPORT). This report level produces no results report. This is used for test modules
|
||||
/// running as part of some kind of continues integration framework
|
||||
/// @param[in] l report level
|
||||
BOOST_TEST_DECL void set_level( report_level l );
|
||||
|
||||
/// Sets output stream for results reporting
|
||||
|
||||
/// By default std::cerr is used. Use this function to set a different stream. The framework
|
||||
/// refers to the stream by reference, so you need to make sure the stream object lifetime exceeds the testing main scope.
|
||||
BOOST_TEST_DECL void set_stream( std::ostream& );
|
||||
|
||||
/// Sets one of the predefined formats
|
||||
|
||||
/// The framework implements two results report formats:
|
||||
/// - plain human readable format (boost::unit_test::OF_CLF)
|
||||
/// - XML format (boost::unit_test::OF_XML)
|
||||
/// @param[in] of one of the presefined enumeration values for output formats
|
||||
BOOST_TEST_DECL void set_format( output_format of );
|
||||
|
||||
/// Sets custom report formatter
|
||||
|
||||
/// The framework takes ownership of the pointer passed as an argument. So this should be a pointer to
|
||||
/// a heap allocated object
|
||||
/// @param[in] f pointer to heap allocated instance of custom report formatter class
|
||||
BOOST_TEST_DECL void set_format( results_reporter::format* f );
|
||||
|
||||
/// @brief Access to configured results reporter stream
|
||||
///
|
||||
/// Use this stream to report additional information abut test module execution
|
||||
BOOST_TEST_DECL std::ostream& get_stream();
|
||||
|
||||
/// @}
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** report initiation ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
BOOST_TEST_DECL void make_report( report_level l = INV_REPORT_LEVEL, test_unit_id = INV_TEST_UNIT_ID );
|
||||
inline void confirmation_report( test_unit_id id = INV_TEST_UNIT_ID )
|
||||
{ make_report( CONFIRMATION_REPORT, id ); }
|
||||
inline void short_report( test_unit_id id = INV_TEST_UNIT_ID )
|
||||
{ make_report( SHORT_REPORT, id ); }
|
||||
inline void detailed_report( test_unit_id id = INV_TEST_UNIT_ID )
|
||||
{ make_report( DETAILED_REPORT, id ); }
|
||||
|
||||
} // namespace results_reporter
|
||||
} // namespace unit_test
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/test/detail/enable_warnings.hpp>
|
||||
|
||||
#endif // BOOST_TEST_RESULTS_REPORTER_HPP_021205GER
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
|
||||
// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
|
||||
// (C) Copyright Eric Friedman 2002-2003.
|
||||
// (C) Copyright Antony Polukhin 2013.
|
||||
// Use, modification and distribution are subject to 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).
|
||||
//
|
||||
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
|
||||
|
||||
#ifndef BOOST_TT_HAS_TRIVIAL_MOVE_ASSIGN_HPP_INCLUDED
|
||||
#define BOOST_TT_HAS_TRIVIAL_MOVE_ASSIGN_HPP_INCLUDED
|
||||
|
||||
#include <cstddef> // size_t
|
||||
#include <boost/type_traits/intrinsics.hpp>
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
|
||||
#if !defined(BOOST_HAS_TRIVIAL_MOVE_ASSIGN) || defined(BOOST_MSVC) || defined(BOOST_INTEL)
|
||||
#include <boost/type_traits/is_pod.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/is_volatile.hpp>
|
||||
#ifdef BOOST_MSVC
|
||||
#include <boost/type_traits/is_reference.hpp>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang)
|
||||
#include <boost/type_traits/is_assignable.hpp>
|
||||
#include <boost/type_traits/is_volatile.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef __SUNPRO_CC
|
||||
#include <boost/type_traits/is_assignable.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#if __cplusplus >= 201103
|
||||
#define SOLARIS_EXTRA_CHECK && is_assignable<typename remove_const<T>::type&, typename remove_const<T>::type&&>::value
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef SOLARIS_EXTRA_CHECK
|
||||
#define SOLARIS_EXTRA_CHECK
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
template <typename T>
|
||||
struct has_trivial_move_assign : public integral_constant<bool,
|
||||
#ifdef BOOST_HAS_TRIVIAL_MOVE_ASSIGN
|
||||
BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T)
|
||||
#else
|
||||
::boost::is_pod<T>::value && !::boost::is_const<T>::value && !::boost::is_volatile<T>::value SOLARIS_EXTRA_CHECK
|
||||
#endif
|
||||
> {};
|
||||
|
||||
template <> struct has_trivial_move_assign<void> : public false_type{};
|
||||
#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
|
||||
template <> struct has_trivial_move_assign<void const> : public false_type{};
|
||||
template <> struct has_trivial_move_assign<void const volatile> : public false_type{};
|
||||
template <> struct has_trivial_move_assign<void volatile> : public false_type{};
|
||||
#endif
|
||||
template <class T> struct has_trivial_move_assign<T&> : public false_type{};
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
template <class T> struct has_trivial_move_assign<T&&> : public false_type{};
|
||||
#endif
|
||||
// Array types are not assignable:
|
||||
template <class T, std::size_t N> struct has_trivial_move_assign<T[N]> : public false_type{};
|
||||
template <class T> struct has_trivial_move_assign<T[]> : public false_type{};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#undef SOLARIS_EXTRA_CHECK
|
||||
|
||||
#endif // BOOST_TT_HAS_TRIVIAL_MOVE_ASSIGN_HPP_INCLUDED
|
||||
@@ -0,0 +1,213 @@
|
||||
// Copyright (C) 2014 Vicente J. Botet Escriba
|
||||
//
|
||||
// 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_THREAD_EXECUTORS_GENERIC_EXECUTOR_REF_HPP
|
||||
#define BOOST_THREAD_EXECUTORS_GENERIC_EXECUTOR_REF_HPP
|
||||
|
||||
#include <boost/thread/detail/config.hpp>
|
||||
|
||||
#include <boost/thread/detail/delete.hpp>
|
||||
#include <boost/thread/detail/move.hpp>
|
||||
#include <boost/thread/executors/executor.hpp>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <boost/config/abi_prefix.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace executors
|
||||
{
|
||||
|
||||
template <class Executor>
|
||||
class executor_ref : public executor
|
||||
{
|
||||
Executor& ex;
|
||||
public:
|
||||
/// type-erasure to store the works to do
|
||||
typedef executors::work work;
|
||||
|
||||
/// executor is not copyable.
|
||||
BOOST_THREAD_NO_COPYABLE(executor_ref)
|
||||
executor_ref(Executor& ex_) : ex(ex_) {}
|
||||
|
||||
/**
|
||||
* \par Effects
|
||||
* Destroys the executor.
|
||||
*
|
||||
* \par Synchronization
|
||||
* The completion of all the closures happen before the completion of the executor destructor.
|
||||
*/
|
||||
~executor_ref() {};
|
||||
|
||||
/**
|
||||
* \par Effects
|
||||
* Close the \c executor for submissions.
|
||||
* The worker threads will work until there is no more closures to run.
|
||||
*/
|
||||
void close() { ex.close(); }
|
||||
|
||||
/**
|
||||
* \par Returns
|
||||
* Whether the pool is closed for submissions.
|
||||
*/
|
||||
bool closed() { return ex.closed(); }
|
||||
|
||||
/**
|
||||
* \par Effects
|
||||
* The specified closure will be scheduled for execution at some point in the future.
|
||||
* If invoked closure throws an exception the executor will call std::terminate, as is the case with threads.
|
||||
*
|
||||
* \par Synchronization
|
||||
* Ccompletion of closure on a particular thread happens before destruction of thread's thread local variables.
|
||||
*
|
||||
* \par Throws
|
||||
* \c sync_queue_is_closed if the thread pool is closed.
|
||||
* Whatever exception that can be throw while storing the closure.
|
||||
*/
|
||||
void submit(BOOST_THREAD_RV_REF(work) closure) {
|
||||
ex.submit(boost::move(closure));
|
||||
}
|
||||
// void submit(work& closure) {
|
||||
// ex.submit(closure);
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* \par Effects
|
||||
* Try to execute one task.
|
||||
*
|
||||
* \par Returns
|
||||
* Whether a task has been executed.
|
||||
*
|
||||
* \par Throws
|
||||
* Whatever the current task constructor throws or the task() throws.
|
||||
*/
|
||||
bool try_executing_one() { return ex.try_executing_one(); }
|
||||
|
||||
};
|
||||
|
||||
class generic_executor_ref
|
||||
{
|
||||
shared_ptr<executor> ex;
|
||||
public:
|
||||
/// type-erasure to store the works to do
|
||||
typedef executors::work work;
|
||||
|
||||
template<typename Executor>
|
||||
generic_executor_ref(Executor& ex_)
|
||||
//: ex(make_shared<executor_ref<Executor> >(ex_)) // todo check why this doesn't works with C++03
|
||||
: ex( new executor_ref<Executor>(ex_) )
|
||||
{
|
||||
}
|
||||
|
||||
//generic_executor_ref(generic_executor_ref const& other) noexcept {}
|
||||
//generic_executor_ref& operator=(generic_executor_ref const& other) noexcept {}
|
||||
|
||||
|
||||
/**
|
||||
* \par Effects
|
||||
* Close the \c executor for submissions.
|
||||
* The worker threads will work until there is no more closures to run.
|
||||
*/
|
||||
void close() { ex->close(); }
|
||||
|
||||
/**
|
||||
* \par Returns
|
||||
* Whether the pool is closed for submissions.
|
||||
*/
|
||||
bool closed() { return ex->closed(); }
|
||||
|
||||
/**
|
||||
* \par Requires
|
||||
* \c Closure is a model of Callable(void()) and a model of CopyConstructible/MoveConstructible.
|
||||
*
|
||||
* \par Effects
|
||||
* The specified closure will be scheduled for execution at some point in the future.
|
||||
* If invoked closure throws an exception the thread pool will call std::terminate, as is the case with threads.
|
||||
*
|
||||
* \par Synchronization
|
||||
* Completion of closure on a particular thread happens before destruction of thread's thread local variables.
|
||||
*
|
||||
* \par Throws
|
||||
* \c sync_queue_is_closed if the thread pool is closed.
|
||||
* Whatever exception that can be throw while storing the closure.
|
||||
*/
|
||||
|
||||
void submit(BOOST_THREAD_RV_REF(work) closure)
|
||||
{
|
||||
ex->submit(boost::move(closure));
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
template <typename Closure>
|
||||
void submit(Closure & closure)
|
||||
{
|
||||
//work w ((closure));
|
||||
//submit(boost::move(w));
|
||||
submit(work(closure));
|
||||
}
|
||||
#endif
|
||||
void submit(void (*closure)())
|
||||
{
|
||||
work w ((closure));
|
||||
submit(boost::move(w));
|
||||
//submit(work(closure));
|
||||
}
|
||||
|
||||
template <typename Closure>
|
||||
void submit(BOOST_THREAD_FWD_REF(Closure) closure)
|
||||
{
|
||||
work w((boost::forward<Closure>(closure)));
|
||||
submit(boost::move(w));
|
||||
}
|
||||
|
||||
// size_t num_pending_closures() const
|
||||
// {
|
||||
// return ex->num_pending_closures();
|
||||
// }
|
||||
|
||||
/**
|
||||
* \par Effects
|
||||
* Try to execute one task.
|
||||
*
|
||||
* \par Returns
|
||||
* Whether a task has been executed.
|
||||
*
|
||||
* \par Throws
|
||||
* Whatever the current task constructor throws or the task() throws.
|
||||
*/
|
||||
bool try_executing_one() { return ex->try_executing_one(); }
|
||||
|
||||
/**
|
||||
* \par Requires
|
||||
* This must be called from an scheduled task.
|
||||
*
|
||||
* \par Effects
|
||||
* reschedule functions until pred()
|
||||
*/
|
||||
template <typename Pred>
|
||||
bool reschedule_until(Pred const& pred)
|
||||
{
|
||||
do {
|
||||
//schedule_one_or_yield();
|
||||
if ( ! try_executing_one())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} while (! pred());
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
using executors::executor_ref;
|
||||
using executors::generic_executor_ref;
|
||||
}
|
||||
|
||||
#include <boost/config/abi_suffix.hpp>
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,202 @@
|
||||
// Copyright (c) 2006 Xiaogang Zhang
|
||||
// Use, modification and distribution are subject to 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_MATH_BESSEL_Y1_HPP
|
||||
#define BOOST_MATH_BESSEL_Y1_HPP
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4702) // Unreachable code (release mode only warning)
|
||||
#endif
|
||||
|
||||
#include <boost/math/special_functions/detail/bessel_j1.hpp>
|
||||
#include <boost/math/constants/constants.hpp>
|
||||
#include <boost/math/tools/rational.hpp>
|
||||
#include <boost/math/tools/big_constant.hpp>
|
||||
#include <boost/math/policies/error_handling.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
// Bessel function of the second kind of order one
|
||||
// x <= 8, minimax rational approximations on root-bracketing intervals
|
||||
// x > 8, Hankel asymptotic expansion in Hart, Computer Approximations, 1968
|
||||
|
||||
namespace boost { namespace math { namespace detail{
|
||||
|
||||
template <typename T, typename Policy>
|
||||
T bessel_y1(T x, const Policy&);
|
||||
|
||||
template <class T, class Policy>
|
||||
struct bessel_y1_initializer
|
||||
{
|
||||
struct init
|
||||
{
|
||||
init()
|
||||
{
|
||||
do_init();
|
||||
}
|
||||
static void do_init()
|
||||
{
|
||||
bessel_y1(T(1), Policy());
|
||||
}
|
||||
void force_instantiate()const{}
|
||||
};
|
||||
static const init initializer;
|
||||
static void force_instantiate()
|
||||
{
|
||||
initializer.force_instantiate();
|
||||
}
|
||||
};
|
||||
|
||||
template <class T, class Policy>
|
||||
const typename bessel_y1_initializer<T, Policy>::init bessel_y1_initializer<T, Policy>::initializer;
|
||||
|
||||
template <typename T, typename Policy>
|
||||
T bessel_y1(T x, const Policy& pol)
|
||||
{
|
||||
bessel_y1_initializer<T, Policy>::force_instantiate();
|
||||
|
||||
static const T P1[] = {
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 4.0535726612579544093e+13)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 5.4708611716525426053e+12)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -3.7595974497819597599e+11)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 7.2144548214502560419e+09)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -5.9157479997408395984e+07)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 2.2157953222280260820e+05)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -3.1714424660046133456e+02)),
|
||||
};
|
||||
static const T Q1[] = {
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 3.0737873921079286084e+14)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 4.1272286200406461981e+12)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 2.7800352738690585613e+10)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.2250435122182963220e+08)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 3.8136470753052572164e+05)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 8.2079908168393867438e+02)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.0)),
|
||||
};
|
||||
static const T P2[] = {
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.1514276357909013326e+19)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -5.6808094574724204577e+18)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -2.3638408497043134724e+16)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 4.0686275289804744814e+15)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -5.9530713129741981618e+13)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 3.7453673962438488783e+11)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -1.1957961912070617006e+09)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.9153806858264202986e+06)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -1.2337180442012953128e+03)),
|
||||
};
|
||||
static const T Q2[] = {
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 5.3321844313316185697e+20)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 5.6968198822857178911e+18)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 3.0837179548112881950e+16)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.1187010065856971027e+14)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 3.0221766852960403645e+11)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 6.3550318087088919566e+08)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.0453748201934079734e+06)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.2855164849321609336e+03)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.0)),
|
||||
};
|
||||
static const T PC[] = {
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -4.4357578167941278571e+06)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -9.9422465050776411957e+06)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -6.6033732483649391093e+06)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -1.5235293511811373833e+06)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -1.0982405543459346727e+05)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -1.6116166443246101165e+03)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 0.0)),
|
||||
};
|
||||
static const T QC[] = {
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -4.4357578167941278568e+06)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -9.9341243899345856590e+06)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -6.5853394797230870728e+06)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -1.5118095066341608816e+06)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -1.0726385991103820119e+05)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -1.4550094401904961825e+03)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.0)),
|
||||
};
|
||||
static const T PS[] = {
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 3.3220913409857223519e+04)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 8.5145160675335701966e+04)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 6.6178836581270835179e+04)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.8494262873223866797e+04)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.7063754290207680021e+03)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 3.5265133846636032186e+01)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 0.0)),
|
||||
};
|
||||
static const T QS[] = {
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 7.0871281941028743574e+05)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.8194580422439972989e+06)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.4194606696037208929e+06)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 4.0029443582266975117e+05)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 3.7890229745772202641e+04)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 8.6383677696049909675e+02)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.0)),
|
||||
};
|
||||
static const T x1 = static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 2.1971413260310170351e+00)),
|
||||
x2 = static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 5.4296810407941351328e+00)),
|
||||
x11 = static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 5.620e+02)),
|
||||
x12 = static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.8288260310170351490e-03)),
|
||||
x21 = static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.3900e+03)),
|
||||
x22 = static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -6.4592058648672279948e-06))
|
||||
;
|
||||
T value, factor, r, rc, rs;
|
||||
|
||||
BOOST_MATH_STD_USING
|
||||
using namespace boost::math::tools;
|
||||
using namespace boost::math::constants;
|
||||
|
||||
if (x <= 0)
|
||||
{
|
||||
return policies::raise_domain_error<T>("bost::math::bessel_y1<%1%>(%1%,%1%)",
|
||||
"Got x == %1%, but x must be > 0, complex result not supported.", x, pol);
|
||||
}
|
||||
if (x <= 4) // x in (0, 4]
|
||||
{
|
||||
T y = x * x;
|
||||
T z = 2 * log(x/x1) * bessel_j1(x) / pi<T>();
|
||||
r = evaluate_rational(P1, Q1, y);
|
||||
factor = (x + x1) * ((x - x11/256) - x12) / x;
|
||||
value = z + factor * r;
|
||||
}
|
||||
else if (x <= 8) // x in (4, 8]
|
||||
{
|
||||
T y = x * x;
|
||||
T z = 2 * log(x/x2) * bessel_j1(x) / pi<T>();
|
||||
r = evaluate_rational(P2, Q2, y);
|
||||
factor = (x + x2) * ((x - x21/256) - x22) / x;
|
||||
value = z + factor * r;
|
||||
}
|
||||
else // x in (8, \infty)
|
||||
{
|
||||
T y = 8 / x;
|
||||
T y2 = y * y;
|
||||
rc = evaluate_rational(PC, QC, y2);
|
||||
rs = evaluate_rational(PS, QS, y2);
|
||||
factor = 1 / (sqrt(x) * root_pi<T>());
|
||||
//
|
||||
// This code is really just:
|
||||
//
|
||||
// T z = x - 0.75f * pi<T>();
|
||||
// value = factor * (rc * sin(z) + y * rs * cos(z));
|
||||
//
|
||||
// But using the sin/cos addition rules, plus constants for sin/cos of 3PI/4
|
||||
// which then cancel out with corresponding terms in "factor".
|
||||
//
|
||||
T sx = sin(x);
|
||||
T cx = cos(x);
|
||||
value = factor * (y * rs * (sx - cx) - rc * (sx + cx));
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
}}} // namespaces
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // BOOST_MATH_BESSEL_Y1_HPP
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
// 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_SI_CURRENT_HPP
|
||||
#define BOOST_UNITS_SI_CURRENT_HPP
|
||||
|
||||
#include <boost/units/systems/si/base.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace units {
|
||||
|
||||
namespace si {
|
||||
|
||||
typedef unit<current_dimension,si::system> current;
|
||||
|
||||
BOOST_UNITS_STATIC_CONSTANT(ampere,current);
|
||||
BOOST_UNITS_STATIC_CONSTANT(amperes,current);
|
||||
|
||||
} // namespace si
|
||||
|
||||
} // namespace units
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_UNITS_SI_CURRENT_HPP
|
||||
@@ -0,0 +1,348 @@
|
||||
// Copyright (c) 2012 Oswin Krause
|
||||
// Copyright (c) 2013 Joaquim Duran
|
||||
//
|
||||
// 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_UBLAS_MATRIX_VECTOR_HPP
|
||||
#define BOOST_UBLAS_MATRIX_VECTOR_HPP
|
||||
|
||||
#include <boost/numeric/ublas/matrix_proxy.hpp>//for matrix_row, matrix_column and matrix_expression
|
||||
#include <boost/numeric/ublas/vector.hpp>
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
|
||||
namespace boost { namespace numeric { namespace ublas {
|
||||
|
||||
namespace detail{
|
||||
|
||||
/** \brief Iterator used in the represention of a matrix as a vector of rows or columns
|
||||
*
|
||||
* Iterator used in the represention of a matrix as a vector of rows/columns. It refers
|
||||
* to the i-th element of the matrix, a column or a row depending of Reference type.
|
||||
*
|
||||
* The type of Reference should provide a constructor Reference(matrix, i)
|
||||
*
|
||||
* This iterator is invalidated when the underlying matrix is resized.
|
||||
*
|
||||
* \tparameter Matrix type of matrix that is represented as a vector of row/column
|
||||
* \tparameter Reference Matrix row or matrix column type.
|
||||
*/
|
||||
template<class Matrix, class Reference>
|
||||
class matrix_vector_iterator: public boost::iterator_facade<
|
||||
matrix_vector_iterator<Matrix,Reference>,
|
||||
typename vector_temporary_traits<Reference>::type,
|
||||
boost::random_access_traversal_tag,
|
||||
Reference
|
||||
>{
|
||||
public:
|
||||
matrix_vector_iterator(){}
|
||||
|
||||
///\brief constructs a matrix_vector_iterator as pointing to the i-th proxy
|
||||
matrix_vector_iterator(Matrix& matrix, std::size_t position)
|
||||
: matrix_(&matrix),position_(position) {}
|
||||
|
||||
template<class M, class R>
|
||||
matrix_vector_iterator(matrix_vector_iterator<M,R> const& other)
|
||||
: matrix_(other.matrix_),position_(other.position_) {}
|
||||
|
||||
private:
|
||||
friend class boost::iterator_core_access;
|
||||
template <class M,class R> friend class matrix_vector_iterator;
|
||||
|
||||
void increment() {
|
||||
++position_;
|
||||
}
|
||||
void decrement() {
|
||||
--position_;
|
||||
}
|
||||
|
||||
void advance(std::ptrdiff_t n){
|
||||
position_ += n;
|
||||
}
|
||||
|
||||
template<class M,class R>
|
||||
std::ptrdiff_t distance_to(matrix_vector_iterator<M,R> const& other) const{
|
||||
BOOST_UBLAS_CHECK (matrix_ == other.matrix_, external_logic ());
|
||||
return (std::ptrdiff_t)other.position_ - (std::ptrdiff_t)position_;
|
||||
}
|
||||
|
||||
template<class M,class R>
|
||||
bool equal(matrix_vector_iterator<M,R> const& other) const{
|
||||
BOOST_UBLAS_CHECK (matrix_ == other.matrix_, external_logic ());
|
||||
return (position_ == other.position_);
|
||||
}
|
||||
Reference dereference() const {
|
||||
return Reference(*matrix_,position_);
|
||||
}
|
||||
|
||||
Matrix* matrix_;//no matrix_closure here to ensure easy usage
|
||||
std::size_t position_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/** \brief Represents a \c Matrix as a vector of rows.
|
||||
*
|
||||
* Implements an interface to Matrix that the underlaying matrix is represented as a
|
||||
* vector of rows.
|
||||
*
|
||||
* The vector could be resized which causes the resize of the number of rows of
|
||||
* the underlaying matrix.
|
||||
*/
|
||||
template<class Matrix>
|
||||
class matrix_row_vector {
|
||||
public:
|
||||
typedef ublas::matrix_row<Matrix> value_type;
|
||||
typedef ublas::matrix_row<Matrix> reference;
|
||||
typedef ublas::matrix_row<Matrix const> const_reference;
|
||||
|
||||
typedef ublas::detail::matrix_vector_iterator<Matrix, ublas::matrix_row<Matrix> > iterator;
|
||||
typedef ublas::detail::matrix_vector_iterator<Matrix const, ublas::matrix_row<Matrix const> const> const_iterator;
|
||||
typedef boost::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef boost::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
typedef typename boost::iterator_difference<iterator>::type difference_type;
|
||||
typedef typename Matrix::size_type size_type;
|
||||
|
||||
matrix_row_vector(Matrix& matrix) :
|
||||
matrix_(matrix) {
|
||||
}
|
||||
|
||||
|
||||
iterator begin(){
|
||||
return iterator(matrix_, 0);
|
||||
}
|
||||
|
||||
const_iterator begin() const {
|
||||
return const_iterator(matrix_, 0);
|
||||
}
|
||||
|
||||
const_iterator cbegin() const {
|
||||
return begin();
|
||||
}
|
||||
|
||||
iterator end() {
|
||||
return iterator(matrix_, matrix_.size1());
|
||||
}
|
||||
|
||||
const_iterator end() const {
|
||||
return const_iterator(matrix_, matrix_.size1());
|
||||
}
|
||||
|
||||
const_iterator cend() const {
|
||||
return end();
|
||||
}
|
||||
|
||||
reverse_iterator rbegin() {
|
||||
return reverse_iterator(end());
|
||||
}
|
||||
|
||||
const_reverse_iterator rbegin() const {
|
||||
return const_reverse_iterator(end());
|
||||
}
|
||||
|
||||
const_reverse_iterator crbegin() const {
|
||||
return rbegin();
|
||||
}
|
||||
|
||||
reverse_iterator rend() {
|
||||
return reverse_iterator(begin());
|
||||
}
|
||||
|
||||
const_reverse_iterator rend() const {
|
||||
return const_reverse_iterator(begin());
|
||||
}
|
||||
|
||||
const_reverse_iterator crend() const {
|
||||
return end();
|
||||
}
|
||||
|
||||
value_type operator()(difference_type index) const {
|
||||
return value_type(matrix_, index);
|
||||
}
|
||||
|
||||
reference operator[](difference_type index){
|
||||
return reference(matrix_, index);
|
||||
}
|
||||
|
||||
const_reference operator[](difference_type index) const {
|
||||
return const_reference(matrix_, index);
|
||||
}
|
||||
|
||||
size_type size() const {
|
||||
return matrix_.size1();
|
||||
}
|
||||
|
||||
void resize(size_type size, bool preserve = true) {
|
||||
matrix_.resize(size, matrix_.size2(), preserve);
|
||||
}
|
||||
|
||||
private:
|
||||
Matrix& matrix_;
|
||||
};
|
||||
|
||||
|
||||
/** \brief Convenience function to create \c matrix_row_vector.
|
||||
*
|
||||
* Function to create \c matrix_row_vector objects.
|
||||
* \param matrix the \c matrix_expression that generates the matrix that \c matrix_row_vector is referring.
|
||||
* \return Created \c matrix_row_vector object.
|
||||
*
|
||||
* \tparam Matrix the type of matrix that \c matrix_row_vector is referring.
|
||||
*/
|
||||
template<class Matrix>
|
||||
matrix_row_vector<Matrix> make_row_vector(matrix_expression<Matrix>& matrix){
|
||||
return matrix_row_vector<Matrix>(matrix());
|
||||
}
|
||||
|
||||
|
||||
/** \brief Convenience function to create \c matrix_row_vector.
|
||||
*
|
||||
* Function to create \c matrix_row_vector objects.
|
||||
* \param matrix the \c matrix_expression that generates the matrix that \c matrix_row_vector is referring.
|
||||
* \return Created \c matrix_row_vector object.
|
||||
*
|
||||
* \tparam Matrix the type of matrix that \c matrix_row_vector is referring.
|
||||
*/
|
||||
template<class Matrix>
|
||||
matrix_row_vector<Matrix const> make_row_vector(matrix_expression<Matrix> const& matrix){
|
||||
return matrix_row_vector<Matrix const>(matrix());
|
||||
}
|
||||
|
||||
|
||||
/** \brief Represents a \c Matrix as a vector of columns.
|
||||
*
|
||||
* Implements an interface to Matrix that the underlaying matrix is represented as a
|
||||
* vector of columns.
|
||||
*
|
||||
* The vector could be resized which causes the resize of the number of columns of
|
||||
* the underlaying matrix.
|
||||
*/
|
||||
template<class Matrix>
|
||||
class matrix_column_vector
|
||||
{
|
||||
public:
|
||||
typedef ublas::matrix_column<Matrix> value_type;
|
||||
typedef ublas::matrix_column<Matrix> reference;
|
||||
typedef const ublas::matrix_column<Matrix const> const_reference;
|
||||
|
||||
typedef ublas::detail::matrix_vector_iterator<Matrix, ublas::matrix_column<Matrix> > iterator;
|
||||
typedef ublas::detail::matrix_vector_iterator<Matrix const, ublas::matrix_column<Matrix const> const > const_iterator;
|
||||
typedef boost::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef boost::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
typedef typename boost::iterator_difference<iterator>::type difference_type;
|
||||
typedef typename Matrix::size_type size_type;
|
||||
|
||||
matrix_column_vector(Matrix& matrix) :
|
||||
matrix_(matrix){
|
||||
}
|
||||
|
||||
iterator begin() {
|
||||
return iterator(matrix_, 0);
|
||||
}
|
||||
|
||||
const_iterator begin() const {
|
||||
return const_iterator(matrix_, 0);
|
||||
}
|
||||
|
||||
const_iterator cbegin() const {
|
||||
return begin();
|
||||
}
|
||||
|
||||
iterator end() {
|
||||
return iterator(matrix_, matrix_.size2());
|
||||
}
|
||||
|
||||
const_iterator end() const {
|
||||
return const_iterator(matrix_, matrix_.size2());
|
||||
}
|
||||
|
||||
const_iterator cend() const {
|
||||
return end();
|
||||
}
|
||||
|
||||
reverse_iterator rbegin() {
|
||||
return reverse_iterator(end());
|
||||
}
|
||||
|
||||
const_reverse_iterator rbegin() const {
|
||||
return const_reverse_iterator(end());
|
||||
}
|
||||
|
||||
const_reverse_iterator crbegin() const {
|
||||
return rbegin();
|
||||
}
|
||||
|
||||
reverse_iterator rend() {
|
||||
return reverse_iterator(begin());
|
||||
}
|
||||
|
||||
const_reverse_iterator rend() const {
|
||||
return const_reverse_iterator(begin());
|
||||
}
|
||||
|
||||
const_reverse_iterator crend() const {
|
||||
return rend();
|
||||
}
|
||||
|
||||
value_type operator()(difference_type index) const {
|
||||
return value_type(matrix_, index);
|
||||
}
|
||||
|
||||
reference operator[](difference_type index) {
|
||||
return reference(matrix_, index);
|
||||
}
|
||||
|
||||
const_reference operator[](difference_type index) const {
|
||||
return const_reference(matrix_, index);
|
||||
}
|
||||
|
||||
size_type size() const {
|
||||
return matrix_.size2();
|
||||
}
|
||||
|
||||
void resize(size_type size, bool preserve = true) {
|
||||
matrix_.resize(matrix_.size1(), size, preserve);
|
||||
}
|
||||
|
||||
private:
|
||||
Matrix& matrix_;
|
||||
};
|
||||
|
||||
|
||||
/** \brief Convenience function to create \c matrix_column_vector.
|
||||
*
|
||||
* Function to create \c matrix_column_vector objects.
|
||||
* \param matrix the \c matrix_expression that generates the matrix that \c matrix_column_vector is referring.
|
||||
* \return Created \c matrix_column_vector object.
|
||||
*
|
||||
* \tparam Matrix the type of matrix that \c matrix_column_vector is referring.
|
||||
*/
|
||||
template<class Matrix>
|
||||
matrix_column_vector<Matrix> make_column_vector(matrix_expression<Matrix>& matrix){
|
||||
return matrix_column_vector<Matrix>(matrix());
|
||||
}
|
||||
|
||||
|
||||
/** \brief Convenience function to create \c matrix_column_vector.
|
||||
*
|
||||
* Function to create \c matrix_column_vector objects.
|
||||
* \param matrix the \c matrix_expression that generates the matrix that \c matrix_column_vector is referring.
|
||||
* \return Created \c matrix_column_vector object.
|
||||
*
|
||||
* \tparam Matrix the type of matrix that \c matrix_column_vector is referring.
|
||||
*/
|
||||
template<class Matrix>
|
||||
matrix_column_vector<Matrix const> make_column_vector(matrix_expression<Matrix> const& matrix){
|
||||
return matrix_column_vector<Matrix const>(matrix());
|
||||
}
|
||||
|
||||
}}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,193 @@
|
||||
// Copyright David Abrahams 2003. Use, modification and distribution is
|
||||
// subject to 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 FACADE_ITERATOR_CATEGORY_DWA20031118_HPP
|
||||
# define FACADE_ITERATOR_CATEGORY_DWA20031118_HPP
|
||||
|
||||
# include <boost/iterator/iterator_categories.hpp>
|
||||
|
||||
# include <boost/mpl/or.hpp> // used in iterator_tag inheritance logic
|
||||
# include <boost/mpl/and.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/mpl/eval_if.hpp>
|
||||
# include <boost/mpl/identity.hpp>
|
||||
# include <boost/mpl/assert.hpp>
|
||||
|
||||
# include <boost/type_traits/is_same.hpp>
|
||||
# include <boost/type_traits/is_const.hpp>
|
||||
# include <boost/type_traits/is_reference.hpp>
|
||||
# include <boost/type_traits/is_convertible.hpp>
|
||||
|
||||
# include <boost/type_traits/is_same.hpp>
|
||||
|
||||
# include <boost/iterator/detail/config_def.hpp> // try to keep this last
|
||||
|
||||
# ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY
|
||||
# include <boost/detail/indirect_traits.hpp>
|
||||
# endif
|
||||
|
||||
//
|
||||
// iterator_category deduction for iterator_facade
|
||||
//
|
||||
|
||||
namespace boost {
|
||||
namespace iterators {
|
||||
|
||||
// forward declaration
|
||||
struct use_default;
|
||||
|
||||
namespace detail {
|
||||
|
||||
struct input_output_iterator_tag
|
||||
: std::input_iterator_tag
|
||||
{
|
||||
// Using inheritance for only input_iterator_tag helps to avoid
|
||||
// ambiguities when a stdlib implementation dispatches on a
|
||||
// function which is overloaded on both input_iterator_tag and
|
||||
// output_iterator_tag, as STLPort does, in its __valid_range
|
||||
// function. I claim it's better to avoid the ambiguity in these
|
||||
// cases.
|
||||
operator std::output_iterator_tag() const
|
||||
{
|
||||
return std::output_iterator_tag();
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// True iff the user has explicitly disabled writability of this
|
||||
// iterator. Pass the iterator_facade's Value parameter and its
|
||||
// nested ::reference type.
|
||||
//
|
||||
template <class ValueParam, class Reference>
|
||||
struct iterator_writability_disabled
|
||||
# ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY // Adding Thomas' logic?
|
||||
: mpl::or_<
|
||||
is_const<Reference>
|
||||
, boost::detail::indirect_traits::is_reference_to_const<Reference>
|
||||
, is_const<ValueParam>
|
||||
>
|
||||
# else
|
||||
: is_const<ValueParam>
|
||||
# endif
|
||||
{};
|
||||
|
||||
|
||||
//
|
||||
// Convert an iterator_facade's traversal category, Value parameter,
|
||||
// and ::reference type to an appropriate old-style category.
|
||||
//
|
||||
// Due to changeset 21683, this now never results in a category convertible
|
||||
// to output_iterator_tag.
|
||||
//
|
||||
// Change at: https://svn.boost.org/trac/boost/changeset/21683
|
||||
template <class Traversal, class ValueParam, class Reference>
|
||||
struct iterator_facade_default_category
|
||||
: mpl::eval_if<
|
||||
mpl::and_<
|
||||
is_reference<Reference>
|
||||
, is_convertible<Traversal,forward_traversal_tag>
|
||||
>
|
||||
, mpl::eval_if<
|
||||
is_convertible<Traversal,random_access_traversal_tag>
|
||||
, mpl::identity<std::random_access_iterator_tag>
|
||||
, mpl::if_<
|
||||
is_convertible<Traversal,bidirectional_traversal_tag>
|
||||
, std::bidirectional_iterator_tag
|
||||
, std::forward_iterator_tag
|
||||
>
|
||||
>
|
||||
, typename mpl::eval_if<
|
||||
mpl::and_<
|
||||
is_convertible<Traversal, single_pass_traversal_tag>
|
||||
|
||||
// check for readability
|
||||
, is_convertible<Reference, ValueParam>
|
||||
>
|
||||
, mpl::identity<std::input_iterator_tag>
|
||||
, mpl::identity<Traversal>
|
||||
>
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
// True iff T is convertible to an old-style iterator category.
|
||||
template <class T>
|
||||
struct is_iterator_category
|
||||
: mpl::or_<
|
||||
is_convertible<T,std::input_iterator_tag>
|
||||
, is_convertible<T,std::output_iterator_tag>
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_iterator_traversal
|
||||
: is_convertible<T,incrementable_traversal_tag>
|
||||
{};
|
||||
|
||||
//
|
||||
// A composite iterator_category tag convertible to Category (a pure
|
||||
// old-style category) and Traversal (a pure traversal tag).
|
||||
// Traversal must be a strict increase of the traversal power given by
|
||||
// Category.
|
||||
//
|
||||
template <class Category, class Traversal>
|
||||
struct iterator_category_with_traversal
|
||||
: Category, Traversal
|
||||
{
|
||||
// Make sure this isn't used to build any categories where
|
||||
// convertibility to Traversal is redundant. Should just use the
|
||||
// Category element in that case.
|
||||
BOOST_MPL_ASSERT_NOT((
|
||||
is_convertible<
|
||||
typename iterator_category_to_traversal<Category>::type
|
||||
, Traversal
|
||||
>));
|
||||
|
||||
BOOST_MPL_ASSERT((is_iterator_category<Category>));
|
||||
BOOST_MPL_ASSERT_NOT((is_iterator_category<Traversal>));
|
||||
BOOST_MPL_ASSERT_NOT((is_iterator_traversal<Category>));
|
||||
# if !BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310))
|
||||
BOOST_MPL_ASSERT((is_iterator_traversal<Traversal>));
|
||||
# endif
|
||||
};
|
||||
|
||||
// Computes an iterator_category tag whose traversal is Traversal and
|
||||
// which is appropriate for an iterator
|
||||
template <class Traversal, class ValueParam, class Reference>
|
||||
struct facade_iterator_category_impl
|
||||
{
|
||||
BOOST_MPL_ASSERT_NOT((is_iterator_category<Traversal>));
|
||||
|
||||
typedef typename iterator_facade_default_category<
|
||||
Traversal,ValueParam,Reference
|
||||
>::type category;
|
||||
|
||||
typedef typename mpl::if_<
|
||||
is_same<
|
||||
Traversal
|
||||
, typename iterator_category_to_traversal<category>::type
|
||||
>
|
||||
, category
|
||||
, iterator_category_with_traversal<category,Traversal>
|
||||
>::type type;
|
||||
};
|
||||
|
||||
//
|
||||
// Compute an iterator_category for iterator_facade
|
||||
//
|
||||
template <class CategoryOrTraversal, class ValueParam, class Reference>
|
||||
struct facade_iterator_category
|
||||
: mpl::eval_if<
|
||||
is_iterator_category<CategoryOrTraversal>
|
||||
, mpl::identity<CategoryOrTraversal> // old-style categories are fine as-is
|
||||
, facade_iterator_category_impl<CategoryOrTraversal,ValueParam,Reference>
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
}}} // namespace boost::iterators::detail
|
||||
|
||||
# include <boost/iterator/detail/config_undef.hpp>
|
||||
|
||||
#endif // FACADE_ITERATOR_CATEGORY_DWA20031118_HPP
|
||||
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
[auto_generated]
|
||||
boost/numeric/odeint/stepper/symplectic_rkn_sb3a_m4_mclachlan.hpp
|
||||
|
||||
[begin_description]
|
||||
tba.
|
||||
[end_description]
|
||||
|
||||
Copyright 2012-2013 Karsten Ahnert
|
||||
Copyright 2012-2013 Mario Mulansky
|
||||
|
||||
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_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_RKN_SB3A_M4_MCLACHLAN_HPP_DEFINED
|
||||
#define BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_RKN_SB3A_M4_MCLACHLAN_HPP_DEFINED
|
||||
|
||||
#include <boost/numeric/odeint/algebra/default_operations.hpp>
|
||||
#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp>
|
||||
#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp>
|
||||
|
||||
#include <boost/numeric/odeint/util/resizer.hpp>
|
||||
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace odeint {
|
||||
|
||||
#ifndef DOXYGEN_SKIP
|
||||
namespace detail {
|
||||
namespace symplectic_rkn_sb3a_m4_mclachlan {
|
||||
|
||||
/*
|
||||
exp( a1 t A ) exp( b1 t B )
|
||||
exp( a2 t A ) exp( b2 t B )
|
||||
exp( a3 t A )
|
||||
exp( b2 t B ) exp( a2 t A )
|
||||
exp( b1 t B ) exp( a1 t A )
|
||||
*/
|
||||
|
||||
|
||||
|
||||
template< class Value >
|
||||
struct coef_a_type : public boost::array< Value , 5 >
|
||||
{
|
||||
coef_a_type( void )
|
||||
{
|
||||
using std::sqrt;
|
||||
|
||||
Value z = sqrt( static_cast< Value >( 7 ) / static_cast< Value >( 8 ) ) / static_cast< Value >( 3 );
|
||||
(*this)[0] = static_cast< Value >( 1 ) / static_cast< Value >( 2 ) - z ;
|
||||
(*this)[1] = static_cast< Value >( -1 ) / static_cast< Value >( 3 ) + z ;
|
||||
(*this)[2] = static_cast< Value >( 2 ) / static_cast< Value >( 3 );
|
||||
(*this)[3] = (*this)[1];
|
||||
(*this)[4] = (*this)[0];
|
||||
}
|
||||
};
|
||||
|
||||
template< class Value >
|
||||
struct coef_b_type : public boost::array< Value , 5 >
|
||||
{
|
||||
coef_b_type( void )
|
||||
{
|
||||
(*this)[0] = static_cast< Value >( 1 );
|
||||
(*this)[1] = static_cast< Value >( -1 ) / static_cast< Value >( 2 );
|
||||
(*this)[2] = (*this)[1];
|
||||
(*this)[3] = (*this)[0];
|
||||
(*this)[4] = static_cast< Value >( 0 );
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace symplectic_rkn_sb3a_m4_mclachlan
|
||||
} // namespace detail
|
||||
#endif // DOXYGEN_SKIP
|
||||
|
||||
|
||||
|
||||
|
||||
template<
|
||||
class Coor ,
|
||||
class Momentum = Coor ,
|
||||
class Value = double ,
|
||||
class CoorDeriv = Coor ,
|
||||
class MomentumDeriv = Coor ,
|
||||
class Time = Value ,
|
||||
class Algebra = typename algebra_dispatcher< Coor >::algebra_type ,
|
||||
class Operations = typename operations_dispatcher< Coor >::operations_type ,
|
||||
class Resizer = initially_resizer
|
||||
>
|
||||
#ifndef DOXYGEN_SKIP
|
||||
class symplectic_rkn_sb3a_m4_mclachlan :
|
||||
public symplectic_nystroem_stepper_base
|
||||
<
|
||||
5 , 4 ,
|
||||
Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer
|
||||
>
|
||||
#else
|
||||
class symplectic_rkn_sb3a_m4_mclachlan : public symplectic_nystroem_stepper_base
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
#ifndef DOXYGEN_SKIP
|
||||
typedef symplectic_nystroem_stepper_base
|
||||
<
|
||||
5 , 4 ,
|
||||
Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer
|
||||
> stepper_base_type;
|
||||
#endif
|
||||
typedef typename stepper_base_type::algebra_type algebra_type;
|
||||
typedef typename stepper_base_type::value_type value_type;
|
||||
|
||||
|
||||
symplectic_rkn_sb3a_m4_mclachlan( const algebra_type &algebra = algebra_type() )
|
||||
: stepper_base_type(
|
||||
detail::symplectic_rkn_sb3a_m4_mclachlan::coef_a_type< value_type >() ,
|
||||
detail::symplectic_rkn_sb3a_m4_mclachlan::coef_b_type< value_type >() ,
|
||||
algebra )
|
||||
{ }
|
||||
};
|
||||
|
||||
|
||||
/***************** DOXYGEN ***************/
|
||||
|
||||
/**
|
||||
* \class symplectic_rkn_sb3a_m4_mclachlan
|
||||
* \brief Implementation of the symmetric B3A Runge-Kutta Nystroem method of fifth order.
|
||||
*
|
||||
* The method is of fourth order and has five stages. It is described HERE. This method can be used
|
||||
* with multiprecision types since the coefficients are defined analytically.
|
||||
*
|
||||
* ToDo: add reference to paper.
|
||||
*
|
||||
* \tparam Order The order of the stepper.
|
||||
* \tparam Coor The type representing the coordinates q.
|
||||
* \tparam Momentum The type representing the coordinates p.
|
||||
* \tparam Value The basic value type. Should be something like float, double or a high-precision type.
|
||||
* \tparam CoorDeriv The type representing the time derivative of the coordinate dq/dt.
|
||||
* \tparam MomemtnumDeriv The type representing the time derivative of the momentum dp/dt.
|
||||
* \tparam Time The type representing the time t.
|
||||
* \tparam Algebra The algebra.
|
||||
* \tparam Operations The operations.
|
||||
* \tparam Resizer The resizer policy.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn symplectic_rkn_sb3a_m4_mclachlan::symplectic_rkn_sb3a_m4_mclachlan( const algebra_type &algebra )
|
||||
* \brief Constructs the symplectic_rkn_sb3a_m4_mclachlan. This constructor can be used as a default
|
||||
* constructor if the algebra has a default constructor.
|
||||
* \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
|
||||
*/
|
||||
|
||||
} // namespace odeint
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_RKN_SB3A_M4_MCLACHLAN_HPP_DEFINED
|
||||
@@ -0,0 +1,402 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2003 Joel de Guzman
|
||||
Copyright (c) 2001-2003 Daniel Nuffer
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
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_SPIRIT_CHSET_OPERATORS_HPP
|
||||
#define BOOST_SPIRIT_CHSET_OPERATORS_HPP
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
#include <boost/spirit/home/classic/utility/chset.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// chset free operators
|
||||
//
|
||||
// Where a and b are both chsets, implements:
|
||||
//
|
||||
// a | b, a & b, a - b, a ^ b
|
||||
//
|
||||
// Where a is a chset, implements:
|
||||
//
|
||||
// ~a
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator~(chset<CharT> const& a);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator|(chset<CharT> const& a, chset<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator&(chset<CharT> const& a, chset<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator-(chset<CharT> const& a, chset<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator^(chset<CharT> const& a, chset<CharT> const& b);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// range <--> chset free operators
|
||||
//
|
||||
// Where a is a chset and b is a range, and vice-versa, implements:
|
||||
//
|
||||
// a | b, a & b, a - b, a ^ b
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator|(chset<CharT> const& a, range<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator&(chset<CharT> const& a, range<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator-(chset<CharT> const& a, range<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator^(chset<CharT> const& a, range<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator|(range<CharT> const& a, chset<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator&(range<CharT> const& a, chset<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator-(range<CharT> const& a, chset<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator^(range<CharT> const& a, chset<CharT> const& b);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// chlit <--> chset free operators
|
||||
//
|
||||
// Where a is a chset and b is a chlit, and vice-versa, implements:
|
||||
//
|
||||
// a | b, a & b, a - b, a ^ b
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator|(chset<CharT> const& a, chlit<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator&(chset<CharT> const& a, chlit<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator-(chset<CharT> const& a, chlit<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator^(chset<CharT> const& a, chlit<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator|(chlit<CharT> const& a, chset<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator&(chlit<CharT> const& a, chset<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator-(chlit<CharT> const& a, chset<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator^(chlit<CharT> const& a, chset<CharT> const& b);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// negated_char_parser<range> <--> chset free operators
|
||||
//
|
||||
// Where a is a chset and b is a range, and vice-versa, implements:
|
||||
//
|
||||
// a | b, a & b, a - b, a ^ b
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator|(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator&(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator-(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator^(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator|(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator&(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator-(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator^(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// negated_char_parser<chlit> <--> chset free operators
|
||||
//
|
||||
// Where a is a chset and b is a chlit, and vice-versa, implements:
|
||||
//
|
||||
// a | b, a & b, a - b, a ^ b
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator|(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator&(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator-(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator^(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator|(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator&(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator-(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator^(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// literal primitives <--> chset free operators
|
||||
//
|
||||
// Where a is a chset and b is a literal primitive,
|
||||
// and vice-versa, implements:
|
||||
//
|
||||
// a | b, a & b, a - b, a ^ b
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator|(chset<CharT> const& a, CharT b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator&(chset<CharT> const& a, CharT b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator-(chset<CharT> const& a, CharT b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator^(chset<CharT> const& a, CharT b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator|(CharT a, chset<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator&(CharT a, chset<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator-(CharT a, chset<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator^(CharT a, chset<CharT> const& b);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// anychar_parser <--> chset free operators
|
||||
//
|
||||
// Where a is chset and b is a anychar_parser, and vice-versa, implements:
|
||||
//
|
||||
// a | b, a & b, a - b, a ^ b
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator|(chset<CharT> const& a, anychar_parser b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator&(chset<CharT> const& a, anychar_parser b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator-(chset<CharT> const& a, anychar_parser b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator^(chset<CharT> const& a, anychar_parser b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator|(anychar_parser a, chset<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator&(anychar_parser a, chset<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator-(anychar_parser a, chset<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator^(anychar_parser a, chset<CharT> const& b);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// nothing_parser <--> chset free operators
|
||||
//
|
||||
// Where a is chset and b is nothing_parser, and vice-versa, implements:
|
||||
//
|
||||
// a | b, a & b, a - b, a ^ b
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator|(chset<CharT> const& a, nothing_parser b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator&(chset<CharT> const& a, nothing_parser b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator-(chset<CharT> const& a, nothing_parser b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator^(chset<CharT> const& a, nothing_parser b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator|(nothing_parser a, chset<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator&(nothing_parser a, chset<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator-(nothing_parser a, chset<CharT> const& b);
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
chset<CharT>
|
||||
operator^(nothing_parser a, chset<CharT> const& b);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}} // namespace BOOST_SPIRIT_CLASSIC_NS
|
||||
|
||||
#endif
|
||||
|
||||
#include <boost/spirit/home/classic/utility/impl/chset_operators.ipp>
|
||||
@@ -0,0 +1,43 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_REPLACE_08182005_0830)
|
||||
#define FUSION_REPLACE_08182005_0830
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/view/transform_view/transform_view.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/detail/replace.hpp>
|
||||
#include <boost/fusion/support/is_sequence.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence, typename T>
|
||||
struct replace
|
||||
{
|
||||
typedef transform_view<Sequence, detail::replacer<T> > type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename
|
||||
enable_if<
|
||||
traits::is_sequence<Sequence>
|
||||
, typename result_of::replace<Sequence const, T>::type
|
||||
>::type
|
||||
replace(Sequence const& seq, T const& old_value, T const& new_value)
|
||||
{
|
||||
typedef typename result_of::replace<Sequence const, T>::type result;
|
||||
detail::replacer<T> f(old_value, new_value);
|
||||
return result(seq, f);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user