Initial Commit

This commit is contained in:
Jordan Sherer
2018-02-08 21:28:33 -05:00
commit 678c1d3966
14352 changed files with 3176737 additions and 0 deletions
@@ -0,0 +1,41 @@
/*=============================================================================
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_BEGIN_IMPL_05042005_1136)
#define FUSION_BEGIN_IMPL_05042005_1136
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/vector/vector_iterator.hpp>
namespace boost { namespace fusion
{
struct vector_tag;
namespace extension
{
template <typename Tag>
struct begin_impl;
template <>
struct begin_impl<vector_tag>
{
template <typename Sequence>
struct apply
{
typedef vector_iterator<Sequence, 0> type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Sequence& v)
{
return type(v);
}
};
};
}
}}
#endif
@@ -0,0 +1,30 @@
/*=============================================================================
Copyright (c) 2012 Nathan Ridge
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_FUSION_SUPPORT_AS_CONST_HPP
#define BOOST_FUSION_SUPPORT_AS_CONST_HPP
#include <boost/config.hpp>
#include <boost/fusion/support/config.hpp>
namespace boost { namespace fusion { namespace extension
{
// A customization point that allows certain wrappers around
// Fusion sequence elements (e.g. adt_attribute_proxy) to be
// unwrapped in contexts where the element only needs to be
// read. The library wraps accesses to Fusion elements in
// such contexts with calls to this function. Users can
// specialize this function for their own wrappers.
template <typename T>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline const T& as_const(const T& obj) BOOST_NOEXCEPT
{
return obj;
}
}}}
#endif
@@ -0,0 +1,123 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
// no include guards, this file is intended for multiple inclusion
// input: BOOST_FT_syntax type macro to use
// input: BOOST_FT_cc empty or cc specifier
// input: BOOST_FT_ell empty or "..."
// input: BOOST_FT_cv empty or cv qualifiers
// input: BOOST_FT_flags single decimal integer encoding the flags
// output: BOOST_FT_n number of component types (arity+1)
// output: BOOST_FT_arity current arity
// output: BOOST_FT_type macro that expands to the type
// output: BOOST_FT_tplargs(p) template arguments with given prefix
// output: BOOST_FT_params(p) parameters with given prefix
# include <boost/function_types/detail/components_impl/arity30_1.hpp>
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30, typename L>
struct components_impl<BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 BOOST_FT_ell) BOOST_FT_cv, L>
{
typedef encode_bits<BOOST_FT_flags,BOOST_FT_cc_id> bits;
typedef constant<BOOST_FT_full_mask> mask;
typedef function_types::components<BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 BOOST_FT_ell) BOOST_FT_cv, L> type;
typedef components_mpl_sequence_tag tag;
typedef mpl::integral_c<std::size_t,31> function_arity;
typedef mpl::vector32< R, typename class_transform<T0 BOOST_FT_cv, L> ::type , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 > types;
};
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31, typename L>
struct components_impl<BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 BOOST_FT_ell) BOOST_FT_cv, L>
{
typedef encode_bits<BOOST_FT_flags,BOOST_FT_cc_id> bits;
typedef constant<BOOST_FT_full_mask> mask;
typedef function_types::components<BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 BOOST_FT_ell) BOOST_FT_cv, L> type;
typedef components_mpl_sequence_tag tag;
typedef mpl::integral_c<std::size_t,32> function_arity;
typedef mpl::vector33< R, typename class_transform<T0 BOOST_FT_cv, L> ::type , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 > types;
};
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32, typename L>
struct components_impl<BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 BOOST_FT_ell) BOOST_FT_cv, L>
{
typedef encode_bits<BOOST_FT_flags,BOOST_FT_cc_id> bits;
typedef constant<BOOST_FT_full_mask> mask;
typedef function_types::components<BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 BOOST_FT_ell) BOOST_FT_cv, L> type;
typedef components_mpl_sequence_tag tag;
typedef mpl::integral_c<std::size_t,33> function_arity;
typedef mpl::vector34< R, typename class_transform<T0 BOOST_FT_cv, L> ::type , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 > types;
};
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33, typename L>
struct components_impl<BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 BOOST_FT_ell) BOOST_FT_cv, L>
{
typedef encode_bits<BOOST_FT_flags,BOOST_FT_cc_id> bits;
typedef constant<BOOST_FT_full_mask> mask;
typedef function_types::components<BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 BOOST_FT_ell) BOOST_FT_cv, L> type;
typedef components_mpl_sequence_tag tag;
typedef mpl::integral_c<std::size_t,34> function_arity;
typedef mpl::vector35< R, typename class_transform<T0 BOOST_FT_cv, L> ::type , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 > types;
};
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34, typename L>
struct components_impl<BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 BOOST_FT_ell) BOOST_FT_cv, L>
{
typedef encode_bits<BOOST_FT_flags,BOOST_FT_cc_id> bits;
typedef constant<BOOST_FT_full_mask> mask;
typedef function_types::components<BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 BOOST_FT_ell) BOOST_FT_cv, L> type;
typedef components_mpl_sequence_tag tag;
typedef mpl::integral_c<std::size_t,35> function_arity;
typedef mpl::vector36< R, typename class_transform<T0 BOOST_FT_cv, L> ::type , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 > types;
};
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35, typename L>
struct components_impl<BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 BOOST_FT_ell) BOOST_FT_cv, L>
{
typedef encode_bits<BOOST_FT_flags,BOOST_FT_cc_id> bits;
typedef constant<BOOST_FT_full_mask> mask;
typedef function_types::components<BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 BOOST_FT_ell) BOOST_FT_cv, L> type;
typedef components_mpl_sequence_tag tag;
typedef mpl::integral_c<std::size_t,36> function_arity;
typedef mpl::vector37< R, typename class_transform<T0 BOOST_FT_cv, L> ::type , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 > types;
};
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36, typename L>
struct components_impl<BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 BOOST_FT_ell) BOOST_FT_cv, L>
{
typedef encode_bits<BOOST_FT_flags,BOOST_FT_cc_id> bits;
typedef constant<BOOST_FT_full_mask> mask;
typedef function_types::components<BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 BOOST_FT_ell) BOOST_FT_cv, L> type;
typedef components_mpl_sequence_tag tag;
typedef mpl::integral_c<std::size_t,37> function_arity;
typedef mpl::vector38< R, typename class_transform<T0 BOOST_FT_cv, L> ::type , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 > types;
};
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37, typename L>
struct components_impl<BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 BOOST_FT_ell) BOOST_FT_cv, L>
{
typedef encode_bits<BOOST_FT_flags,BOOST_FT_cc_id> bits;
typedef constant<BOOST_FT_full_mask> mask;
typedef function_types::components<BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 BOOST_FT_ell) BOOST_FT_cv, L> type;
typedef components_mpl_sequence_tag tag;
typedef mpl::integral_c<std::size_t,38> function_arity;
typedef mpl::vector39< R, typename class_transform<T0 BOOST_FT_cv, L> ::type , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 > types;
};
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38, typename L>
struct components_impl<BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 BOOST_FT_ell) BOOST_FT_cv, L>
{
typedef encode_bits<BOOST_FT_flags,BOOST_FT_cc_id> bits;
typedef constant<BOOST_FT_full_mask> mask;
typedef function_types::components<BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 BOOST_FT_ell) BOOST_FT_cv, L> type;
typedef components_mpl_sequence_tag tag;
typedef mpl::integral_c<std::size_t,39> function_arity;
typedef mpl::vector40< R, typename class_transform<T0 BOOST_FT_cv, L> ::type , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 > types;
};
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39, typename L>
struct components_impl<BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 BOOST_FT_ell) BOOST_FT_cv, L>
{
typedef encode_bits<BOOST_FT_flags,BOOST_FT_cc_id> bits;
typedef constant<BOOST_FT_full_mask> mask;
typedef function_types::components<BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 BOOST_FT_ell) BOOST_FT_cv, L> type;
typedef components_mpl_sequence_tag tag;
typedef mpl::integral_c<std::size_t,40> function_arity;
typedef mpl::vector41< R, typename class_transform<T0 BOOST_FT_cv, L> ::type , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 > types;
};
@@ -0,0 +1,499 @@
program wspr5d
! Decode WSPR-LF data read from *.c5 or *.wav files.
! WSPR-LF is a potential WSPR-like mode intended for use at LF and MF.
! It uses an LDPC (300,60) code, OQPSK modulation, and 5 minute T/R sequences.
!
! Still to do: find and decode more than one signal in the specified passband.
! include 'wsprlf_params.f90'
parameter (NDOWN=30)
parameter (KK=60)
parameter (ND=300)
parameter (NS=109)
parameter (NR=3)
parameter (NN=NR+NS+ND)
parameter (NSPS0=8640)
parameter (NSPS=16)
parameter (N2=2*NSPS)
parameter (NZ=NSPS*NN)
parameter (NZ400=288*NN)
parameter (NMAX=300*12000)
character arg*8,message*22,cbits*50,infile*80,fname*16,datetime*11
character*120 data_dir
complex csync(0:NZ-1) !Sync symbols only, from cbb
complex c400(0:NZ400-1) !Complex waveform
complex c(0:NZ-1) !Complex waveform
complex cd(0:NZ-1) !Complex waveform
complex ca(0:NZ-1) !Complex waveform
complex zz
real*8 fMHz
real rxdata(ND),llr(ND) !Soft symbols
real pp(32) !Shaped pulse for OQPSK
real sbits(412),softbits(9)
real fpks(20)
integer id(NS+ND) !NRZ values (+/-1) for Sync and Data
integer isync(48) !Long sync vector
integer ib13(13) !Barker 13 code
integer ihdr(11)
integer*8 n8
integer*2 iwave(NMAX) !Generated full-length waveform
integer*1 idat(7)
integer*1 decoded(KK),apmask(ND),cw(ND)
integer*1 hbits(412),bits(13)
data ib13/1,1,1,1,1,-1,-1,1,1,-1,1,-1,1/
nargs=iargc()
if(nargs.lt.2) then
print*,'Usage: wspr5d [-a <data_dir>] [-f fMHz] file1 [file2 ...]'
go to 999
endif
iarg=1
data_dir="."
call getarg(iarg,arg)
if(arg(1:2).eq.'-a') then
call getarg(iarg+1,data_dir)
iarg=iarg+2
endif
call getarg(iarg,arg)
if(arg(1:2).eq.'-f') then
call getarg(iarg+1,arg)
read(arg,*) fMHz
iarg=iarg+2
endif
open(13,file=trim(data_dir)//'/ALL_WSPR.TXT',status='unknown', &
position='append')
maxn=8 !Default value
twopi=8.0*atan(1.0)
fs=NSPS*12000.0/NSPS0 !Sample rate
dt=1.0/fs !Sample interval (s)
tt=NSPS*dt !Duration of "itone" symbols (s)
ts=2*NSPS*dt !Duration of OQPSK symbols (s)
baud=1.0/tt !Keying rate for "itone" symbols (baud)
txt=NZ*dt !Transmission length (s)
do i=1,32 !Half-sine pulse shape
pp(i)=sin(0.5*(i-1)*twopi/(32))
enddo
n8=z'cbf089223a51'
do i=1,48
isync(i)=-1
if(iand(n8,1).eq.1) isync(i)=1
n8=n8/2
enddo
! Define array id() for sync symbols
id=0
do j=1,48 !First group of 48
id(2*j-1)=2*isync(j)
enddo
do j=1,13 !Barker 13 code
id(j+96)=2*ib13(j)
enddo
do j=1,48 !Second group of 48
id(2*j+109)=2*isync(j)
enddo
csync=0.
do j=1,205
if(abs(id(j)).eq.2) then
ia=nint((j-0.5)*N2)
ib=ia+N2-1
csync(ia:ib)=pp*id(j)/abs(id(j))
endif
enddo
do ifile=iarg,nargs
call getarg(ifile,infile)
open(10,file=infile,status='old',access='stream')
j1=index(infile,'.c5')
j2=index(infile,'.wav')
if(j1.gt.0) then
read(10,end=999) fname,ntrmin,fMHz,c400
read(fname(8:11),*) nutc
write(datetime,'(i11)') nutc
else if(j2.gt.0) then
read(10,end=999) ihdr,iwave
read(infile(j2-4:j2-1),*) nutc
datetime=infile(j2-11:j2-1)
call wspr5_downsample(iwave,c400)
else
print*,'Wrong file format?'
go to 999
endif
close(10)
fa=100.0
fb=150.0
fs400=400.0
call getfc1(c400,fs400,fa,fb,fc1,xsnr) !First approx for freq
!write(*,*) datetime,'initial guess ',fc1
npeaks=5
call getfc2(c400,npeaks,fs400,fc1,fpks) !Refined freq
do idf=1,npeaks ! consider the top npeak peaks
fc2=fpks(idf)
call downsample(c400,fc1+fc2,cd)
s2=sum(cd*conjg(cd))/(16*412)
cd=cd/sqrt(s2)
do is=0,8 ! dt search range is narrow, to save time.
idt=is/2
if( mod(is,2).eq. 1 ) idt=-(is+1)/2
xdt=real(22+idt)/22.222 - 1.0
ca=cshift(cd,22+idt)
do iseq=1,3 ! try sequence estimation lengths of 3, 6, and 9 bits.
k=1-2*iseq
nseq=iseq*3
do i=1,408,iseq*4
k=k+iseq*2
j=(i+1)*16
call mskseqdet(nseq,ca(j),pp,id(k),softbits,1,phase)
hbits(i:i+iseq*4)=bits
sbits(i:i+iseq*4)=bits
sbits(i+1)=softbits(1)
sbits(i+2)=softbits(2)
if( id(k+1) .ne. 0 ) sbits(i+2)=id(k+1)*25
sbits(i+3)=softbits(3)
if( iseq .ge. 2 ) then
sbits(i+5)=softbits(4)
sbits(i+6)=softbits(5)
if( id(k+3) .ne. 0 ) sbits(i+6)=id(k+3)*25
sbits(i+7)=softbits(6)
if( iseq .eq. 3 ) then
sbits(i+9)=softbits(7)
sbits(i+10)=softbits(8)
if( id(k+5) .ne. 0 ) sbits(i+10)=id(k+5)*25
sbits(i+11)=softbits(9)
endif
endif
enddo
j=1
do i=1,205
if( abs(id(i)) .ne. 2 ) then
rxdata(j)=sbits(2*i-1)
j=j+1
endif
enddo
do i=1,204
rxdata(j)=sbits(2*i)
j=j+1
enddo
rxav=sum(rxdata)/ND
rx2av=sum(rxdata*rxdata)/ND
rxsig=sqrt(rx2av-rxav*rxav)
rxdata=rxdata/rxsig
! sigma=0.84
sigma=1.20
llr=2*rxdata/(sigma*sigma)
apmask=0
max_iterations=40
ifer=0
nbadcrc=0
call bpdecode300(llr,apmask,max_iterations,decoded,niterations,cw)
! niterations will be equal to the Hamming distance between hard received word and the codeword
if(niterations.lt.0) call osd300(llr,3,decoded,niterations,cw)
if(niterations.ge.0) call chkcrc10(decoded,nbadcrc)
if(niterations.lt.0 .or. nbadcrc.ne.0) ifer=1
if( ifer.eq.0 ) then
write(cbits,1200) decoded(1:50)
1200 format(50i1)
read(cbits,1202) idat
1202 format(6b8,b2)
idat(7)=ishft(idat(7),6)
call wqdecode(idat,message,itype)
nsnr=nint(xsnr)
freq=fMHz + 1.d-6*(fc1+fc2)
nfdot=0
write(13,1210) datetime,0,nsnr,xdt,freq,message,nfdot
1210 format(a11,2i4,f6.2,f12.7,2x,a22,i3)
write(*,1212) datetime(8:11),nsnr,xdt,freq,nfdot,message,'*',idf,nseq,is,niterations
1212 format(a4,i4,f5.1,f11.6,i3,2x,a22,a1,i3,i3,i3,i4)
goto 888
endif
enddo !iseq
enddo
enddo
888 continue
enddo
write(*,1120)
1120 format("<DecodeFinished>")
999 end program wspr5d
subroutine getmetric(ib,ps,xmet)
real ps(0:511)
xm1=0
xm0=0
do i=0,511
if( iand(i/ib,1) .eq. 1 .and. ps(i) .gt. xm1 ) xm1=ps(i)
if( iand(i/ib,1) .eq. 0 .and. ps(i) .gt. xm0 ) xm0=ps(i)
enddo
xmet=xm1-xm0
return
end subroutine getmetric
subroutine mskseqdet(ns,cdat,pp,bsync,softbits,ncoh,phase)
!
! Detect sequences of 3, 6, or 9 bits (ns).
! Sync bits are assumed to be known.
!
complex cdat(16*12),cbest(16*12),cideal(16*12)
complex cdf(16*12),cfac,zz
real cm(0:511),cmbest(0:511)
real pp(32),softbits(9)
integer bit(13),bestbits(13),sgn(13)
integer bsync(7)
twopi=8.0*atan(1.0)
dt=30.0*18.0/12000.0
cmax=0;
fbest=0.0;
np=2**ns-1
idfmax=40
if( ncoh .eq. 1 ) idfmax=0
do idf=0,idfmax
if( mod(idf,2).eq.1 ) deltaf=idf/2*0.02
if( mod(idf,2).eq.1 ) deltaf=-(idf+1)/2*0.02
dphi=twopi*deltaf*dt
cfac=cmplx(cos(dphi),sin(dphi))
cdf=1.0
do i=2,16*(ns-1)
cdf(i)=cdf(i-1)*cfac
enddo
cm=0
ibflag=0
do i=0,np
bit(1)=(bsync(1)+2)/4
bit(2)=iand(i/(2**(ns-1)),1)
bit(3)=iand(i/(2**(ns-2)),1)
if( bsync(2).ne.0 ) then ! force the barker bits
bit(3)=(bsync(2)+2)/4
endif
bit(4)=iand(i/(2**(ns-3)),1)
bit(5)=(bsync(3)+2)/4
if( ns .ge. 6 ) then
bit(6)=iand(i/(2**(ns-4)),1)
bit(7)=iand(i/(2**(ns-5)),1)
if( bsync(4).ne.0 ) then ! force the barker bits
bit(7)=(bsync(4)+2)/4
endif
bit(8)=iand(i/(2**(ns-6)),1)
bit(9)=(bsync(5)+2)/4
if( ns .eq. 9 ) then
bit(10)=iand(i/4,1)
bit(11)=iand(i/2,1)
if( bsync(6).ne.0 ) then ! force the barker bits
bit(11)=(bsync(6)+2)/4
endif
bit(12)=iand(i/1,1)
bit(13)=(bsync(7)+2)/4
endif
endif
sgn=2*bit-1
cideal(1:16) =cmplx(sgn(1)*pp(17:32),sgn(2)*pp(1:16))
cideal(17:32) =cmplx(sgn(3)*pp(1:16),sgn(2)*pp(17:32))
cideal(33:48) =cmplx(sgn(3)*pp(17:32),sgn(4)*pp(1:16))
cideal(49:64) =cmplx(sgn(5)*pp(1:16),sgn(4)*pp(17:32))
if( ns .ge. 6 ) then
cideal(65:80) =cmplx(sgn(5)*pp(17:32),sgn(6)*pp(1:16))
cideal(81:96) =cmplx(sgn(7)*pp(1:16),sgn(6)*pp(17:32))
cideal(97:112) =cmplx(sgn(7)*pp(17:32),sgn(8)*pp(1:16))
cideal(113:128)=cmplx(sgn(9)*pp(1:16),sgn(8)*pp(17:32))
if( ns .eq. 9 ) then
cideal(129:144) =cmplx(sgn(9)*pp(17:32),sgn(10)*pp(1:16))
cideal(145:160) =cmplx(sgn(11)*pp(1:16),sgn(10)*pp(17:32))
cideal(161:176) =cmplx(sgn(11)*pp(17:32),sgn(12)*pp(1:16))
cideal(177:192)=cmplx(sgn(13)*pp(1:16),sgn(12)*pp(17:32))
endif
endif
cideal=cideal*cdf
cm(i)=abs(sum(cdat(1:64*ns/3)*conjg(cideal(1:64*ns/3))))/1.e3
if( cm(i) .gt. cmax ) then
ibflag=1
cmax=cm(i)
bestbits=bit
cbest=cideal
fbest=deltaf
zz=sum(cdat*conjg(cbest))/1.e3
phase=atan2(imag(zz),real(zz))
endif
enddo
if( ibflag .eq. 1 ) then ! new best found
cmbest=cm
endif
enddo
softbits=0.0
call getmetric(1,cmbest,softbits(ns))
call getmetric(2,cmbest,softbits(ns-1))
call getmetric(4,cmbest,softbits(ns-2))
if( ns .ge. 6 ) then
call getmetric(8,cmbest,softbits(ns-3))
call getmetric(16,cmbest,softbits(ns-4))
call getmetric(32,cmbest,softbits(ns-5))
if( ns .eq. 9 ) then
call getmetric(64,cmbest,softbits(3))
call getmetric(128,cmbest,softbits(2))
call getmetric(256,cmbest,softbits(1))
endif
endif
end subroutine mskseqdet
subroutine downsample(ci,f0,co)
parameter(NI=412*288,NO=NI/18)
complex ci(0:NI-1),ct(0:NI-1)
complex co(0:NO-1)
df=400.0/NI
ct=ci
call four2a(ct,NI,1,-1,1) !c2c FFT to freq domain
i0=nint(f0/df)
co=0.0
co(0)=ct(i0)
b=3.0
do i=1,NO/2
arg=(i*df/b)**2
filt=exp(-arg)
co(i)=ct(i0+i)*filt
co(NO-i)=ct(i0-i)*filt
enddo
co=co/NO
call four2a(co,NO,1,1,1) !c2c FFT back to time domain
return
end subroutine downsample
subroutine getfc1(c,fs,fa,fb,fc1,xsnr)
! include 'wsprlf_params.f90'
parameter (NZ=288*412)
parameter (NSPS=288)
parameter (N2=2*NSPS)
parameter (NFFT1=16*NSPS)
parameter (NH1=NFFT1/2)
complex c(0:NZ-1) !Complex waveform
complex c2(0:NFFT1-1) !Short spectra
real s(-NH1+1:NH1) !Coarse spectrum
nspec=NZ/N2
df1=fs/NFFT1
s=0.
do k=1,nspec
ia=(k-1)*N2
ib=ia+N2-1
c2(0:N2-1)=c(ia:ib)
c2(N2:)=0.
call four2a(c2,NFFT1,1,-1,1)
do i=0,NFFT1-1
j=i
if(j.gt.NH1) j=j-NFFT1
s(j)=s(j) + real(c2(i))**2 + aimag(c2(i))**2
enddo
enddo
! call smo121(s,NFFT1)
smax=0.
ipk=0
fc1=0.
ia=nint(fa/df1)
ib=nint(fb/df1)
do i=ia,ib
f=i*df1
if(s(i).gt.smax) then
smax=s(i)
ipk=i
fc1=f
endif
! write(51,3001) f,s(i),db(s(i))
! 3001 format(f10.3,e12.3,f10.3)
enddo
! The following is for testing SNR calibration:
sp3n=(s(ipk-1)+s(ipk)+s(ipk+1)) !Sig + 3*noise
base=(sum(s)-sp3n)/(NFFT1-3.0) !Noise per bin
psig=sp3n-3*base !Sig only
pnoise=(2500.0/df1)*base !Noise in 2500 Hz
xsnr=db(psig/pnoise)
xsnr=xsnr+5.0
return
end subroutine getfc1
subroutine getfc2(c,npeaks,fs,fc1,fpks)
! include 'wsprlf_params.f90'
parameter (NZ=288*412)
parameter (NSPS=288)
parameter (N2=2*NSPS)
parameter (NFFT1=16*NSPS)
parameter (NH1=NFFT1/2)
complex c(0:NZ-1) !Complex waveform
complex cs(0:NZ-1) !For computing spectrum
real a(5)
real freqs(413),sp2(413),fpks(npeaks)
integer pkloc(1)
df=fs/NZ
baud=fs/NSPS
a(1)=-fc1
a(2:5)=0.
call twkfreq1(c,NZ,fs,a,cs) !Mix down by fc1
! Filter, square, then FFT to get refined carrier frequency fc2.
call four2a(cs,NZ,1,-1,1) !To freq domain
ia=nint(0.75*baud/df)
cs(ia:NZ-1-ia)=0. !Save only freqs around fc1
! do i=1,NZ/2
! filt=1/(1+((i*df)**2/(0.50*baud)**2)**8)
! cs(i)=cs(i)*filt
! cs(NZ+1-i)=cs(NZ+1-i)*filt
! enddo
call four2a(cs,NZ,1,1,1) !Back to time domain
cs=cs/NZ
cs=cs*cs !Square the data
call four2a(cs,NZ,1,-1,1) !Compute squared spectrum
! Find two peaks separated by baud
pmax=0.
fc2=0.
! ja=nint(0.3*baud/df)
ja=nint(0.5*baud/df)
k=1
sp2=0.0
do j=-ja,ja
f2=j*df
ia=nint((f2-0.5*baud)/df)
if(ia.lt.0) ia=ia+NZ
ib=nint((f2+0.5*baud)/df)
p=real(cs(ia))**2 + aimag(cs(ia))**2 + &
real(cs(ib))**2 + aimag(cs(ib))**2
if(p.gt.pmax) then
pmax=p
fc2=0.5*f2
endif
freqs(k)=0.5*f2
sp2(k)=p
k=k+1
! write(52,1200) f2,p,db(p)
!1200 format(f10.3,2f15.3)
enddo
do i=1,npeaks
pkloc=maxloc(sp2)
ipk=pkloc(1)
fpks(i)=freqs(ipk)
ipk0=max(1,ipk-2)
ipk1=min(413,ipk+2)
! ipk0=ipk
! ipk1=ipk
sp2(ipk0:ipk1)=0.0
enddo
return
end subroutine getfc2
@@ -0,0 +1,20 @@
//---------------------------------------------------------------------------//
// Copyright (c) 2013 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_CL_EXT_HPP
#define BOOST_COMPUTE_CL_EXT_HPP
#if defined(__APPLE__)
#include <OpenCL/cl_ext.h>
#else
#include <CL/cl_ext.h>
#endif
#endif // BOOST_COMPUTE_CL_EXT_HPP
@@ -0,0 +1,622 @@
// Copyright 2002 The Trustees of Indiana University.
// 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)
// Boost.MultiArray Library
// Authors: Ronald Garcia
// Jeremy Siek
// Andrew Lumsdaine
// See http://www.boost.org/libs/multi_array for documentation.
#ifndef BOOST_MULTI_ARRAY_REF_RG071801_HPP
#define BOOST_MULTI_ARRAY_REF_RG071801_HPP
//
// multi_array_ref.hpp - code for creating "views" of array data.
//
#include "boost/multi_array/base.hpp"
#include "boost/multi_array/collection_concept.hpp"
#include "boost/multi_array/concept_checks.hpp"
#include "boost/multi_array/iterator.hpp"
#include "boost/multi_array/storage_order.hpp"
#include "boost/multi_array/subarray.hpp"
#include "boost/multi_array/view.hpp"
#include "boost/multi_array/algorithm.hpp"
#include "boost/type_traits/is_integral.hpp"
#include "boost/utility/enable_if.hpp"
#include "boost/array.hpp"
#include "boost/concept_check.hpp"
#include "boost/functional.hpp"
#include "boost/limits.hpp"
#include <algorithm>
#include <cstddef>
#include <functional>
#include <numeric>
namespace boost {
template <typename T, std::size_t NumDims,
typename TPtr = const T*
>
class const_multi_array_ref :
public detail::multi_array::multi_array_impl_base<T,NumDims>
{
typedef detail::multi_array::multi_array_impl_base<T,NumDims> super_type;
public:
typedef typename super_type::value_type value_type;
typedef typename super_type::const_reference const_reference;
typedef typename super_type::const_iterator const_iterator;
typedef typename super_type::const_reverse_iterator const_reverse_iterator;
typedef typename super_type::element element;
typedef typename super_type::size_type size_type;
typedef typename super_type::difference_type difference_type;
typedef typename super_type::index index;
typedef typename super_type::extent_range extent_range;
typedef general_storage_order<NumDims> storage_order_type;
// template typedefs
template <std::size_t NDims>
struct const_array_view {
typedef boost::detail::multi_array::const_multi_array_view<T,NDims> type;
};
template <std::size_t NDims>
struct array_view {
typedef boost::detail::multi_array::multi_array_view<T,NDims> type;
};
#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
// make const_multi_array_ref a friend of itself
template <typename,std::size_t,typename>
friend class const_multi_array_ref;
#endif
// This ensures that const_multi_array_ref types with different TPtr
// types can convert to each other
template <typename OPtr>
const_multi_array_ref(const const_multi_array_ref<T,NumDims,OPtr>& other)
: base_(other.base_), storage_(other.storage_),
extent_list_(other.extent_list_),
stride_list_(other.stride_list_),
index_base_list_(other.index_base_list_),
origin_offset_(other.origin_offset_),
directional_offset_(other.directional_offset_),
num_elements_(other.num_elements_) { }
template <typename ExtentList>
explicit const_multi_array_ref(TPtr base, const ExtentList& extents) :
base_(base), storage_(c_storage_order()) {
boost::function_requires<
CollectionConcept<ExtentList> >();
index_base_list_.assign(0);
init_multi_array_ref(extents.begin());
}
template <typename ExtentList>
explicit const_multi_array_ref(TPtr base, const ExtentList& extents,
const general_storage_order<NumDims>& so) :
base_(base), storage_(so) {
boost::function_requires<
CollectionConcept<ExtentList> >();
index_base_list_.assign(0);
init_multi_array_ref(extents.begin());
}
explicit const_multi_array_ref(TPtr base,
const detail::multi_array::
extent_gen<NumDims>& ranges) :
base_(base), storage_(c_storage_order()) {
init_from_extent_gen(ranges);
}
explicit const_multi_array_ref(TPtr base,
const detail::multi_array::
extent_gen<NumDims>& ranges,
const general_storage_order<NumDims>& so) :
base_(base), storage_(so) {
init_from_extent_gen(ranges);
}
template <class InputIterator>
void assign(InputIterator begin, InputIterator end) {
boost::function_requires<InputIteratorConcept<InputIterator> >();
InputIterator in_iter = begin;
T* out_iter = base_;
std::size_t copy_count=0;
while (in_iter != end && copy_count < num_elements_) {
*out_iter++ = *in_iter++;
copy_count++;
}
}
template <class BaseList>
#ifdef BOOST_NO_SFINAE
void
#else
typename
disable_if<typename boost::is_integral<BaseList>::type,void >::type
#endif // BOOST_NO_SFINAE
reindex(const BaseList& values) {
boost::function_requires<
CollectionConcept<BaseList> >();
boost::detail::multi_array::
copy_n(values.begin(),num_dimensions(),index_base_list_.begin());
origin_offset_ =
this->calculate_origin_offset(stride_list_,extent_list_,
storage_,index_base_list_);
}
void reindex(index value) {
index_base_list_.assign(value);
origin_offset_ =
this->calculate_origin_offset(stride_list_,extent_list_,
storage_,index_base_list_);
}
template <typename SizeList>
void reshape(const SizeList& extents) {
boost::function_requires<
CollectionConcept<SizeList> >();
BOOST_ASSERT(num_elements_ ==
std::accumulate(extents.begin(),extents.end(),
size_type(1),std::multiplies<size_type>()));
std::copy(extents.begin(),extents.end(),extent_list_.begin());
this->compute_strides(stride_list_,extent_list_,storage_);
origin_offset_ =
this->calculate_origin_offset(stride_list_,extent_list_,
storage_,index_base_list_);
}
size_type num_dimensions() const { return NumDims; }
size_type size() const { return extent_list_.front(); }
// given reshaping functionality, this is the max possible size.
size_type max_size() const { return num_elements(); }
bool empty() const { return size() == 0; }
const size_type* shape() const {
return extent_list_.data();
}
const index* strides() const {
return stride_list_.data();
}
const element* origin() const { return base_+origin_offset_; }
const element* data() const { return base_; }
size_type num_elements() const { return num_elements_; }
const index* index_bases() const {
return index_base_list_.data();
}
const storage_order_type& storage_order() const {
return storage_;
}
template <typename IndexList>
const element& operator()(IndexList indices) const {
boost::function_requires<
CollectionConcept<IndexList> >();
return super_type::access_element(boost::type<const element&>(),
indices,origin(),
shape(),strides(),index_bases());
}
// Only allow const element access
const_reference operator[](index idx) const {
return super_type::access(boost::type<const_reference>(),
idx,origin(),
shape(),strides(),index_bases());
}
// see generate_array_view in base.hpp
template <int NDims>
typename const_array_view<NDims>::type
operator[](const detail::multi_array::
index_gen<NumDims,NDims>& indices)
const {
typedef typename const_array_view<NDims>::type return_type;
return
super_type::generate_array_view(boost::type<return_type>(),
indices,
shape(),
strides(),
index_bases(),
origin());
}
const_iterator begin() const {
return const_iterator(*index_bases(),origin(),
shape(),strides(),index_bases());
}
const_iterator end() const {
return const_iterator(*index_bases()+(index)*shape(),origin(),
shape(),strides(),index_bases());
}
const_reverse_iterator rbegin() const {
return const_reverse_iterator(end());
}
const_reverse_iterator rend() const {
return const_reverse_iterator(begin());
}
template <typename OPtr>
bool operator==(const
const_multi_array_ref<T,NumDims,OPtr>& rhs)
const {
if(std::equal(extent_list_.begin(),
extent_list_.end(),
rhs.extent_list_.begin()))
return std::equal(begin(),end(),rhs.begin());
else return false;
}
template <typename OPtr>
bool operator<(const
const_multi_array_ref<T,NumDims,OPtr>& rhs)
const {
return std::lexicographical_compare(begin(),end(),rhs.begin(),rhs.end());
}
template <typename OPtr>
bool operator!=(const
const_multi_array_ref<T,NumDims,OPtr>& rhs)
const {
return !(*this == rhs);
}
template <typename OPtr>
bool operator>(const
const_multi_array_ref<T,NumDims,OPtr>& rhs)
const {
return rhs < *this;
}
template <typename OPtr>
bool operator<=(const
const_multi_array_ref<T,NumDims,OPtr>& rhs)
const {
return !(*this > rhs);
}
template <typename OPtr>
bool operator>=(const
const_multi_array_ref<T,NumDims,OPtr>& rhs)
const {
return !(*this < rhs);
}
#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
protected:
#else
public:
#endif
typedef boost::array<size_type,NumDims> size_list;
typedef boost::array<index,NumDims> index_list;
// This is used by multi_array, which is a subclass of this
void set_base_ptr(TPtr new_base) { base_ = new_base; }
// This constructor supports multi_array's default constructor
// and constructors from multi_array_ref, subarray, and array_view
explicit
const_multi_array_ref(TPtr base,
const storage_order_type& so,
const index * index_bases,
const size_type* extents) :
base_(base), storage_(so), origin_offset_(0), directional_offset_(0)
{
// If index_bases or extents is null, then initialize the corresponding
// private data to zeroed lists.
if(index_bases) {
boost::detail::multi_array::
copy_n(index_bases,NumDims,index_base_list_.begin());
} else {
std::fill_n(index_base_list_.begin(),NumDims,0);
}
if(extents) {
init_multi_array_ref(extents);
} else {
boost::array<index,NumDims> extent_list;
extent_list.assign(0);
init_multi_array_ref(extent_list.begin());
}
}
TPtr base_;
storage_order_type storage_;
size_list extent_list_;
index_list stride_list_;
index_list index_base_list_;
index origin_offset_;
index directional_offset_;
size_type num_elements_;
private:
// const_multi_array_ref cannot be assigned to (no deep copies!)
const_multi_array_ref& operator=(const const_multi_array_ref& other);
void init_from_extent_gen(const
detail::multi_array::
extent_gen<NumDims>& ranges) {
typedef boost::array<index,NumDims> extent_list;
// get the index_base values
std::transform(ranges.ranges_.begin(),ranges.ranges_.end(),
index_base_list_.begin(),
boost::mem_fun_ref(&extent_range::start));
// calculate the extents
extent_list extents;
std::transform(ranges.ranges_.begin(),ranges.ranges_.end(),
extents.begin(),
boost::mem_fun_ref(&extent_range::size));
init_multi_array_ref(extents.begin());
}
#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
protected:
#else
public:
#endif
// RG - move me!
template <class InputIterator>
void init_multi_array_ref(InputIterator extents_iter) {
boost::function_requires<InputIteratorConcept<InputIterator> >();
boost::detail::multi_array::
copy_n(extents_iter,num_dimensions(),extent_list_.begin());
// Calculate the array size
num_elements_ = std::accumulate(extent_list_.begin(),extent_list_.end(),
size_type(1),std::multiplies<size_type>());
this->compute_strides(stride_list_,extent_list_,storage_);
origin_offset_ =
this->calculate_origin_offset(stride_list_,extent_list_,
storage_,index_base_list_);
directional_offset_ =
this->calculate_descending_dimension_offset(stride_list_,extent_list_,
storage_);
}
};
template <typename T, std::size_t NumDims>
class multi_array_ref :
public const_multi_array_ref<T,NumDims,T*>
{
typedef const_multi_array_ref<T,NumDims,T*> super_type;
public:
typedef typename super_type::value_type value_type;
typedef typename super_type::reference reference;
typedef typename super_type::iterator iterator;
typedef typename super_type::reverse_iterator reverse_iterator;
typedef typename super_type::const_reference const_reference;
typedef typename super_type::const_iterator const_iterator;
typedef typename super_type::const_reverse_iterator const_reverse_iterator;
typedef typename super_type::element element;
typedef typename super_type::size_type size_type;
typedef typename super_type::difference_type difference_type;
typedef typename super_type::index index;
typedef typename super_type::extent_range extent_range;
typedef typename super_type::storage_order_type storage_order_type;
typedef typename super_type::index_list index_list;
typedef typename super_type::size_list size_list;
template <std::size_t NDims>
struct const_array_view {
typedef boost::detail::multi_array::const_multi_array_view<T,NDims> type;
};
template <std::size_t NDims>
struct array_view {
typedef boost::detail::multi_array::multi_array_view<T,NDims> type;
};
template <class ExtentList>
explicit multi_array_ref(T* base, const ExtentList& extents) :
super_type(base,extents) {
boost::function_requires<
CollectionConcept<ExtentList> >();
}
template <class ExtentList>
explicit multi_array_ref(T* base, const ExtentList& extents,
const general_storage_order<NumDims>& so) :
super_type(base,extents,so) {
boost::function_requires<
CollectionConcept<ExtentList> >();
}
explicit multi_array_ref(T* base,
const detail::multi_array::
extent_gen<NumDims>& ranges) :
super_type(base,ranges) { }
explicit multi_array_ref(T* base,
const detail::multi_array::
extent_gen<NumDims>&
ranges,
const general_storage_order<NumDims>& so) :
super_type(base,ranges,so) { }
// Assignment from other ConstMultiArray types.
template <typename ConstMultiArray>
multi_array_ref& operator=(const ConstMultiArray& other) {
function_requires<
multi_array_concepts::
ConstMultiArrayConcept<ConstMultiArray,NumDims> >();
// make sure the dimensions agree
BOOST_ASSERT(other.num_dimensions() == this->num_dimensions());
BOOST_ASSERT(std::equal(other.shape(),other.shape()+this->num_dimensions(),
this->shape()));
// iterator-based copy
std::copy(other.begin(),other.end(),this->begin());
return *this;
}
multi_array_ref& operator=(const multi_array_ref& other) {
if (&other != this) {
// make sure the dimensions agree
BOOST_ASSERT(other.num_dimensions() == this->num_dimensions());
BOOST_ASSERT(std::equal(other.shape(),
other.shape()+this->num_dimensions(),
this->shape()));
// iterator-based copy
std::copy(other.begin(),other.end(),this->begin());
}
return *this;
}
element* origin() { return super_type::base_+super_type::origin_offset_; }
element* data() { return super_type::base_; }
template <class IndexList>
element& operator()(const IndexList& indices) {
boost::function_requires<
CollectionConcept<IndexList> >();
return super_type::access_element(boost::type<element&>(),
indices,origin(),
this->shape(),this->strides(),
this->index_bases());
}
reference operator[](index idx) {
return super_type::access(boost::type<reference>(),
idx,origin(),
this->shape(),this->strides(),
this->index_bases());
}
// See note attached to generate_array_view in base.hpp
template <int NDims>
typename array_view<NDims>::type
operator[](const detail::multi_array::
index_gen<NumDims,NDims>& indices) {
typedef typename array_view<NDims>::type return_type;
return
super_type::generate_array_view(boost::type<return_type>(),
indices,
this->shape(),
this->strides(),
this->index_bases(),
origin());
}
iterator begin() {
return iterator(*this->index_bases(),origin(),this->shape(),
this->strides(),this->index_bases());
}
iterator end() {
return iterator(*this->index_bases()+(index)*this->shape(),origin(),
this->shape(),this->strides(),
this->index_bases());
}
// rbegin() and rend() written naively to thwart MSVC ICE.
reverse_iterator rbegin() {
reverse_iterator ri(end());
return ri;
}
reverse_iterator rend() {
reverse_iterator ri(begin());
return ri;
}
// Using declarations don't seem to work for g++
// These are the proxies to work around this.
const element* origin() const { return super_type::origin(); }
const element* data() const { return super_type::data(); }
template <class IndexList>
const element& operator()(const IndexList& indices) const {
boost::function_requires<
CollectionConcept<IndexList> >();
return super_type::operator()(indices);
}
const_reference operator[](index idx) const {
return super_type::access(boost::type<const_reference>(),
idx,origin(),
this->shape(),this->strides(),
this->index_bases());
}
// See note attached to generate_array_view in base.hpp
template <int NDims>
typename const_array_view<NDims>::type
operator[](const detail::multi_array::
index_gen<NumDims,NDims>& indices)
const {
return super_type::operator[](indices);
}
const_iterator begin() const {
return super_type::begin();
}
const_iterator end() const {
return super_type::end();
}
const_reverse_iterator rbegin() const {
return super_type::rbegin();
}
const_reverse_iterator rend() const {
return super_type::rend();
}
protected:
// This is only supplied to support multi_array's default constructor
explicit multi_array_ref(T* base,
const storage_order_type& so,
const index* index_bases,
const size_type* extents) :
super_type(base,so,index_bases,extents) { }
};
} // namespace boost
#endif // BOOST_MULTI_ARRAY_REF_RG071801_HPP
@@ -0,0 +1,147 @@
/*=============================================================================
Copyright (c) 1998-2003 Joel de Guzman
Copyright (c) 2001 Daniel Nuffer
Copyright (c) 2002 Hartmut Kaiser
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)
=============================================================================*/
#if !defined(BOOST_SPIRIT_ALTERNATIVE_HPP)
#define BOOST_SPIRIT_ALTERNATIVE_HPP
#include <boost/spirit/home/classic/namespace.hpp>
#include <boost/spirit/home/classic/core/parser.hpp>
#include <boost/spirit/home/classic/core/primitives/primitives.hpp>
#include <boost/spirit/home/classic/core/composite/composite.hpp>
#include <boost/spirit/home/classic/meta/as_parser.hpp>
namespace boost { namespace spirit {
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
///////////////////////////////////////////////////////////////////////////
//
// alternative class
//
// Handles expressions of the form:
//
// a | b
//
// where a and b are parsers. The expression returns a composite
// parser that matches a or b. One (not both) of the operands may
// be a literal char, wchar_t or a primitive string char const*,
// wchar_t const*.
//
// The expression is short circuit evaluated. b is never touched
// when a is returns a successful match.
//
///////////////////////////////////////////////////////////////////////////
struct alternative_parser_gen;
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
#pragma warning(push)
#pragma warning(disable:4512) //assignment operator could not be generated
#endif
template <typename A, typename B>
struct alternative
: public binary<A, B, parser<alternative<A, B> > >
{
typedef alternative<A, B> self_t;
typedef binary_parser_category parser_category_t;
typedef alternative_parser_gen parser_generator_t;
typedef binary<A, B, parser<self_t> > base_t;
alternative(A const& a, B const& b)
: base_t(a, b) {}
template <typename ScannerT>
typename parser_result<self_t, ScannerT>::type
parse(ScannerT const& scan) const
{
typedef typename parser_result<self_t, ScannerT>::type result_t;
typedef typename ScannerT::iterator_t iterator_t;
{ // scope for save
iterator_t save = scan.first;
if (result_t hit = this->left().parse(scan))
return hit;
scan.first = save;
}
return this->right().parse(scan);
}
};
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
#pragma warning(pop)
#endif
struct alternative_parser_gen
{
template <typename A, typename B>
struct result
{
typedef
alternative<
typename as_parser<A>::type
, typename as_parser<B>::type
>
type;
};
template <typename A, typename B>
static alternative<
typename as_parser<A>::type
, typename as_parser<B>::type
>
generate(A const& a, B const& b)
{
return alternative<BOOST_DEDUCED_TYPENAME as_parser<A>::type,
BOOST_DEDUCED_TYPENAME as_parser<B>::type>
(as_parser<A>::convert(a), as_parser<B>::convert(b));
}
};
template <typename A, typename B>
alternative<A, B>
operator|(parser<A> const& a, parser<B> const& b);
template <typename A>
alternative<A, chlit<char> >
operator|(parser<A> const& a, char b);
template <typename B>
alternative<chlit<char>, B>
operator|(char a, parser<B> const& b);
template <typename A>
alternative<A, strlit<char const*> >
operator|(parser<A> const& a, char const* b);
template <typename B>
alternative<strlit<char const*>, B>
operator|(char const* a, parser<B> const& b);
template <typename A>
alternative<A, chlit<wchar_t> >
operator|(parser<A> const& a, wchar_t b);
template <typename B>
alternative<chlit<wchar_t>, B>
operator|(wchar_t a, parser<B> const& b);
template <typename A>
alternative<A, strlit<wchar_t const*> >
operator|(parser<A> const& a, wchar_t const* b);
template <typename B>
alternative<strlit<wchar_t const*>, B>
operator|(wchar_t const* a, parser<B> const& b);
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
}} // namespace BOOST_SPIRIT_CLASSIC_NS
#endif
#include <boost/spirit/home/classic/core/composite/impl/alternative.ipp>
@@ -0,0 +1,315 @@
// (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 algorithms for comparing floating point values
// ***************************************************************************
#ifndef BOOST_TEST_FLOATING_POINT_COMPARISON_HPP_071894GER
#define BOOST_TEST_FLOATING_POINT_COMPARISON_HPP_071894GER
// Boost.Test
#include <boost/test/detail/global_typedef.hpp>
#include <boost/test/tools/assertion_result.hpp>
// Boost
#include <boost/limits.hpp> // for std::numeric_limits
#include <boost/static_assert.hpp>
#include <boost/assert.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/type_traits/is_floating_point.hpp>
#include <boost/type_traits/is_array.hpp>
#include <boost/type_traits/conditional.hpp>
#include <boost/utility/enable_if.hpp>
// STL
#include <iosfwd>
#include <boost/test/detail/suppress_warnings.hpp>
//____________________________________________________________________________//
namespace boost {
namespace math {
namespace fpc {
// ************************************************************************** //
// ************** fpc::tolerance_based ************** //
// ************************************************************************** //
//! @internal
//! Protects the instanciation of std::numeric_limits from non-supported types (eg. T=array)
template <typename T, bool enabled>
struct tolerance_based_delegate;
template <typename T>
struct tolerance_based_delegate<T, false> : mpl::false_ {};
template <typename T>
struct tolerance_based_delegate<T, true>
: mpl::bool_<
is_floating_point<T>::value ||
(!std::numeric_limits<T>::is_integer && std::numeric_limits<T>::is_specialized && !std::numeric_limits<T>::is_exact)>
{};
/*!@brief Indicates if a type can be compared using a tolerance scheme
*
* This is a metafunction that should evaluate to @c mpl::true_ if the type
* @c T can be compared using a tolerance based method, typically for floating point
* types.
*
* This metafunction can be specialized further to declare user types that are
* floating point (eg. boost.multiprecision).
*/
template <typename T>
struct tolerance_based : tolerance_based_delegate<T, !is_array<T>::value >::type {};
// ************************************************************************** //
// ************** fpc::strength ************** //
// ************************************************************************** //
//! Method for comparing floating point numbers
enum strength {
FPC_STRONG, //!< "Very close" - equation 2' in docs, the default
FPC_WEAK //!< "Close enough" - equation 3' in docs.
};
// ************************************************************************** //
// ************** tolerance presentation types ************** //
// ************************************************************************** //
template<typename FPT>
struct percent_tolerance_t {
explicit percent_tolerance_t( FPT v ) : m_value( v ) {}
FPT m_value;
};
//____________________________________________________________________________//
template<typename FPT>
inline std::ostream& operator<<( std::ostream& out, percent_tolerance_t<FPT> t )
{
return out << t.m_value;
}
//____________________________________________________________________________//
template<typename FPT>
inline percent_tolerance_t<FPT>
percent_tolerance( FPT v )
{
return percent_tolerance_t<FPT>( v );
}
//____________________________________________________________________________//
// ************************************************************************** //
// ************** details ************** //
// ************************************************************************** //
namespace fpc_detail {
// FPT is Floating-Point Type: float, double, long double or User-Defined.
template<typename FPT>
inline FPT
fpt_abs( FPT fpv )
{
return fpv < static_cast<FPT>(0) ? -fpv : fpv;
}
//____________________________________________________________________________//
template<typename FPT>
struct fpt_specialized_limits
{
static FPT min_value() { return (std::numeric_limits<FPT>::min)(); }
static FPT max_value() { return (std::numeric_limits<FPT>::max)(); }
};
template<typename FPT>
struct fpt_non_specialized_limits
{
static FPT min_value() { return static_cast<FPT>(0); }
static FPT max_value() { return static_cast<FPT>(1000000); } // for our purposes it doesn't really matter what value is returned here
};
template<typename FPT>
struct fpt_limits : boost::conditional<std::numeric_limits<FPT>::is_specialized,
fpt_specialized_limits<FPT>,
fpt_non_specialized_limits<FPT>
>::type
{};
//____________________________________________________________________________//
// both f1 and f2 are unsigned here
template<typename FPT>
inline FPT
safe_fpt_division( FPT f1, FPT f2 )
{
// Avoid overflow.
if( (f2 < static_cast<FPT>(1)) && (f1 > f2*fpt_limits<FPT>::max_value()) )
return fpt_limits<FPT>::max_value();
// Avoid underflow.
if( (f1 == static_cast<FPT>(0)) ||
((f2 > static_cast<FPT>(1)) && (f1 < f2*fpt_limits<FPT>::min_value())) )
return static_cast<FPT>(0);
return f1/f2;
}
//____________________________________________________________________________//
template<typename FPT, typename ToleranceType>
inline FPT
fraction_tolerance( ToleranceType tolerance )
{
return static_cast<FPT>(tolerance);
}
//____________________________________________________________________________//
template<typename FPT2, typename FPT>
inline FPT2
fraction_tolerance( percent_tolerance_t<FPT> tolerance )
{
return FPT2(tolerance.m_value)*FPT2(0.01);
}
//____________________________________________________________________________//
} // namespace fpc_detail
// ************************************************************************** //
// ************** close_at_tolerance ************** //
// ************************************************************************** //
/*!@brief Predicate for comparing floating point numbers
*
* This predicate is used to compare floating point numbers. In addition the comparison produces maximum
* related differnce, which can be used to generate detailed error message
* The methods for comparing floating points are detailed in the documentation. The method is chosen
* by the @ref boost::math::fpc::strength given at construction.
*/
template<typename FPT>
class close_at_tolerance {
public:
// Public typedefs
typedef bool result_type;
// Constructor
template<typename ToleranceType>
explicit close_at_tolerance( ToleranceType tolerance, fpc::strength fpc_strength = FPC_STRONG )
: m_fraction_tolerance( fpc_detail::fraction_tolerance<FPT>( tolerance ) )
, m_strength( fpc_strength )
, m_tested_rel_diff( 0 )
{
BOOST_ASSERT_MSG( m_fraction_tolerance >= FPT(0), "tolerance must not be negative!" ); // no reason for tolerance to be negative
}
// Access methods
//! Returns the tolerance
FPT fraction_tolerance() const { return m_fraction_tolerance; }
//! Returns the comparison method
fpc::strength strength() const { return m_strength; }
//! Returns the failing fraction
FPT tested_rel_diff() const { return m_tested_rel_diff; }
/*! Compares two floating point numbers a and b such that their "left" relative difference |a-b|/a and/or
* "right" relative difference |a-b|/b does not exceed specified relative (fraction) tolerance.
*
* @param[in] left first floating point number to be compared
* @param[in] right second floating point number to be compared
*
* What is reported by @c tested_rel_diff in case of failure depends on the comparison method:
* - for @c FPC_STRONG: the max of the two fractions
* - for @c FPC_WEAK: the min of the two fractions
* The rationale behind is to report the tolerance to set in order to make a test pass.
*/
bool operator()( FPT left, FPT right ) const
{
FPT diff = fpc_detail::fpt_abs<FPT>( left - right );
FPT fraction_of_right = fpc_detail::safe_fpt_division( diff, fpc_detail::fpt_abs( right ) );
FPT fraction_of_left = fpc_detail::safe_fpt_division( diff, fpc_detail::fpt_abs( left ) );
FPT max_rel_diff = (std::max)( fraction_of_left, fraction_of_right );
FPT min_rel_diff = (std::min)( fraction_of_left, fraction_of_right );
m_tested_rel_diff = m_strength == FPC_STRONG ? max_rel_diff : min_rel_diff;
return m_tested_rel_diff <= m_fraction_tolerance;
}
private:
// Data members
FPT m_fraction_tolerance;
fpc::strength m_strength;
mutable FPT m_tested_rel_diff;
};
// ************************************************************************** //
// ************** small_with_tolerance ************** //
// ************************************************************************** //
/*!@brief Predicate for comparing floating point numbers against 0
*
* Serves the same purpose as boost::math::fpc::close_at_tolerance, but used when one
* of the operand is null.
*/
template<typename FPT>
class small_with_tolerance {
public:
// Public typedefs
typedef bool result_type;
// Constructor
explicit small_with_tolerance( FPT tolerance ) // <= absolute tolerance
: m_tolerance( tolerance )
{
BOOST_ASSERT( m_tolerance >= FPT(0) ); // no reason for the tolerance to be negative
}
// Action method
bool operator()( FPT fpv ) const
{
return fpc::fpc_detail::fpt_abs( fpv ) <= m_tolerance;
}
private:
// Data members
FPT m_tolerance;
};
// ************************************************************************** //
// ************** is_small ************** //
// ************************************************************************** //
template<typename FPT>
inline bool
is_small( FPT fpv, FPT tolerance )
{
return small_with_tolerance<FPT>( tolerance )( fpv );
}
//____________________________________________________________________________//
} // namespace fpc
} // namespace math
} // namespace boost
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_FLOATING_POINT_COMAPARISON_HPP_071894GER
@@ -0,0 +1,101 @@
// Copyright Aleksey Gurtovoy 2000-2004
//
// 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)
//
// Preprocessed version of "boost/mpl/modulus.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl {
template<
typename Tag1
, typename Tag2
>
struct modulus_impl
: if_c<
( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1)
> BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2)
)
, aux::cast2nd_impl< modulus_impl< Tag1,Tag1 >,Tag1, Tag2 >
, aux::cast1st_impl< modulus_impl< Tag2,Tag2 >,Tag1, Tag2 >
>::type
{
};
/// for Digital Mars C++/compilers with no CTPS/TTP support
template<> struct modulus_impl< na,na >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename Tag > struct modulus_impl< na,Tag >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename Tag > struct modulus_impl< Tag,na >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename T > struct modulus_tag
{
typedef typename T::tag type;
};
template<
typename BOOST_MPL_AUX_NA_PARAM(N1)
, typename BOOST_MPL_AUX_NA_PARAM(N2)
>
struct modulus
: modulus_impl<
typename modulus_tag<N1>::type
, typename modulus_tag<N2>::type
>::template apply< N1,N2 >::type
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(2, modulus, (N1, N2))
};
BOOST_MPL_AUX_NA_SPEC2(2, 2, modulus)
}}
namespace boost { namespace mpl {
template<>
struct modulus_impl< integral_c_tag,integral_c_tag >
{
template< typename N1, typename N2 > struct apply
: integral_c<
typename aux::largest_int<
typename N1::value_type
, typename N2::value_type
>::type
, ( BOOST_MPL_AUX_VALUE_WKND(N1)::value
% BOOST_MPL_AUX_VALUE_WKND(N2)::value
)
>
{
};
};
}}
@@ -0,0 +1,110 @@
// Copyright John Maddock 2007.
// 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)
/*
This header defines two traits classes, both in namespace boost::math::tools.
is_distribution<D>::value is true iff D has overloaded "cdf" and
"quantile" functions, plus member typedefs value_type and policy_type.
It's not much of a definitive test frankly,
but if it looks like a distribution and quacks like a distribution
then it must be a distribution.
is_scaled_distribution<D>::value is true iff D is a distribution
as defined above, and has member functions "scale" and "location".
*/
#ifndef BOOST_STATS_IS_DISTRIBUTION_HPP
#define BOOST_STATS_IS_DISTRIBUTION_HPP
#ifdef _MSC_VER
#pragma once
#endif
#include <boost/mpl/has_xxx.hpp>
#include <boost/type_traits/integral_constant.hpp>
namespace boost{ namespace math{ namespace tools{
namespace detail{
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_value_type, value_type, true)
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_policy_type, policy_type, true)
template<class D>
char cdf(const D& ...);
template<class D>
char quantile(const D& ...);
template <class D>
struct has_cdf
{
static D d;
BOOST_STATIC_CONSTANT(bool, value = sizeof(cdf(d, 0.0f)) != 1);
};
template <class D>
struct has_quantile
{
static D d;
BOOST_STATIC_CONSTANT(bool, value = sizeof(quantile(d, 0.0f)) != 1);
};
template <class D>
struct is_distribution_imp
{
BOOST_STATIC_CONSTANT(bool, value =
has_quantile<D>::value
&& has_cdf<D>::value
&& has_value_type<D>::value
&& has_policy_type<D>::value);
};
template <class sig, sig val>
struct result_tag{};
template <class D>
double test_has_location(const volatile result_tag<typename D::value_type (D::*)()const, &D::location>*);
template <class D>
char test_has_location(...);
template <class D>
double test_has_scale(const volatile result_tag<typename D::value_type (D::*)()const, &D::scale>*);
template <class D>
char test_has_scale(...);
template <class D, bool b>
struct is_scaled_distribution_helper
{
BOOST_STATIC_CONSTANT(bool, value = false);
};
template <class D>
struct is_scaled_distribution_helper<D, true>
{
BOOST_STATIC_CONSTANT(bool, value =
(sizeof(test_has_location<D>(0)) != 1)
&&
(sizeof(test_has_scale<D>(0)) != 1));
};
template <class D>
struct is_scaled_distribution_imp
{
BOOST_STATIC_CONSTANT(bool, value = (::boost::math::tools::detail::is_scaled_distribution_helper<D, ::boost::math::tools::detail::is_distribution_imp<D>::value>::value));
};
} // namespace detail
template <class T> struct is_distribution : public boost::integral_constant<bool, ::boost::math::tools::detail::is_distribution_imp<T>::value> {};
template <class T> struct is_scaled_distribution : public boost::integral_constant<bool, ::boost::math::tools::detail::is_scaled_distribution_imp<T>::value> {};
}}}
#endif
@@ -0,0 +1,54 @@
program ft8d
! Decode FT8 data read from *.wav files.
! FT8 is a potential mode intended for use at 6m (and maybe HF). It uses an
! LDPC (174,87) code, 8-FSK modulation, and 15 second T/R sequences. Otherwise
! should behave like JT65 and JT9 as used on HF bands, except that QSOs are
! 4 x faster.
! Reception and Demodulation algorithm:
! ... tbd ...
include 'ft8_params.f90'
character*12 arg
character infile*80,datetime*13
real s(NH1,NHSYM)
real candidate(3,100)
integer ihdr(11)
integer*2 iwave(NMAX) !Generated full-length waveform
nargs=iargc()
if(nargs.lt.3) then
print*,'Usage: ft8d MaxIt Norder file1 [file2 ...]'
print*,'Example ft8d 40 2 *.wav'
go to 999
endif
call getarg(1,arg)
read(arg,*) max_iterations
call getarg(2,arg)
read(arg,*) norder
nfiles=nargs-2
twopi=8.0*atan(1.0)
fs=12000.0 !Sample rate
dt=1.0/fs !Sample interval (s)
tt=NSPS*dt !Duration of "itone" symbols (s)
ts=2*NSPS*dt !Duration of OQPSK symbols (s)
baud=1.0/tt !Keying rate (baud)
txt=NZ*dt !Transmission length (s)
do ifile=1,nfiles
call getarg(ifile+2,infile)
open(10,file=infile,status='old',access='stream')
read(10,end=999) ihdr,iwave
close(10)
j2=index(infile,'.wav')
read(infile(j2-6:j2-1),*) nutc
datetime=infile(j2-13:j2-1)
call sync8(iwave,s,candidate,ncand)
call ft8b(datetime,s,candidate,ncand)
enddo ! ifile loop
999 end program ft8d
@@ -0,0 +1,67 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2011 Eric Niebler
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_FIND_IF_05052005_1108)
#define FUSION_FIND_IF_05052005_1108
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/algorithm/query/find_if_fwd.hpp>
#include <boost/fusion/algorithm/query/detail/find_if.hpp>
#include <boost/fusion/algorithm/query/detail/segmented_find_if.hpp>
#include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/support/is_segmented.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/mpl/bind.hpp>
#include <boost/mpl/lambda.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/mpl/quote.hpp>
namespace boost { namespace fusion
{
namespace result_of
{
template <typename Sequence, typename Pred>
struct find_if
: mpl::if_<
traits::is_segmented<Sequence>
, detail::result_of_segmented_find_if<Sequence, Pred>
, detail::result_of_find_if<
Sequence,
mpl::bind1<
typename mpl::lambda<Pred>::type
, mpl::bind1<mpl::quote1<value_of>, mpl::_1>
>
>
>::type
{};
}
template <typename Pred, typename Sequence>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename
lazy_disable_if<
is_const<Sequence>
, result_of::find_if<Sequence, Pred>
>::type
find_if(Sequence& seq)
{
typedef typename result_of::find_if<Sequence, Pred>::filter filter;
return filter::call(seq);
}
template <typename Pred, typename Sequence>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::find_if<Sequence const, Pred>::type const
find_if(Sequence const& seq)
{
typedef typename result_of::find_if<Sequence const, Pred>::filter filter;
return filter::call(seq);
}
}}
#endif
@@ -0,0 +1,34 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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(BOOST_FUSION_EQUAL_TO_IMPL_02012005_2133)
#define BOOST_FUSION_EQUAL_TO_IMPL_02012005_2133
namespace boost { namespace fusion
{
struct filter_view_iterator_tag;
namespace extension
{
template<typename I1, typename I2>
struct equal_to;
template<typename Tag>
struct equal_to_impl;
template<>
struct equal_to_impl<filter_view_iterator_tag>
{
template<typename I1, typename I2>
struct apply
: result_of::equal_to<typename I1::first_type, typename I2::first_type>
{};
};
}
}}
#endif
@@ -0,0 +1,36 @@
/*=============================================================================
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_ADAPT_DEREF_TRAITS_05062005_0900)
#define FUSION_ADAPT_DEREF_TRAITS_05062005_0900
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/iterator/deref.hpp>
namespace boost { namespace fusion { namespace detail
{
struct adapt_deref_traits
{
template <typename Iterator>
struct apply
{
typedef typename
result_of::deref<typename Iterator::first_type>::type
type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Iterator const& i)
{
return *i.first;
}
};
};
}}}
#endif
@@ -0,0 +1,50 @@
// Copyright David Abrahams 2002.
// 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 STRING_LITERAL_DWA2002629_HPP
# define STRING_LITERAL_DWA2002629_HPP
# include <cstddef>
# include <boost/type.hpp>
# include <boost/type_traits/array_traits.hpp>
# include <boost/type_traits/same_traits.hpp>
# include <boost/mpl/bool.hpp>
# include <boost/detail/workaround.hpp>
namespace boost { namespace python { namespace detail {
template <class T>
struct is_string_literal : mpl::false_
{
};
# if !defined(__MWERKS__) || __MWERKS__ > 0x2407
template <std::size_t n>
struct is_string_literal<char const[n]> : mpl::true_
{
};
# if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590040)) \
|| (defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 730)
// This compiler mistakenly gets the type of string literals as char*
// instead of char[NN].
template <>
struct is_string_literal<char* const> : mpl::true_
{
};
# endif
# else
// CWPro7 has trouble with the array type deduction above
template <class T, std::size_t n>
struct is_string_literal<T[n]>
: is_same<T, char const>
{
};
# endif
}}} // namespace boost::python::detail
#endif // STRING_LITERAL_DWA2002629_HPP
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,169 @@
// Boost.Range library
//
// Copyright Neil Groves 2007. 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_ADAPTOR_REPLACED_IMPL_HPP_INCLUDED
#define BOOST_RANGE_ADAPTOR_REPLACED_IMPL_HPP_INCLUDED
#include <boost/config.hpp>
#include <boost/range/adaptor/argument_fwd.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/value_type.hpp>
#include <boost/range/concepts.hpp>
#include <boost/iterator/iterator_adaptor.hpp>
#include <boost/iterator/transform_iterator.hpp>
#include <boost/optional/optional.hpp>
namespace boost
{
namespace range_detail
{
template< class Value >
class replace_value
{
public:
typedef const Value& result_type;
typedef const Value& first_argument_type;
// Rationale:
// The default constructor is required to allow the transform
// iterator to properly model the iterator concept.
replace_value()
{
}
replace_value(const Value& from, const Value& to)
: m_impl(data(from, to))
{
}
const Value& operator()(const Value& x) const
{
return (x == m_impl->m_from) ? m_impl->m_to : x;
}
private:
struct data
{
data(const Value& from, const Value& to)
: m_from(from)
, m_to(to)
{
}
Value m_from;
Value m_to;
};
boost::optional<data> m_impl;
};
template< class R >
class replaced_range :
public boost::iterator_range<
boost::transform_iterator<
replace_value< BOOST_DEDUCED_TYPENAME range_value<R>::type >,
BOOST_DEDUCED_TYPENAME range_iterator<R>::type > >
{
private:
typedef replace_value< BOOST_DEDUCED_TYPENAME range_value<R>::type > Fn;
typedef boost::iterator_range<
boost::transform_iterator<
replace_value< BOOST_DEDUCED_TYPENAME range_value<R>::type >,
BOOST_DEDUCED_TYPENAME range_iterator<R>::type > > base_t;
public:
typedef BOOST_DEDUCED_TYPENAME range_value<R>::type value_type;
replaced_range( R& r, value_type from, value_type to )
: base_t( make_transform_iterator( boost::begin(r), Fn(from, to) ),
make_transform_iterator( boost::end(r), Fn(from, to) ) )
{ }
};
template< class T >
class replace_holder : public holder2<T>
{
public:
replace_holder( const T& from, const T& to )
: holder2<T>(from, to)
{ }
private:
// not assignable
void operator=(const replace_holder&);
};
template< class SinglePassRange >
inline replaced_range<SinglePassRange>
operator|(
SinglePassRange& r,
const replace_holder<
BOOST_DEDUCED_TYPENAME range_value<SinglePassRange>::type>& f )
{
BOOST_RANGE_CONCEPT_ASSERT((
SinglePassRangeConcept<SinglePassRange>));
return replaced_range<SinglePassRange>(r, f.val1, f.val2);
}
template< class SinglePassRange >
inline replaced_range<const SinglePassRange>
operator|(
const SinglePassRange& r,
const replace_holder<
BOOST_DEDUCED_TYPENAME range_value<SinglePassRange>::type>& f)
{
BOOST_RANGE_CONCEPT_ASSERT((
SinglePassRangeConcept<const SinglePassRange>));
return replaced_range<const SinglePassRange>(r, f.val1, f.val2);
}
} // 'range_detail'
using range_detail::replaced_range;
namespace adaptors
{
namespace
{
const range_detail::forwarder2<range_detail::replace_holder>
replaced =
range_detail::forwarder2<range_detail::replace_holder>();
}
template<class SinglePassRange>
inline replaced_range<SinglePassRange>
replace(SinglePassRange& rng,
BOOST_DEDUCED_TYPENAME range_value<SinglePassRange>::type from,
BOOST_DEDUCED_TYPENAME range_value<SinglePassRange>::type to)
{
BOOST_RANGE_CONCEPT_ASSERT((
SinglePassRangeConcept<SinglePassRange>));
return replaced_range<SinglePassRange>(rng, from, to);
}
template<class SinglePassRange>
inline replaced_range<const SinglePassRange>
replace(const SinglePassRange& rng,
BOOST_DEDUCED_TYPENAME range_value<SinglePassRange>::type from,
BOOST_DEDUCED_TYPENAME range_value<SinglePassRange>::type to)
{
BOOST_RANGE_CONCEPT_ASSERT((
SinglePassRangeConcept<const SinglePassRange>));
return replaced_range<const SinglePassRange>(rng, from ,to);
}
} // 'adaptors'
} // 'boost'
#endif // include guard
@@ -0,0 +1,119 @@
///////////////////////////////////////////////////////////////////////////////
// deduce_domain_n.hpp
// Definitions of common_domain[n] and deduce_domain[n] class templates.
//
// Copyright 2008 Eric Niebler. 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)
template<typename A0 , typename A1 , typename A2>
struct common_domain3
{
typedef A0 common1;
typedef typename common_domain2<common1, A1>::type common2; typedef typename common_domain2<common2, A2>::type common3;
typedef common3 type;
BOOST_PROTO_ASSERT_VALID_DOMAIN(type);
};
template<typename E0 , typename E1 , typename E2>
struct deduce_domain3
: common_domain3<
typename domain_of<E0 >::type , typename domain_of<E1 >::type , typename domain_of<E2 >::type
>
{};
template<typename A0 , typename A1 , typename A2 , typename A3>
struct common_domain4
{
typedef A0 common1;
typedef typename common_domain2<common1, A1>::type common2; typedef typename common_domain2<common2, A2>::type common3; typedef typename common_domain2<common3, A3>::type common4;
typedef common4 type;
BOOST_PROTO_ASSERT_VALID_DOMAIN(type);
};
template<typename E0 , typename E1 , typename E2 , typename E3>
struct deduce_domain4
: common_domain4<
typename domain_of<E0 >::type , typename domain_of<E1 >::type , typename domain_of<E2 >::type , typename domain_of<E3 >::type
>
{};
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
struct common_domain5
{
typedef A0 common1;
typedef typename common_domain2<common1, A1>::type common2; typedef typename common_domain2<common2, A2>::type common3; typedef typename common_domain2<common3, A3>::type common4; typedef typename common_domain2<common4, A4>::type common5;
typedef common5 type;
BOOST_PROTO_ASSERT_VALID_DOMAIN(type);
};
template<typename E0 , typename E1 , typename E2 , typename E3 , typename E4>
struct deduce_domain5
: common_domain5<
typename domain_of<E0 >::type , typename domain_of<E1 >::type , typename domain_of<E2 >::type , typename domain_of<E3 >::type , typename domain_of<E4 >::type
>
{};
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
struct common_domain6
{
typedef A0 common1;
typedef typename common_domain2<common1, A1>::type common2; typedef typename common_domain2<common2, A2>::type common3; typedef typename common_domain2<common3, A3>::type common4; typedef typename common_domain2<common4, A4>::type common5; typedef typename common_domain2<common5, A5>::type common6;
typedef common6 type;
BOOST_PROTO_ASSERT_VALID_DOMAIN(type);
};
template<typename E0 , typename E1 , typename E2 , typename E3 , typename E4 , typename E5>
struct deduce_domain6
: common_domain6<
typename domain_of<E0 >::type , typename domain_of<E1 >::type , typename domain_of<E2 >::type , typename domain_of<E3 >::type , typename domain_of<E4 >::type , typename domain_of<E5 >::type
>
{};
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
struct common_domain7
{
typedef A0 common1;
typedef typename common_domain2<common1, A1>::type common2; typedef typename common_domain2<common2, A2>::type common3; typedef typename common_domain2<common3, A3>::type common4; typedef typename common_domain2<common4, A4>::type common5; typedef typename common_domain2<common5, A5>::type common6; typedef typename common_domain2<common6, A6>::type common7;
typedef common7 type;
BOOST_PROTO_ASSERT_VALID_DOMAIN(type);
};
template<typename E0 , typename E1 , typename E2 , typename E3 , typename E4 , typename E5 , typename E6>
struct deduce_domain7
: common_domain7<
typename domain_of<E0 >::type , typename domain_of<E1 >::type , typename domain_of<E2 >::type , typename domain_of<E3 >::type , typename domain_of<E4 >::type , typename domain_of<E5 >::type , typename domain_of<E6 >::type
>
{};
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
struct common_domain8
{
typedef A0 common1;
typedef typename common_domain2<common1, A1>::type common2; typedef typename common_domain2<common2, A2>::type common3; typedef typename common_domain2<common3, A3>::type common4; typedef typename common_domain2<common4, A4>::type common5; typedef typename common_domain2<common5, A5>::type common6; typedef typename common_domain2<common6, A6>::type common7; typedef typename common_domain2<common7, A7>::type common8;
typedef common8 type;
BOOST_PROTO_ASSERT_VALID_DOMAIN(type);
};
template<typename E0 , typename E1 , typename E2 , typename E3 , typename E4 , typename E5 , typename E6 , typename E7>
struct deduce_domain8
: common_domain8<
typename domain_of<E0 >::type , typename domain_of<E1 >::type , typename domain_of<E2 >::type , typename domain_of<E3 >::type , typename domain_of<E4 >::type , typename domain_of<E5 >::type , typename domain_of<E6 >::type , typename domain_of<E7 >::type
>
{};
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
struct common_domain9
{
typedef A0 common1;
typedef typename common_domain2<common1, A1>::type common2; typedef typename common_domain2<common2, A2>::type common3; typedef typename common_domain2<common3, A3>::type common4; typedef typename common_domain2<common4, A4>::type common5; typedef typename common_domain2<common5, A5>::type common6; typedef typename common_domain2<common6, A6>::type common7; typedef typename common_domain2<common7, A7>::type common8; typedef typename common_domain2<common8, A8>::type common9;
typedef common9 type;
BOOST_PROTO_ASSERT_VALID_DOMAIN(type);
};
template<typename E0 , typename E1 , typename E2 , typename E3 , typename E4 , typename E5 , typename E6 , typename E7 , typename E8>
struct deduce_domain9
: common_domain9<
typename domain_of<E0 >::type , typename domain_of<E1 >::type , typename domain_of<E2 >::type , typename domain_of<E3 >::type , typename domain_of<E4 >::type , typename domain_of<E5 >::type , typename domain_of<E6 >::type , typename domain_of<E7 >::type , typename domain_of<E8 >::type
>
{};
template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
struct common_domain10
{
typedef A0 common1;
typedef typename common_domain2<common1, A1>::type common2; typedef typename common_domain2<common2, A2>::type common3; typedef typename common_domain2<common3, A3>::type common4; typedef typename common_domain2<common4, A4>::type common5; typedef typename common_domain2<common5, A5>::type common6; typedef typename common_domain2<common6, A6>::type common7; typedef typename common_domain2<common7, A7>::type common8; typedef typename common_domain2<common8, A8>::type common9; typedef typename common_domain2<common9, A9>::type common10;
typedef common10 type;
BOOST_PROTO_ASSERT_VALID_DOMAIN(type);
};
template<typename E0 , typename E1 , typename E2 , typename E3 , typename E4 , typename E5 , typename E6 , typename E7 , typename E8 , typename E9>
struct deduce_domain10
: common_domain10<
typename domain_of<E0 >::type , typename domain_of<E1 >::type , typename domain_of<E2 >::type , typename domain_of<E3 >::type , typename domain_of<E4 >::type , typename domain_of<E5 >::type , typename domain_of<E6 >::type , typename domain_of<E7 >::type , typename domain_of<E8 >::type , typename domain_of<E9 >::type
>
{};
@@ -0,0 +1,150 @@
// win/chrono.cpp --------------------------------------------------------------//
// Copyright Beman Dawes 2008
// Copyright 2009-2010 Vicente J. Botet Escriba
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
//----------------------------------------------------------------------------//
// Windows //
//----------------------------------------------------------------------------//
#ifndef BOOST_CHRONO_DETAIL_INLINED_WIN_CHRONO_HPP
#define BOOST_CHRONO_DETAIL_INLINED_WIN_CHRONO_HPP
#include <boost/detail/winapi/time.hpp>
#include <boost/detail/winapi/timers.hpp>
#include <boost/detail/winapi/get_last_error.hpp>
#include <boost/assert.hpp>
namespace boost
{
namespace chrono
{
namespace chrono_detail
{
BOOST_CHRONO_INLINE double get_nanosecs_per_tic() BOOST_NOEXCEPT
{
boost::detail::winapi::LARGE_INTEGER_ freq;
if ( !boost::detail::winapi::QueryPerformanceFrequency( &freq ) )
return 0.0L;
return double(1000000000.0L / freq.QuadPart);
}
}
steady_clock::time_point steady_clock::now() BOOST_NOEXCEPT
{
double nanosecs_per_tic = chrono_detail::get_nanosecs_per_tic();
boost::detail::winapi::LARGE_INTEGER_ pcount;
if ( nanosecs_per_tic <= 0.0L )
{
BOOST_ASSERT(0 && "Boost::Chrono - get_nanosecs_per_tic Internal Error");
return steady_clock::time_point();
}
unsigned times=0;
while ( ! boost::detail::winapi::QueryPerformanceCounter( &pcount ) )
{
if ( ++times > 3 )
{
BOOST_ASSERT(0 && "Boost::Chrono - QueryPerformanceCounter Internal Error");
return steady_clock::time_point();
}
}
return steady_clock::time_point(steady_clock::duration(
static_cast<steady_clock::rep>((nanosecs_per_tic) * pcount.QuadPart)));
}
#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
steady_clock::time_point steady_clock::now( system::error_code & ec )
{
double nanosecs_per_tic = chrono_detail::get_nanosecs_per_tic();
boost::detail::winapi::LARGE_INTEGER_ pcount;
if ( (nanosecs_per_tic <= 0.0L)
|| (!boost::detail::winapi::QueryPerformanceCounter( &pcount )) )
{
boost::detail::winapi::DWORD_ cause =
((nanosecs_per_tic <= 0.0L)
? ERROR_NOT_SUPPORTED
: boost::detail::winapi::GetLastError());
if (BOOST_CHRONO_IS_THROWS(ec)) {
boost::throw_exception(
system::system_error(
cause,
BOOST_CHRONO_SYSTEM_CATEGORY,
"chrono::steady_clock" ));
}
else
{
ec.assign( cause, BOOST_CHRONO_SYSTEM_CATEGORY );
return steady_clock::time_point(duration(0));
}
}
if (!BOOST_CHRONO_IS_THROWS(ec))
{
ec.clear();
}
return time_point(duration(
static_cast<steady_clock::rep>(nanosecs_per_tic * pcount.QuadPart)));
}
#endif
BOOST_CHRONO_INLINE
system_clock::time_point system_clock::now() BOOST_NOEXCEPT
{
boost::detail::winapi::FILETIME_ ft;
boost::detail::winapi::GetSystemTimeAsFileTime( &ft ); // never fails
return system_clock::time_point(
system_clock::duration(
((static_cast<__int64>( ft.dwHighDateTime ) << 32) | ft.dwLowDateTime)
- 116444736000000000LL
//- (134775LL*864000000000LL)
)
);
}
#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
BOOST_CHRONO_INLINE
system_clock::time_point system_clock::now( system::error_code & ec )
{
boost::detail::winapi::FILETIME_ ft;
boost::detail::winapi::GetSystemTimeAsFileTime( &ft ); // never fails
if (!BOOST_CHRONO_IS_THROWS(ec))
{
ec.clear();
}
return system_clock::time_point(
system_clock::duration(
((static_cast<__int64>( ft.dwHighDateTime ) << 32) | ft.dwLowDateTime)
- 116444736000000000LL
//- (134775LL*864000000000LL)
));
}
#endif
BOOST_CHRONO_INLINE
std::time_t system_clock::to_time_t(const system_clock::time_point& t) BOOST_NOEXCEPT
{
__int64 temp = t.time_since_epoch().count();
temp /= 10000000;
return static_cast<std::time_t>( temp );
}
BOOST_CHRONO_INLINE
system_clock::time_point system_clock::from_time_t(std::time_t t) BOOST_NOEXCEPT
{
__int64 temp = t;
temp *= 10000000;
return time_point(duration(temp));
}
} // namespace chrono
} // namespace boost
#endif
@@ -0,0 +1,259 @@
#if !defined(BOOST_PP_IS_ITERATING)
// Copyright David Abrahams 2002.
// 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 CALLER_DWA20021121_HPP
# define CALLER_DWA20021121_HPP
# include <boost/python/type_id.hpp>
# include <boost/python/handle.hpp>
# include <boost/detail/indirect_traits.hpp>
# include <boost/python/detail/invoke.hpp>
# include <boost/python/detail/signature.hpp>
# include <boost/python/detail/preprocessor.hpp>
# include <boost/python/arg_from_python.hpp>
# include <boost/python/converter/context_result_converter.hpp>
# include <boost/python/converter/builtin_converters.hpp>
# include <boost/preprocessor/iterate.hpp>
# include <boost/preprocessor/cat.hpp>
# include <boost/preprocessor/dec.hpp>
# include <boost/preprocessor/if.hpp>
# include <boost/preprocessor/iteration/local.hpp>
# include <boost/preprocessor/repetition/enum_trailing_params.hpp>
# include <boost/preprocessor/repetition/repeat.hpp>
# include <boost/compressed_pair.hpp>
# include <boost/type_traits/is_same.hpp>
# include <boost/type_traits/is_convertible.hpp>
# include <boost/mpl/apply.hpp>
# include <boost/mpl/eval_if.hpp>
# include <boost/mpl/identity.hpp>
# include <boost/mpl/size.hpp>
# include <boost/mpl/at.hpp>
# include <boost/mpl/int.hpp>
# include <boost/mpl/next.hpp>
namespace boost { namespace python { namespace detail {
template <int N>
inline PyObject* get(mpl::int_<N>, PyObject* const& args_)
{
return PyTuple_GET_ITEM(args_,N);
}
inline unsigned arity(PyObject* const& args_)
{
return PyTuple_GET_SIZE(args_);
}
// This "result converter" is really just used as
// a dispatch tag to invoke(...), selecting the appropriate
// implementation
typedef int void_result_to_python;
// Given a model of CallPolicies and a C++ result type, this
// metafunction selects the appropriate converter to use for
// converting the result to python.
template <class Policies, class Result>
struct select_result_converter
: mpl::eval_if<
is_same<Result,void>
, mpl::identity<void_result_to_python>
, mpl::apply1<typename Policies::result_converter,Result>
>
{
};
template <class ArgPackage, class ResultConverter>
inline ResultConverter create_result_converter(
ArgPackage const& args_
, ResultConverter*
, converter::context_result_converter*
)
{
return ResultConverter(args_);
}
template <class ArgPackage, class ResultConverter>
inline ResultConverter create_result_converter(
ArgPackage const&
, ResultConverter*
, ...
)
{
return ResultConverter();
}
#ifndef BOOST_PYTHON_NO_PY_SIGNATURES
template <class ResultConverter>
struct converter_target_type
{
static PyTypeObject const *get_pytype()
{
return create_result_converter((PyObject*)0, (ResultConverter *)0, (ResultConverter *)0).get_pytype();
}
};
template < >
struct converter_target_type <void_result_to_python >
{
static PyTypeObject const *get_pytype()
{
return 0;
}
};
#endif
template <unsigned> struct caller_arity;
template <class F, class CallPolicies, class Sig>
struct caller;
# define BOOST_PYTHON_NEXT(init,name,n) \
typedef BOOST_PP_IF(n,typename mpl::next< BOOST_PP_CAT(name,BOOST_PP_DEC(n)) >::type, init) name##n;
# define BOOST_PYTHON_ARG_CONVERTER(n) \
BOOST_PYTHON_NEXT(typename mpl::next<first>::type, arg_iter,n) \
typedef arg_from_python<BOOST_DEDUCED_TYPENAME arg_iter##n::type> c_t##n; \
c_t##n c##n(get(mpl::int_<n>(), inner_args)); \
if (!c##n.convertible()) \
return 0;
# define BOOST_PP_ITERATION_PARAMS_1 \
(3, (0, BOOST_PYTHON_MAX_ARITY + 1, <boost/python/detail/caller.hpp>))
# include BOOST_PP_ITERATE()
# undef BOOST_PYTHON_ARG_CONVERTER
# undef BOOST_PYTHON_NEXT
// A metafunction returning the base class used for caller<class F,
// class ConverterGenerators, class CallPolicies, class Sig>.
template <class F, class CallPolicies, class Sig>
struct caller_base_select
{
enum { arity = mpl::size<Sig>::value - 1 };
typedef typename caller_arity<arity>::template impl<F,CallPolicies,Sig> type;
};
// A function object type which wraps C++ objects as Python callable
// objects.
//
// Template Arguments:
//
// F -
// the C++ `function object' that will be called. Might
// actually be any data for which an appropriate invoke_tag() can
// be generated. invoke(...) takes care of the actual invocation syntax.
//
// CallPolicies -
// The precall, postcall, and what kind of resultconverter to
// generate for mpl::front<Sig>::type
//
// Sig -
// The `intended signature' of the function. An MPL sequence
// beginning with a result type and continuing with a list of
// argument types.
template <class F, class CallPolicies, class Sig>
struct caller
: caller_base_select<F,CallPolicies,Sig>::type
{
typedef typename caller_base_select<
F,CallPolicies,Sig
>::type base;
typedef PyObject* result_type;
caller(F f, CallPolicies p) : base(f,p) {}
};
}}} // namespace boost::python::detail
# endif // CALLER_DWA20021121_HPP
#else
# define N BOOST_PP_ITERATION()
template <>
struct caller_arity<N>
{
template <class F, class Policies, class Sig>
struct impl
{
impl(F f, Policies p) : m_data(f,p) {}
PyObject* operator()(PyObject* args_, PyObject*) // eliminate
// this
// trailing
// keyword dict
{
typedef typename mpl::begin<Sig>::type first;
typedef typename first::type result_t;
typedef typename select_result_converter<Policies, result_t>::type result_converter;
typedef typename Policies::argument_package argument_package;
argument_package inner_args(args_);
# if N
# define BOOST_PP_LOCAL_MACRO(i) BOOST_PYTHON_ARG_CONVERTER(i)
# define BOOST_PP_LOCAL_LIMITS (0, N-1)
# include BOOST_PP_LOCAL_ITERATE()
# endif
// all converters have been checked. Now we can do the
// precall part of the policy
if (!m_data.second().precall(inner_args))
return 0;
PyObject* result = detail::invoke(
detail::invoke_tag<result_t,F>()
, create_result_converter(args_, (result_converter*)0, (result_converter*)0)
, m_data.first()
BOOST_PP_ENUM_TRAILING_PARAMS(N, c)
);
return m_data.second().postcall(inner_args, result);
}
static unsigned min_arity() { return N; }
static py_func_sig_info signature()
{
const signature_element * sig = detail::signature<Sig>::elements();
#ifndef BOOST_PYTHON_NO_PY_SIGNATURES
typedef BOOST_DEDUCED_TYPENAME Policies::template extract_return_type<Sig>::type rtype;
typedef typename select_result_converter<Policies, rtype>::type result_converter;
static const signature_element ret = {
(boost::is_void<rtype>::value ? "void" : type_id<rtype>().name())
, &detail::converter_target_type<result_converter>::get_pytype
, boost::detail::indirect_traits::is_reference_to_non_const<rtype>::value
};
py_func_sig_info res = {sig, &ret };
#else
py_func_sig_info res = {sig, sig };
#endif
return res;
}
private:
compressed_pair<F,Policies> m_data;
};
};
#endif // BOOST_PP_IS_ITERATING
@@ -0,0 +1,506 @@
#include "DXLabSuiteCommanderTransceiver.hpp"
#include <QTcpSocket>
#include <QRegularExpression>
#include <QLocale>
#include <QThread>
#include <QDateTime>
#include "NetworkServerLookup.hpp"
#include "moc_DXLabSuiteCommanderTransceiver.cpp"
namespace
{
char const * const commander_transceiver_name {"DX Lab Suite Commander"};
QString map_mode (Transceiver::MODE mode)
{
switch (mode)
{
case Transceiver::AM: return "AM";
case Transceiver::CW: return "CW";
case Transceiver::CW_R: return "CW-R";
case Transceiver::USB: return "USB";
case Transceiver::LSB: return "LSB";
case Transceiver::FSK: return "RTTY";
case Transceiver::FSK_R: return "RTTY-R";
case Transceiver::DIG_L: return "DATA-L";
case Transceiver::DIG_U: return "DATA-U";
case Transceiver::FM:
case Transceiver::DIG_FM:
return "FM";
default: break;
}
return "USB";
}
}
void DXLabSuiteCommanderTransceiver::register_transceivers (TransceiverFactory::Transceivers * registry, int id)
{
(*registry)[commander_transceiver_name] = TransceiverFactory::Capabilities {id, TransceiverFactory::Capabilities::network, true};
}
DXLabSuiteCommanderTransceiver::DXLabSuiteCommanderTransceiver (std::unique_ptr<TransceiverBase> wrapped,
QString const& address, bool use_for_ptt,
int poll_interval, QObject * parent)
: PollingTransceiver {poll_interval, parent}
, wrapped_ {std::move (wrapped)}
, use_for_ptt_ {use_for_ptt}
, server_ {address}
, commander_ {nullptr}
{
}
int DXLabSuiteCommanderTransceiver::do_start ()
{
TRACE_CAT ("DXLabSuiteCommanderTransceiver", "starting");
if (wrapped_) wrapped_->start (0);
auto server_details = network_server_lookup (server_, 52002u, QHostAddress::LocalHost, QAbstractSocket::IPv4Protocol);
if (!commander_)
{
commander_ = new QTcpSocket {this}; // QObject takes ownership
}
commander_->connectToHost (std::get<0> (server_details), std::get<1> (server_details));
if (!commander_->waitForConnected ())
{
TRACE_CAT ("DXLabSuiteCommanderTransceiver", "failed to connect" << commander_->errorString ());
throw error {tr ("Failed to connect to DX Lab Suite Commander\n") + commander_->errorString ()};
}
// sleeps here are to ensure Commander has actually queried the rig
// rather than returning cached data which maybe stale or simply
// read backs of not yet committed values, the 2s delays are
// arbitrary but hopefully enough as the actual time required is rig
// and Commander setting dependent
int resolution {0};
QThread::msleep (2000);
auto reply = command_with_reply ("<command:10>CmdGetFreq<parameters:0>");
if (0 == reply.indexOf ("<CmdFreq:"))
{
auto f = string_to_frequency (reply.mid (reply.indexOf ('>') + 1));
if (f && !(f % 10))
{
auto test_frequency = f - f % 100 + 55;
auto f_string = frequency_to_string (test_frequency);
auto params = ("<xcvrfreq:%1>" + f_string).arg (f_string.size ());
simple_command (("<command:10>CmdSetFreq<parameters:%1>" + params).arg (params.size ()));
QThread::msleep (2000);
reply = command_with_reply ("<command:10>CmdGetFreq<parameters:0>");
if (0 == reply.indexOf ("<CmdFreq:"))
{
auto new_frequency = string_to_frequency (reply.mid (reply.indexOf ('>') + 1));
switch (static_cast<Radio::FrequencyDelta> (new_frequency - test_frequency))
{
case -5: resolution = -1; break; // 10Hz truncated
case 5: resolution = 1; break; // 10Hz rounded
case -15: resolution = -2; break; // 20Hz truncated
case -55: resolution = -2; break; // 100Hz truncated
case 45: resolution = 2; break; // 100Hz rounded
}
if (1 == resolution) // may be 20Hz rounded
{
test_frequency = f - f % 100 + 51;
f_string = frequency_to_string (test_frequency);
params = ("<xcvrfreq:%1>" + f_string).arg (f_string.size ());
simple_command (("<command:10>CmdSetFreq<parameters:%1>" + params).arg (params.size ()));
QThread::msleep (2000);
reply = command_with_reply ("<command:10>CmdGetFreq<parameters:0>");
new_frequency = string_to_frequency (reply.mid (reply.indexOf ('>') + 1));
if (9 == static_cast<Radio::FrequencyDelta> (new_frequency - test_frequency))
{
resolution = 2; // 20Hz rounded
}
}
f_string = frequency_to_string (f);
params = ("<xcvrfreq:%1>" + f_string).arg (f_string.size ());
simple_command (("<command:10>CmdSetFreq<parameters:%1>" + params).arg (params.size ()));
}
}
}
else
{
TRACE_CAT ("DXLabSuiteCommanderTransceiver", "get frequency unexpected response" << reply);
throw error {tr ("DX Lab Suite Commander didn't respond correctly reading frequency: ") + reply};
}
poll ();
return resolution;
}
void DXLabSuiteCommanderTransceiver::do_stop ()
{
if (commander_)
{
commander_->close ();
delete commander_, commander_ = nullptr;
}
if (wrapped_) wrapped_->stop ();
TRACE_CAT ("DXLabSuiteCommanderTransceiver", "stopped");
}
void DXLabSuiteCommanderTransceiver::do_ptt (bool on)
{
TRACE_CAT ("DXLabSuiteCommanderTransceiver", on << state ());
if (use_for_ptt_)
{
simple_command (on ? "<command:5>CmdTX<parameters:0>" : "<command:5>CmdRX<parameters:0>");
bool tx {!on};
auto start = QDateTime::currentMSecsSinceEpoch ();
// we must now wait for Tx on the rig, we will wait a short while
// before bailing out
while (tx != on && QDateTime::currentMSecsSinceEpoch () - start < 1000)
{
auto reply = command_with_reply ("<command:9>CmdSendTx<parameters:0>");
if (0 == reply.indexOf ("<CmdTX:"))
{
auto state = reply.mid (reply.indexOf ('>') + 1);
if ("ON" == state)
{
tx = true;
}
else if ("OFF" == state)
{
tx = false;
}
else
{
TRACE_CAT ("DXLabSuiteCommanderTransceiver", "unexpected TX state" << state);
throw error {tr ("DX Lab Suite Commander sent an unrecognised TX state: ") + state};
}
}
else
{
TRACE_CAT ("DXLabSuiteCommanderTransceiver", "get TX unexpected response" << reply);
throw error {tr ("DX Lab Suite Commander didn't respond correctly polling TX status: ") + reply};
}
if (tx != on) QThread::msleep (10); // don't thrash Commander
}
update_PTT (tx);
if (tx != on)
{
TRACE_CAT ("DXLabSuiteCommanderTransceiver", "rig failed to respond to PTT: " << on);
throw error {tr ("DX Lab Suite Commander rig did not respond to PTT: ") + (on ? "ON" : "OFF")};
}
}
else
{
Q_ASSERT (wrapped_);
TransceiverState new_state {wrapped_->state ()};
new_state.ptt (on);
wrapped_->set (new_state, 0);
update_PTT (on);
}
}
void DXLabSuiteCommanderTransceiver::do_frequency (Frequency f, MODE m, bool /*no_ignore*/)
{
TRACE_CAT ("DXLabSuiteCommanderTransceiver", f << state ());
auto f_string = frequency_to_string (f);
if (UNK != m && m != get_mode ())
{
auto m_string = map_mode (m);
auto params = ("<xcvrfreq:%1>" + f_string + "<xcvrmode:%2>" + m_string + "<preservesplitanddual:1>Y").arg (f_string.size ()).arg (m_string.size ());
simple_command (("<command:14>CmdSetFreqMode<parameters:%1>" + params).arg (params.size ()));
update_mode (m);
}
else
{
auto params = ("<xcvrfreq:%1>" + f_string).arg (f_string.size ());
simple_command (("<command:10>CmdSetFreq<parameters:%1>" + params).arg (params.size ()));
}
update_rx_frequency (f);
}
void DXLabSuiteCommanderTransceiver::do_tx_frequency (Frequency tx, MODE mode, bool /*no_ignore*/)
{
TRACE_CAT ("DXLabSuiteCommanderTransceiver", tx << state ());
if (tx)
{
auto f_string = frequency_to_string (tx);
auto params = ("<xcvrfreq:%1>" + f_string + "<SuppressDual:1>Y").arg (f_string.size ());
if (UNK == mode)
{
params += "<SuppressModeChange:1>Y";
}
simple_command (("<command:11>CmdQSXSplit<parameters:%1>" + params).arg (params.size ()));
}
else
{
simple_command ("<command:8>CmdSplit<parameters:8><1:3>off");
}
update_split (tx);
update_other_frequency (tx);
}
void DXLabSuiteCommanderTransceiver::do_mode (MODE m)
{
TRACE_CAT ("DXLabSuiteCommanderTransceiver", m << state ());
auto m_string = map_mode (m);
auto params = ("<1:%1>" + m_string).arg (m_string.size ());
simple_command (("<command:10>CmdSetMode<parameters:%1>" + params).arg (params.size ()));
update_mode (m);
}
void DXLabSuiteCommanderTransceiver::poll ()
{
#if WSJT_TRACE_CAT && WSJT_TRACE_CAT_POLLS
bool quiet {false};
#else
bool quiet {true};
#endif
auto reply = command_with_reply ("<command:10>CmdGetFreq<parameters:0>", quiet);
if (0 == reply.indexOf ("<CmdFreq:"))
{
auto f = string_to_frequency (reply.mid (reply.indexOf ('>') + 1));
if (f)
{
if (!state ().ptt ()) // Commander is not reliable on frequency
// polls while transmitting
{
update_rx_frequency (f);
}
}
}
else
{
TRACE_CAT_POLL ("DXLabSuiteCommanderTransceiver", "get frequency unexpected response" << reply);
throw error {tr ("DX Lab Suite Commander didn't respond correctly polling frequency: ") + reply};
}
if (state ().split ())
{
reply = command_with_reply ("<command:12>CmdGetTXFreq<parameters:0>", quiet);
if (0 == reply.indexOf ("<CmdTXFreq:"))
{
auto f = string_to_frequency (reply.mid (reply.indexOf ('>') + 1));
if (f)
{
if (!state ().ptt ()) // Commander is not reliable on frequency
// polls while transmitting
{
update_other_frequency (f);
}
}
}
else
{
TRACE_CAT_POLL ("DXLabSuiteCommanderTransceiver", "get tx frequency unexpected response" << reply);
throw error {tr ("DX Lab Suite Commander didn't respond correctly polling TX frequency: ") + reply};
}
}
reply = command_with_reply ("<command:12>CmdSendSplit<parameters:0>", quiet);
if (0 == reply.indexOf ("<CmdSplit:"))
{
auto split = reply.mid (reply.indexOf ('>') + 1);
if ("ON" == split)
{
update_split (true);
}
else if ("OFF" == split)
{
update_split (false);
}
else
{
TRACE_CAT_POLL ("DXLabSuiteCommanderTransceiver", "unexpected split state" << split);
throw error {tr ("DX Lab Suite Commander sent an unrecognised split state: ") + split};
}
}
else
{
TRACE_CAT_POLL ("DXLabSuiteCommanderTransceiver", "get split mode unexpected response" << reply);
throw error {tr ("DX Lab Suite Commander didn't respond correctly polling split status: ") + reply};
}
get_mode (quiet);
}
auto DXLabSuiteCommanderTransceiver::get_mode (bool no_debug) -> MODE
{
MODE m {UNK};
auto reply = command_with_reply ("<command:11>CmdSendMode<parameters:0>", no_debug);
if (0 == reply.indexOf ("<CmdMode:"))
{
auto mode = reply.mid (reply.indexOf ('>') + 1);
if ("AM" == mode)
{
m = AM;
}
else if ("CW" == mode)
{
m = CW;
}
else if ("CW-R" == mode)
{
m = CW_R;
}
else if ("FM" == mode || "WBFM" == mode)
{
m = FM;
}
else if ("LSB" == mode)
{
m = LSB;
}
else if ("USB" == mode)
{
m = USB;
}
else if ("RTTY" == mode)
{
m = FSK;
}
else if ("RTTY-R" == mode)
{
m = FSK_R;
}
else if ("PKT" == mode || "DATA-L" == mode || "Data-L" == mode || "DIGL" == mode)
{
m = DIG_L;
}
else if ("PKT-R" == mode || "DATA-U" == mode || "Data-U" == mode || "DIGU" == mode)
{
m = DIG_U;
}
else
{
TRACE_CAT_POLL ("DXLabSuiteCommanderTransceiver", "unexpected mode name" << mode);
throw error {tr ("DX Lab Suite Commander sent an unrecognised mode: \"") + mode + '"'};
}
update_mode (m);
}
else
{
TRACE_CAT_POLL ("DXLabSuiteCommanderTransceiver", "unexpected response" << reply);
throw error {tr ("DX Lab Suite Commander didn't respond correctly polling mode: ") + reply};
}
return m;
}
void DXLabSuiteCommanderTransceiver::simple_command (QString const& cmd, bool no_debug)
{
Q_ASSERT (commander_);
if (!no_debug)
{
TRACE_CAT ("DXLabSuiteCommanderTransceiver", cmd);
}
if (!write_to_port (cmd))
{
TRACE_CAT ("DXLabSuiteCommanderTransceiver", "failed:" << commander_->errorString ());
throw error {tr ("DX Lab Suite Commander send command failed\n") + commander_->errorString ()};
}
}
QString DXLabSuiteCommanderTransceiver::command_with_reply (QString const& cmd, bool no_debug)
{
Q_ASSERT (commander_);
if (!write_to_port (cmd))
{
TRACE_CAT ("DXLabSuiteCommanderTransceiver", "failed to send command:" << commander_->errorString ());
throw error {
tr ("DX Lab Suite Commander failed to send command \"%1\": %2\n")
.arg (cmd)
.arg (commander_->errorString ())
};
}
// waitForReadReady appears to be unreliable on Windows timing out
// when data is waiting so retry a few times
unsigned retries {5};
bool replied {false};
while (!replied && --retries)
{
replied = commander_->waitForReadyRead ();
if (!replied && commander_->error () != commander_->SocketTimeoutError)
{
TRACE_CAT ("DXLabSuiteCommanderTransceiver", cmd << "failed to read reply:" << commander_->errorString ());
throw error {
tr ("DX Lab Suite Commander send command \"%1\" read reply failed: %2\n")
.arg (cmd)
.arg (commander_->errorString ())
};
}
}
if (!replied)
{
TRACE_CAT ("DXLabSuiteCommanderTransceiver", cmd << "retries exhausted");
throw error {
tr ("DX Lab Suite Commander retries exhausted sending command \"%1\"")
.arg (cmd)
};
}
auto result = commander_->readAll ();
// qDebug () << "result: " << result;
// for (int i = 0; i < result.size (); ++i)
// {
// qDebug () << i << ":" << hex << int (result[i]);
// }
if (!no_debug)
{
TRACE_CAT ("DXLabSuiteCommanderTransceiver", cmd << "->" << result);
}
return result; // converting raw UTF-8 bytes to QString
}
bool DXLabSuiteCommanderTransceiver::write_to_port (QString const& s)
{
auto data = s.toLocal8Bit ();
auto to_send = data.constData ();
auto length = data.size ();
qint64 total_bytes_sent {0};
while (total_bytes_sent < length)
{
auto bytes_sent = commander_->write (to_send + total_bytes_sent, length - total_bytes_sent);
if (bytes_sent < 0 || !commander_->waitForBytesWritten ())
{
return false;
}
total_bytes_sent += bytes_sent;
}
return true;
}
QString DXLabSuiteCommanderTransceiver::frequency_to_string (Frequency f) const
{
// number is localized and in kHz, avoid floating point translation
// errors by adding a small number (0.1Hz)
return QString {"%L1"}.arg (f / 1e3 + 1e-4, 10, 'f', 3);
}
auto DXLabSuiteCommanderTransceiver::string_to_frequency (QString s) const -> Frequency
{
// temporary hack because Commander is returning invalid UTF-8 bytes
s.replace (QChar {QChar::ReplacementCharacter}, locale_.groupSeparator ());
// remove DP - relies on n.nnn kHz format so we can do ulonglong
// conversion to Hz
bool ok;
// auto f = locale_.toDouble (s, &ok); // use when CmdSendFreq and
// CmdSendTxFreq reinstated
auto f = QLocale::c ().toDouble (s, &ok); // temporary fix
if (!ok)
{
throw error {tr ("DX Lab Suite Commander sent an unrecognized frequency")};
}
return (f + 1e-4) * 1e3;
}
@@ -0,0 +1,67 @@
/*=============================================================================
Copyright (c) 2014-2015 Kohei Takahashi
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 FUSION_AS_SET_11062014_2121
#define FUSION_AS_SET_11062014_2121
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/set/set_fwd.hpp>
///////////////////////////////////////////////////////////////////////////////
// Without variadics, we will use the PP version
///////////////////////////////////////////////////////////////////////////////
#if !defined(BOOST_FUSION_HAS_VARIADIC_SET)
# include <boost/fusion/container/set/detail/cpp03/as_set.hpp>
#else
///////////////////////////////////////////////////////////////////////////////
// C++11 interface
///////////////////////////////////////////////////////////////////////////////
#include <boost/fusion/support/detail/index_sequence.hpp>
#include <boost/fusion/container/set/set.hpp>
#include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/advance.hpp>
#include <cstddef>
namespace boost { namespace fusion { namespace detail
{
BOOST_FUSION_BARRIER_BEGIN
template <int size
, typename = typename detail::make_index_sequence<size>::type>
struct as_set;
template <int size, std::size_t ...Indices>
struct as_set<size, detail::index_sequence<Indices...> >
{
template <typename I>
struct apply
{
typedef set<
typename result_of::value_of<
typename result_of::advance_c<I, Indices>::type
>::type...
> type;
};
template <typename Iterator>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static typename apply<Iterator>::type
call(Iterator const& i)
{
typedef apply<Iterator> gen;
typedef typename gen::type result;
return result(*advance_c<Indices>(i)...);
}
};
BOOST_FUSION_BARRIER_END
}}}
#endif
#endif
@@ -0,0 +1,100 @@
#include "logbook.h"
#include <QDebug>
#include <QFontMetrics>
#include <QStandardPaths>
#include <QDir>
namespace
{
auto logFileName = "wsjtx_log.adi";
auto countryFileName = "cty.dat";
}
void LogBook::init()
{
QDir dataPath {QStandardPaths::writableLocation (QStandardPaths::DataLocation)};
QString countryDataFilename;
if (dataPath.exists (countryFileName))
{
// User override
countryDataFilename = dataPath.absoluteFilePath (countryFileName);
}
else
{
countryDataFilename = QString {":/"} + countryFileName;
}
_countries.init(countryDataFilename);
_countries.load();
_worked.init(_countries.getCountryNames());
_log.init(dataPath.absoluteFilePath (logFileName));
_log.load();
_setAlreadyWorkedFromLog();
/*
int QSOcount = _log.getCount();
int count = _worked.getWorkedCount();
qDebug() << QSOcount << "QSOs and" << count << "countries worked in file" << logFilename;
*/
// QString call = "ok1ct";
// QString countryName;
// bool callWorkedBefore,countryWorkedBefore;
// match(/*in*/call, /*out*/ countryName,callWorkedBefore,countryWorkedBefore);
// qDebug() << countryName;
}
void LogBook::_setAlreadyWorkedFromLog()
{
QList<QString> calls = _log.getCallList();
QString c;
foreach(c,calls)
{
QString countryName = _countries.find(c);
if (countryName.length() > 0)
{
_worked.setAsWorked(countryName);
//qDebug() << countryName << " worked " << c;
}
}
}
void LogBook::match(/*in*/const QString call,
/*out*/ QString &countryName,
bool &callWorkedBefore,
bool &countryWorkedBefore)
{
if (call.length() > 0)
{
QString currentMode = "JT9"; // JT65 == JT9 in ADIF::match()
QString currentBand = ""; // match any band
callWorkedBefore = _log.match(call,currentBand,currentMode);
countryName = _countries.find(call);
if (countryName.length() > 0) // country was found
countryWorkedBefore = _worked.getHasWorked(countryName);
else
{
countryName = "where?"; //error: prefix not found
countryWorkedBefore = false;
}
}
//qDebug() << "Logbook:" << call << ":" << countryName << "Cty B4:" << countryWorkedBefore << "call B4:" << callWorkedBefore;
}
void LogBook::addAsWorked(const QString call, const QString band, const QString mode, const QString date)
{
//qDebug() << "adding " << call << " as worked";
_log.add(call,band,mode,date);
QString countryName = _countries.find(call);
if (countryName.length() > 0)
_worked.setAsWorked(countryName);
}
@@ -0,0 +1,78 @@
#if !BOOST_PHOENIX_IS_ITERATING
#if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
#include <boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_eval.hpp>
#else
#if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/mem_fun_ptr_eval_" BOOST_PHOENIX_LIMIT_STR ".hpp")
#endif
/*==============================================================================
Copyright (c) 2005-2010 Joel de Guzman
Copyright (c) 2010 Thomas Heller
Copyright (c) 2016 Kohei Takahashi
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(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
#pragma wave option(preserve: 1)
#endif
#define BOOST_PHOENIX_MEMBER_EVAL(Z, N, D) \
BOOST_PP_COMMA_IF(BOOST_PP_NOT(BOOST_PP_EQUAL(N, 2))) \
boost::phoenix::eval(BOOST_PP_CAT(a, N), ctx) \
/**/
#define BOOST_PHOENIX_ITERATION_PARAMS \
(3, (2, BOOST_PHOENIX_LIMIT, \
<boost/phoenix/operator/detail/cpp03/mem_fun_ptr_eval.hpp>)) \
/**/
#include BOOST_PHOENIX_ITERATE()
#undef BOOST_PHOENIX_MEMBER_EVAL
#if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
#pragma wave option(output: null)
#endif
#endif
#else // BOOST_PHOENIX_IS_ITERATING
template <typename This, BOOST_PHOENIX_typename_A, typename Context>
struct result<This(BOOST_PHOENIX_A, Context)>
: result<This(BOOST_PHOENIX_A_const_ref, Context)>
{};
template <typename This, BOOST_PHOENIX_typename_A, typename Context>
struct result<This(BOOST_PHOENIX_A_ref, Context)>
: result_of::mem_fun_ptr_eval<Context, BOOST_PHOENIX_A>
{};
template <BOOST_PHOENIX_typename_A, typename Context>
typename result_of::mem_fun_ptr_eval<Context, BOOST_PHOENIX_A>::type
operator()(
BOOST_PHOENIX_A_const_ref_a
, Context const & ctx
) const
{
return
(
get_pointer(boost::phoenix::eval(a0, ctx))
->*boost::phoenix::eval(a1, ctx)
)(
BOOST_PP_REPEAT_FROM_TO(
2
, BOOST_PHOENIX_ITERATION
, BOOST_PHOENIX_MEMBER_EVAL
, BOOST_PHOENIX_ITERATION
)
);
}
#endif
@@ -0,0 +1,404 @@
//=======================================================================
// Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
//
// 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_GRAPH_TRAITS_HPP
#define BOOST_GRAPH_TRAITS_HPP
#include <boost/config.hpp>
#include <iterator>
#include <utility> /* Primarily for std::pair */
#include <boost/tuple/tuple.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/not.hpp>
#include <boost/mpl/has_xxx.hpp>
#include <boost/mpl/void.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/iterator/iterator_categories.hpp>
#include <boost/iterator/iterator_adaptor.hpp>
#include <boost/pending/property.hpp>
#include <boost/detail/workaround.hpp>
namespace boost {
namespace detail {
#define BOOST_GRAPH_MEMBER_OR_VOID(name) \
BOOST_MPL_HAS_XXX_TRAIT_DEF(name) \
template <typename T> struct BOOST_JOIN(get_member_, name) {typedef typename T::name type;}; \
template <typename T> struct BOOST_JOIN(get_opt_member_, name): \
boost::mpl::eval_if_c< \
BOOST_JOIN(has_, name)<T>::value, \
BOOST_JOIN(get_member_, name)<T>, \
boost::mpl::identity<void> > \
{};
BOOST_GRAPH_MEMBER_OR_VOID(adjacency_iterator)
BOOST_GRAPH_MEMBER_OR_VOID(out_edge_iterator)
BOOST_GRAPH_MEMBER_OR_VOID(in_edge_iterator)
BOOST_GRAPH_MEMBER_OR_VOID(vertex_iterator)
BOOST_GRAPH_MEMBER_OR_VOID(edge_iterator)
BOOST_GRAPH_MEMBER_OR_VOID(vertices_size_type)
BOOST_GRAPH_MEMBER_OR_VOID(edges_size_type)
BOOST_GRAPH_MEMBER_OR_VOID(degree_size_type)
}
template <typename G>
struct graph_traits {
#define BOOST_GRAPH_PULL_OPT_MEMBER(name) \
typedef typename detail::BOOST_JOIN(get_opt_member_, name)<G>::type name;
typedef typename G::vertex_descriptor vertex_descriptor;
typedef typename G::edge_descriptor edge_descriptor;
BOOST_GRAPH_PULL_OPT_MEMBER(adjacency_iterator)
BOOST_GRAPH_PULL_OPT_MEMBER(out_edge_iterator)
BOOST_GRAPH_PULL_OPT_MEMBER(in_edge_iterator)
BOOST_GRAPH_PULL_OPT_MEMBER(vertex_iterator)
BOOST_GRAPH_PULL_OPT_MEMBER(edge_iterator)
typedef typename G::directed_category directed_category;
typedef typename G::edge_parallel_category edge_parallel_category;
typedef typename G::traversal_category traversal_category;
BOOST_GRAPH_PULL_OPT_MEMBER(vertices_size_type)
BOOST_GRAPH_PULL_OPT_MEMBER(edges_size_type)
BOOST_GRAPH_PULL_OPT_MEMBER(degree_size_type)
#undef BOOST_GRAPH_PULL_OPT_MEMBER
static inline vertex_descriptor null_vertex();
};
template <typename G>
inline typename graph_traits<G>::vertex_descriptor
graph_traits<G>::null_vertex()
{ return G::null_vertex(); }
// directed_category tags
struct directed_tag { };
struct undirected_tag { };
struct bidirectional_tag : public directed_tag { };
namespace detail {
inline bool is_directed(directed_tag) { return true; }
inline bool is_directed(undirected_tag) { return false; }
}
/** Return true if the given graph is directed. */
template <typename Graph>
bool is_directed(const Graph&) {
typedef typename graph_traits<Graph>::directed_category Cat;
return detail::is_directed(Cat());
}
/** Return true if the given graph is undirected. */
template <typename Graph>
bool is_undirected(const Graph& g) {
return !is_directed(g);
}
/** @name Directed/Undirected Graph Traits */
//@{
namespace graph_detail {
template <typename Tag>
struct is_directed_tag
: mpl::bool_<is_convertible<Tag, directed_tag>::value>
{ };
} // namespace graph_detail
template <typename Graph>
struct is_directed_graph
: graph_detail::is_directed_tag<
typename graph_traits<Graph>::directed_category
>
{ };
template <typename Graph>
struct is_undirected_graph
: mpl::not_< is_directed_graph<Graph> >
{ };
//@}
// edge_parallel_category tags
struct allow_parallel_edge_tag { };
struct disallow_parallel_edge_tag { };
namespace detail {
inline bool allows_parallel(allow_parallel_edge_tag) { return true; }
inline bool allows_parallel(disallow_parallel_edge_tag) { return false; }
}
template <typename Graph>
bool allows_parallel_edges(const Graph&) {
typedef typename graph_traits<Graph>::edge_parallel_category Cat;
return detail::allows_parallel(Cat());
}
/** @name Parallel Edges Traits */
//@{
/**
* The is_multigraph metafunction returns true if the graph allows
* parallel edges. Technically, a multigraph is a simple graph that
* allows parallel edges, but since there are no traits for the allowance
* or disallowance of loops, this is a moot point.
*/
template <typename Graph>
struct is_multigraph
: mpl::bool_<
is_same<
typename graph_traits<Graph>::edge_parallel_category,
allow_parallel_edge_tag
>::value
>
{ };
//@}
// traversal_category tags
struct incidence_graph_tag { };
struct adjacency_graph_tag { };
struct bidirectional_graph_tag : virtual incidence_graph_tag { };
struct vertex_list_graph_tag { };
struct edge_list_graph_tag { };
struct adjacency_matrix_tag { };
// Parallel traversal_category tags
struct distributed_graph_tag { };
struct distributed_vertex_list_graph_tag { };
struct distributed_edge_list_graph_tag { };
#define BOOST_GRAPH_SEQUENTIAL_TRAITS_DEFINES_DISTRIBUTED_TAGS // Disable these from external versions of PBGL
/** @name Traversal Category Traits
* These traits classify graph types by their supported methods of
* vertex and edge traversal.
*/
//@{
template <typename Graph>
struct is_incidence_graph
: mpl::bool_<
is_convertible<
typename graph_traits<Graph>::traversal_category,
incidence_graph_tag
>::value
>
{ };
template <typename Graph>
struct is_bidirectional_graph
: mpl::bool_<
is_convertible<
typename graph_traits<Graph>::traversal_category,
bidirectional_graph_tag
>::value
>
{ };
template <typename Graph>
struct is_vertex_list_graph
: mpl::bool_<
is_convertible<
typename graph_traits<Graph>::traversal_category,
vertex_list_graph_tag
>::value
>
{ };
template <typename Graph>
struct is_edge_list_graph
: mpl::bool_<
is_convertible<
typename graph_traits<Graph>::traversal_category,
edge_list_graph_tag
>::value
>
{ };
template <typename Graph>
struct is_adjacency_matrix
: mpl::bool_<
is_convertible<
typename graph_traits<Graph>::traversal_category,
adjacency_matrix_tag
>::value
>
{ };
//@}
/** @name Directed Graph Traits
* These metafunctions are used to fully classify directed vs. undirected
* graphs. Recall that an undirected graph is also bidirectional, but it
* cannot be both undirected and directed at the same time.
*/
//@{
template <typename Graph>
struct is_directed_unidirectional_graph
: mpl::and_<
is_directed_graph<Graph>, mpl::not_< is_bidirectional_graph<Graph> >
>
{ };
template <typename Graph>
struct is_directed_bidirectional_graph
: mpl::and_<
is_directed_graph<Graph>, is_bidirectional_graph<Graph>
>
{ };
//@}
//?? not the right place ?? Lee
typedef boost::forward_traversal_tag multi_pass_input_iterator_tag;
namespace detail {
BOOST_MPL_HAS_XXX_TRAIT_DEF(graph_property_type)
BOOST_MPL_HAS_XXX_TRAIT_DEF(edge_property_type)
BOOST_MPL_HAS_XXX_TRAIT_DEF(vertex_property_type)
template <typename G> struct get_graph_property_type {typedef typename G::graph_property_type type;};
template <typename G> struct get_edge_property_type {typedef typename G::edge_property_type type;};
template <typename G> struct get_vertex_property_type {typedef typename G::vertex_property_type type;};
}
template <typename G>
struct graph_property_type
: boost::mpl::eval_if<detail::has_graph_property_type<G>,
detail::get_graph_property_type<G>,
no_property> {};
template <typename G>
struct edge_property_type
: boost::mpl::eval_if<detail::has_edge_property_type<G>,
detail::get_edge_property_type<G>,
no_property> {};
template <typename G>
struct vertex_property_type
: boost::mpl::eval_if<detail::has_vertex_property_type<G>,
detail::get_vertex_property_type<G>,
no_property> {};
template<typename G>
struct graph_bundle_type {
typedef typename G::graph_bundled type;
};
template<typename G>
struct vertex_bundle_type {
typedef typename G::vertex_bundled type;
};
template<typename G>
struct edge_bundle_type {
typedef typename G::edge_bundled type;
};
namespace graph { namespace detail {
template<typename Graph, typename Descriptor>
class bundled_result {
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
typedef typename mpl::if_c<(is_same<Descriptor, Vertex>::value),
vertex_bundle_type<Graph>,
edge_bundle_type<Graph> >::type bundler;
public:
typedef typename bundler::type type;
};
template<typename Graph>
class bundled_result<Graph, graph_bundle_t> {
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
typedef graph_bundle_type<Graph> bundler;
public:
typedef typename bundler::type type;
};
} } // namespace graph::detail
namespace graph_detail {
// A helper metafunction for determining whether or not a type is
// bundled.
template <typename T>
struct is_no_bundle : mpl::bool_<is_same<T, no_property>::value>
{ };
} // namespace graph_detail
/** @name Graph Property Traits
* These metafunctions (along with those above), can be used to access the
* vertex and edge properties (bundled or otherwise) of vertices and
* edges.
*/
//@{
template<typename Graph>
struct has_graph_property
: mpl::not_<
typename detail::is_no_property<
typename graph_property_type<Graph>::type
>::type
>::type
{ };
template<typename Graph>
struct has_bundled_graph_property
: mpl::not_<
graph_detail::is_no_bundle<typename graph_bundle_type<Graph>::type>
>
{ };
template <typename Graph>
struct has_vertex_property
: mpl::not_<
typename detail::is_no_property<typename vertex_property_type<Graph>::type>
>::type
{ };
template <typename Graph>
struct has_bundled_vertex_property
: mpl::not_<
graph_detail::is_no_bundle<typename vertex_bundle_type<Graph>::type>
>
{ };
template <typename Graph>
struct has_edge_property
: mpl::not_<
typename detail::is_no_property<typename edge_property_type<Graph>::type>
>::type
{ };
template <typename Graph>
struct has_bundled_edge_property
: mpl::not_<
graph_detail::is_no_bundle<typename edge_bundle_type<Graph>::type>
>
{ };
//@}
} // namespace boost
// Since pair is in namespace std, Koenig lookup will find source and
// target if they are also defined in namespace std. This is illegal,
// but the alternative is to put source and target in the global
// namespace which causes name conflicts with other libraries (like
// SUIF).
namespace std {
/* Some helper functions for dealing with pairs as edges */
template <class T, class G>
T source(pair<T,T> p, const G&) { return p.first; }
template <class T, class G>
T target(pair<T,T> p, const G&) { return p.second; }
}
#if defined(__GNUC__) && defined(__SGI_STL_PORT)
// For some reason g++ with STLport does not see the above definition
// of source() and target() unless we bring them into the boost
// namespace.
namespace boost {
using std::source;
using std::target;
}
#endif
#endif // BOOST_GRAPH_TRAITS_HPP
@@ -0,0 +1,800 @@
#include "FrequencyList.hpp"
#include <cstdlib>
#include <utility>
#include <limits>
#include <QMetaType>
#include <QAbstractTableModel>
#include <QString>
#include <QList>
#include <QListIterator>
#include <QVector>
#include <QStringList>
#include <QMimeData>
#include <QDataStream>
#include <QByteArray>
#include <QDebugStateSaver>
#include "Radio.hpp"
#include "Bands.hpp"
#include "pimpl_impl.hpp"
#include "moc_FrequencyList.cpp"
namespace
{
FrequencyList::FrequencyItems const default_frequency_list =
{
{198000, Modes::FreqCal, IARURegions::R1}, // BBC Radio 4 Droitwich
{4996000, Modes::FreqCal, IARURegions::R1}, // RWM time signal
{9996000, Modes::FreqCal, IARURegions::R1}, // RWM time signal
{14996000, Modes::FreqCal, IARURegions::R1}, // RWM time signal
{660000, Modes::FreqCal, IARURegions::R2},
{880000, Modes::FreqCal, IARURegions::R2},
{1210000, Modes::FreqCal, IARURegions::R2},
{2500000, Modes::FreqCal, IARURegions::ALL},
{3330000, Modes::FreqCal, IARURegions::ALL},
{5000000, Modes::FreqCal, IARURegions::ALL},
{7850000, Modes::FreqCal, IARURegions::ALL},
{10000000, Modes::FreqCal, IARURegions::ALL},
{14670000, Modes::FreqCal, IARURegions::ALL},
{15000000, Modes::FreqCal, IARURegions::ALL},
{20000000, Modes::FreqCal, IARURegions::ALL},
{136000, Modes::WSPR, IARURegions::ALL},
{136130, Modes::JT65, IARURegions::ALL},
{136130, Modes::JT9, IARURegions::ALL},
{474200, Modes::JT65, IARURegions::ALL},
{474200, Modes::JT9, IARURegions::ALL},
{474200, Modes::WSPR, IARURegions::ALL},
{1836600, Modes::WSPR, IARURegions::ALL},
{1838000, Modes::JT65, IARURegions::ALL}, // squeezed allocations
{1839000, Modes::JT9, IARURegions::ALL},
{1840000, Modes::FT8, IARURegions::ALL},
{3570000, Modes::JT65, IARURegions::ALL}, // JA compatible
{3572000, Modes::JT9, IARURegions::ALL},
{3573000, Modes::FT8, IARURegions::ALL}, // above as below JT65
// is out of DM allocation
{3572600, Modes::WSPR, IARURegions::ALL}, // needs guard marker
// and lock out
{7038600, Modes::WSPR, IARURegions::ALL},
{7074000, Modes::FT8, IARURegions::ALL},
{7076000, Modes::JT65, IARURegions::ALL},
{7078000, Modes::JT9, IARURegions::ALL},
{10136000, Modes::FT8, IARURegions::ALL},
{10138000, Modes::JT65, IARURegions::ALL},
{10138700, Modes::WSPR, IARURegions::ALL},
{10140000, Modes::JT9, IARURegions::ALL},
{14095600, Modes::WSPR, IARURegions::ALL},
{14074000, Modes::FT8, IARURegions::ALL},
{14076000, Modes::JT65, IARURegions::ALL},
{14078000, Modes::JT9, IARURegions::ALL},
{18100000, Modes::FT8, IARURegions::ALL},
{18102000, Modes::JT65, IARURegions::ALL},
{18104000, Modes::JT9, IARURegions::ALL},
{18104600, Modes::WSPR, IARURegions::ALL},
{21074000, Modes::FT8, IARURegions::ALL},
{21076000, Modes::JT65, IARURegions::ALL},
{21078000, Modes::JT9, IARURegions::ALL},
{21094600, Modes::WSPR, IARURegions::ALL},
{24915000, Modes::FT8, IARURegions::ALL},
{24917000, Modes::JT65, IARURegions::ALL},
{24919000, Modes::JT9, IARURegions::ALL},
{24924600, Modes::WSPR, IARURegions::ALL},
{28074000, Modes::FT8, IARURegions::ALL},
{28076000, Modes::JT65, IARURegions::ALL},
{28078000, Modes::JT9, IARURegions::ALL},
{28124600, Modes::WSPR, IARURegions::ALL},
{50000000, Modes::Echo, IARURegions::ALL},
{50276000, Modes::JT65, IARURegions::R2},
{50276000, Modes::JT65, IARURegions::R3},
{50260000, Modes::MSK144, IARURegions::R2},
{50260000, Modes::MSK144, IARURegions::R3},
{50293000, Modes::WSPR, IARURegions::R2},
{50293000, Modes::WSPR, IARURegions::R3},
{50310000, Modes::JT65, IARURegions::ALL},
{50312000, Modes::JT9, IARURegions::ALL},
{50313000, Modes::FT8, IARURegions::ALL},
{50360000, Modes::MSK144, IARURegions::R1},
{70100000, Modes::FT8, IARURegions::R1},
{70102000, Modes::JT65, IARURegions::R1},
{70104000, Modes::JT9, IARURegions::R1},
{70091000, Modes::WSPR, IARURegions::R1},
{70230000, Modes::MSK144, IARURegions::R1},
{144000000, Modes::Echo, IARURegions::ALL},
{144120000, Modes::JT65, IARURegions::ALL},
{144120000, Modes::Echo, IARURegions::ALL},
{144360000, Modes::MSK144, IARURegions::R1},
{144150000, Modes::MSK144, IARURegions::R2},
{144489000, Modes::WSPR, IARURegions::ALL},
{222065000, Modes::Echo, IARURegions::R2},
{222065000, Modes::JT65, IARURegions::R2},
{432065000, Modes::Echo, IARURegions::ALL},
{432065000, Modes::JT65, IARURegions::ALL},
{432300000, Modes::WSPR, IARURegions::ALL},
{432360000, Modes::MSK144, IARURegions::ALL},
{902065000, Modes::JT65, IARURegions::ALL},
{1296065000, Modes::Echo, IARURegions::ALL},
{1296065000, Modes::JT65, IARURegions::ALL},
{1296500000, Modes::WSPR, IARURegions::ALL},
{2301000000, Modes::Echo, IARURegions::ALL},
{2301065000, Modes::JT4, IARURegions::ALL},
{2301065000, Modes::JT65, IARURegions::ALL},
{2304065000, Modes::Echo, IARURegions::ALL},
{2304065000, Modes::JT4, IARURegions::ALL},
{2304065000, Modes::JT65, IARURegions::ALL},
{2320065000, Modes::Echo, IARURegions::ALL},
{2320065000, Modes::JT4, IARURegions::ALL},
{2320065000, Modes::JT65, IARURegions::ALL},
{3400065000, Modes::Echo, IARURegions::ALL},
{3400065000, Modes::JT4, IARURegions::ALL},
{3400065000, Modes::JT65, IARURegions::ALL},
{3456065000, Modes::Echo, IARURegions::ALL},
{3456065000, Modes::JT4, IARURegions::ALL},
{3456065000, Modes::JT65, IARURegions::ALL},
{5760065000, Modes::Echo, IARURegions::ALL},
{5760065000, Modes::JT4, IARURegions::ALL},
{5760065000, Modes::JT65, IARURegions::ALL},
{10368100000, Modes::Echo, IARURegions::ALL},
{10368100000, Modes::JT4, IARURegions::ALL},
{10368100000, Modes::JT65, IARURegions::ALL},
{24048100000, Modes::Echo, IARURegions::ALL},
{24048100000, Modes::JT4, IARURegions::ALL},
{24048100000, Modes::JT65, IARURegions::ALL},
};
}
#if !defined (QT_NO_DEBUG_STREAM)
QDebug operator << (QDebug debug, FrequencyList::Item const& item)
{
QDebugStateSaver saver {debug};
debug.nospace () << "FrequencyItem("
<< item.frequency_ << ", "
<< item.region_ << ", "
<< item.mode_ << ')';
return debug;
}
#endif
QDataStream& operator << (QDataStream& os, FrequencyList::Item const& item)
{
return os << item.frequency_
<< item.mode_
<< item.region_;
}
QDataStream& operator >> (QDataStream& is, FrequencyList::Item& item)
{
return is >> item.frequency_
>> item.mode_
>> item.region_;
}
class FrequencyList::impl final
: public QAbstractTableModel
{
public:
impl (Bands const * bands, QObject * parent)
: QAbstractTableModel {parent}
, bands_ {bands}
, region_filter_ {IARURegions::ALL}
, mode_filter_ {Modes::ALL}
{
}
FrequencyItems frequency_list (FrequencyItems);
QModelIndex add (Item);
void add (FrequencyItems);
// Implement the QAbstractTableModel interface
int rowCount (QModelIndex const& parent = QModelIndex {}) const override;
int columnCount (QModelIndex const& parent = QModelIndex {}) const override;
Qt::ItemFlags flags (QModelIndex const& = QModelIndex {}) const override;
QVariant data (QModelIndex const&, int role = Qt::DisplayRole) const override;
bool setData (QModelIndex const&, QVariant const& value, int role = Qt::EditRole) override;
QVariant headerData (int section, Qt::Orientation, int = Qt::DisplayRole) const override;
bool removeRows (int row, int count, QModelIndex const& parent = QModelIndex {}) override;
bool insertRows (int row, int count, QModelIndex const& parent = QModelIndex {}) override;
QStringList mimeTypes () const override;
QMimeData * mimeData (QModelIndexList const&) const override;
static int constexpr num_cols {SENTINAL};
static auto constexpr mime_type = "application/wsjt.Frequencies";
Bands const * bands_;
FrequencyItems frequency_list_;
Region region_filter_;
Mode mode_filter_;
};
FrequencyList::FrequencyList (Bands const * bands, QObject * parent)
: QSortFilterProxyModel {parent}
, m_ {bands, parent}
{
setSourceModel (&*m_);
setSortRole (SortRole);
}
FrequencyList::~FrequencyList ()
{
}
auto FrequencyList::frequency_list (FrequencyItems frequency_list) -> FrequencyItems
{
return m_->frequency_list (frequency_list);
}
auto FrequencyList::frequency_list () const -> FrequencyItems const&
{
return m_->frequency_list_;
}
auto FrequencyList::frequency_list (QModelIndexList const& model_index_list) const -> FrequencyItems
{
FrequencyItems list;
Q_FOREACH (auto const& index, model_index_list)
{
list << m_->frequency_list_[mapToSource (index).row ()];
}
return list;
}
void FrequencyList::frequency_list_merge (FrequencyItems const& items)
{
m_->add (items);
}
int FrequencyList::best_working_frequency (Frequency f) const
{
int result {-1};
auto const& target_band = m_->bands_->find (f);
if (!target_band.isEmpty ())
{
Radio::FrequencyDelta delta {std::numeric_limits<Radio::FrequencyDelta>::max ()};
// find a frequency in the same band that is allowed
for (int row = 0; row < rowCount (); ++row)
{
auto const& source_row = mapToSource (index (row, 0)).row ();
auto const& candidate_frequency = m_->frequency_list_[source_row].frequency_;
auto const& band = m_->bands_->find (candidate_frequency);
if (band == target_band)
{
// take closest band match
Radio::FrequencyDelta new_delta = f - candidate_frequency;
if (std::abs (new_delta) < std::abs (delta))
{
delta = new_delta;
result = row;
}
}
}
}
return result;
}
int FrequencyList::best_working_frequency (QString const& target_band) const
{
int result {-1};
if (!target_band.isEmpty ())
{
// find a frequency in the same band that is allowed
for (int row = 0; row < rowCount (); ++row)
{
auto const& source_row = mapToSource (index (row, 0)).row ();
auto const& band = m_->bands_->find (m_->frequency_list_[source_row].frequency_);
if (band == target_band)
{
return row;
}
}
}
return result;
}
void FrequencyList::reset_to_defaults ()
{
m_->frequency_list (default_frequency_list);
}
QModelIndex FrequencyList::add (Item f)
{
return mapFromSource (m_->add (f));
}
bool FrequencyList::remove (Item f)
{
auto row = m_->frequency_list_.indexOf (f);
if (0 > row)
{
return false;
}
return m_->removeRow (row);
}
namespace
{
bool row_is_higher (QModelIndex const& lhs, QModelIndex const& rhs)
{
return lhs.row () > rhs.row ();
}
}
bool FrequencyList::removeDisjointRows (QModelIndexList rows)
{
bool result {true};
// We must work with source model indexes because we don't want row
// removes to invalidate model indexes we haven't yet processed. We
// achieve that by processing them in decending row order.
for (int r = 0; r < rows.size (); ++r)
{
rows[r] = mapToSource (rows[r]);
}
// reverse sort by row
qSort (rows.begin (), rows.end (), row_is_higher);
Q_FOREACH (auto index, rows)
{
if (result && !m_->removeRow (index.row ()))
{
result = false;
}
}
return result;
}
void FrequencyList::filter (Region region, Mode mode)
{
m_->region_filter_ = region;
m_->mode_filter_ = mode;
invalidateFilter ();
}
bool FrequencyList::filterAcceptsRow (int source_row, QModelIndex const& /* parent */) const
{
bool result {true};
auto const& item = m_->frequency_list_[source_row];
if (m_->region_filter_ != IARURegions::ALL)
{
result = IARURegions::ALL == item.region_ || m_->region_filter_ == item.region_;
}
if (result && m_->mode_filter_ != Modes::ALL)
{
// we pass ALL mode rows unless filtering for FreqCal mode
result = (Modes::ALL == item.mode_ && m_->mode_filter_ != Modes::FreqCal)
|| m_->mode_filter_ == item.mode_;
}
return result;
}
auto FrequencyList::impl::frequency_list (FrequencyItems frequency_list) -> FrequencyItems
{
beginResetModel ();
std::swap (frequency_list_, frequency_list);
endResetModel ();
return frequency_list;
}
QModelIndex FrequencyList::impl::add (Item f)
{
// Any Frequency that isn't in the list may be added
if (!frequency_list_.contains (f))
{
auto row = frequency_list_.size ();
beginInsertRows (QModelIndex {}, row, row);
frequency_list_.append (f);
endInsertRows ();
return index (row, 0);
}
return QModelIndex {};
}
void FrequencyList::impl::add (FrequencyItems items)
{
// Any Frequency that isn't in the list may be added
for (auto p = items.begin (); p != items.end ();)
{
if (frequency_list_.contains (*p))
{
p = items.erase (p);
}
else
{
++p;
}
}
if (items.size ())
{
auto row = frequency_list_.size ();
beginInsertRows (QModelIndex {}, row, row + items.size () - 1);
frequency_list_.append (items);
endInsertRows ();
}
}
int FrequencyList::impl::rowCount (QModelIndex const& parent) const
{
return parent.isValid () ? 0 : frequency_list_.size ();
}
int FrequencyList::impl::columnCount (QModelIndex const& parent) const
{
return parent.isValid () ? 0 : num_cols;
}
Qt::ItemFlags FrequencyList::impl::flags (QModelIndex const& index) const
{
auto result = QAbstractTableModel::flags (index) | Qt::ItemIsDropEnabled;
auto row = index.row ();
auto column = index.column ();
if (index.isValid ()
&& row < frequency_list_.size ()
&& column < num_cols)
{
if (frequency_mhz_column != column)
{
result |= Qt::ItemIsEditable | Qt::ItemIsDragEnabled;
}
}
return result;
}
QVariant FrequencyList::impl::data (QModelIndex const& index, int role) const
{
QVariant item;
auto const& row = index.row ();
auto const& column = index.column ();
if (index.isValid ()
&& row < frequency_list_.size ()
&& column < num_cols)
{
auto const& frequency_item = frequency_list_.at (row);
switch (column)
{
case region_column:
switch (role)
{
case SortRole:
case Qt::DisplayRole:
case Qt::EditRole:
case Qt::AccessibleTextRole:
item = IARURegions::name (frequency_item.region_);
break;
case Qt::ToolTipRole:
case Qt::AccessibleDescriptionRole:
item = tr ("IARU Region");
break;
case Qt::TextAlignmentRole:
item = Qt::AlignHCenter + Qt::AlignVCenter;
break;
}
break;
case mode_column:
switch (role)
{
case SortRole:
case Qt::DisplayRole:
case Qt::EditRole:
case Qt::AccessibleTextRole:
item = Modes::name (frequency_item.mode_);
break;
case Qt::ToolTipRole:
case Qt::AccessibleDescriptionRole:
item = tr ("Mode");
break;
case Qt::TextAlignmentRole:
item = Qt::AlignHCenter + Qt::AlignVCenter;
break;
}
break;
case frequency_column:
switch (role)
{
case SortRole:
case Qt::EditRole:
case Qt::AccessibleTextRole:
item = frequency_item.frequency_;
break;
case Qt::DisplayRole:
{
auto const& band = bands_->find (frequency_item.frequency_);
item = Radio::pretty_frequency_MHz_string (frequency_item.frequency_)
+ " MHz (" + (band.isEmpty () ? "OOB" : band) + ')';
}
break;
case Qt::ToolTipRole:
case Qt::AccessibleDescriptionRole:
item = tr ("Frequency");
break;
case Qt::TextAlignmentRole:
item = Qt::AlignRight + Qt::AlignVCenter;
break;
}
break;
case frequency_mhz_column:
switch (role)
{
case Qt::EditRole:
case Qt::AccessibleTextRole:
item = Radio::frequency_MHz_string (frequency_item.frequency_);
break;
case Qt::DisplayRole:
{
auto const& band = bands_->find (frequency_item.frequency_);
item = Radio::pretty_frequency_MHz_string (frequency_item.frequency_)
+ " MHz (" + (band.isEmpty () ? "OOB" : band) + ')';
}
break;
case Qt::ToolTipRole:
case Qt::AccessibleDescriptionRole:
item = tr ("Frequency (MHz)");
break;
case Qt::TextAlignmentRole:
item = Qt::AlignRight + Qt::AlignVCenter;
break;
}
break;
}
}
return item;
}
bool FrequencyList::impl::setData (QModelIndex const& model_index, QVariant const& value, int role)
{
bool changed {false};
auto const& row = model_index.row ();
if (model_index.isValid ()
&& Qt::EditRole == role
&& row < frequency_list_.size ())
{
QVector<int> roles;
roles << role;
auto& item = frequency_list_[row];
switch (model_index.column ())
{
case region_column:
if (value.canConvert<Region> ())
{
auto region = IARURegions::value (value.toString ());
if (region != item.region_)
{
item.region_ = region;
Q_EMIT dataChanged (model_index, model_index, roles);
changed = true;
}
}
break;
case mode_column:
if (value.canConvert<Mode> ())
{
auto mode = Modes::value (value.toString ());
if (mode != item.mode_)
{
item.mode_ = mode;
Q_EMIT dataChanged (model_index, model_index, roles);
changed = true;
}
}
break;
case frequency_column:
if (value.canConvert<Frequency> ())
{
Radio::Frequency frequency {qvariant_cast <Radio::Frequency> (value)};
if (frequency != item.frequency_)
{
item.frequency_ = frequency;
// mark derived column (1) changed as well
Q_EMIT dataChanged (index (model_index.row (), 1), model_index, roles);
changed = true;
}
}
break;
}
}
return changed;
}
QVariant FrequencyList::impl::headerData (int section, Qt::Orientation orientation, int role) const
{
QVariant header;
if (Qt::DisplayRole == role
&& Qt::Horizontal == orientation
&& section < num_cols)
{
switch (section)
{
case region_column: header = tr ("IARU Region"); break;
case mode_column: header = tr ("Mode"); break;
case frequency_column: header = tr ("Frequency"); break;
case frequency_mhz_column: header = tr ("Frequency (MHz)"); break;
}
}
else
{
header = QAbstractTableModel::headerData (section, orientation, role);
}
return header;
}
bool FrequencyList::impl::removeRows (int row, int count, QModelIndex const& parent)
{
if (0 < count && (row + count) <= rowCount (parent))
{
beginRemoveRows (parent, row, row + count - 1);
for (auto r = 0; r < count; ++r)
{
frequency_list_.removeAt (row);
}
endRemoveRows ();
return true;
}
return false;
}
bool FrequencyList::impl::insertRows (int row, int count, QModelIndex const& parent)
{
if (0 < count)
{
beginInsertRows (parent, row, row + count - 1);
for (auto r = 0; r < count; ++r)
{
frequency_list_.insert (row, Item {0, Mode::ALL, IARURegions::ALL});
}
endInsertRows ();
return true;
}
return false;
}
QStringList FrequencyList::impl::mimeTypes () const
{
QStringList types;
types << mime_type;
return types;
}
QMimeData * FrequencyList::impl::mimeData (QModelIndexList const& items) const
{
QMimeData * mime_data = new QMimeData {};
QByteArray encoded_data;
QDataStream stream {&encoded_data, QIODevice::WriteOnly};
Q_FOREACH (auto const& item, items)
{
if (item.isValid () && frequency_column == item.column ())
{
stream << frequency_list_.at (item.row ());
}
}
mime_data->setData (mime_type, encoded_data);
return mime_data;
}
auto FrequencyList::const_iterator::operator * () const -> Item const&
{
return parent_->frequency_list ().at(parent_->mapToSource (parent_->index (row_, 0)).row ());
}
auto FrequencyList::const_iterator::operator -> () const -> Item const *
{
return &parent_->frequency_list ().at(parent_->mapToSource (parent_->index (row_, 0)).row ());
}
bool FrequencyList::const_iterator::operator != (const_iterator const& rhs) const
{
return parent_ != rhs.parent_ || row_ != rhs.row_;
}
bool FrequencyList::const_iterator::operator == (const_iterator const& rhs) const
{
return parent_ == rhs.parent_ && row_ == rhs.row_;
}
auto FrequencyList::const_iterator::operator ++ () -> const_iterator&
{
++row_;
return *this;
}
auto FrequencyList::begin () const -> const_iterator
{
return const_iterator (this, 0);
}
auto FrequencyList::end () const -> const_iterator
{
return const_iterator (this, rowCount ());
}
auto FrequencyList::find (Frequency f) const -> const_iterator
{
int row {0};
for (; row < rowCount (); ++row)
{
if (m_->frequency_list_[mapToSource (index (row, 0)).row ()].frequency_ == f)
{
break;
}
}
return const_iterator (this, row);
}
auto FrequencyList::filtered_bands () const -> BandSet
{
BandSet result;
for (auto const& item : *this)
{
result << m_->bands_->find (item.frequency_);
}
return result;
}
auto FrequencyList::all_bands (Region region, Mode mode) const -> BandSet
{
BandSet result;
for (auto const& item : m_->frequency_list_)
{
if (region == IARURegions::ALL || item.region_ == region
|| mode == Modes::ALL || item.mode_ == mode)
{
result << m_->bands_->find (item.frequency_);
}
}
return result;
}
@@ -0,0 +1,24 @@
// Copyright David Abrahams 2002.
// 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 HAS_BACK_REFERENCE_DWA2002323_HPP
# define HAS_BACK_REFERENCE_DWA2002323_HPP
# include <boost/python/detail/prefix.hpp>
# include <boost/mpl/bool.hpp>
namespace boost { namespace python {
// traits class which users can specialize to indicate that a class
// contains a back-reference to its owning PyObject*
template <class T>
struct has_back_reference
: mpl::false_
{
};
}} // namespace boost::python
#endif // HAS_BACK_REFERENCE_DWA2002323_HPP
@@ -0,0 +1,20 @@
subroutine averms(x,n,nskip,ave,rms)
real x(n)
integer ipk(1)
ns=0
s=0.
sq=0.
ipk=maxloc(x)
do i=1,n
if(abs(i-ipk(1)).gt.nskip) then
s=s + x(i)
sq=sq + x(i)**2
ns=ns+1
endif
enddo
ave=s/ns
rms=sqrt(sq/ns - ave*ave)
return
end subroutine averms
@@ -0,0 +1,70 @@
// Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland.
//
// 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 BOOST_CORE_IGNORE_UNUSED_HPP
#define BOOST_CORE_IGNORE_UNUSED_HPP
#include <boost/config.hpp>
namespace boost {
#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES
template <typename... Ts>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(Ts const& ...)
{}
template <typename... Ts>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused()
{}
#else
template <typename T1>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1 const&)
{}
template <typename T1, typename T2>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1 const&, T2 const&)
{}
template <typename T1, typename T2, typename T3>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1 const&, T2 const&, T3 const&)
{}
template <typename T1, typename T2, typename T3, typename T4>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1 const&, T2 const&, T3 const&, T4 const&)
{}
template <typename T1, typename T2, typename T3, typename T4, typename T5>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1 const&, T2 const&, T3 const&, T4 const&, T5 const&)
{}
template <typename T1>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused()
{}
template <typename T1, typename T2>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused()
{}
template <typename T1, typename T2, typename T3>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused()
{}
template <typename T1, typename T2, typename T3, typename T4>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused()
{}
template <typename T1, typename T2, typename T3, typename T4, typename T5>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused()
{}
#endif
} // namespace boost
#endif // BOOST_CORE_IGNORE_UNUSED_HPP
@@ -0,0 +1,60 @@
// Copyright (C) 2006 Arkadiy Vertleyb
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_TYPEOF_NATIVE_HPP_INCLUDED
#define BOOST_TYPEOF_NATIVE_HPP_INCLUDED
#ifndef MSVC_TYPEOF_HACK
#ifdef BOOST_NO_SFINAE
namespace boost { namespace type_of {
template<class T>
T& ensure_obj(const T&);
}}
#else
#include <boost/type_traits/is_function.hpp>
#include <boost/utility/enable_if.hpp>
namespace boost { namespace type_of {
# ifdef BOOST_NO_SFINAE
template<class T>
T& ensure_obj(const T&);
# else
template<typename T>
typename enable_if<is_function<T>, T&>::type
ensure_obj(T&);
template<typename T>
typename disable_if<is_function<T>, T&>::type
ensure_obj(const T&);
# endif
}}
#endif//BOOST_NO_SFINAE
#define BOOST_TYPEOF(expr) BOOST_TYPEOF_KEYWORD(boost::type_of::ensure_obj(expr))
#define BOOST_TYPEOF_TPL BOOST_TYPEOF
#define BOOST_TYPEOF_NESTED_TYPEDEF_TPL(name,expr) \
struct name {\
typedef BOOST_TYPEOF_TPL(expr) type;\
};
#define BOOST_TYPEOF_NESTED_TYPEDEF(name,expr) \
struct name {\
typedef BOOST_TYPEOF(expr) type;\
};
#endif//MSVC_TYPEOF_HACK
#define BOOST_TYPEOF_REGISTER_TYPE(x)
#define BOOST_TYPEOF_REGISTER_TEMPLATE(x, params)
#endif//BOOST_TYPEOF_NATIVE_HPP_INCLUDED
@@ -0,0 +1,18 @@
/*=============================================================================
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)
This is an auto-generated file. Do not edit!
==============================================================================*/
namespace boost { namespace fusion
{
struct void_;
struct map_tag;
struct map_iterator_tag;
template <
typename T0 = void_ , typename T1 = void_ , typename T2 = void_ , typename T3 = void_ , typename T4 = void_ , typename T5 = void_ , typename T6 = void_ , typename T7 = void_ , typename T8 = void_ , typename T9 = void_ , typename T10 = void_ , typename T11 = void_ , typename T12 = void_ , typename T13 = void_ , typename T14 = void_ , typename T15 = void_ , typename T16 = void_ , typename T17 = void_ , typename T18 = void_ , typename T19 = void_
>
struct map;
}}