Initial Commit
This commit is contained in:
@@ -0,0 +1,348 @@
|
||||
/*==============================================================================
|
||||
Copyright (c) 2005-2010 Joel de Guzman
|
||||
Copyright (c) 2010 Thomas Heller
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Fun, typename Expr, typename State, typename Data>
|
||||
struct call_impl<Fun, Expr, State, Data, 1>
|
||||
: proto::transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef
|
||||
typename boost::phoenix::result_of::context<State, Data>::type
|
||||
context_type;
|
||||
typedef typename proto::result_of::child_c<Expr, 0>::type A0;
|
||||
typedef
|
||||
typename boost::result_of<
|
||||
Fun(A0, context_type)
|
||||
>::type
|
||||
result_type;
|
||||
result_type operator()(
|
||||
typename call_impl::expr_param e
|
||||
, typename call_impl::state_param s
|
||||
, typename call_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return
|
||||
Fun()(
|
||||
proto::child_c< 0>(e)
|
||||
, boost::phoenix::context(s, d)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Fun, typename Expr, typename State, typename Data>
|
||||
struct call_impl<Fun, Expr, State, Data, 2>
|
||||
: proto::transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef
|
||||
typename boost::phoenix::result_of::context<State, Data>::type
|
||||
context_type;
|
||||
typedef typename proto::result_of::child_c<Expr, 0>::type A0; typedef typename proto::result_of::child_c<Expr, 1>::type A1;
|
||||
typedef
|
||||
typename boost::result_of<
|
||||
Fun(A0 , A1, context_type)
|
||||
>::type
|
||||
result_type;
|
||||
result_type operator()(
|
||||
typename call_impl::expr_param e
|
||||
, typename call_impl::state_param s
|
||||
, typename call_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return
|
||||
Fun()(
|
||||
proto::child_c< 0>(e) , proto::child_c< 1>(e)
|
||||
, boost::phoenix::context(s, d)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Fun, typename Expr, typename State, typename Data>
|
||||
struct call_impl<Fun, Expr, State, Data, 3>
|
||||
: proto::transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef
|
||||
typename boost::phoenix::result_of::context<State, Data>::type
|
||||
context_type;
|
||||
typedef typename proto::result_of::child_c<Expr, 0>::type A0; typedef typename proto::result_of::child_c<Expr, 1>::type A1; typedef typename proto::result_of::child_c<Expr, 2>::type A2;
|
||||
typedef
|
||||
typename boost::result_of<
|
||||
Fun(A0 , A1 , A2, context_type)
|
||||
>::type
|
||||
result_type;
|
||||
result_type operator()(
|
||||
typename call_impl::expr_param e
|
||||
, typename call_impl::state_param s
|
||||
, typename call_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return
|
||||
Fun()(
|
||||
proto::child_c< 0>(e) , proto::child_c< 1>(e) , proto::child_c< 2>(e)
|
||||
, boost::phoenix::context(s, d)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Fun, typename Expr, typename State, typename Data>
|
||||
struct call_impl<Fun, Expr, State, Data, 4>
|
||||
: proto::transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef
|
||||
typename boost::phoenix::result_of::context<State, Data>::type
|
||||
context_type;
|
||||
typedef typename proto::result_of::child_c<Expr, 0>::type A0; typedef typename proto::result_of::child_c<Expr, 1>::type A1; typedef typename proto::result_of::child_c<Expr, 2>::type A2; typedef typename proto::result_of::child_c<Expr, 3>::type A3;
|
||||
typedef
|
||||
typename boost::result_of<
|
||||
Fun(A0 , A1 , A2 , A3, context_type)
|
||||
>::type
|
||||
result_type;
|
||||
result_type operator()(
|
||||
typename call_impl::expr_param e
|
||||
, typename call_impl::state_param s
|
||||
, typename call_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return
|
||||
Fun()(
|
||||
proto::child_c< 0>(e) , proto::child_c< 1>(e) , proto::child_c< 2>(e) , proto::child_c< 3>(e)
|
||||
, boost::phoenix::context(s, d)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Fun, typename Expr, typename State, typename Data>
|
||||
struct call_impl<Fun, Expr, State, Data, 5>
|
||||
: proto::transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef
|
||||
typename boost::phoenix::result_of::context<State, Data>::type
|
||||
context_type;
|
||||
typedef typename proto::result_of::child_c<Expr, 0>::type A0; typedef typename proto::result_of::child_c<Expr, 1>::type A1; typedef typename proto::result_of::child_c<Expr, 2>::type A2; typedef typename proto::result_of::child_c<Expr, 3>::type A3; typedef typename proto::result_of::child_c<Expr, 4>::type A4;
|
||||
typedef
|
||||
typename boost::result_of<
|
||||
Fun(A0 , A1 , A2 , A3 , A4, context_type)
|
||||
>::type
|
||||
result_type;
|
||||
result_type operator()(
|
||||
typename call_impl::expr_param e
|
||||
, typename call_impl::state_param s
|
||||
, typename call_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return
|
||||
Fun()(
|
||||
proto::child_c< 0>(e) , proto::child_c< 1>(e) , proto::child_c< 2>(e) , proto::child_c< 3>(e) , proto::child_c< 4>(e)
|
||||
, boost::phoenix::context(s, d)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Fun, typename Expr, typename State, typename Data>
|
||||
struct call_impl<Fun, Expr, State, Data, 6>
|
||||
: proto::transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef
|
||||
typename boost::phoenix::result_of::context<State, Data>::type
|
||||
context_type;
|
||||
typedef typename proto::result_of::child_c<Expr, 0>::type A0; typedef typename proto::result_of::child_c<Expr, 1>::type A1; typedef typename proto::result_of::child_c<Expr, 2>::type A2; typedef typename proto::result_of::child_c<Expr, 3>::type A3; typedef typename proto::result_of::child_c<Expr, 4>::type A4; typedef typename proto::result_of::child_c<Expr, 5>::type A5;
|
||||
typedef
|
||||
typename boost::result_of<
|
||||
Fun(A0 , A1 , A2 , A3 , A4 , A5, context_type)
|
||||
>::type
|
||||
result_type;
|
||||
result_type operator()(
|
||||
typename call_impl::expr_param e
|
||||
, typename call_impl::state_param s
|
||||
, typename call_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return
|
||||
Fun()(
|
||||
proto::child_c< 0>(e) , proto::child_c< 1>(e) , proto::child_c< 2>(e) , proto::child_c< 3>(e) , proto::child_c< 4>(e) , proto::child_c< 5>(e)
|
||||
, boost::phoenix::context(s, d)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Fun, typename Expr, typename State, typename Data>
|
||||
struct call_impl<Fun, Expr, State, Data, 7>
|
||||
: proto::transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef
|
||||
typename boost::phoenix::result_of::context<State, Data>::type
|
||||
context_type;
|
||||
typedef typename proto::result_of::child_c<Expr, 0>::type A0; typedef typename proto::result_of::child_c<Expr, 1>::type A1; typedef typename proto::result_of::child_c<Expr, 2>::type A2; typedef typename proto::result_of::child_c<Expr, 3>::type A3; typedef typename proto::result_of::child_c<Expr, 4>::type A4; typedef typename proto::result_of::child_c<Expr, 5>::type A5; typedef typename proto::result_of::child_c<Expr, 6>::type A6;
|
||||
typedef
|
||||
typename boost::result_of<
|
||||
Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6, context_type)
|
||||
>::type
|
||||
result_type;
|
||||
result_type operator()(
|
||||
typename call_impl::expr_param e
|
||||
, typename call_impl::state_param s
|
||||
, typename call_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return
|
||||
Fun()(
|
||||
proto::child_c< 0>(e) , proto::child_c< 1>(e) , proto::child_c< 2>(e) , proto::child_c< 3>(e) , proto::child_c< 4>(e) , proto::child_c< 5>(e) , proto::child_c< 6>(e)
|
||||
, boost::phoenix::context(s, d)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Fun, typename Expr, typename State, typename Data>
|
||||
struct call_impl<Fun, Expr, State, Data, 8>
|
||||
: proto::transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef
|
||||
typename boost::phoenix::result_of::context<State, Data>::type
|
||||
context_type;
|
||||
typedef typename proto::result_of::child_c<Expr, 0>::type A0; typedef typename proto::result_of::child_c<Expr, 1>::type A1; typedef typename proto::result_of::child_c<Expr, 2>::type A2; typedef typename proto::result_of::child_c<Expr, 3>::type A3; typedef typename proto::result_of::child_c<Expr, 4>::type A4; typedef typename proto::result_of::child_c<Expr, 5>::type A5; typedef typename proto::result_of::child_c<Expr, 6>::type A6; typedef typename proto::result_of::child_c<Expr, 7>::type A7;
|
||||
typedef
|
||||
typename boost::result_of<
|
||||
Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7, context_type)
|
||||
>::type
|
||||
result_type;
|
||||
result_type operator()(
|
||||
typename call_impl::expr_param e
|
||||
, typename call_impl::state_param s
|
||||
, typename call_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return
|
||||
Fun()(
|
||||
proto::child_c< 0>(e) , proto::child_c< 1>(e) , proto::child_c< 2>(e) , proto::child_c< 3>(e) , proto::child_c< 4>(e) , proto::child_c< 5>(e) , proto::child_c< 6>(e) , proto::child_c< 7>(e)
|
||||
, boost::phoenix::context(s, d)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Fun, typename Expr, typename State, typename Data>
|
||||
struct call_impl<Fun, Expr, State, Data, 9>
|
||||
: proto::transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef
|
||||
typename boost::phoenix::result_of::context<State, Data>::type
|
||||
context_type;
|
||||
typedef typename proto::result_of::child_c<Expr, 0>::type A0; typedef typename proto::result_of::child_c<Expr, 1>::type A1; typedef typename proto::result_of::child_c<Expr, 2>::type A2; typedef typename proto::result_of::child_c<Expr, 3>::type A3; typedef typename proto::result_of::child_c<Expr, 4>::type A4; typedef typename proto::result_of::child_c<Expr, 5>::type A5; typedef typename proto::result_of::child_c<Expr, 6>::type A6; typedef typename proto::result_of::child_c<Expr, 7>::type A7; typedef typename proto::result_of::child_c<Expr, 8>::type A8;
|
||||
typedef
|
||||
typename boost::result_of<
|
||||
Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8, context_type)
|
||||
>::type
|
||||
result_type;
|
||||
result_type operator()(
|
||||
typename call_impl::expr_param e
|
||||
, typename call_impl::state_param s
|
||||
, typename call_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return
|
||||
Fun()(
|
||||
proto::child_c< 0>(e) , proto::child_c< 1>(e) , proto::child_c< 2>(e) , proto::child_c< 3>(e) , proto::child_c< 4>(e) , proto::child_c< 5>(e) , proto::child_c< 6>(e) , proto::child_c< 7>(e) , proto::child_c< 8>(e)
|
||||
, boost::phoenix::context(s, d)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Fun, typename Expr, typename State, typename Data>
|
||||
struct call_impl<Fun, Expr, State, Data, 10>
|
||||
: proto::transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef
|
||||
typename boost::phoenix::result_of::context<State, Data>::type
|
||||
context_type;
|
||||
typedef typename proto::result_of::child_c<Expr, 0>::type A0; typedef typename proto::result_of::child_c<Expr, 1>::type A1; typedef typename proto::result_of::child_c<Expr, 2>::type A2; typedef typename proto::result_of::child_c<Expr, 3>::type A3; typedef typename proto::result_of::child_c<Expr, 4>::type A4; typedef typename proto::result_of::child_c<Expr, 5>::type A5; typedef typename proto::result_of::child_c<Expr, 6>::type A6; typedef typename proto::result_of::child_c<Expr, 7>::type A7; typedef typename proto::result_of::child_c<Expr, 8>::type A8; typedef typename proto::result_of::child_c<Expr, 9>::type A9;
|
||||
typedef
|
||||
typename boost::result_of<
|
||||
Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9, context_type)
|
||||
>::type
|
||||
result_type;
|
||||
result_type operator()(
|
||||
typename call_impl::expr_param e
|
||||
, typename call_impl::state_param s
|
||||
, typename call_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return
|
||||
Fun()(
|
||||
proto::child_c< 0>(e) , proto::child_c< 1>(e) , proto::child_c< 2>(e) , proto::child_c< 3>(e) , proto::child_c< 4>(e) , proto::child_c< 5>(e) , proto::child_c< 6>(e) , proto::child_c< 7>(e) , proto::child_c< 8>(e) , proto::child_c< 9>(e)
|
||||
, boost::phoenix::context(s, d)
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,75 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// 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_ALGORITHM_RANDOM_SHUFFLE_HPP
|
||||
#define BOOST_COMPUTE_ALGORITHM_RANDOM_SHUFFLE_HPP
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/range/algorithm_ext/iota.hpp>
|
||||
|
||||
#include <boost/compute/system.hpp>
|
||||
#include <boost/compute/functional.hpp>
|
||||
#include <boost/compute/command_queue.hpp>
|
||||
#include <boost/compute/container/vector.hpp>
|
||||
#include <boost/compute/algorithm/scatter.hpp>
|
||||
#include <boost/compute/detail/iterator_range_size.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
|
||||
/// Randomly shuffles the elements in the range [\p first, \p last).
|
||||
///
|
||||
/// \see scatter()
|
||||
template<class Iterator>
|
||||
inline void random_shuffle(Iterator first,
|
||||
Iterator last,
|
||||
command_queue &queue = system::default_queue())
|
||||
{
|
||||
typedef typename std::iterator_traits<Iterator>::value_type value_type;
|
||||
|
||||
size_t count = detail::iterator_range_size(first, last);
|
||||
if(count == 0){
|
||||
return;
|
||||
}
|
||||
|
||||
// generate shuffled indices on the host
|
||||
std::vector<cl_uint> random_indices(count);
|
||||
boost::iota(random_indices, 0);
|
||||
std::random_shuffle(random_indices.begin(), random_indices.end());
|
||||
|
||||
// copy random indices to the device
|
||||
const context &context = queue.get_context();
|
||||
vector<cl_uint> indices(count, context);
|
||||
::boost::compute::copy(random_indices.begin(),
|
||||
random_indices.end(),
|
||||
indices.begin(),
|
||||
queue);
|
||||
|
||||
// make a copy of the values on the device
|
||||
vector<value_type> tmp(count, context);
|
||||
::boost::compute::copy(first,
|
||||
last,
|
||||
tmp.begin(),
|
||||
queue);
|
||||
|
||||
// write values to their new locations
|
||||
::boost::compute::scatter(tmp.begin(),
|
||||
tmp.end(),
|
||||
indices.begin(),
|
||||
first,
|
||||
queue);
|
||||
}
|
||||
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_ALGORITHM_RANDOM_SHUFFLE_HPP
|
||||
@@ -0,0 +1,47 @@
|
||||
// Copyright 2005 Daniel Wallin.
|
||||
// Copyright 2005 Joel de Guzman.
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
// Modeled after range_ex, Copyright 2004 Eric Niebler
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// has_upper_bound.hpp
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_PHOENIX_HAS_UPPER_BOUND_EN_14_12_2004
|
||||
#define BOOST_PHOENIX_HAS_UPPER_BOUND_EN_14_12_2004
|
||||
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include "./is_std_map.hpp"
|
||||
#include "./is_std_set.hpp"
|
||||
#include "./is_std_hash_map.hpp"
|
||||
#include "./is_std_hash_set.hpp"
|
||||
|
||||
namespace boost
|
||||
{
|
||||
// Specialize this for user-defined types
|
||||
template<typename T>
|
||||
struct has_upper_bound
|
||||
: boost::mpl::or_<
|
||||
boost::mpl::or_<
|
||||
is_std_map<T>
|
||||
, is_std_multimap<T>
|
||||
, is_std_set<T>
|
||||
, is_std_multiset<T>
|
||||
>
|
||||
, boost::mpl::or_<
|
||||
is_std_hash_map<T>
|
||||
, is_std_hash_multimap<T>
|
||||
, is_std_hash_set<T>
|
||||
, is_std_hash_multiset<T>
|
||||
>
|
||||
>
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,73 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
// See http://boostorg.github.com/compute for more information.
|
||||
//---------------------------------------------------------------------------//
|
||||
|
||||
#ifndef BOOST_COMPUTE_DETAIL_PATH_HPP
|
||||
#define BOOST_COMPUTE_DETAIL_PATH_HPP
|
||||
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/compute/detail/getenv.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
namespace detail {
|
||||
|
||||
// Path delimiter symbol for the current OS.
|
||||
static const std::string& path_delim()
|
||||
{
|
||||
static const std::string delim =
|
||||
boost::filesystem::path("/").make_preferred().string();
|
||||
return delim;
|
||||
}
|
||||
|
||||
// Path to appdata folder.
|
||||
inline const std::string& appdata_path()
|
||||
{
|
||||
#ifdef WIN32
|
||||
static const std::string appdata = detail::getenv("APPDATA")
|
||||
+ path_delim() + "boost_compute";
|
||||
#else
|
||||
static const std::string appdata = detail::getenv("HOME")
|
||||
+ path_delim() + ".boost_compute";
|
||||
#endif
|
||||
return appdata;
|
||||
}
|
||||
|
||||
// Path to cached binaries.
|
||||
inline std::string program_binary_path(const std::string &hash, bool create = false)
|
||||
{
|
||||
std::string dir = detail::appdata_path() + path_delim()
|
||||
+ hash.substr(0, 2) + path_delim()
|
||||
+ hash.substr(2);
|
||||
|
||||
if(create && !boost::filesystem::exists(dir)){
|
||||
boost::filesystem::create_directories(dir);
|
||||
}
|
||||
|
||||
return dir + path_delim();
|
||||
}
|
||||
|
||||
// Path to parameter caches.
|
||||
inline std::string parameter_cache_path(bool create = false)
|
||||
{
|
||||
const static std::string dir = appdata_path() + path_delim() + "tune";
|
||||
|
||||
if(create && !boost::filesystem::exists(dir)){
|
||||
boost::filesystem::create_directories(dir);
|
||||
}
|
||||
|
||||
return dir + path_delim();
|
||||
}
|
||||
|
||||
} // end detail namespace
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_DETAIL_PATH_HPP
|
||||
@@ -0,0 +1,29 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2009-2010 Christopher Schmidt
|
||||
|
||||
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_ADAPTED_STRUCT_DETAIL_VALUE_OF_IMPL_HPP
|
||||
#define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_VALUE_OF_IMPL_HPP
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
template <typename>
|
||||
struct value_of_impl;
|
||||
|
||||
template <>
|
||||
struct value_of_impl<struct_iterator_tag>
|
||||
{
|
||||
template <typename It>
|
||||
struct apply
|
||||
: access::struct_member<
|
||||
typename remove_const<typename It::seq_type>::type
|
||||
, It::index::value
|
||||
>
|
||||
{};
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,43 @@
|
||||
// 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 BASE_TYPE_TRAITS_DWA2002614_HPP
|
||||
# define BASE_TYPE_TRAITS_DWA2002614_HPP
|
||||
|
||||
# include <boost/python/detail/prefix.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
namespace detail
|
||||
{
|
||||
struct unspecialized {};
|
||||
}
|
||||
|
||||
// Derive from unspecialized so we can detect whether traits are
|
||||
// specialized
|
||||
template <class T> struct base_type_traits
|
||||
: detail::unspecialized
|
||||
{};
|
||||
|
||||
template <>
|
||||
struct base_type_traits<PyObject>
|
||||
{
|
||||
typedef PyObject type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct base_type_traits<PyTypeObject>
|
||||
{
|
||||
typedef PyObject type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct base_type_traits<PyMethodObject>
|
||||
{
|
||||
typedef PyObject type;
|
||||
};
|
||||
|
||||
}} // namespace boost::python
|
||||
|
||||
#endif // BASE_TYPE_TRAITS_DWA2002614_HPP
|
||||
@@ -0,0 +1,185 @@
|
||||
subroutine synciscat(cdat,npts,nh,npct,s0,jsym,df,ntol,NFreeze, &
|
||||
MouseDF,mousebutton,mode4,nafc,psavg,xsync,sig,ndf0,msglen, &
|
||||
ipk,jpk,idf,df1)
|
||||
|
||||
! Synchronize an ISCAT signal
|
||||
! cdat() is the downsampled analytic signal.
|
||||
! Sample rate = fsample = BW = 11025 * (9/32) = 3100.78125 Hz
|
||||
! npts, nsps, etc., are all reduced by 9/32
|
||||
|
||||
parameter (NMAX=30*3101)
|
||||
parameter (NSZ=4*1400)
|
||||
complex cdat(NMAX)
|
||||
complex c(288)
|
||||
real s0(288,NSZ)
|
||||
real fs0(288,96) !108 = 96 + 3*4
|
||||
real savg(288)
|
||||
real sref(288)
|
||||
real psavg(72) !Average spectrum of whole file
|
||||
integer icos(4)
|
||||
data icos/0,1,3,2/
|
||||
data nsync/4/,nlen/2/,ndat/18/
|
||||
|
||||
! Silence compiler warnings:
|
||||
sigbest=-20.0
|
||||
ndf0best=0
|
||||
msglenbest=0
|
||||
ipkbest=0
|
||||
jpkbest=0
|
||||
ipk2=0
|
||||
idfbest=mousebutton
|
||||
|
||||
fsample=3100.78125 !New sample rate
|
||||
nsps=144/mode4
|
||||
nsym=npts/nsps - 1
|
||||
nblk=nsync+nlen+ndat
|
||||
nfft=2*nsps !FFTs at twice the symbol length,
|
||||
|
||||
kstep=nsps/4 ! stepped by 1/4 symbol
|
||||
df=fsample/nfft
|
||||
fac=1.0/1000.0 !Somewhat arbitrary
|
||||
savg=0.
|
||||
s0=0.
|
||||
|
||||
ia=1-kstep
|
||||
do j=1,4*nsym !Compute symbol spectra
|
||||
ia=ia+kstep
|
||||
ib=ia+nsps-1
|
||||
if(ib.gt.npts) exit
|
||||
c(1:nsps)=fac*cdat(ia:ib)
|
||||
c(nsps+1:nfft)=0.
|
||||
call four2a(c,nfft,1,-1,1)
|
||||
do i=1,nfft
|
||||
s0(i,j)=real(c(i))**2 + aimag(c(i))**2
|
||||
savg(i)=savg(i) + s0(i,j) !Accumulate avg spectrum
|
||||
enddo
|
||||
i0=40
|
||||
enddo
|
||||
|
||||
jsym=4*nsym
|
||||
savg=savg/jsym
|
||||
|
||||
do i=1,71 !Compute spectrum in dB, for plot
|
||||
if(mode4.eq.1) then
|
||||
psavg(i)=2*db(savg(4*i)+savg(4*i-1)+savg(4*i-2)+savg(4*i-3)) + 1.0
|
||||
else
|
||||
psavg(i)=2*db(savg(2*i)+savg(2*i-1)) + 7.0
|
||||
endif
|
||||
enddo
|
||||
|
||||
do i=nh+1,nfft-nh
|
||||
call pctile(savg(i-nh),2*nh+1,npct,sref(i))
|
||||
enddo
|
||||
sref(1:nh)=sref(nh+11)
|
||||
sref(nfft-nh+1:nfft)=sref(nfft-nh)
|
||||
|
||||
do i=1,nfft !Normalize the symbol spectra
|
||||
fac=1.0/sref(i)
|
||||
if(i.lt.11) fac=1.0/savg(11)
|
||||
do j=1,jsym
|
||||
s0(i,j)=fac*s0(i,j)
|
||||
enddo
|
||||
enddo
|
||||
|
||||
nfold=jsym/96
|
||||
jb=96*nfold
|
||||
|
||||
ttot=npts/fsample !Length of record (s)
|
||||
df1=df/ttot !Step size for f1=fdot
|
||||
idf1=-25.0/df1
|
||||
idf2=5.0/df1
|
||||
if(nafc.eq.0) then
|
||||
idf1=0
|
||||
idf2=0
|
||||
else if(mod(-idf1,2).eq.1) then
|
||||
idf1=idf1-1
|
||||
endif
|
||||
|
||||
xsyncbest=0.
|
||||
do idf=idf1,idf2 !Loop over fdot
|
||||
fs0=0.
|
||||
do j=1,jb !Fold s0 into fs0, modulo 4*nblk
|
||||
k=mod(j-1,4*nblk)+1
|
||||
ii=nint(idf*float(j-jb/2)/float(jb))
|
||||
ia=max(1-ii,1)
|
||||
ib=min(nfft-ii,nfft)
|
||||
do i=ia,ib
|
||||
fs0(i,k)=fs0(i,k) + s0(i+ii,j)
|
||||
enddo
|
||||
enddo
|
||||
ref=nfold*4
|
||||
|
||||
i0=27
|
||||
if(mode4.eq.1) i0=95
|
||||
ia=i0-nint(ntol/df)
|
||||
ib=i0+nint(ntol/df)
|
||||
if(ia.lt.1) ia=1
|
||||
if(ib.gt.nfft-3) ib=nfft-3
|
||||
|
||||
smax=0.
|
||||
ipk=1
|
||||
jpk=1
|
||||
do j=0,4*nblk-1 !Find sync pattern: lags 0-95
|
||||
do i=ia,ib !Search specified freq range
|
||||
ss=0.
|
||||
do n=1,4 !Sum over 4 sync tones
|
||||
k=j+4*n-3
|
||||
if(k.gt.96) k=k-96
|
||||
ss=ss + fs0(i+2*icos(n),k)
|
||||
enddo
|
||||
if(ss.gt.smax) then
|
||||
smax=ss
|
||||
ipk=i !Frequency offset, DF
|
||||
jpk=j+1 !Time offset, DT
|
||||
endif
|
||||
enddo
|
||||
enddo
|
||||
|
||||
xsync=smax/ref - 1.0
|
||||
if(nfold.lt.26) xsync=xsync * sqrt(nfold/26.0)
|
||||
xsync=xsync-0.5 !Empirical
|
||||
|
||||
sig=db(smax/ref - 1.0) - 15.0
|
||||
if(mode4.eq.1) sig=sig-5.0
|
||||
! if(sig.lt.-20 .or. xsync.lt.1.0) sig=-20.0
|
||||
! if(sig.lt.-20) sig=-20.0
|
||||
ndf0=nint(df*(ipk-i0))
|
||||
|
||||
smax=0.
|
||||
ja=jpk+16
|
||||
if(ja.gt.4*nblk) ja=ja-4*nblk
|
||||
jj=jpk+20
|
||||
if(jj.gt.4*nblk) jj=jj-4*nblk
|
||||
do i=ipk,ipk+60,2 !Find User's message length
|
||||
ss=fs0(i,ja) + fs0(i+10,jj)
|
||||
if(ss.gt.smax) then
|
||||
smax=ss
|
||||
ipk2=i
|
||||
endif
|
||||
enddo
|
||||
|
||||
msglen=(ipk2-ipk)/2
|
||||
if(msglen.lt.2 .or. msglen.gt.29) cycle
|
||||
|
||||
if(xsync.ge.xsyncbest) then
|
||||
xsyncbest=xsync
|
||||
sigbest=sig
|
||||
ndf0best=ndf0
|
||||
msglenbest=msglen
|
||||
ipkbest=ipk
|
||||
jpkbest=jpk
|
||||
idfbest=idf
|
||||
endif
|
||||
enddo
|
||||
|
||||
xsync=xsyncbest
|
||||
sig=sigbest
|
||||
ndf0=ndf0best
|
||||
msglen=msglenbest
|
||||
ipk=ipkbest
|
||||
jpk=jpkbest
|
||||
idf=idfbest
|
||||
if(nafc.eq.0) idf=0
|
||||
|
||||
return
|
||||
end subroutine synciscat
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,96 @@
|
||||
subroutine calibrate(data_dir,iz,a,b,rms,sigmaa,sigmab,irc)
|
||||
|
||||
! Average groups of frequency-calibration measurements, then fit a
|
||||
! straight line for slope and intercept.
|
||||
|
||||
parameter (NZ=1000)
|
||||
implicit real*8 (a-h,o-z)
|
||||
character*(*) data_dir
|
||||
character*256 infile,outfile
|
||||
character*8 cutc,cutc1
|
||||
character*1 c1
|
||||
real*8 fd(NZ),deltaf(NZ),r(NZ),rmsd(NZ)
|
||||
integer nn(NZ)
|
||||
|
||||
infile=trim(data_dir)//'fmt.all'
|
||||
outfile=trim(data_dir)//'fcal2.out'
|
||||
|
||||
open(10,file=trim(infile),status='old',err=996)
|
||||
open(12,file=trim(outfile),status='unknown',err=997)
|
||||
|
||||
nkhz0=0
|
||||
sum=0.d0
|
||||
sumsq=0.d0
|
||||
n=0
|
||||
j=0
|
||||
do i=1,99999
|
||||
read(10,*,end=10,err=995) cutc,nkHz,ncal,noffset,faudio,df,dblevel,snr
|
||||
if((nkHz.ne.nkHz0) .and. i.ne.1) then
|
||||
ave=sum/n
|
||||
rms=0.d0
|
||||
if(n.gt.1) then
|
||||
rms=sqrt(abs(sumsq - sum*sum/n)/(n-1.d0))
|
||||
endif
|
||||
fMHz=0.001d0*nkHz0
|
||||
j=j+1
|
||||
fd(j)=fMHz
|
||||
deltaf(j)=ave
|
||||
r(j)=0.d0
|
||||
rmsd(j)=rms
|
||||
nn(j)=n
|
||||
sum=0.d0
|
||||
sumsq=0.d0
|
||||
n=0
|
||||
endif
|
||||
dial_error=faudio-noffset
|
||||
sum=sum + dial_error
|
||||
sumsq=sumsq + dial_error**2
|
||||
n=n+1
|
||||
if(n.eq.1) then
|
||||
cutc1=cutc
|
||||
ncal0=ncal
|
||||
endif
|
||||
nkHz0=nkHz
|
||||
enddo
|
||||
|
||||
10 ave=sum/n
|
||||
rms=0.d0
|
||||
if(n.gt.0) then
|
||||
rms=sqrt((sumsq - sum*sum/n)/(n-1.d0))
|
||||
endif
|
||||
fMHz=0.001d0*nkHz
|
||||
j=j+1
|
||||
fd(j)=fMHz
|
||||
deltaf(j)=ave
|
||||
r(j)=0.d0
|
||||
rmsd(j)=rms
|
||||
nn(j)=n
|
||||
iz=j
|
||||
if(iz.lt.2) go to 998
|
||||
|
||||
call fitcal(fd,deltaf,r,iz,a,b,sigmaa,sigmab,rms)
|
||||
|
||||
write(12,1002)
|
||||
1002 format(' Freq DF Meas Freq N rms Resid'/ &
|
||||
' (MHz) (Hz) (MHz) (Hz) (Hz)'/ &
|
||||
'----------------------------------------------------')
|
||||
irc=0
|
||||
do i=1,iz
|
||||
fm=fd(i) + 1.d-6*deltaf(i)
|
||||
c1=' '
|
||||
if(rmsd(i).gt.1.0d0) c1='*'
|
||||
write(12,1012) fd(i),deltaf(i),fm,nn(i),rmsd(i),r(i),c1
|
||||
1012 format(f8.3,f9.3,f14.9,i4,f7.2,f9.3,1x,a1)
|
||||
enddo
|
||||
go to 999
|
||||
|
||||
995 irc=-4; iz=i; go to 999
|
||||
996 irc=-1; go to 999
|
||||
997 irc=-2; go to 999
|
||||
998 irc=-3
|
||||
999 continue
|
||||
close(10)
|
||||
close(12)
|
||||
|
||||
return
|
||||
end subroutine calibrate
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
Copyright Rene Rivera 2008-2015
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef BOOST_PREDEF_LIBRARY_STD_VACPP_H
|
||||
#define BOOST_PREDEF_LIBRARY_STD_VACPP_H
|
||||
|
||||
#include <boost/predef/library/std/_prefix.h>
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
|
||||
/*`
|
||||
[heading `BOOST_LIB_STD_IBM`]
|
||||
|
||||
[@http://www.ibm.com/software/awdtools/xlcpp/ IBM VACPP Standard C++] library.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`__IBMCPP__`] [__predef_detection__]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define BOOST_LIB_STD_IBM BOOST_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if defined(__IBMCPP__)
|
||||
# undef BOOST_LIB_STD_IBM
|
||||
# define BOOST_LIB_STD_IBM BOOST_VERSION_NUMBER_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if BOOST_LIB_STD_IBM
|
||||
# define BOOST_LIB_STD_IBM_AVAILABLE
|
||||
#endif
|
||||
|
||||
#define BOOST_LIB_STD_IBM_NAME "IBM VACPP"
|
||||
|
||||
#endif
|
||||
|
||||
#include <boost/predef/detail/test.h>
|
||||
BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_STD_IBM,BOOST_LIB_STD_IBM_NAME)
|
||||
@@ -0,0 +1,487 @@
|
||||
/*==============================================================================
|
||||
Copyright (c) 2005-2010 Joel de Guzman
|
||||
Copyright (c) 2010 Thomas Heller
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Try, typename A0, typename Context>
|
||||
typename boost::enable_if<
|
||||
proto::matches<
|
||||
A0
|
||||
, rule::catch_
|
||||
>
|
||||
, result_type
|
||||
>::type
|
||||
operator()(Try const & try_, A0 const& a0, Context const & ctx
|
||||
BOOST_PHOENIX_SFINAE_AND_OVERLOADS) const
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::phoenix::eval(proto::child_c<0>(try_), ctx);
|
||||
}
|
||||
catch( typename proto::result_of::value< typename proto::result_of::child_c< A0 , 0 >::type >::type::type &e ) { eval_catch_body(a0, e, ctx); }
|
||||
}
|
||||
template <typename Try, typename A0, typename Context>
|
||||
typename boost::disable_if<
|
||||
proto::matches<
|
||||
A0
|
||||
, rule::catch_
|
||||
>
|
||||
, result_type
|
||||
>::type
|
||||
operator()(Try const & try_, A0 const& a0, Context const & ctx) const
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::phoenix::eval(proto::child_c<0>(try_), ctx);
|
||||
}
|
||||
|
||||
catch(...)
|
||||
{
|
||||
boost::phoenix::eval(
|
||||
proto::child_c<0>(
|
||||
a0
|
||||
)
|
||||
, ctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Try, typename A0 , typename A1, typename Context>
|
||||
typename boost::enable_if<
|
||||
proto::matches<
|
||||
A1
|
||||
, rule::catch_
|
||||
>
|
||||
, result_type
|
||||
>::type
|
||||
operator()(Try const & try_, A0 const& a0 , A1 const& a1, Context const & ctx
|
||||
BOOST_PHOENIX_SFINAE_AND_OVERLOADS) const
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::phoenix::eval(proto::child_c<0>(try_), ctx);
|
||||
}
|
||||
catch( typename proto::result_of::value< typename proto::result_of::child_c< A0 , 0 >::type >::type::type &e ) { eval_catch_body(a0, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A1 , 0 >::type >::type::type &e ) { eval_catch_body(a1, e, ctx); }
|
||||
}
|
||||
template <typename Try, typename A0 , typename A1, typename Context>
|
||||
typename boost::disable_if<
|
||||
proto::matches<
|
||||
A1
|
||||
, rule::catch_
|
||||
>
|
||||
, result_type
|
||||
>::type
|
||||
operator()(Try const & try_, A0 const& a0 , A1 const& a1, Context const & ctx) const
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::phoenix::eval(proto::child_c<0>(try_), ctx);
|
||||
}
|
||||
catch( typename proto::result_of::value< typename proto::result_of::child_c< A0 , 0 >::type >::type::type &e ) { eval_catch_body(a0, e, ctx); }
|
||||
catch(...)
|
||||
{
|
||||
boost::phoenix::eval(
|
||||
proto::child_c<0>(
|
||||
a1
|
||||
)
|
||||
, ctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Try, typename A0 , typename A1 , typename A2, typename Context>
|
||||
typename boost::enable_if<
|
||||
proto::matches<
|
||||
A2
|
||||
, rule::catch_
|
||||
>
|
||||
, result_type
|
||||
>::type
|
||||
operator()(Try const & try_, A0 const& a0 , A1 const& a1 , A2 const& a2, Context const & ctx
|
||||
BOOST_PHOENIX_SFINAE_AND_OVERLOADS) const
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::phoenix::eval(proto::child_c<0>(try_), ctx);
|
||||
}
|
||||
catch( typename proto::result_of::value< typename proto::result_of::child_c< A0 , 0 >::type >::type::type &e ) { eval_catch_body(a0, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A1 , 0 >::type >::type::type &e ) { eval_catch_body(a1, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A2 , 0 >::type >::type::type &e ) { eval_catch_body(a2, e, ctx); }
|
||||
}
|
||||
template <typename Try, typename A0 , typename A1 , typename A2, typename Context>
|
||||
typename boost::disable_if<
|
||||
proto::matches<
|
||||
A2
|
||||
, rule::catch_
|
||||
>
|
||||
, result_type
|
||||
>::type
|
||||
operator()(Try const & try_, A0 const& a0 , A1 const& a1 , A2 const& a2, Context const & ctx) const
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::phoenix::eval(proto::child_c<0>(try_), ctx);
|
||||
}
|
||||
catch( typename proto::result_of::value< typename proto::result_of::child_c< A0 , 0 >::type >::type::type &e ) { eval_catch_body(a0, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A1 , 0 >::type >::type::type &e ) { eval_catch_body(a1, e, ctx); }
|
||||
catch(...)
|
||||
{
|
||||
boost::phoenix::eval(
|
||||
proto::child_c<0>(
|
||||
a2
|
||||
)
|
||||
, ctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Try, typename A0 , typename A1 , typename A2 , typename A3, typename Context>
|
||||
typename boost::enable_if<
|
||||
proto::matches<
|
||||
A3
|
||||
, rule::catch_
|
||||
>
|
||||
, result_type
|
||||
>::type
|
||||
operator()(Try const & try_, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3, Context const & ctx
|
||||
BOOST_PHOENIX_SFINAE_AND_OVERLOADS) const
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::phoenix::eval(proto::child_c<0>(try_), ctx);
|
||||
}
|
||||
catch( typename proto::result_of::value< typename proto::result_of::child_c< A0 , 0 >::type >::type::type &e ) { eval_catch_body(a0, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A1 , 0 >::type >::type::type &e ) { eval_catch_body(a1, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A2 , 0 >::type >::type::type &e ) { eval_catch_body(a2, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A3 , 0 >::type >::type::type &e ) { eval_catch_body(a3, e, ctx); }
|
||||
}
|
||||
template <typename Try, typename A0 , typename A1 , typename A2 , typename A3, typename Context>
|
||||
typename boost::disable_if<
|
||||
proto::matches<
|
||||
A3
|
||||
, rule::catch_
|
||||
>
|
||||
, result_type
|
||||
>::type
|
||||
operator()(Try const & try_, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3, Context const & ctx) const
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::phoenix::eval(proto::child_c<0>(try_), ctx);
|
||||
}
|
||||
catch( typename proto::result_of::value< typename proto::result_of::child_c< A0 , 0 >::type >::type::type &e ) { eval_catch_body(a0, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A1 , 0 >::type >::type::type &e ) { eval_catch_body(a1, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A2 , 0 >::type >::type::type &e ) { eval_catch_body(a2, e, ctx); }
|
||||
catch(...)
|
||||
{
|
||||
boost::phoenix::eval(
|
||||
proto::child_c<0>(
|
||||
a3
|
||||
)
|
||||
, ctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Try, typename A0 , typename A1 , typename A2 , typename A3 , typename A4, typename Context>
|
||||
typename boost::enable_if<
|
||||
proto::matches<
|
||||
A4
|
||||
, rule::catch_
|
||||
>
|
||||
, result_type
|
||||
>::type
|
||||
operator()(Try const & try_, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4, Context const & ctx
|
||||
BOOST_PHOENIX_SFINAE_AND_OVERLOADS) const
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::phoenix::eval(proto::child_c<0>(try_), ctx);
|
||||
}
|
||||
catch( typename proto::result_of::value< typename proto::result_of::child_c< A0 , 0 >::type >::type::type &e ) { eval_catch_body(a0, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A1 , 0 >::type >::type::type &e ) { eval_catch_body(a1, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A2 , 0 >::type >::type::type &e ) { eval_catch_body(a2, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A3 , 0 >::type >::type::type &e ) { eval_catch_body(a3, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A4 , 0 >::type >::type::type &e ) { eval_catch_body(a4, e, ctx); }
|
||||
}
|
||||
template <typename Try, typename A0 , typename A1 , typename A2 , typename A3 , typename A4, typename Context>
|
||||
typename boost::disable_if<
|
||||
proto::matches<
|
||||
A4
|
||||
, rule::catch_
|
||||
>
|
||||
, result_type
|
||||
>::type
|
||||
operator()(Try const & try_, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4, Context const & ctx) const
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::phoenix::eval(proto::child_c<0>(try_), ctx);
|
||||
}
|
||||
catch( typename proto::result_of::value< typename proto::result_of::child_c< A0 , 0 >::type >::type::type &e ) { eval_catch_body(a0, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A1 , 0 >::type >::type::type &e ) { eval_catch_body(a1, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A2 , 0 >::type >::type::type &e ) { eval_catch_body(a2, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A3 , 0 >::type >::type::type &e ) { eval_catch_body(a3, e, ctx); }
|
||||
catch(...)
|
||||
{
|
||||
boost::phoenix::eval(
|
||||
proto::child_c<0>(
|
||||
a4
|
||||
)
|
||||
, ctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Try, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5, typename Context>
|
||||
typename boost::enable_if<
|
||||
proto::matches<
|
||||
A5
|
||||
, rule::catch_
|
||||
>
|
||||
, result_type
|
||||
>::type
|
||||
operator()(Try const & try_, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5, Context const & ctx
|
||||
BOOST_PHOENIX_SFINAE_AND_OVERLOADS) const
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::phoenix::eval(proto::child_c<0>(try_), ctx);
|
||||
}
|
||||
catch( typename proto::result_of::value< typename proto::result_of::child_c< A0 , 0 >::type >::type::type &e ) { eval_catch_body(a0, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A1 , 0 >::type >::type::type &e ) { eval_catch_body(a1, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A2 , 0 >::type >::type::type &e ) { eval_catch_body(a2, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A3 , 0 >::type >::type::type &e ) { eval_catch_body(a3, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A4 , 0 >::type >::type::type &e ) { eval_catch_body(a4, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A5 , 0 >::type >::type::type &e ) { eval_catch_body(a5, e, ctx); }
|
||||
}
|
||||
template <typename Try, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5, typename Context>
|
||||
typename boost::disable_if<
|
||||
proto::matches<
|
||||
A5
|
||||
, rule::catch_
|
||||
>
|
||||
, result_type
|
||||
>::type
|
||||
operator()(Try const & try_, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5, Context const & ctx) const
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::phoenix::eval(proto::child_c<0>(try_), ctx);
|
||||
}
|
||||
catch( typename proto::result_of::value< typename proto::result_of::child_c< A0 , 0 >::type >::type::type &e ) { eval_catch_body(a0, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A1 , 0 >::type >::type::type &e ) { eval_catch_body(a1, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A2 , 0 >::type >::type::type &e ) { eval_catch_body(a2, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A3 , 0 >::type >::type::type &e ) { eval_catch_body(a3, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A4 , 0 >::type >::type::type &e ) { eval_catch_body(a4, e, ctx); }
|
||||
catch(...)
|
||||
{
|
||||
boost::phoenix::eval(
|
||||
proto::child_c<0>(
|
||||
a5
|
||||
)
|
||||
, ctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Try, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6, typename Context>
|
||||
typename boost::enable_if<
|
||||
proto::matches<
|
||||
A6
|
||||
, rule::catch_
|
||||
>
|
||||
, result_type
|
||||
>::type
|
||||
operator()(Try const & try_, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6, Context const & ctx
|
||||
BOOST_PHOENIX_SFINAE_AND_OVERLOADS) const
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::phoenix::eval(proto::child_c<0>(try_), ctx);
|
||||
}
|
||||
catch( typename proto::result_of::value< typename proto::result_of::child_c< A0 , 0 >::type >::type::type &e ) { eval_catch_body(a0, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A1 , 0 >::type >::type::type &e ) { eval_catch_body(a1, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A2 , 0 >::type >::type::type &e ) { eval_catch_body(a2, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A3 , 0 >::type >::type::type &e ) { eval_catch_body(a3, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A4 , 0 >::type >::type::type &e ) { eval_catch_body(a4, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A5 , 0 >::type >::type::type &e ) { eval_catch_body(a5, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A6 , 0 >::type >::type::type &e ) { eval_catch_body(a6, e, ctx); }
|
||||
}
|
||||
template <typename Try, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6, typename Context>
|
||||
typename boost::disable_if<
|
||||
proto::matches<
|
||||
A6
|
||||
, rule::catch_
|
||||
>
|
||||
, result_type
|
||||
>::type
|
||||
operator()(Try const & try_, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6, Context const & ctx) const
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::phoenix::eval(proto::child_c<0>(try_), ctx);
|
||||
}
|
||||
catch( typename proto::result_of::value< typename proto::result_of::child_c< A0 , 0 >::type >::type::type &e ) { eval_catch_body(a0, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A1 , 0 >::type >::type::type &e ) { eval_catch_body(a1, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A2 , 0 >::type >::type::type &e ) { eval_catch_body(a2, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A3 , 0 >::type >::type::type &e ) { eval_catch_body(a3, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A4 , 0 >::type >::type::type &e ) { eval_catch_body(a4, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A5 , 0 >::type >::type::type &e ) { eval_catch_body(a5, e, ctx); }
|
||||
catch(...)
|
||||
{
|
||||
boost::phoenix::eval(
|
||||
proto::child_c<0>(
|
||||
a6
|
||||
)
|
||||
, ctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Try, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7, typename Context>
|
||||
typename boost::enable_if<
|
||||
proto::matches<
|
||||
A7
|
||||
, rule::catch_
|
||||
>
|
||||
, result_type
|
||||
>::type
|
||||
operator()(Try const & try_, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7, Context const & ctx
|
||||
BOOST_PHOENIX_SFINAE_AND_OVERLOADS) const
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::phoenix::eval(proto::child_c<0>(try_), ctx);
|
||||
}
|
||||
catch( typename proto::result_of::value< typename proto::result_of::child_c< A0 , 0 >::type >::type::type &e ) { eval_catch_body(a0, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A1 , 0 >::type >::type::type &e ) { eval_catch_body(a1, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A2 , 0 >::type >::type::type &e ) { eval_catch_body(a2, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A3 , 0 >::type >::type::type &e ) { eval_catch_body(a3, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A4 , 0 >::type >::type::type &e ) { eval_catch_body(a4, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A5 , 0 >::type >::type::type &e ) { eval_catch_body(a5, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A6 , 0 >::type >::type::type &e ) { eval_catch_body(a6, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A7 , 0 >::type >::type::type &e ) { eval_catch_body(a7, e, ctx); }
|
||||
}
|
||||
template <typename Try, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7, typename Context>
|
||||
typename boost::disable_if<
|
||||
proto::matches<
|
||||
A7
|
||||
, rule::catch_
|
||||
>
|
||||
, result_type
|
||||
>::type
|
||||
operator()(Try const & try_, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7, Context const & ctx) const
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::phoenix::eval(proto::child_c<0>(try_), ctx);
|
||||
}
|
||||
catch( typename proto::result_of::value< typename proto::result_of::child_c< A0 , 0 >::type >::type::type &e ) { eval_catch_body(a0, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A1 , 0 >::type >::type::type &e ) { eval_catch_body(a1, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A2 , 0 >::type >::type::type &e ) { eval_catch_body(a2, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A3 , 0 >::type >::type::type &e ) { eval_catch_body(a3, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A4 , 0 >::type >::type::type &e ) { eval_catch_body(a4, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A5 , 0 >::type >::type::type &e ) { eval_catch_body(a5, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A6 , 0 >::type >::type::type &e ) { eval_catch_body(a6, e, ctx); }
|
||||
catch(...)
|
||||
{
|
||||
boost::phoenix::eval(
|
||||
proto::child_c<0>(
|
||||
a7
|
||||
)
|
||||
, ctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Try, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8, typename Context>
|
||||
typename boost::enable_if<
|
||||
proto::matches<
|
||||
A8
|
||||
, rule::catch_
|
||||
>
|
||||
, result_type
|
||||
>::type
|
||||
operator()(Try const & try_, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8, Context const & ctx
|
||||
BOOST_PHOENIX_SFINAE_AND_OVERLOADS) const
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::phoenix::eval(proto::child_c<0>(try_), ctx);
|
||||
}
|
||||
catch( typename proto::result_of::value< typename proto::result_of::child_c< A0 , 0 >::type >::type::type &e ) { eval_catch_body(a0, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A1 , 0 >::type >::type::type &e ) { eval_catch_body(a1, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A2 , 0 >::type >::type::type &e ) { eval_catch_body(a2, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A3 , 0 >::type >::type::type &e ) { eval_catch_body(a3, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A4 , 0 >::type >::type::type &e ) { eval_catch_body(a4, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A5 , 0 >::type >::type::type &e ) { eval_catch_body(a5, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A6 , 0 >::type >::type::type &e ) { eval_catch_body(a6, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A7 , 0 >::type >::type::type &e ) { eval_catch_body(a7, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A8 , 0 >::type >::type::type &e ) { eval_catch_body(a8, e, ctx); }
|
||||
}
|
||||
template <typename Try, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8, typename Context>
|
||||
typename boost::disable_if<
|
||||
proto::matches<
|
||||
A8
|
||||
, rule::catch_
|
||||
>
|
||||
, result_type
|
||||
>::type
|
||||
operator()(Try const & try_, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8, Context const & ctx) const
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::phoenix::eval(proto::child_c<0>(try_), ctx);
|
||||
}
|
||||
catch( typename proto::result_of::value< typename proto::result_of::child_c< A0 , 0 >::type >::type::type &e ) { eval_catch_body(a0, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A1 , 0 >::type >::type::type &e ) { eval_catch_body(a1, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A2 , 0 >::type >::type::type &e ) { eval_catch_body(a2, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A3 , 0 >::type >::type::type &e ) { eval_catch_body(a3, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A4 , 0 >::type >::type::type &e ) { eval_catch_body(a4, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A5 , 0 >::type >::type::type &e ) { eval_catch_body(a5, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A6 , 0 >::type >::type::type &e ) { eval_catch_body(a6, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A7 , 0 >::type >::type::type &e ) { eval_catch_body(a7, e, ctx); }
|
||||
catch(...)
|
||||
{
|
||||
boost::phoenix::eval(
|
||||
proto::child_c<0>(
|
||||
a8
|
||||
)
|
||||
, ctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename Try, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9, typename Context>
|
||||
typename boost::enable_if<
|
||||
proto::matches<
|
||||
A9
|
||||
, rule::catch_
|
||||
>
|
||||
, result_type
|
||||
>::type
|
||||
operator()(Try const & try_, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9, Context const & ctx
|
||||
BOOST_PHOENIX_SFINAE_AND_OVERLOADS) const
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::phoenix::eval(proto::child_c<0>(try_), ctx);
|
||||
}
|
||||
catch( typename proto::result_of::value< typename proto::result_of::child_c< A0 , 0 >::type >::type::type &e ) { eval_catch_body(a0, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A1 , 0 >::type >::type::type &e ) { eval_catch_body(a1, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A2 , 0 >::type >::type::type &e ) { eval_catch_body(a2, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A3 , 0 >::type >::type::type &e ) { eval_catch_body(a3, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A4 , 0 >::type >::type::type &e ) { eval_catch_body(a4, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A5 , 0 >::type >::type::type &e ) { eval_catch_body(a5, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A6 , 0 >::type >::type::type &e ) { eval_catch_body(a6, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A7 , 0 >::type >::type::type &e ) { eval_catch_body(a7, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A8 , 0 >::type >::type::type &e ) { eval_catch_body(a8, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A9 , 0 >::type >::type::type &e ) { eval_catch_body(a9, e, ctx); }
|
||||
}
|
||||
template <typename Try, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9, typename Context>
|
||||
typename boost::disable_if<
|
||||
proto::matches<
|
||||
A9
|
||||
, rule::catch_
|
||||
>
|
||||
, result_type
|
||||
>::type
|
||||
operator()(Try const & try_, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9, Context const & ctx) const
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::phoenix::eval(proto::child_c<0>(try_), ctx);
|
||||
}
|
||||
catch( typename proto::result_of::value< typename proto::result_of::child_c< A0 , 0 >::type >::type::type &e ) { eval_catch_body(a0, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A1 , 0 >::type >::type::type &e ) { eval_catch_body(a1, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A2 , 0 >::type >::type::type &e ) { eval_catch_body(a2, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A3 , 0 >::type >::type::type &e ) { eval_catch_body(a3, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A4 , 0 >::type >::type::type &e ) { eval_catch_body(a4, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A5 , 0 >::type >::type::type &e ) { eval_catch_body(a5, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A6 , 0 >::type >::type::type &e ) { eval_catch_body(a6, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A7 , 0 >::type >::type::type &e ) { eval_catch_body(a7, e, ctx); } catch( typename proto::result_of::value< typename proto::result_of::child_c< A8 , 0 >::type >::type::type &e ) { eval_catch_body(a8, e, ctx); }
|
||||
catch(...)
|
||||
{
|
||||
boost::phoenix::eval(
|
||||
proto::child_c<0>(
|
||||
a9
|
||||
)
|
||||
, ctx);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
#include "Random.h"
|
||||
|
||||
void Random::bubbleSort(int a[], int size)
|
||||
{
|
||||
for(int pass=1; pass<size; pass++) {
|
||||
for(int i=0;i<size-pass;i++)
|
||||
if(a[i]>a[i+1]){
|
||||
std::swap(a[i], a[i+1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double Random::gauss(double sdev, double mean)
|
||||
{
|
||||
double sum=0.0;
|
||||
for (int i=1;i<=12;++i)
|
||||
{
|
||||
seed_u = 1664525lu * seed_u + 123456789lu;
|
||||
sum+=double(seed_u);
|
||||
}
|
||||
return (sum/4.29497e9-6.0)*sdev+mean;
|
||||
}
|
||||
|
||||
double Random::uniform(double a, double b)
|
||||
{
|
||||
double t;
|
||||
for(int i=0; i<10;i++){
|
||||
seed=2045*seed+1;
|
||||
//seed=seed -(seed/1048576)*1048576;
|
||||
seed%=1048576;
|
||||
}
|
||||
t=seed/1048576.0;
|
||||
t=a+(b-a)*t;
|
||||
return(t);
|
||||
}
|
||||
|
||||
int Random::uniform(int a, int b) // [a, b-1]
|
||||
{
|
||||
double t;
|
||||
int i, tt;
|
||||
if(b==a+1) return(a);
|
||||
for(i=0; i<10;i++){
|
||||
seed=2045*seed+1;
|
||||
//seed=seed -(seed/1048576)*1048576;
|
||||
seed%=1048576;
|
||||
}
|
||||
t=seed/1048576.0;
|
||||
t=a+(b-a)*t;
|
||||
tt=(int)t;
|
||||
if(tt<a) tt=a;
|
||||
else if(tt>=b) tt=b-1;
|
||||
return(tt);
|
||||
}
|
||||
|
||||
int Random::nonUniform(int a, int b) // [a, b-1]
|
||||
{
|
||||
double t;
|
||||
int i, tt;
|
||||
if(b==a+1) return(a);
|
||||
for(i=0; i<10;i++){
|
||||
seed=2045*seed+1;
|
||||
//seed=seed -(seed/1048576)*1048576;
|
||||
seed%=1048576;
|
||||
}
|
||||
t=seed/1048576.0;
|
||||
t=a+(b-a)*pow(t, 0.6667); //t^1.5
|
||||
tt=(int)t;
|
||||
if(tt<a) tt=a;
|
||||
else if(tt>=b) tt=b-1;
|
||||
return(tt);
|
||||
}
|
||||
|
||||
/*
|
||||
void m_uniform(int a , int b, long int *seed, int *itmp, int num)
|
||||
{
|
||||
int index, imed, i, k;
|
||||
|
||||
index=0;
|
||||
itmp[0]=uniform(a, b, seed);
|
||||
Loop1:
|
||||
imed=uniform(a, b, seed);
|
||||
k=0;
|
||||
for(i=0;i<=index;i++)
|
||||
if(imed==itmp[i]) {k=1; break;}
|
||||
if(k==0) {index++; itmp[index]=imed;}
|
||||
if(index<num-1) goto Loop1;
|
||||
bubble(itmp, num); //bubble sorting
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,439 @@
|
||||
// Boost io/ios_state.hpp header file --------------------------------------//
|
||||
|
||||
// Copyright 2002, 2005 Daryle Walker. Use, modification, and distribution
|
||||
// are subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or a copy at <http://www.boost.org/LICENSE_1_0.txt>.)
|
||||
|
||||
// See <http://www.boost.org/libs/io/> for the library's home page.
|
||||
|
||||
#ifndef BOOST_IO_IOS_STATE_HPP
|
||||
#define BOOST_IO_IOS_STATE_HPP
|
||||
|
||||
#include <boost/io_fwd.hpp> // self include
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <ios> // for std::ios_base, std::basic_ios, etc.
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
#include <locale> // for std::locale
|
||||
#endif
|
||||
#include <ostream> // for std::basic_ostream
|
||||
#include <streambuf> // for std::basic_streambuf
|
||||
#include <string> // for std::char_traits
|
||||
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace io
|
||||
{
|
||||
|
||||
|
||||
// Basic stream state saver class declarations -----------------------------//
|
||||
|
||||
class ios_flags_saver
|
||||
{
|
||||
public:
|
||||
typedef ::std::ios_base state_type;
|
||||
typedef ::std::ios_base::fmtflags aspect_type;
|
||||
|
||||
explicit ios_flags_saver( state_type &s )
|
||||
: s_save_( s ), a_save_( s.flags() )
|
||||
{}
|
||||
ios_flags_saver( state_type &s, aspect_type const &a )
|
||||
: s_save_( s ), a_save_( s.flags(a) )
|
||||
{}
|
||||
~ios_flags_saver()
|
||||
{ this->restore(); }
|
||||
|
||||
void restore()
|
||||
{ s_save_.flags( a_save_ ); }
|
||||
|
||||
private:
|
||||
state_type & s_save_;
|
||||
aspect_type const a_save_;
|
||||
|
||||
ios_flags_saver& operator=(const ios_flags_saver&);
|
||||
};
|
||||
|
||||
class ios_precision_saver
|
||||
{
|
||||
public:
|
||||
typedef ::std::ios_base state_type;
|
||||
typedef ::std::streamsize aspect_type;
|
||||
|
||||
explicit ios_precision_saver( state_type &s )
|
||||
: s_save_( s ), a_save_( s.precision() )
|
||||
{}
|
||||
ios_precision_saver( state_type &s, aspect_type const &a )
|
||||
: s_save_( s ), a_save_( s.precision(a) )
|
||||
{}
|
||||
~ios_precision_saver()
|
||||
{ this->restore(); }
|
||||
|
||||
void restore()
|
||||
{ s_save_.precision( a_save_ ); }
|
||||
|
||||
private:
|
||||
state_type & s_save_;
|
||||
aspect_type const a_save_;
|
||||
|
||||
ios_precision_saver& operator=(const ios_precision_saver&);
|
||||
};
|
||||
|
||||
class ios_width_saver
|
||||
{
|
||||
public:
|
||||
typedef ::std::ios_base state_type;
|
||||
typedef ::std::streamsize aspect_type;
|
||||
|
||||
explicit ios_width_saver( state_type &s )
|
||||
: s_save_( s ), a_save_( s.width() )
|
||||
{}
|
||||
ios_width_saver( state_type &s, aspect_type const &a )
|
||||
: s_save_( s ), a_save_( s.width(a) )
|
||||
{}
|
||||
~ios_width_saver()
|
||||
{ this->restore(); }
|
||||
|
||||
void restore()
|
||||
{ s_save_.width( a_save_ ); }
|
||||
|
||||
private:
|
||||
state_type & s_save_;
|
||||
aspect_type const a_save_;
|
||||
ios_width_saver& operator=(const ios_width_saver&);
|
||||
};
|
||||
|
||||
|
||||
// Advanced stream state saver class template declarations -----------------//
|
||||
|
||||
template < typename Ch, class Tr >
|
||||
class basic_ios_iostate_saver
|
||||
{
|
||||
public:
|
||||
typedef ::std::basic_ios<Ch, Tr> state_type;
|
||||
typedef ::std::ios_base::iostate aspect_type;
|
||||
|
||||
explicit basic_ios_iostate_saver( state_type &s )
|
||||
: s_save_( s ), a_save_( s.rdstate() )
|
||||
{}
|
||||
basic_ios_iostate_saver( state_type &s, aspect_type const &a )
|
||||
: s_save_( s ), a_save_( s.rdstate() )
|
||||
{ s.clear(a); }
|
||||
~basic_ios_iostate_saver()
|
||||
{ this->restore(); }
|
||||
|
||||
void restore()
|
||||
{ s_save_.clear( a_save_ ); }
|
||||
|
||||
private:
|
||||
state_type & s_save_;
|
||||
aspect_type const a_save_;
|
||||
basic_ios_iostate_saver& operator=(const basic_ios_iostate_saver&);
|
||||
};
|
||||
|
||||
template < typename Ch, class Tr >
|
||||
class basic_ios_exception_saver
|
||||
{
|
||||
public:
|
||||
typedef ::std::basic_ios<Ch, Tr> state_type;
|
||||
typedef ::std::ios_base::iostate aspect_type;
|
||||
|
||||
explicit basic_ios_exception_saver( state_type &s )
|
||||
: s_save_( s ), a_save_( s.exceptions() )
|
||||
{}
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
|
||||
basic_ios_exception_saver( state_type &s, aspect_type a )
|
||||
#else
|
||||
basic_ios_exception_saver( state_type &s, aspect_type const &a )
|
||||
#endif
|
||||
: s_save_( s ), a_save_( s.exceptions() )
|
||||
{ s.exceptions(a); }
|
||||
~basic_ios_exception_saver()
|
||||
{ this->restore(); }
|
||||
|
||||
void restore()
|
||||
{ s_save_.exceptions( a_save_ ); }
|
||||
|
||||
private:
|
||||
state_type & s_save_;
|
||||
aspect_type const a_save_;
|
||||
basic_ios_exception_saver& operator=(const basic_ios_exception_saver&);
|
||||
};
|
||||
|
||||
template < typename Ch, class Tr >
|
||||
class basic_ios_tie_saver
|
||||
{
|
||||
public:
|
||||
typedef ::std::basic_ios<Ch, Tr> state_type;
|
||||
typedef ::std::basic_ostream<Ch, Tr> * aspect_type;
|
||||
|
||||
explicit basic_ios_tie_saver( state_type &s )
|
||||
: s_save_( s ), a_save_( s.tie() )
|
||||
{}
|
||||
basic_ios_tie_saver( state_type &s, aspect_type const &a )
|
||||
: s_save_( s ), a_save_( s.tie(a) )
|
||||
{}
|
||||
~basic_ios_tie_saver()
|
||||
{ this->restore(); }
|
||||
|
||||
void restore()
|
||||
{ s_save_.tie( a_save_ ); }
|
||||
|
||||
private:
|
||||
state_type & s_save_;
|
||||
aspect_type const a_save_;
|
||||
basic_ios_tie_saver& operator=(const basic_ios_tie_saver&);
|
||||
};
|
||||
|
||||
template < typename Ch, class Tr >
|
||||
class basic_ios_rdbuf_saver
|
||||
{
|
||||
public:
|
||||
typedef ::std::basic_ios<Ch, Tr> state_type;
|
||||
typedef ::std::basic_streambuf<Ch, Tr> * aspect_type;
|
||||
|
||||
explicit basic_ios_rdbuf_saver( state_type &s )
|
||||
: s_save_( s ), a_save_( s.rdbuf() )
|
||||
{}
|
||||
basic_ios_rdbuf_saver( state_type &s, aspect_type const &a )
|
||||
: s_save_( s ), a_save_( s.rdbuf(a) )
|
||||
{}
|
||||
~basic_ios_rdbuf_saver()
|
||||
{ this->restore(); }
|
||||
|
||||
void restore()
|
||||
{ s_save_.rdbuf( a_save_ ); }
|
||||
|
||||
private:
|
||||
state_type & s_save_;
|
||||
aspect_type const a_save_;
|
||||
basic_ios_rdbuf_saver& operator=(const basic_ios_rdbuf_saver&);
|
||||
};
|
||||
|
||||
template < typename Ch, class Tr >
|
||||
class basic_ios_fill_saver
|
||||
{
|
||||
public:
|
||||
typedef ::std::basic_ios<Ch, Tr> state_type;
|
||||
typedef typename state_type::char_type aspect_type;
|
||||
|
||||
explicit basic_ios_fill_saver( state_type &s )
|
||||
: s_save_( s ), a_save_( s.fill() )
|
||||
{}
|
||||
basic_ios_fill_saver( state_type &s, aspect_type const &a )
|
||||
: s_save_( s ), a_save_( s.fill(a) )
|
||||
{}
|
||||
~basic_ios_fill_saver()
|
||||
{ this->restore(); }
|
||||
|
||||
void restore()
|
||||
{ s_save_.fill( a_save_ ); }
|
||||
|
||||
private:
|
||||
state_type & s_save_;
|
||||
aspect_type const a_save_;
|
||||
basic_ios_fill_saver& operator=(const basic_ios_fill_saver&);
|
||||
};
|
||||
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
template < typename Ch, class Tr >
|
||||
class basic_ios_locale_saver
|
||||
{
|
||||
public:
|
||||
typedef ::std::basic_ios<Ch, Tr> state_type;
|
||||
typedef ::std::locale aspect_type;
|
||||
|
||||
explicit basic_ios_locale_saver( state_type &s )
|
||||
: s_save_( s ), a_save_( s.getloc() )
|
||||
{}
|
||||
basic_ios_locale_saver( state_type &s, aspect_type const &a )
|
||||
: s_save_( s ), a_save_( s.imbue(a) )
|
||||
{}
|
||||
~basic_ios_locale_saver()
|
||||
{ this->restore(); }
|
||||
|
||||
void restore()
|
||||
{ s_save_.imbue( a_save_ ); }
|
||||
|
||||
private:
|
||||
state_type & s_save_;
|
||||
aspect_type const a_save_;
|
||||
basic_ios_locale_saver& operator=(const basic_ios_locale_saver&);
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
// User-defined stream state saver class declarations ----------------------//
|
||||
|
||||
class ios_iword_saver
|
||||
{
|
||||
public:
|
||||
typedef ::std::ios_base state_type;
|
||||
typedef int index_type;
|
||||
typedef long aspect_type;
|
||||
|
||||
explicit ios_iword_saver( state_type &s, index_type i )
|
||||
: s_save_( s ), a_save_( s.iword(i) ), i_save_( i )
|
||||
{}
|
||||
ios_iword_saver( state_type &s, index_type i, aspect_type const &a )
|
||||
: s_save_( s ), a_save_( s.iword(i) ), i_save_( i )
|
||||
{ s.iword(i) = a; }
|
||||
~ios_iword_saver()
|
||||
{ this->restore(); }
|
||||
|
||||
void restore()
|
||||
{ s_save_.iword( i_save_ ) = a_save_; }
|
||||
|
||||
private:
|
||||
state_type & s_save_;
|
||||
aspect_type const a_save_;
|
||||
index_type const i_save_;
|
||||
|
||||
ios_iword_saver& operator=(const ios_iword_saver&);
|
||||
};
|
||||
|
||||
class ios_pword_saver
|
||||
{
|
||||
public:
|
||||
typedef ::std::ios_base state_type;
|
||||
typedef int index_type;
|
||||
typedef void * aspect_type;
|
||||
|
||||
explicit ios_pword_saver( state_type &s, index_type i )
|
||||
: s_save_( s ), a_save_( s.pword(i) ), i_save_( i )
|
||||
{}
|
||||
ios_pword_saver( state_type &s, index_type i, aspect_type const &a )
|
||||
: s_save_( s ), a_save_( s.pword(i) ), i_save_( i )
|
||||
{ s.pword(i) = a; }
|
||||
~ios_pword_saver()
|
||||
{ this->restore(); }
|
||||
|
||||
void restore()
|
||||
{ s_save_.pword( i_save_ ) = a_save_; }
|
||||
|
||||
private:
|
||||
state_type & s_save_;
|
||||
aspect_type const a_save_;
|
||||
index_type const i_save_;
|
||||
|
||||
ios_pword_saver operator=(const ios_pword_saver&);
|
||||
};
|
||||
|
||||
|
||||
// Combined stream state saver class (template) declarations ---------------//
|
||||
|
||||
class ios_base_all_saver
|
||||
{
|
||||
public:
|
||||
typedef ::std::ios_base state_type;
|
||||
|
||||
explicit ios_base_all_saver( state_type &s )
|
||||
: s_save_( s ), a1_save_( s.flags() ), a2_save_( s.precision() )
|
||||
, a3_save_( s.width() )
|
||||
{}
|
||||
|
||||
~ios_base_all_saver()
|
||||
{ this->restore(); }
|
||||
|
||||
void restore()
|
||||
{
|
||||
s_save_.width( a3_save_ );
|
||||
s_save_.precision( a2_save_ );
|
||||
s_save_.flags( a1_save_ );
|
||||
}
|
||||
|
||||
private:
|
||||
state_type & s_save_;
|
||||
state_type::fmtflags const a1_save_;
|
||||
::std::streamsize const a2_save_;
|
||||
::std::streamsize const a3_save_;
|
||||
|
||||
ios_base_all_saver& operator=(const ios_base_all_saver&);
|
||||
};
|
||||
|
||||
template < typename Ch, class Tr >
|
||||
class basic_ios_all_saver
|
||||
{
|
||||
public:
|
||||
typedef ::std::basic_ios<Ch, Tr> state_type;
|
||||
|
||||
explicit basic_ios_all_saver( state_type &s )
|
||||
: s_save_( s ), a1_save_( s.flags() ), a2_save_( s.precision() )
|
||||
, a3_save_( s.width() ), a4_save_( s.rdstate() )
|
||||
, a5_save_( s.exceptions() ), a6_save_( s.tie() )
|
||||
, a7_save_( s.rdbuf() ), a8_save_( s.fill() )
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
, a9_save_( s.getloc() )
|
||||
#endif
|
||||
{}
|
||||
|
||||
~basic_ios_all_saver()
|
||||
{ this->restore(); }
|
||||
|
||||
void restore()
|
||||
{
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
s_save_.imbue( a9_save_ );
|
||||
#endif
|
||||
s_save_.fill( a8_save_ );
|
||||
s_save_.rdbuf( a7_save_ );
|
||||
s_save_.tie( a6_save_ );
|
||||
s_save_.exceptions( a5_save_ );
|
||||
s_save_.clear( a4_save_ );
|
||||
s_save_.width( a3_save_ );
|
||||
s_save_.precision( a2_save_ );
|
||||
s_save_.flags( a1_save_ );
|
||||
}
|
||||
|
||||
private:
|
||||
state_type & s_save_;
|
||||
typename state_type::fmtflags const a1_save_;
|
||||
::std::streamsize const a2_save_;
|
||||
::std::streamsize const a3_save_;
|
||||
typename state_type::iostate const a4_save_;
|
||||
typename state_type::iostate const a5_save_;
|
||||
::std::basic_ostream<Ch, Tr> * const a6_save_;
|
||||
::std::basic_streambuf<Ch, Tr> * const a7_save_;
|
||||
typename state_type::char_type const a8_save_;
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
::std::locale const a9_save_;
|
||||
#endif
|
||||
|
||||
basic_ios_all_saver& operator=(const basic_ios_all_saver&);
|
||||
};
|
||||
|
||||
class ios_all_word_saver
|
||||
{
|
||||
public:
|
||||
typedef ::std::ios_base state_type;
|
||||
typedef int index_type;
|
||||
|
||||
ios_all_word_saver( state_type &s, index_type i )
|
||||
: s_save_( s ), i_save_( i ), a1_save_( s.iword(i) )
|
||||
, a2_save_( s.pword(i) )
|
||||
{}
|
||||
|
||||
~ios_all_word_saver()
|
||||
{ this->restore(); }
|
||||
|
||||
void restore()
|
||||
{
|
||||
s_save_.pword( i_save_ ) = a2_save_;
|
||||
s_save_.iword( i_save_ ) = a1_save_;
|
||||
}
|
||||
|
||||
private:
|
||||
state_type & s_save_;
|
||||
index_type const i_save_;
|
||||
long const a1_save_;
|
||||
void * const a2_save_;
|
||||
|
||||
ios_all_word_saver& operator=(const ios_all_word_saver&);
|
||||
};
|
||||
|
||||
|
||||
} // namespace io
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // BOOST_IO_IOS_STATE_HPP
|
||||
@@ -0,0 +1,98 @@
|
||||
/*=============================================================================
|
||||
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_04052005_1132)
|
||||
#define FUSION_BEGIN_04052005_1132
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/mpl/empty_base.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic_fwd.hpp>
|
||||
#include <boost/fusion/support/tag_of.hpp>
|
||||
#include <boost/fusion/support/is_sequence.hpp>
|
||||
#include <boost/fusion/support/is_segmented.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/detail/segmented_begin.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
// Special tags:
|
||||
struct sequence_facade_tag; // iterator facade tag
|
||||
struct boost_tuple_tag; // boost::tuples::tuple tag
|
||||
struct boost_array_tag; // boost::array tag
|
||||
struct mpl_sequence_tag; // mpl sequence tag
|
||||
struct std_pair_tag; // std::pair tag
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct begin_impl
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply
|
||||
: mpl::if_<
|
||||
traits::is_segmented<Sequence>
|
||||
, detail::segmented_begin<Sequence>
|
||||
, mpl::empty_base
|
||||
>::type
|
||||
{};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct begin_impl<sequence_facade_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply : Sequence::template begin<Sequence> {};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct begin_impl<boost_tuple_tag>;
|
||||
|
||||
template <>
|
||||
struct begin_impl<boost_array_tag>;
|
||||
|
||||
template <>
|
||||
struct begin_impl<mpl_sequence_tag>;
|
||||
|
||||
template <>
|
||||
struct begin_impl<std_pair_tag>;
|
||||
}
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct begin
|
||||
: extension::begin_impl<typename detail::tag_of<Sequence>::type>::
|
||||
template apply<Sequence>
|
||||
{};
|
||||
}
|
||||
|
||||
template <typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename
|
||||
lazy_enable_if<
|
||||
traits::is_sequence<Sequence>
|
||||
, result_of::begin<Sequence>
|
||||
>::type const
|
||||
begin(Sequence& seq)
|
||||
{
|
||||
return result_of::begin<Sequence>::call(seq);
|
||||
}
|
||||
|
||||
template <typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename
|
||||
lazy_enable_if<
|
||||
traits::is_sequence<Sequence>
|
||||
, result_of::begin<Sequence const>
|
||||
>::type const
|
||||
begin(Sequence const& seq)
|
||||
{
|
||||
return result_of::begin<Sequence const>::call(seq);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,77 @@
|
||||
// Status=review
|
||||
|
||||
image::RadioTab.png[align="center",alt="Radio Tab"]
|
||||
|
||||
_WSJT-X_ offers CAT (Computer Aided Transceiver) control of relevant
|
||||
features of most modern transceivers. To configure the program for
|
||||
your radio, select the *Radio* tab.
|
||||
|
||||
- Select your radio type from the drop-down list labeled *Rig*, or
|
||||
*None* if you do not wish to use CAT control.
|
||||
|
||||
- Alternatively, if you have configured your station for control by
|
||||
*DX Lab Suite Commander*, *Ham Radio Deluxe*, *Hamlib NET rigctl*, or
|
||||
*OmniRig*, you may select one of those program names from the *Rig*
|
||||
list. In these cases the entry field immediately under _CAT Control_
|
||||
will be relabeled as *Network Server*. Leave this field blank to
|
||||
access the default instance of your control program, running on the
|
||||
same computer. If the control program runs on a different computer
|
||||
and/or port, specify it here. Hover the mouse pointer over the entry
|
||||
field to see the required formatting details.
|
||||
|
||||
- Select *OmniRig Rig 1* or *OmniRig Rig 2* to connect to an _OmniRig_
|
||||
server running on the same computer. Note that _OmniRig_ is available
|
||||
only under Windows.
|
||||
|
||||
- Set *Poll Interval* to the desired interval for _WSJT-X_ to query
|
||||
your radio. For most radios a small number (say, 1 – 3 s) is
|
||||
suitable.
|
||||
|
||||
- _CAT Control_: To have _WSJT-X_ control the radio directly rather
|
||||
than though another program, make the following settings:
|
||||
|
||||
* Select the *Serial Port* used to communicate with your radio.
|
||||
|
||||
* _Serial Port Parameters_: Set values for *Baud Rate*, *Data Bits*,
|
||||
*Stop Bits*, and *Handshake* method. Consult your radio's user guide
|
||||
for the proper parameter values.
|
||||
|
||||
* _Force Control Lines_: A few station setups require the CAT serial
|
||||
port’s *RTS* and/or *DTR* control lines to be forced high or
|
||||
low. Check these boxes only if you are sure they are needed (for
|
||||
example, to power the radio serial interface).
|
||||
|
||||
- _PTT Method_: select *VOX*, *CAT*, *DTR*, or *RTS* as the desired
|
||||
method for T/R switching. If your choice is *DTR* or *RTS*, select
|
||||
the desired serial port (which may be the same one as used for
|
||||
CAT control).
|
||||
|
||||
- _Transmit Audio Source_: some radios permit you to choose the
|
||||
connector that will accept Tx audio. If this choice is enabled,
|
||||
select *Rear/Data* or *Front/Mic*.
|
||||
|
||||
- _Mode_: _WSJT-X_ uses upper sideband mode for both transmitting and
|
||||
receiving. Select *USB*, or choose *Data/Pkt* if your radio offers
|
||||
such an option and uses it to enable the rear-panel audio line input.
|
||||
Some radios also offer wider and/or flatter passbands when set to
|
||||
*Data/Pkt* mode. Select *None* if you do not want _WSJT-X_ to change
|
||||
the radio's Mode setting.
|
||||
|
||||
- _Split Operation_: Significant advantages result from using *Split*
|
||||
mode (separate VFOs for Rx and Tx) if your radio supports it. If it
|
||||
does not, _WSJT-X_ can emulate such behavior. Either method will
|
||||
result in a cleaner transmitted signal, by keeping the Tx audio always
|
||||
in the range 1500 to 2000 Hz so that audio harmonics cannot pass
|
||||
through the Tx sideband filter. Select *Rig* to use the radio's Split
|
||||
mode, or *Fake It* to have _WSJT-X_ adjust the VFO frequency as
|
||||
needed, when T/R switching occurs. Choose *None* if you do not
|
||||
wish to use split operation.
|
||||
|
||||
When all required settings have been made, click *Test CAT* to test
|
||||
communication between _WSJT-X_ and your radio. The button should turn
|
||||
green to indicate that proper communication has been established.
|
||||
Failure of the CAT-control test turns the button red and displays an
|
||||
error message. After a successful CAT test, toggle the *Test PTT*
|
||||
button to confirm that your selected method of T/R control is working
|
||||
properly. (If you selected *VOX* for _PTT Method_, you can test T/R
|
||||
switching later by using the *Tune* button on the main window.)
|
||||
@@ -0,0 +1,315 @@
|
||||
/*
|
||||
[auto_generated]
|
||||
boost/numeric/odeint/stepper/modified_midpoint.hpp
|
||||
|
||||
[begin_description]
|
||||
Modified midpoint method for the use in Burlish-Stoer stepper.
|
||||
[end_description]
|
||||
|
||||
Copyright 2011-2013 Mario Mulansky
|
||||
Copyright 2011-2013 Karsten Ahnert
|
||||
Copyright 2012 Christoph Koke
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or
|
||||
copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_MODIFIED_MIDPOINT_HPP_INCLUDED
|
||||
#define BOOST_NUMERIC_ODEINT_STEPPER_MODIFIED_MIDPOINT_HPP_INCLUDED
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp>
|
||||
#include <boost/numeric/odeint/util/resizer.hpp>
|
||||
#include <boost/numeric/odeint/util/is_resizeable.hpp>
|
||||
#include <boost/numeric/odeint/algebra/range_algebra.hpp>
|
||||
#include <boost/numeric/odeint/algebra/default_operations.hpp>
|
||||
#include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp>
|
||||
#include <boost/numeric/odeint/algebra/operations_dispatcher.hpp>
|
||||
#include <boost/numeric/odeint/util/copy.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace odeint {
|
||||
|
||||
template<
|
||||
class State ,
|
||||
class Value = double ,
|
||||
class Deriv = State ,
|
||||
class Time = Value ,
|
||||
class Algebra = typename algebra_dispatcher< State >::algebra_type ,
|
||||
class Operations = typename operations_dispatcher< State >::operations_type ,
|
||||
class Resizer = initially_resizer
|
||||
>
|
||||
#ifndef DOXYGEN_SKIP
|
||||
class modified_midpoint
|
||||
: public explicit_stepper_base<
|
||||
modified_midpoint< State , Value , Deriv , Time , Algebra , Operations , Resizer > ,
|
||||
2 , State , Value , Deriv , Time , Algebra , Operations , Resizer >
|
||||
#else
|
||||
class modified_midpoint : public explicit_stepper_base
|
||||
#endif
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
typedef explicit_stepper_base<
|
||||
modified_midpoint< State , Value , Deriv , Time , Algebra , Operations , Resizer > ,
|
||||
2 , State , Value , Deriv , Time , Algebra , Operations , Resizer > stepper_base_type;
|
||||
|
||||
typedef typename stepper_base_type::state_type state_type;
|
||||
typedef typename stepper_base_type::wrapped_state_type wrapped_state_type;
|
||||
typedef typename stepper_base_type::value_type value_type;
|
||||
typedef typename stepper_base_type::deriv_type deriv_type;
|
||||
typedef typename stepper_base_type::wrapped_deriv_type wrapped_deriv_type;
|
||||
typedef typename stepper_base_type::time_type time_type;
|
||||
typedef typename stepper_base_type::algebra_type algebra_type;
|
||||
typedef typename stepper_base_type::operations_type operations_type;
|
||||
typedef typename stepper_base_type::resizer_type resizer_type;
|
||||
typedef typename stepper_base_type::stepper_type stepper_type;
|
||||
|
||||
|
||||
modified_midpoint( unsigned short steps = 2 , const algebra_type &algebra = algebra_type() )
|
||||
: stepper_base_type( algebra ) , m_steps( steps )
|
||||
{ }
|
||||
|
||||
template< class System , class StateIn , class DerivIn , class StateOut >
|
||||
void do_step_impl( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt )
|
||||
{
|
||||
static const value_type val1 = static_cast< value_type >( 1 );
|
||||
static const value_type val05 = static_cast< value_type >( 1 ) / static_cast< value_type >( 2 );
|
||||
|
||||
m_resizer.adjust_size( in , detail::bind( &stepper_type::template resize_impl< StateIn > , detail::ref( *this ) , detail::_1 ) );
|
||||
|
||||
const time_type h = dt / static_cast<value_type>( m_steps );
|
||||
const time_type h2 = static_cast<value_type>(2) * h;
|
||||
|
||||
typename odeint::unwrap_reference< System >::type &sys = system;
|
||||
|
||||
time_type th = t + h;
|
||||
|
||||
// m_x1 = x + h*dxdt
|
||||
stepper_base_type::m_algebra.for_each3( m_x1.m_v , in , dxdt ,
|
||||
typename operations_type::template scale_sum2< value_type , time_type >( val1 , h ) );
|
||||
|
||||
sys( m_x1.m_v , m_dxdt.m_v , th );
|
||||
|
||||
boost::numeric::odeint::copy( in , m_x0.m_v );
|
||||
|
||||
unsigned short i = 1;
|
||||
while( i != m_steps )
|
||||
{
|
||||
// general step
|
||||
//tmp = m_x1; m_x1 = m_x0 + h2*m_dxdt; m_x0 = tmp
|
||||
stepper_base_type::m_algebra.for_each3( m_x1.m_v , m_x0.m_v , m_dxdt.m_v ,
|
||||
typename operations_type::template scale_sum_swap2< value_type , time_type >( val1 , h2 ) );
|
||||
th += h;
|
||||
sys( m_x1.m_v , m_dxdt.m_v , th);
|
||||
i++;
|
||||
}
|
||||
|
||||
// last step
|
||||
// x = 0.5*( m_x0 + m_x1 + h*m_dxdt )
|
||||
stepper_base_type::m_algebra.for_each4( out , m_x0.m_v , m_x1.m_v , m_dxdt.m_v ,
|
||||
typename operations_type::template scale_sum3< value_type , value_type , time_type >( val05 , val05 , val05*h ) );
|
||||
}
|
||||
|
||||
|
||||
void set_steps( unsigned short steps )
|
||||
{ m_steps = steps; }
|
||||
|
||||
|
||||
unsigned short steps( void ) const
|
||||
{ return m_steps; }
|
||||
|
||||
|
||||
template< class StateIn >
|
||||
void adjust_size( const StateIn &x )
|
||||
{
|
||||
resize_impl( x );
|
||||
stepper_base_type::adjust_size( x );
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
template< class StateIn >
|
||||
bool resize_impl( const StateIn &x )
|
||||
{
|
||||
bool resized( false );
|
||||
resized |= adjust_size_by_resizeability( m_x0 , x , typename is_resizeable<state_type>::type() );
|
||||
resized |= adjust_size_by_resizeability( m_x1 , x , typename is_resizeable<state_type>::type() );
|
||||
resized |= adjust_size_by_resizeability( m_dxdt , x , typename is_resizeable<deriv_type>::type() );
|
||||
return resized;
|
||||
}
|
||||
|
||||
|
||||
unsigned short m_steps;
|
||||
|
||||
resizer_type m_resizer;
|
||||
|
||||
wrapped_state_type m_x0;
|
||||
wrapped_state_type m_x1;
|
||||
wrapped_deriv_type m_dxdt;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/* Modified midpoint which stores derivatives and state at dt/2 in some external storage for later usage in dense output calculation
|
||||
* This Stepper is for use in Bulirsch Stoer only. It DOES NOT meet any stepper concept.
|
||||
*/
|
||||
template<
|
||||
class State ,
|
||||
class Value = double ,
|
||||
class Deriv = State ,
|
||||
class Time = Value ,
|
||||
class Algebra = typename algebra_dispatcher< State >::algebra_type ,
|
||||
class Operations = typename operations_dispatcher< State >::operations_type ,
|
||||
class Resizer = initially_resizer
|
||||
>
|
||||
class modified_midpoint_dense_out
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
typedef State state_type;
|
||||
typedef Value value_type;
|
||||
typedef Deriv deriv_type;
|
||||
typedef Time time_type;
|
||||
typedef Algebra algebra_type;
|
||||
typedef Operations operations_type;
|
||||
typedef Resizer resizer_type;
|
||||
typedef state_wrapper< state_type > wrapped_state_type;
|
||||
typedef state_wrapper< deriv_type > wrapped_deriv_type;
|
||||
|
||||
typedef modified_midpoint_dense_out< State , Value , Deriv , Time , Algebra , Operations , Resizer > stepper_type;
|
||||
typedef std::vector< wrapped_deriv_type > deriv_table_type;
|
||||
|
||||
modified_midpoint_dense_out( unsigned short steps = 2 , const algebra_type &algebra = algebra_type() )
|
||||
: m_algebra( algebra ) , m_steps( steps )
|
||||
{ }
|
||||
|
||||
/*
|
||||
* performs a modified midpoint step with m_steps intermediate points
|
||||
* stores approximation for x(t+dt/2) in x_mp and all evaluated function results in derivs
|
||||
*
|
||||
*/
|
||||
|
||||
template< class System , class StateIn , class DerivIn , class StateOut >
|
||||
void do_step( System system , const StateIn &in , const DerivIn &dxdt , time_type t , StateOut &out , time_type dt ,
|
||||
state_type &x_mp , deriv_table_type &derivs )
|
||||
{
|
||||
|
||||
static const value_type val1 = static_cast< value_type >( 1 );
|
||||
static const value_type val05 = static_cast< value_type >( 1 ) / static_cast< value_type >( 2 );
|
||||
|
||||
m_resizer.adjust_size( in , detail::bind( &stepper_type::template resize< StateIn > , detail::ref( *this ) , detail::_1 ) );
|
||||
|
||||
const time_type h = dt / static_cast<value_type>( m_steps );
|
||||
const time_type h2 = static_cast<value_type>( 2 ) * h;
|
||||
|
||||
typename odeint::unwrap_reference< System >::type &sys = system;
|
||||
|
||||
time_type th = t + h;
|
||||
|
||||
// m_x1 = x + h*dxdt
|
||||
m_algebra.for_each3( m_x1.m_v , in , dxdt ,
|
||||
typename operations_type::template scale_sum2< value_type , time_type >( val1 , h ) );
|
||||
|
||||
if( m_steps == 2 )
|
||||
// result of first step already gives approximation at the center of the interval
|
||||
boost::numeric::odeint::copy( m_x1.m_v , x_mp );
|
||||
|
||||
sys( m_x1.m_v , derivs[0].m_v , th );
|
||||
|
||||
boost::numeric::odeint::copy( in , m_x0.m_v );
|
||||
|
||||
unsigned short i = 1;
|
||||
while( i != m_steps )
|
||||
{
|
||||
// general step
|
||||
//tmp = m_x1; m_x1 = m_x0 + h2*m_dxdt; m_x0 = tmp
|
||||
m_algebra.for_each3( m_x1.m_v , m_x0.m_v , derivs[i-1].m_v ,
|
||||
typename operations_type::template scale_sum_swap2< value_type , time_type >( val1 , h2 ) );
|
||||
if( i == m_steps/2-1 )
|
||||
// save approximation at the center of the interval
|
||||
boost::numeric::odeint::copy( m_x1.m_v , x_mp );
|
||||
|
||||
th += h;
|
||||
sys( m_x1.m_v , derivs[i].m_v , th);
|
||||
i++;
|
||||
}
|
||||
|
||||
// last step
|
||||
// x = 0.5*( m_x0 + m_x1 + h*m_dxdt )
|
||||
m_algebra.for_each4( out , m_x0.m_v , m_x1.m_v , derivs[m_steps-1].m_v ,
|
||||
typename operations_type::template scale_sum3< value_type , value_type , time_type >( val05 , val05 , val05*h ) );
|
||||
}
|
||||
|
||||
|
||||
void set_steps( unsigned short steps )
|
||||
{ m_steps = steps; }
|
||||
|
||||
|
||||
unsigned short steps( void ) const
|
||||
{ return m_steps; }
|
||||
|
||||
|
||||
template< class StateIn >
|
||||
bool resize( const StateIn &x )
|
||||
{
|
||||
bool resized( false );
|
||||
resized |= adjust_size_by_resizeability( m_x0 , x , typename is_resizeable<state_type>::type() );
|
||||
resized |= adjust_size_by_resizeability( m_x1 , x , typename is_resizeable<state_type>::type() );
|
||||
return resized;
|
||||
}
|
||||
|
||||
template< class StateIn >
|
||||
void adjust_size( const StateIn &x )
|
||||
{
|
||||
resize( x );
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
algebra_type m_algebra;
|
||||
|
||||
unsigned short m_steps;
|
||||
|
||||
resizer_type m_resizer;
|
||||
|
||||
wrapped_state_type m_x0;
|
||||
wrapped_state_type m_x1;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/********** DOXYGEN ***********/
|
||||
|
||||
/**
|
||||
* \class modified_midpoint
|
||||
*
|
||||
* Implementation of the modified midpoint method with a configurable
|
||||
* number of intermediate steps. This class is used by the Bulirsch-Stoer
|
||||
* algorithm and is not meant for direct usage.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \class modified_midpoint_dense_out
|
||||
*
|
||||
* Implementation of the modified midpoint method with a configurable
|
||||
* number of intermediate steps. This class is used by the dense output
|
||||
* Bulirsch-Stoer algorithm and is not meant for direct usage.
|
||||
* \note This stepper is for internal use only and does not meet
|
||||
* any stepper concept.
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BOOST_NUMERIC_ODEINT_STEPPER_MODIFIED_MIDPOINT_HPP_INCLUDED
|
||||
@@ -0,0 +1,84 @@
|
||||
/* boost random/detail/operators.hpp header file
|
||||
*
|
||||
* Copyright Steven Watanabe 2010-2011
|
||||
* 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 for most recent version including documentation.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef BOOST_RANDOM_DETAIL_OPERATORS_HPP
|
||||
#define BOOST_RANDOM_DETAIL_OPERATORS_HPP
|
||||
|
||||
#include <boost/random/detail/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1310) \
|
||||
|| BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x5100))
|
||||
|
||||
#define BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, T, t) \
|
||||
template<class CharT, class Traits> \
|
||||
friend std::basic_ostream<CharT,Traits>& \
|
||||
operator<<(std::basic_ostream<CharT,Traits>& os, const T& t) { \
|
||||
t.print(os, t); \
|
||||
return os; \
|
||||
} \
|
||||
template<class CharT, class Traits> \
|
||||
static std::basic_ostream<CharT,Traits>& \
|
||||
print(std::basic_ostream<CharT,Traits>& os, const T& t)
|
||||
|
||||
#define BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR(is, T, t) \
|
||||
template<class CharT, class Traits> \
|
||||
friend std::basic_istream<CharT,Traits>& \
|
||||
operator>>(std::basic_istream<CharT,Traits>& is, T& t) { \
|
||||
t.read(is, t); \
|
||||
return is; \
|
||||
} \
|
||||
template<class CharT, class Traits> \
|
||||
static std::basic_istream<CharT,Traits>& \
|
||||
read(std::basic_istream<CharT,Traits>& is, T& t)
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__BORLANDC__)
|
||||
|
||||
#define BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(T, lhs, rhs) \
|
||||
bool operator==(const T& rhs) const \
|
||||
{ return T::is_equal(*this, rhs); } \
|
||||
static bool is_equal(const T& lhs, const T& rhs)
|
||||
|
||||
#define BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR(T) \
|
||||
bool operator!=(const T& rhs) const \
|
||||
{ return !T::is_equal(*this, rhs); }
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR
|
||||
#define BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, T, t) \
|
||||
template<class CharT, class Traits> \
|
||||
friend std::basic_ostream<CharT,Traits>& \
|
||||
operator<<(std::basic_ostream<CharT,Traits>& os, const T& t)
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR
|
||||
#define BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR(is, T, t) \
|
||||
template<class CharT, class Traits> \
|
||||
friend std::basic_istream<CharT,Traits>& \
|
||||
operator>>(std::basic_istream<CharT,Traits>& is, T& t)
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR
|
||||
#define BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(T, lhs, rhs) \
|
||||
friend bool operator==(const T& lhs, const T& rhs)
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR
|
||||
#define BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR(T) \
|
||||
friend bool operator!=(const T& lhs, const T& rhs) \
|
||||
{ return !(lhs == rhs); }
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,97 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Thorsten Ottosen, Neil Groves 2006 - 2008. 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_UNIQUED_IMPL_HPP
|
||||
#define BOOST_RANGE_ADAPTOR_UNIQUED_IMPL_HPP
|
||||
|
||||
#include <boost/range/adaptor/adjacent_filtered.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace range_detail
|
||||
{
|
||||
struct unique_forwarder { };
|
||||
|
||||
struct unique_not_equal_to
|
||||
{
|
||||
typedef bool result_type;
|
||||
|
||||
template< class T >
|
||||
bool operator()( const T& l, const T& r ) const
|
||||
{
|
||||
return !(l == r);
|
||||
}
|
||||
};
|
||||
|
||||
template<class ForwardRng>
|
||||
class uniqued_range : public adjacent_filtered_range<unique_not_equal_to, ForwardRng, true>
|
||||
{
|
||||
typedef adjacent_filtered_range<unique_not_equal_to, ForwardRng, true> base;
|
||||
public:
|
||||
explicit uniqued_range(ForwardRng& rng)
|
||||
: base(unique_not_equal_to(), rng)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template< class ForwardRng >
|
||||
inline uniqued_range<ForwardRng>
|
||||
operator|( ForwardRng& r,
|
||||
unique_forwarder )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<ForwardRng>));
|
||||
return uniqued_range<ForwardRng>(r);
|
||||
}
|
||||
|
||||
template< class ForwardRng >
|
||||
inline uniqued_range<const ForwardRng>
|
||||
operator|( const ForwardRng& r,
|
||||
unique_forwarder )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<const ForwardRng>));
|
||||
return uniqued_range<const ForwardRng>(r);
|
||||
}
|
||||
|
||||
} // 'range_detail'
|
||||
|
||||
using range_detail::uniqued_range;
|
||||
|
||||
namespace adaptors
|
||||
{
|
||||
namespace
|
||||
{
|
||||
const range_detail::unique_forwarder uniqued =
|
||||
range_detail::unique_forwarder();
|
||||
}
|
||||
|
||||
template<class ForwardRange>
|
||||
inline uniqued_range<ForwardRange>
|
||||
unique(ForwardRange& rng)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<ForwardRange>));
|
||||
return uniqued_range<ForwardRange>(rng);
|
||||
}
|
||||
|
||||
template<class ForwardRange>
|
||||
inline uniqued_range<const ForwardRange>
|
||||
unique(const ForwardRange& rng)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
ForwardRangeConcept<const ForwardRange>));
|
||||
|
||||
return uniqued_range<const ForwardRange>(rng);
|
||||
}
|
||||
} // 'adaptors'
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,102 @@
|
||||
|
||||
// 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/less_equal.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<
|
||||
typename Tag1
|
||||
, typename Tag2
|
||||
|
||||
, BOOST_MPL_AUX_NTTP_DECL(int, tag1_) = BOOST_MPL_AUX_MSVC_VALUE_WKND(Tag1)::value
|
||||
, BOOST_MPL_AUX_NTTP_DECL(int, tag2_) = BOOST_MPL_AUX_MSVC_VALUE_WKND(Tag2)::value
|
||||
>
|
||||
struct less_equal_impl
|
||||
: if_c<
|
||||
( tag1_ > tag2_ )
|
||||
, aux::cast2nd_impl< less_equal_impl< Tag1,Tag1 >,Tag1, Tag2 >
|
||||
, aux::cast1st_impl< less_equal_impl< Tag2,Tag2 >,Tag1, Tag2 >
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
/// for Digital Mars C++/compilers with no CTPS/TTP support
|
||||
template<> struct less_equal_impl< na,na >
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template<> struct less_equal_impl< na,integral_c_tag >
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template<> struct less_equal_impl< integral_c_tag,na >
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template< typename T > struct less_equal_tag
|
||||
{
|
||||
typedef typename T::tag type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename BOOST_MPL_AUX_NA_PARAM(N1)
|
||||
, typename BOOST_MPL_AUX_NA_PARAM(N2)
|
||||
>
|
||||
struct less_equal
|
||||
: aux::msvc_eti_base< typename apply_wrap2<
|
||||
less_equal_impl<
|
||||
typename less_equal_tag<N1>::type
|
||||
, typename less_equal_tag<N2>::type
|
||||
>
|
||||
, N1
|
||||
, N2
|
||||
>::type >::type
|
||||
|
||||
{
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(2, less_equal, (N1, N2))
|
||||
|
||||
};
|
||||
|
||||
BOOST_MPL_AUX_NA_SPEC2(2, 2, less_equal)
|
||||
|
||||
}}
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<>
|
||||
struct less_equal_impl< integral_c_tag,integral_c_tag >
|
||||
{
|
||||
template< typename N1, typename N2 > struct apply
|
||||
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
( BOOST_MPL_AUX_VALUE_WKND(N1)::value <=
|
||||
BOOST_MPL_AUX_VALUE_WKND(N2)::value )
|
||||
);
|
||||
typedef bool_<value> type;
|
||||
};
|
||||
};
|
||||
|
||||
}}
|
||||
@@ -0,0 +1,791 @@
|
||||
#include "MultiSettings.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include <QObject>
|
||||
#include <QSettings>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QDir>
|
||||
#include <QFont>
|
||||
#include <QApplication>
|
||||
#include <QStandardPaths>
|
||||
#include <QMainWindow>
|
||||
#include <QMenu>
|
||||
#include <QAction>
|
||||
#include <QActionGroup>
|
||||
#include <QDialog>
|
||||
#include <QLineEdit>
|
||||
#include <QRegularExpression>
|
||||
#include <QRegularExpressionValidator>
|
||||
#include <QFormLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QPushButton>
|
||||
#include <QComboBox>
|
||||
#include <QLabel>
|
||||
#include <QList>
|
||||
#include <QMetaObject>
|
||||
|
||||
#include "SettingsGroup.hpp"
|
||||
#include "qt_helpers.hpp"
|
||||
#include "SettingsGroup.hpp"
|
||||
#include "MessageBox.hpp"
|
||||
|
||||
#include "pimpl_impl.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
char const * default_string = QT_TRANSLATE_NOOP ("MultiSettings", "Default");
|
||||
char const * multi_settings_root_group = "MultiSettings";
|
||||
char const * multi_settings_current_group_key = "CurrentMultiSettingsConfiguration";
|
||||
char const * multi_settings_current_name_key = "CurrentName";
|
||||
char const * multi_settings_place_holder_key = "MultiSettingsPlaceHolder";
|
||||
|
||||
QString unescape_ampersands (QString s)
|
||||
{
|
||||
return s.replace ("&&", "&");
|
||||
}
|
||||
|
||||
// calculate a useable and unique settings file path
|
||||
QString settings_path ()
|
||||
{
|
||||
auto const& config_directory = QStandardPaths::writableLocation (QStandardPaths::ConfigLocation);
|
||||
QDir config_path {config_directory}; // will be "." if config_directory is empty
|
||||
if (!config_path.mkpath ("."))
|
||||
{
|
||||
throw std::runtime_error {"Cannot find a usable configuration path \"" + config_path.path ().toStdString () + '"'};
|
||||
}
|
||||
return config_path.absoluteFilePath (QApplication::applicationName () + ".ini");
|
||||
}
|
||||
|
||||
//
|
||||
// Dialog to get a valid new configuration name
|
||||
//
|
||||
class NameDialog final
|
||||
: public QDialog
|
||||
{
|
||||
public:
|
||||
explicit NameDialog (QString const& current_name,
|
||||
QStringList const& current_names,
|
||||
QWidget * parent = nullptr)
|
||||
: QDialog {parent}
|
||||
{
|
||||
setWindowTitle (tr ("New Configuration Name"));
|
||||
|
||||
auto form_layout = new QFormLayout ();
|
||||
form_layout->addRow (tr ("Old name:"), &old_name_label_);
|
||||
old_name_label_.setText (current_name);
|
||||
form_layout->addRow (tr ("&New name:"), &name_line_edit_);
|
||||
|
||||
auto main_layout = new QVBoxLayout (this);
|
||||
main_layout->addLayout (form_layout);
|
||||
|
||||
auto button_box = new QDialogButtonBox {QDialogButtonBox::Ok | QDialogButtonBox::Cancel};
|
||||
button_box->button (QDialogButtonBox::Ok)->setEnabled (false);
|
||||
main_layout->addWidget (button_box);
|
||||
|
||||
auto name_validator = new QRegularExpressionValidator {QRegularExpression {R"([^/\\]+)"}, this};
|
||||
name_line_edit_.setValidator (name_validator);
|
||||
|
||||
connect (&name_line_edit_, &QLineEdit::textChanged, [current_names, button_box] (QString const& name) {
|
||||
bool valid {!current_names.contains (name.trimmed ())};
|
||||
button_box->button (QDialogButtonBox::Ok)->setEnabled (valid);
|
||||
});
|
||||
connect (button_box, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||
connect (button_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
}
|
||||
|
||||
QString new_name () const
|
||||
{
|
||||
return name_line_edit_.text ().trimmed ();
|
||||
}
|
||||
|
||||
private:
|
||||
QLabel old_name_label_;
|
||||
QLineEdit name_line_edit_;
|
||||
};
|
||||
|
||||
//
|
||||
// Dialog to get a valid new existing name
|
||||
//
|
||||
class ExistingNameDialog final
|
||||
: public QDialog
|
||||
{
|
||||
public:
|
||||
explicit ExistingNameDialog (QStringList const& current_names, QWidget * parent = nullptr)
|
||||
: QDialog {parent}
|
||||
{
|
||||
setWindowTitle (tr ("Configuration to Clone From"));
|
||||
|
||||
name_combo_box_.addItems (current_names);
|
||||
|
||||
auto form_layout = new QFormLayout ();
|
||||
form_layout->addRow (tr ("&Source Configuration Name:"), &name_combo_box_);
|
||||
|
||||
auto main_layout = new QVBoxLayout (this);
|
||||
main_layout->addLayout (form_layout);
|
||||
|
||||
auto button_box = new QDialogButtonBox {QDialogButtonBox::Ok | QDialogButtonBox::Cancel};
|
||||
main_layout->addWidget (button_box);
|
||||
|
||||
connect (button_box, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||
connect (button_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
}
|
||||
|
||||
QString name () const
|
||||
{
|
||||
return name_combo_box_.currentText ();
|
||||
}
|
||||
|
||||
private:
|
||||
QComboBox name_combo_box_;
|
||||
};
|
||||
}
|
||||
|
||||
class MultiSettings::impl final
|
||||
: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit impl (MultiSettings const * parent, QString const& config_name);
|
||||
bool reposition ();
|
||||
void create_menu_actions (QMainWindow * main_window, QMenu * menu);
|
||||
bool exit ();
|
||||
|
||||
QSettings settings_;
|
||||
|
||||
private:
|
||||
using Dictionary = QMap<QString, QVariant>;
|
||||
|
||||
// create a configuration maintenance sub menu
|
||||
QMenu * create_sub_menu (QMainWindow * main_window,
|
||||
QMenu * parent,
|
||||
QString const& menu_title,
|
||||
QActionGroup * = nullptr);
|
||||
|
||||
// extract all settings from the current QSettings group
|
||||
Dictionary get_settings () const;
|
||||
|
||||
// write the settings values from the dictionary to the current group
|
||||
void load_from (Dictionary const&, bool add_placeholder = true);
|
||||
|
||||
// switch to this configuration
|
||||
void select_configuration (QMainWindow *, QMenu const *);
|
||||
|
||||
// clone this configuration
|
||||
void clone_configuration (QMainWindow * main_window, QMenu *, QMenu const *);
|
||||
|
||||
// update this configuration from another
|
||||
void clone_into_configuration (QMainWindow *, QMenu const *);
|
||||
|
||||
// reset configuration to default values
|
||||
void reset_configuration (QMainWindow *, QMenu const *);
|
||||
|
||||
// change configuration name
|
||||
void rename_configuration (QMainWindow *, QMenu *);
|
||||
|
||||
// remove a configuration
|
||||
void delete_configuration (QMainWindow *, QMenu *);
|
||||
|
||||
MultiSettings const * parent_; // required for emitting signals
|
||||
bool name_change_emit_pending_; // delayed until menu built
|
||||
|
||||
QFont original_font_;
|
||||
QString current_;
|
||||
|
||||
// action to take on restart
|
||||
enum class RepositionType {unchanged, replace, save_and_replace} reposition_type_;
|
||||
Dictionary new_settings_;
|
||||
bool exit_flag_; // false means loop around with new
|
||||
// configuration
|
||||
QActionGroup * configurations_group_;
|
||||
};
|
||||
|
||||
#include "MultiSettings.moc"
|
||||
#include "moc_MultiSettings.cpp"
|
||||
|
||||
MultiSettings::MultiSettings (QString const& config_name)
|
||||
: m_ {this, config_name}
|
||||
{
|
||||
}
|
||||
|
||||
MultiSettings::~MultiSettings ()
|
||||
{
|
||||
}
|
||||
|
||||
QSettings * MultiSettings::settings ()
|
||||
{
|
||||
return &m_->settings_;
|
||||
}
|
||||
|
||||
QVariant MultiSettings::common_value (QString const& key, QVariant const& default_value) const
|
||||
{
|
||||
QVariant value;
|
||||
QSettings * mutable_settings {const_cast<QSettings *> (&m_->settings_)};
|
||||
auto const& current_group = mutable_settings->group ();
|
||||
if (current_group.size ()) mutable_settings->endGroup ();
|
||||
{
|
||||
SettingsGroup alternatives {mutable_settings, multi_settings_root_group};
|
||||
value = mutable_settings->value (key, default_value);
|
||||
}
|
||||
if (current_group.size ()) mutable_settings->beginGroup (current_group);
|
||||
return value;
|
||||
}
|
||||
|
||||
void MultiSettings::set_common_value (QString const& key, QVariant const& value)
|
||||
{
|
||||
auto const& current_group = m_->settings_.group ();
|
||||
if (current_group.size ()) m_->settings_.endGroup ();
|
||||
{
|
||||
SettingsGroup alternatives {&m_->settings_, multi_settings_root_group};
|
||||
m_->settings_.setValue (key, value);
|
||||
}
|
||||
if (current_group.size ()) m_->settings_.beginGroup (current_group);
|
||||
}
|
||||
|
||||
void MultiSettings::remove_common_value (QString const& key)
|
||||
{
|
||||
if (!key.size ()) return; // we don't allow global delete as it
|
||||
// would break this classes data model
|
||||
auto const& current_group = m_->settings_.group ();
|
||||
if (current_group.size ()) m_->settings_.endGroup ();
|
||||
{
|
||||
SettingsGroup alternatives {&m_->settings_, multi_settings_root_group};
|
||||
m_->settings_.remove (key);
|
||||
}
|
||||
if (current_group.size ()) m_->settings_.beginGroup (current_group);
|
||||
}
|
||||
|
||||
void MultiSettings::create_menu_actions (QMainWindow * main_window, QMenu * menu)
|
||||
{
|
||||
m_->create_menu_actions (main_window, menu);
|
||||
}
|
||||
|
||||
bool MultiSettings::exit ()
|
||||
{
|
||||
return m_->exit ();
|
||||
}
|
||||
|
||||
MultiSettings::impl::impl (MultiSettings const * parent, QString const& config_name)
|
||||
: settings_ {settings_path (), QSettings::IniFormat}
|
||||
, parent_ {parent}
|
||||
, name_change_emit_pending_ {true}
|
||||
, reposition_type_ {RepositionType::unchanged}
|
||||
, exit_flag_ {true}
|
||||
, configurations_group_ {new QActionGroup {this}}
|
||||
{
|
||||
if (!settings_.isWritable ())
|
||||
{
|
||||
throw std::runtime_error {QString {"Cannot access \"%1\" for writing"}
|
||||
.arg (settings_.fileName ()).toStdString ()};
|
||||
}
|
||||
|
||||
// deal with transient, now defunct, settings key
|
||||
if (settings_.contains (multi_settings_current_group_key))
|
||||
{
|
||||
current_ = settings_.value (multi_settings_current_group_key).toString ();
|
||||
settings_.remove (multi_settings_current_group_key);
|
||||
if (current_.size ())
|
||||
{
|
||||
{
|
||||
SettingsGroup alternatives {&settings_, multi_settings_root_group};
|
||||
{
|
||||
SettingsGroup source_group {&settings_, current_};
|
||||
new_settings_ = get_settings ();
|
||||
}
|
||||
settings_.setValue (multi_settings_current_name_key, tr (default_string));
|
||||
}
|
||||
reposition_type_ = RepositionType::save_and_replace;
|
||||
reposition ();
|
||||
}
|
||||
else
|
||||
{
|
||||
SettingsGroup alternatives {&settings_, multi_settings_root_group};
|
||||
settings_.setValue (multi_settings_current_name_key, tr (default_string));
|
||||
}
|
||||
}
|
||||
|
||||
// bootstrap
|
||||
QStringList available_configurations;
|
||||
{
|
||||
SettingsGroup alternatives {&settings_, multi_settings_root_group};
|
||||
available_configurations = settings_.childGroups ();
|
||||
// use last selected configuration
|
||||
current_ = settings_.value (multi_settings_current_name_key).toString ();
|
||||
if (!current_.size ())
|
||||
{
|
||||
// no configurations so use default name
|
||||
current_ = tr (default_string);
|
||||
settings_.setValue (multi_settings_current_name_key, current_);
|
||||
}
|
||||
}
|
||||
|
||||
if (config_name.size () && available_configurations.contains (config_name) && config_name != current_)
|
||||
{
|
||||
// switch to specified configuration
|
||||
{
|
||||
SettingsGroup alternatives {&settings_, multi_settings_root_group};
|
||||
// save the target settings
|
||||
SettingsGroup target_group {&settings_, config_name};
|
||||
new_settings_ = get_settings ();
|
||||
}
|
||||
current_ = config_name;
|
||||
reposition_type_ = RepositionType::save_and_replace;
|
||||
reposition ();
|
||||
}
|
||||
settings_.sync ();
|
||||
}
|
||||
|
||||
// do actions that can only be done once all the windows are closed
|
||||
bool MultiSettings::impl::reposition ()
|
||||
{
|
||||
auto const& current_group = settings_.group ();
|
||||
if (current_group.size ()) settings_.endGroup ();
|
||||
switch (reposition_type_)
|
||||
{
|
||||
case RepositionType::save_and_replace:
|
||||
{
|
||||
// save the current settings with the other alternatives
|
||||
Dictionary saved_settings {get_settings ()};
|
||||
SettingsGroup alternatives {&settings_, multi_settings_root_group};
|
||||
// get the current configuration name
|
||||
auto const& previous_group_name = settings_.value (multi_settings_current_name_key, tr (default_string)).toString ();
|
||||
SettingsGroup save_group {&settings_, previous_group_name};
|
||||
load_from (saved_settings);
|
||||
}
|
||||
// fall through
|
||||
case RepositionType::replace:
|
||||
// and purge current settings
|
||||
for (auto const& key: settings_.allKeys ())
|
||||
{
|
||||
if (!key.contains (multi_settings_root_group))
|
||||
{
|
||||
settings_.remove (key);
|
||||
}
|
||||
}
|
||||
// insert the new settings
|
||||
load_from (new_settings_, false);
|
||||
if (!new_settings_.size ())
|
||||
{
|
||||
// if we are clearing the current settings then we must
|
||||
// reset the application font and the font in the
|
||||
// application style sheet, this is necessary since the
|
||||
// application instance is not recreated
|
||||
qApp->setFont (original_font_);
|
||||
qApp->setStyleSheet (qApp->styleSheet () + "* {" + font_as_stylesheet (original_font_) + '}');
|
||||
}
|
||||
// now we have set up the new current we can safely purge it
|
||||
// from the alternatives
|
||||
{
|
||||
SettingsGroup alternatives {&settings_, multi_settings_root_group};
|
||||
{
|
||||
SettingsGroup purge_group {&settings_, current_};
|
||||
settings_.remove (QString {}); // purge entire group
|
||||
}
|
||||
// switch to the specified configuration name
|
||||
settings_.setValue (multi_settings_current_name_key, current_);
|
||||
}
|
||||
settings_.sync ();
|
||||
// fall through
|
||||
case RepositionType::unchanged:
|
||||
new_settings_.clear ();
|
||||
break;
|
||||
}
|
||||
if (current_group.size ()) settings_.beginGroup (current_group);
|
||||
|
||||
reposition_type_ = RepositionType::unchanged; // reset
|
||||
bool exit {exit_flag_};
|
||||
exit_flag_ = true; // reset exit flag so normal exit works
|
||||
|
||||
return exit;
|
||||
}
|
||||
|
||||
// populate a pop up menu with the configurations sub-menus for
|
||||
// maintenance including select, clone, clone from, delete, rename
|
||||
// and, reset
|
||||
void MultiSettings::impl::create_menu_actions (QMainWindow * main_window, QMenu * menu)
|
||||
{
|
||||
auto const& current_group = settings_.group ();
|
||||
if (current_group.size ()) settings_.endGroup ();
|
||||
SettingsGroup alternatives {&settings_, multi_settings_root_group};
|
||||
// get the current configuration name
|
||||
auto const& current_configuration_name = settings_.value (multi_settings_current_name_key, tr (default_string)).toString ();
|
||||
// add the default configuration sub menu
|
||||
QMenu * default_menu = create_sub_menu (main_window, menu, current_configuration_name, configurations_group_);
|
||||
// and set as the current configuration
|
||||
default_menu->menuAction ()->setChecked (true);
|
||||
|
||||
// get the existing alternatives
|
||||
auto const& available_configurations = settings_.childGroups ();
|
||||
|
||||
// add all the other configurations
|
||||
for (auto const& configuration_name: available_configurations)
|
||||
{
|
||||
create_sub_menu (main_window, menu, configuration_name, configurations_group_);
|
||||
}
|
||||
|
||||
if (current_group.size ()) settings_.beginGroup (current_group);
|
||||
|
||||
if (name_change_emit_pending_)
|
||||
{
|
||||
Q_EMIT parent_->configurationNameChanged (unescape_ampersands (current_));
|
||||
name_change_emit_pending_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
// call this at the end of the main program loop to determine if the
|
||||
// main window really wants to quit or to run again with a new configuration
|
||||
bool MultiSettings::impl::exit ()
|
||||
{
|
||||
// ensure that configuration name changed signal gets fired on restart
|
||||
name_change_emit_pending_ = true;
|
||||
|
||||
// do any configuration swap required and return exit flag
|
||||
return reposition ();
|
||||
}
|
||||
|
||||
QMenu * MultiSettings::impl::create_sub_menu (QMainWindow * main_window,
|
||||
QMenu * parent_menu,
|
||||
QString const& menu_title,
|
||||
QActionGroup * action_group)
|
||||
{
|
||||
auto sub_menu = parent_menu->addMenu (menu_title);
|
||||
if (action_group) action_group->addAction (sub_menu->menuAction ());
|
||||
sub_menu->menuAction ()->setCheckable (true);
|
||||
|
||||
// populate sub-menu actions before showing
|
||||
connect (sub_menu, &QMenu::aboutToShow, [this, main_window, parent_menu, sub_menu] () {
|
||||
// depopulate before populating and showing because on Mac OS X
|
||||
// there is an issue with depopulating in QMenu::aboutToHide()
|
||||
// with connections being disconnected before they are actioned
|
||||
while (!sub_menu->actions ().isEmpty ())
|
||||
{
|
||||
sub_menu->removeAction (sub_menu->actions ().last ());
|
||||
}
|
||||
|
||||
bool is_current {sub_menu->menuAction ()->text () == current_};
|
||||
if (!is_current)
|
||||
{
|
||||
auto select_action = new QAction {tr ("&Switch To"), this};
|
||||
sub_menu->addAction (select_action);
|
||||
connect (select_action, &QAction::triggered, [this, main_window, sub_menu] (bool) {
|
||||
select_configuration (main_window, sub_menu);
|
||||
});
|
||||
sub_menu->addSeparator ();
|
||||
}
|
||||
|
||||
auto clone_action = new QAction {tr ("&Clone"), this};
|
||||
sub_menu->addAction (clone_action);
|
||||
connect (clone_action, &QAction::triggered, [this, main_window, parent_menu, sub_menu] (bool) {
|
||||
clone_configuration (main_window, parent_menu, sub_menu);
|
||||
});
|
||||
|
||||
auto const& current_group = settings_.group ();
|
||||
if (current_group.size ()) settings_.endGroup ();
|
||||
SettingsGroup alternatives {&settings_, multi_settings_root_group};
|
||||
if (settings_.childGroups ().size ())
|
||||
{
|
||||
auto clone_into_action = new QAction {tr ("Clone &Into ..."), this};
|
||||
sub_menu->addAction (clone_into_action);
|
||||
connect (clone_into_action, &QAction::triggered, [this, main_window, sub_menu] (bool) {
|
||||
clone_into_configuration (main_window, sub_menu);
|
||||
});
|
||||
}
|
||||
if (current_group.size ()) settings_.beginGroup (current_group);
|
||||
auto reset_action = new QAction {tr ("R&eset"), this};
|
||||
sub_menu->addAction (reset_action);
|
||||
connect (reset_action, &QAction::triggered, [this, main_window, sub_menu] (bool) {
|
||||
reset_configuration (main_window, sub_menu);
|
||||
});
|
||||
|
||||
auto rename_action = new QAction {tr ("&Rename ..."), this};
|
||||
sub_menu->addAction (rename_action);
|
||||
connect (rename_action, &QAction::triggered, [this, main_window, sub_menu] (bool) {
|
||||
rename_configuration (main_window, sub_menu);
|
||||
});
|
||||
|
||||
if (!is_current)
|
||||
{
|
||||
auto delete_action = new QAction {tr ("&Delete"), this};
|
||||
sub_menu->addAction (delete_action);
|
||||
connect (delete_action, &QAction::triggered, [this, main_window, sub_menu] (bool) {
|
||||
delete_configuration (main_window, sub_menu);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return sub_menu;
|
||||
}
|
||||
|
||||
auto MultiSettings::impl::get_settings () const -> Dictionary
|
||||
{
|
||||
Dictionary settings;
|
||||
for (auto const& key: settings_.allKeys ())
|
||||
{
|
||||
// filter out multi settings group and empty settings
|
||||
// placeholder
|
||||
if (!key.contains (multi_settings_root_group)
|
||||
&& !key.contains (multi_settings_place_holder_key))
|
||||
{
|
||||
settings[key] = settings_.value (key);
|
||||
}
|
||||
}
|
||||
return settings;
|
||||
}
|
||||
|
||||
void MultiSettings::impl::load_from (Dictionary const& dictionary, bool add_placeholder)
|
||||
{
|
||||
if (dictionary.size ())
|
||||
{
|
||||
for (Dictionary::const_iterator iter = dictionary.constBegin ();
|
||||
iter != dictionary.constEnd (); ++iter)
|
||||
{
|
||||
settings_.setValue (iter.key (), iter.value ());
|
||||
}
|
||||
}
|
||||
else if (add_placeholder)
|
||||
{
|
||||
// add a placeholder key to stop the alternative configuration
|
||||
// name from disappearing
|
||||
settings_.setValue (multi_settings_place_holder_key, QVariant {});
|
||||
}
|
||||
settings_.sync ();
|
||||
}
|
||||
|
||||
void MultiSettings::impl::select_configuration (QMainWindow * main_window, QMenu const * menu)
|
||||
{
|
||||
auto const& target_name = menu->title ();
|
||||
|
||||
if (target_name != current_)
|
||||
{
|
||||
{
|
||||
auto const& current_group = settings_.group ();
|
||||
if (current_group.size ()) settings_.endGroup ();
|
||||
// position to the alternative settings
|
||||
SettingsGroup alternatives {&settings_, multi_settings_root_group};
|
||||
// save the target settings
|
||||
SettingsGroup target_group {&settings_, target_name};
|
||||
new_settings_ = get_settings ();
|
||||
if (current_group.size ()) settings_.beginGroup (current_group);
|
||||
}
|
||||
// and set up the restart
|
||||
current_ = target_name;
|
||||
Q_EMIT parent_->configurationNameChanged (unescape_ampersands (current_));
|
||||
reposition_type_ = RepositionType::save_and_replace;
|
||||
exit_flag_ = false;
|
||||
main_window->close ();
|
||||
}
|
||||
}
|
||||
|
||||
void MultiSettings::impl::clone_configuration (QMainWindow * main_window, QMenu * parent_menu, QMenu const * menu)
|
||||
{
|
||||
auto const& current_group = settings_.group ();
|
||||
if (current_group.size ()) settings_.endGroup ();
|
||||
auto const& source_name = menu->title ();
|
||||
|
||||
// settings to clone
|
||||
Dictionary source_settings;
|
||||
if (source_name == current_)
|
||||
{
|
||||
// grab the data to clone from the current settings
|
||||
source_settings = get_settings ();
|
||||
}
|
||||
SettingsGroup alternatives {&settings_, multi_settings_root_group};
|
||||
if (source_name != current_)
|
||||
{
|
||||
SettingsGroup source_group {&settings_, source_name};
|
||||
source_settings = get_settings ();
|
||||
}
|
||||
|
||||
// find a new unique name
|
||||
QString new_name_root {source_name + " - Copy"};;
|
||||
QString new_name {new_name_root};
|
||||
unsigned index {0};
|
||||
do
|
||||
{
|
||||
if (index++) new_name = new_name_root + '(' + QString::number (index) + ')';
|
||||
}
|
||||
while (settings_.childGroups ().contains (new_name) || new_name == current_);
|
||||
SettingsGroup new_group {&settings_, new_name};
|
||||
load_from (source_settings);
|
||||
|
||||
// insert the new configuration sub menu in the parent menu
|
||||
create_sub_menu (main_window, parent_menu, new_name, configurations_group_);
|
||||
if (current_group.size ()) settings_.beginGroup (current_group);
|
||||
}
|
||||
|
||||
void MultiSettings::impl::clone_into_configuration (QMainWindow * main_window, QMenu const * menu)
|
||||
{
|
||||
auto const& current_group = settings_.group ();
|
||||
if (current_group.size ()) settings_.endGroup ();
|
||||
auto const& target_name = menu->title ();
|
||||
|
||||
// get the current configuration name
|
||||
QString current_group_name;
|
||||
QStringList sources;
|
||||
{
|
||||
SettingsGroup alternatives {&settings_, multi_settings_root_group};
|
||||
current_group_name = settings_.value (multi_settings_current_name_key).toString ();
|
||||
|
||||
{
|
||||
// get the source configuration name for the clone
|
||||
sources = settings_.childGroups ();
|
||||
sources << current_group_name;
|
||||
sources.removeOne (target_name);
|
||||
}
|
||||
}
|
||||
|
||||
// pick a source configuration
|
||||
ExistingNameDialog dialog {sources, main_window};
|
||||
if (sources.size () && (1 == sources.size () || QDialog::Accepted == dialog.exec ()))
|
||||
{
|
||||
QString source_name {1 == sources.size () ? sources.at (0) : dialog.name ()};
|
||||
if (MessageBox::Yes == MessageBox::query_message (main_window,
|
||||
tr ("Clone Into Configuration"),
|
||||
tr ("Confirm overwrite of all values for configuration \"%1\" with values from \"%2\"?")
|
||||
.arg (unescape_ampersands (target_name))
|
||||
.arg (unescape_ampersands (source_name))))
|
||||
{
|
||||
// grab the data to clone from
|
||||
if (source_name == current_group_name)
|
||||
{
|
||||
// grab the data to clone from the current settings
|
||||
new_settings_ = get_settings ();
|
||||
}
|
||||
else
|
||||
{
|
||||
SettingsGroup alternatives {&settings_, multi_settings_root_group};
|
||||
SettingsGroup source_group {&settings_, source_name};
|
||||
new_settings_ = get_settings ();
|
||||
}
|
||||
|
||||
// purge target settings and replace
|
||||
if (target_name == current_)
|
||||
{
|
||||
// restart with new settings
|
||||
reposition_type_ = RepositionType::replace;
|
||||
exit_flag_ = false;
|
||||
main_window->close ();
|
||||
}
|
||||
else
|
||||
{
|
||||
SettingsGroup alternatives {&settings_, multi_settings_root_group};
|
||||
SettingsGroup target_group {&settings_, target_name};
|
||||
settings_.remove (QString {}); // purge entire group
|
||||
load_from (new_settings_);
|
||||
new_settings_.clear ();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (current_group.size ()) settings_.beginGroup (current_group);
|
||||
}
|
||||
|
||||
void MultiSettings::impl::reset_configuration (QMainWindow * main_window, QMenu const * menu)
|
||||
{
|
||||
auto const& target_name = menu->title ();
|
||||
|
||||
if (MessageBox::Yes != MessageBox::query_message (main_window,
|
||||
tr ("Reset Configuration"),
|
||||
tr ("Confirm reset to default values for configuration \"%1\"?")
|
||||
.arg (unescape_ampersands (target_name))))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (target_name == current_)
|
||||
{
|
||||
// restart with default settings
|
||||
reposition_type_ = RepositionType::replace;
|
||||
new_settings_.clear ();
|
||||
exit_flag_ = false;
|
||||
main_window->close ();
|
||||
}
|
||||
else
|
||||
{
|
||||
auto const& current_group = settings_.group ();
|
||||
if (current_group.size ()) settings_.endGroup ();
|
||||
SettingsGroup alternatives {&settings_, multi_settings_root_group};
|
||||
SettingsGroup target_group {&settings_, target_name};
|
||||
settings_.remove (QString {}); // purge entire group
|
||||
// add a placeholder to stop alternative configuration name
|
||||
// being lost
|
||||
settings_.setValue (multi_settings_place_holder_key, QVariant {});
|
||||
settings_.sync ();
|
||||
if (current_group.size ()) settings_.beginGroup (current_group);
|
||||
}
|
||||
}
|
||||
|
||||
void MultiSettings::impl::rename_configuration (QMainWindow * main_window, QMenu * menu)
|
||||
{
|
||||
auto const& current_group = settings_.group ();
|
||||
if (current_group.size ()) settings_.endGroup ();
|
||||
auto const& target_name = menu->title ();
|
||||
|
||||
// gather names we cannot use
|
||||
SettingsGroup alternatives {&settings_, multi_settings_root_group};
|
||||
auto invalid_names = settings_.childGroups ();
|
||||
invalid_names << settings_.value (multi_settings_current_name_key).toString ();
|
||||
|
||||
// get the new name
|
||||
NameDialog dialog {target_name, invalid_names, main_window};
|
||||
if (QDialog::Accepted == dialog.exec ())
|
||||
{
|
||||
if (target_name == current_)
|
||||
{
|
||||
settings_.setValue (multi_settings_current_name_key, dialog.new_name ());
|
||||
settings_.sync ();
|
||||
current_ = dialog.new_name ();
|
||||
Q_EMIT parent_->configurationNameChanged (unescape_ampersands (current_));
|
||||
}
|
||||
else
|
||||
{
|
||||
// switch to the target group and fetch the configuration data
|
||||
Dictionary target_settings;
|
||||
{
|
||||
// grab the target configuration settings
|
||||
SettingsGroup target_group {&settings_, target_name};
|
||||
target_settings = get_settings ();
|
||||
// purge the old configuration data
|
||||
settings_.remove (QString {}); // purge entire group
|
||||
}
|
||||
// load into new configuration group name
|
||||
SettingsGroup target_group {&settings_, dialog.new_name ()};
|
||||
load_from (target_settings);
|
||||
}
|
||||
// change the action text in the menu
|
||||
menu->setTitle (dialog.new_name ());
|
||||
}
|
||||
if (current_group.size ()) settings_.beginGroup (current_group);
|
||||
}
|
||||
|
||||
void MultiSettings::impl::delete_configuration (QMainWindow * main_window, QMenu * menu)
|
||||
{
|
||||
auto const& target_name = menu->title ();
|
||||
|
||||
if (target_name == current_)
|
||||
{
|
||||
return; // suicide not allowed here
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MessageBox::Yes != MessageBox::query_message (main_window,
|
||||
tr ("Delete Configuration"),
|
||||
tr ("Confirm deletion of configuration \"%1\"?")
|
||||
.arg (unescape_ampersands (target_name))))
|
||||
{
|
||||
return;
|
||||
}
|
||||
auto const& current_group = settings_.group ();
|
||||
if (current_group.size ()) settings_.endGroup ();
|
||||
SettingsGroup alternatives {&settings_, multi_settings_root_group};
|
||||
SettingsGroup target_group {&settings_, target_name};
|
||||
// purge the configuration data
|
||||
settings_.remove (QString {}); // purge entire group
|
||||
settings_.sync ();
|
||||
if (current_group.size ()) settings_.beginGroup (current_group);
|
||||
}
|
||||
// update the menu
|
||||
menu->deleteLater ();
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,21 @@
|
||||
/*=============================================================================
|
||||
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!
|
||||
==============================================================================*/
|
||||
#if FUSION_MAX_VECTOR_SIZE <= 10
|
||||
#include <boost/fusion/tuple/detail/preprocessed/make_tuple10.hpp>
|
||||
#elif FUSION_MAX_VECTOR_SIZE <= 20
|
||||
#include <boost/fusion/tuple/detail/preprocessed/make_tuple20.hpp>
|
||||
#elif FUSION_MAX_VECTOR_SIZE <= 30
|
||||
#include <boost/fusion/tuple/detail/preprocessed/make_tuple30.hpp>
|
||||
#elif FUSION_MAX_VECTOR_SIZE <= 40
|
||||
#include <boost/fusion/tuple/detail/preprocessed/make_tuple40.hpp>
|
||||
#elif FUSION_MAX_VECTOR_SIZE <= 50
|
||||
#include <boost/fusion/tuple/detail/preprocessed/make_tuple50.hpp>
|
||||
#else
|
||||
#error "FUSION_MAX_VECTOR_SIZE out of bounds for preprocessed headers"
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/functional/hash/hash.hpp>
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
#ifndef BOOST_SERIALIZATION_COLLECTION_SIZE_TYPE_HPP
|
||||
#define BOOST_SERIALIZATION_COLLECTION_SIZE_TYPE_HPP
|
||||
|
||||
// (C) Copyright 2005 Matthias Troyer
|
||||
// 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)
|
||||
|
||||
#include <cstddef> // size_t
|
||||
#include <boost/serialization/strong_typedef.hpp>
|
||||
#include <boost/serialization/level.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/is_bitwise_serializable.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
|
||||
//BOOST_STRONG_TYPEDEF(std::size_t, collection_size_type)
|
||||
|
||||
class collection_size_type {
|
||||
private:
|
||||
typedef std::size_t base_type;
|
||||
base_type t;
|
||||
public:
|
||||
collection_size_type(): t(0) {};
|
||||
explicit collection_size_type(const std::size_t & t_) :
|
||||
t(t_)
|
||||
{}
|
||||
collection_size_type(const collection_size_type & t_) :
|
||||
t(t_.t)
|
||||
{}
|
||||
collection_size_type & operator=(const collection_size_type & rhs){
|
||||
t = rhs.t;
|
||||
return *this;
|
||||
}
|
||||
collection_size_type & operator=(const unsigned int & rhs){
|
||||
t = rhs;
|
||||
return *this;
|
||||
}
|
||||
// used for text output
|
||||
operator base_type () const {
|
||||
return t;
|
||||
}
|
||||
// used for text input
|
||||
operator base_type & () {
|
||||
return t;
|
||||
}
|
||||
bool operator==(const collection_size_type & rhs) const {
|
||||
return t == rhs.t;
|
||||
}
|
||||
bool operator<(const collection_size_type & rhs) const {
|
||||
return t < rhs.t;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} } // end namespace boost::serialization
|
||||
|
||||
BOOST_CLASS_IMPLEMENTATION(collection_size_type, primitive_type)
|
||||
BOOST_IS_BITWISE_SERIALIZABLE(collection_size_type)
|
||||
|
||||
#endif //BOOST_SERIALIZATION_COLLECTION_SIZE_TYPE_HPP
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,36 @@
|
||||
// (C) Copyright David Abrahams 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 for most recent version including documentation.
|
||||
|
||||
// Revision History
|
||||
// 09 Feb 01 Applied John Maddock's Borland patch Moving <true>
|
||||
// specialization to unspecialized template (David Abrahams)
|
||||
// 06 Feb 01 Created (David Abrahams)
|
||||
|
||||
#ifndef SELECT_TYPE_DWA20010206_HPP
|
||||
# define SELECT_TYPE_DWA20010206_HPP
|
||||
|
||||
namespace boost { namespace detail {
|
||||
|
||||
// Template class if_true -- select among 2 types based on a bool constant expression
|
||||
// Usage:
|
||||
// typename if_true<(bool_const_expression)>::template then<true_type, false_type>::type
|
||||
|
||||
// HP aCC cannot deal with missing names for template value parameters
|
||||
template <bool b> struct if_true
|
||||
{
|
||||
template <class T, class F>
|
||||
struct then { typedef T type; };
|
||||
};
|
||||
|
||||
template <>
|
||||
struct if_true<false>
|
||||
{
|
||||
template <class T, class F>
|
||||
struct then { typedef F type; };
|
||||
};
|
||||
}}
|
||||
#endif // SELECT_TYPE_DWA20010206_HPP
|
||||
@@ -0,0 +1,43 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2014-2014. 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/container for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_DETAIL_STD_FWD_HPP
|
||||
#define BOOST_INTRUSIVE_DETAIL_STD_FWD_HPP
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
# include <boost/config.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Standard predeclarations
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <boost/move/detail/std_ns_begin.hpp>
|
||||
BOOST_MOVE_STD_NS_BEG
|
||||
|
||||
template<class T>
|
||||
struct less;
|
||||
|
||||
template<class T>
|
||||
struct equal_to;
|
||||
|
||||
struct input_iterator_tag;
|
||||
struct forward_iterator_tag;
|
||||
struct bidirectional_iterator_tag;
|
||||
struct random_access_iterator_tag;
|
||||
|
||||
BOOST_MOVE_STD_NS_END
|
||||
#include <boost/move/detail/std_ns_end.hpp>
|
||||
|
||||
#endif //#ifndef BOOST_INTRUSIVE_DETAIL_STD_FWD_HPP
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
// (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 inclusions
|
||||
|
||||
struct BOOST_FT_cc_name
|
||||
{
|
||||
typedef detail::encode_bits<0,BOOST_FT_cc_id> bits;
|
||||
typedef detail::constant<BOOST_FT_cc_mask> mask;
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
// (C) 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 file is machine generated, do not edit by hand
|
||||
|
||||
// Unrolled polynomial evaluation using second order Horners rule
|
||||
#ifndef BOOST_MATH_TOOLS_POLY_EVAL_11_HPP
|
||||
#define BOOST_MATH_TOOLS_POLY_EVAL_11_HPP
|
||||
|
||||
namespace boost{ namespace math{ namespace tools{ namespace detail{
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T*, const V&, const mpl::int_<0>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(0);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(a[1] * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = static_cast<V>(a[4] * x2 + a[2]);
|
||||
t[1] = static_cast<V>(a[3] * x2 + a[1]);
|
||||
t[0] *= x2;
|
||||
t[0] += static_cast<V>(a[0]);
|
||||
t[1] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = a[5] * x2 + a[3];
|
||||
t[1] = a[4] * x2 + a[2];
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[1]);
|
||||
t[1] += static_cast<V>(a[0]);
|
||||
t[0] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = static_cast<V>(a[6] * x2 + a[4]);
|
||||
t[1] = static_cast<V>(a[5] * x2 + a[3]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[2]);
|
||||
t[1] += static_cast<V>(a[1]);
|
||||
t[0] *= x2;
|
||||
t[0] += static_cast<V>(a[0]);
|
||||
t[1] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = a[7] * x2 + a[5];
|
||||
t[1] = a[6] * x2 + a[4];
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[3]);
|
||||
t[1] += static_cast<V>(a[2]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[1]);
|
||||
t[1] += static_cast<V>(a[0]);
|
||||
t[0] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = static_cast<V>(a[8] * x2 + a[6]);
|
||||
t[1] = static_cast<V>(a[7] * x2 + a[5]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[4]);
|
||||
t[1] += static_cast<V>(a[3]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[2]);
|
||||
t[1] += static_cast<V>(a[1]);
|
||||
t[0] *= x2;
|
||||
t[0] += static_cast<V>(a[0]);
|
||||
t[1] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = a[9] * x2 + a[7];
|
||||
t[1] = a[8] * x2 + a[6];
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[5]);
|
||||
t[1] += static_cast<V>(a[4]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[3]);
|
||||
t[1] += static_cast<V>(a[2]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[1]);
|
||||
t[1] += static_cast<V>(a[0]);
|
||||
t[0] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
V t[2];
|
||||
t[0] = static_cast<V>(a[10] * x2 + a[8]);
|
||||
t[1] = static_cast<V>(a[9] * x2 + a[7]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[6]);
|
||||
t[1] += static_cast<V>(a[5]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[4]);
|
||||
t[1] += static_cast<V>(a[3]);
|
||||
t[0] *= x2;
|
||||
t[1] *= x2;
|
||||
t[0] += static_cast<V>(a[2]);
|
||||
t[1] += static_cast<V>(a[1]);
|
||||
t[0] *= x2;
|
||||
t[0] += static_cast<V>(a[0]);
|
||||
t[1] *= x;
|
||||
return t[0] + t[1];
|
||||
}
|
||||
|
||||
|
||||
}}}} // namespaces
|
||||
|
||||
#endif // include guard
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_CLEAR_IMPL_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_CLEAR_IMPL_HPP_INCLUDED
|
||||
|
||||
// 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)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id$
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
#include <boost/mpl/clear_fwd.hpp>
|
||||
#include <boost/mpl/aux_/traits_lambda_spec.hpp>
|
||||
#include <boost/mpl/aux_/config/eti.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
// no default implementation; the definition is needed to make MSVC happy
|
||||
|
||||
template< typename Tag >
|
||||
struct clear_impl
|
||||
{
|
||||
template< typename Sequence > struct apply;
|
||||
};
|
||||
|
||||
BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(1, clear_impl)
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_AUX_CLEAR_IMPL_HPP_INCLUDED
|
||||
@@ -0,0 +1,34 @@
|
||||
// Copyright (C) 2005 Arkadiy Vertleyb
|
||||
// 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_TYPEOF_ENCODE_DECODE_PARAMS_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_ENCODE_DECODE_PARAMS_HPP_INCLUDED
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
|
||||
// Assumes iter0 contains initial iterator
|
||||
|
||||
#define BOOST_TYPEOF_DECODE_PARAM(z, n, text) \
|
||||
typedef boost::type_of::decode_type<iter##n> decode##n; \
|
||||
typedef typename decode##n::type p##n; \
|
||||
typedef typename decode##n::iter BOOST_PP_CAT(iter, BOOST_PP_INC(n));
|
||||
|
||||
#define BOOST_TYPEOF_DECODE_PARAMS(n)\
|
||||
BOOST_PP_REPEAT(n, BOOST_TYPEOF_DECODE_PARAM, ~)
|
||||
|
||||
// The P0, P1, ... PN are encoded and added to V
|
||||
|
||||
#define BOOST_TYPEOF_ENCODE_PARAMS_BEGIN(z, n, text)\
|
||||
typename boost::type_of::encode_type<
|
||||
|
||||
#define BOOST_TYPEOF_ENCODE_PARAMS_END(z, n, text)\
|
||||
, BOOST_PP_CAT(P, n)>::type
|
||||
|
||||
#define BOOST_TYPEOF_ENCODE_PARAMS(n, ID) \
|
||||
BOOST_PP_REPEAT(n, BOOST_TYPEOF_ENCODE_PARAMS_BEGIN, ~) \
|
||||
typename boost::type_of::push_back<V, boost::mpl::size_t<ID> >::type \
|
||||
BOOST_PP_REPEAT(n, BOOST_TYPEOF_ENCODE_PARAMS_END, ~)
|
||||
|
||||
#endif//BOOST_TYPEOF_ENCODE_DECODE_PARAMS_HPP_INCLUDED
|
||||
@@ -0,0 +1,38 @@
|
||||
#ifndef WSJTX_UDP_BEACONS_MODEL_HPP__
|
||||
#define WSJTX_UDP_BEACONS_MODEL_HPP__
|
||||
|
||||
#include <QStandardItemModel>
|
||||
|
||||
#include "MessageServer.hpp"
|
||||
|
||||
using Frequency = MessageServer::Frequency;
|
||||
|
||||
class QString;
|
||||
class QTime;
|
||||
|
||||
//
|
||||
// Beacons Model - simple data model for all beacon spots
|
||||
//
|
||||
// The model is a basic table with uniform row format. Rows consist of
|
||||
// QStandardItem instances containing the string representation of the
|
||||
// column data and if the underlying field is not a string then the
|
||||
// UserRole+1 role contains the underlying data item.
|
||||
//
|
||||
// Two slots are provided to add a new decode and remove all spots for
|
||||
// a client.
|
||||
//
|
||||
class BeaconsModel
|
||||
: public QStandardItemModel
|
||||
{
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
explicit BeaconsModel (QObject * parent = nullptr);
|
||||
|
||||
Q_SLOT void add_beacon_spot (bool is_new, QString const& client_id, QTime time, qint32 snr, float delta_time
|
||||
, Frequency frequency, qint32 drift, QString const& callsign, QString const& grid
|
||||
, qint32 power);
|
||||
Q_SLOT void clear_decodes (QString const& client_id);
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user