Initial Commit
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 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_INCLUDE_IS_SEQUENCE)
|
||||
#define FUSION_INCLUDE_IS_SEQUENCE
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/support/is_sequence.hpp>
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,236 @@
|
||||
#include "Bands.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
|
||||
namespace
|
||||
{
|
||||
// Table of ADIF band definitions as defined in the ADIF
|
||||
// specification.
|
||||
struct ADIFBand
|
||||
{
|
||||
char const * const name_;
|
||||
Radio::Frequency lower_bound_;
|
||||
Radio::Frequency upper_bound_;
|
||||
} constexpr ADIF_bands[] = {
|
||||
{"2190m", 136000u, 137000u},
|
||||
{"630m", 472000u, 479000u},
|
||||
{"560m", 501000u, 504000u},
|
||||
{"160m", 1800000u, 2000000u},
|
||||
{"80m", 3500000u, 4000000u},
|
||||
{"60m", 5102000u, 5406500u},
|
||||
{"40m", 7000000u, 7300000u},
|
||||
{"30m", 10000000u, 10150000u},
|
||||
{"20m", 14000000u, 14350000u},
|
||||
{"17m", 18068000u, 18168000u},
|
||||
{"15m", 21000000u, 21450000u},
|
||||
{"12m", 24890000u, 24990000u},
|
||||
{"10m", 28000000u, 29700000u},
|
||||
{"6m", 50000000u, 54000000u},
|
||||
{"4m", 70000000u, 71000000u},
|
||||
{"2m", 144000000u, 148000000u},
|
||||
{"1.25m", 222000000u, 225000000u},
|
||||
{"70cm", 420000000u, 450000000u},
|
||||
{"33cm", 902000000u, 928000000u},
|
||||
{"23cm", 1240000000u, 1300000000u},
|
||||
{"13cm", 2300000000u, 2450000000u},
|
||||
{"9cm", 3300000000u, 3500000000u},
|
||||
{"6cm", 5650000000u, 5925000000u},
|
||||
{"3cm", 10000000000u, 10500000000u},
|
||||
{"1.25cm",24000000000u, 24250000000u},
|
||||
{"6mm", 47000000000u, 47200000000u},
|
||||
{"4mm", 75500000000u, 81000000000u},
|
||||
{"2.5mm", 119980000000u,120020000000u},
|
||||
{"2mm", 142000000000u,149000000000u},
|
||||
{"1mm", 241000000000u,250000000000u},
|
||||
};
|
||||
|
||||
QString const oob_name {QObject::tr ("OOB")};
|
||||
|
||||
int constexpr table_rows ()
|
||||
{
|
||||
return sizeof (ADIF_bands) / sizeof (ADIF_bands[0]);
|
||||
}
|
||||
}
|
||||
|
||||
Bands::Bands (QObject * parent)
|
||||
: QAbstractTableModel {parent}
|
||||
{
|
||||
}
|
||||
|
||||
QString Bands::find (Frequency f) const
|
||||
{
|
||||
QString result;
|
||||
auto const& end_iter = ADIF_bands + table_rows ();
|
||||
auto const& row_iter = std::find_if (ADIF_bands, end_iter, [f] (ADIFBand const& band) {
|
||||
return band.lower_bound_ <= f && f <= band.upper_bound_;
|
||||
});
|
||||
if (row_iter != end_iter)
|
||||
{
|
||||
result = row_iter->name_;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int Bands::find (QString const& band) const
|
||||
{
|
||||
int result {-1};
|
||||
for (auto i = 0u; i < table_rows (); ++i)
|
||||
{
|
||||
if (band == ADIF_bands[i].name_)
|
||||
{
|
||||
result = i;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QString const& Bands::oob ()
|
||||
{
|
||||
return oob_name;
|
||||
}
|
||||
|
||||
int Bands::rowCount (QModelIndex const& parent) const
|
||||
{
|
||||
return parent.isValid () ? 0 : table_rows ();
|
||||
}
|
||||
|
||||
int Bands::columnCount (QModelIndex const& parent) const
|
||||
{
|
||||
return parent.isValid () ? 0 : 3;
|
||||
}
|
||||
|
||||
Qt::ItemFlags Bands::flags (QModelIndex const& index) const
|
||||
{
|
||||
return QAbstractTableModel::flags (index) | Qt::ItemIsDropEnabled;
|
||||
}
|
||||
|
||||
QVariant Bands::data (QModelIndex const& index, int role) const
|
||||
{
|
||||
QVariant item;
|
||||
|
||||
if (!index.isValid ())
|
||||
{
|
||||
// Hijack root for OOB string.
|
||||
if (Qt::DisplayRole == role)
|
||||
{
|
||||
item = oob_name;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
auto row = index.row ();
|
||||
auto column = index.column ();
|
||||
|
||||
if (row < table_rows ())
|
||||
{
|
||||
switch (role)
|
||||
{
|
||||
case Qt::ToolTipRole:
|
||||
case Qt::AccessibleDescriptionRole:
|
||||
switch (column)
|
||||
{
|
||||
case 0: item = tr ("Band name"); break;
|
||||
case 1: item = tr ("Lower frequency limit"); break;
|
||||
case 2: item = tr ("Upper frequency limit"); break;
|
||||
}
|
||||
break;
|
||||
|
||||
case SortRole:
|
||||
case Qt::DisplayRole:
|
||||
case Qt::EditRole:
|
||||
switch (column)
|
||||
{
|
||||
case 0:
|
||||
if (SortRole == role)
|
||||
{
|
||||
// band name sorts by lower bound
|
||||
item = ADIF_bands[row].lower_bound_;
|
||||
}
|
||||
else
|
||||
{
|
||||
item = ADIF_bands[row].name_;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1: item = ADIF_bands[row].lower_bound_; break;
|
||||
case 2: item = ADIF_bands[row].upper_bound_; break;
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::AccessibleTextRole:
|
||||
switch (column)
|
||||
{
|
||||
case 0: item = ADIF_bands[row].name_; break;
|
||||
case 1: item = ADIF_bands[row].lower_bound_; break;
|
||||
case 2: item = ADIF_bands[row].upper_bound_; break;
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::TextAlignmentRole:
|
||||
switch (column)
|
||||
{
|
||||
case 0:
|
||||
item = Qt::AlignHCenter + Qt::AlignVCenter;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
case 2:
|
||||
item = Qt::AlignRight + Qt::AlignVCenter;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
QVariant Bands::headerData (int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
QVariant result;
|
||||
|
||||
if (Qt::DisplayRole == role && Qt::Horizontal == orientation)
|
||||
{
|
||||
switch (section)
|
||||
{
|
||||
case 0: result = tr ("Band"); break;
|
||||
case 1: result = tr ("Lower Limit"); break;
|
||||
case 2: result = tr ("Upper Limit"); break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result = QAbstractTableModel::headerData (section, orientation, role);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
QString Bands::const_iterator::operator * ()
|
||||
{
|
||||
return ADIF_bands[row_].name_;
|
||||
}
|
||||
|
||||
bool Bands::const_iterator::operator != (const_iterator const& rhs) const
|
||||
{
|
||||
return row_ != rhs.row_;
|
||||
}
|
||||
|
||||
auto Bands::const_iterator::operator ++ () -> const_iterator&
|
||||
{
|
||||
++row_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
auto Bands::begin () const -> Bands::const_iterator
|
||||
{
|
||||
return const_iterator (0);
|
||||
}
|
||||
|
||||
auto Bands::end () const -> Bands::const_iterator
|
||||
{
|
||||
return const_iterator (table_rows ());
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Paul Mensonides 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)
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# ifndef BOOST_PREPROCESSOR_SEQ_FOR_EACH_PRODUCT_HPP
|
||||
# define BOOST_PREPROCESSOR_SEQ_FOR_EACH_PRODUCT_HPP
|
||||
#
|
||||
# include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
# include <boost/preprocessor/config/config.hpp>
|
||||
# include <boost/preprocessor/control/if.hpp>
|
||||
# include <boost/preprocessor/repetition/for.hpp>
|
||||
# include <boost/preprocessor/seq/seq.hpp>
|
||||
# include <boost/preprocessor/seq/size.hpp>
|
||||
# include <boost/preprocessor/tuple/elem.hpp>
|
||||
# include <boost/preprocessor/tuple/rem.hpp>
|
||||
#
|
||||
# /* BOOST_PP_SEQ_FOR_EACH_PRODUCT */
|
||||
#
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT(macro, sets) BOOST_PP_SEQ_FOR_EACH_PRODUCT_E(BOOST_PP_FOR, macro, sets)
|
||||
#
|
||||
# /* BOOST_PP_SEQ_FOR_EACH_PRODUCT_R */
|
||||
#
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_R(r, macro, sets) BOOST_PP_SEQ_FOR_EACH_PRODUCT_E(BOOST_PP_FOR_ ## r, macro, sets)
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_E(impl, macro, sets) impl((BOOST_PP_SEQ_HEAD(sets)(nil), BOOST_PP_SEQ_TAIL(sets)(nil), (nil), macro), BOOST_PP_SEQ_FOR_EACH_PRODUCT_P, BOOST_PP_SEQ_FOR_EACH_PRODUCT_O, BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_0)
|
||||
# else
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_E(impl, macro, sets) BOOST_PP_SEQ_FOR_EACH_PRODUCT_E_I(impl, macro, sets)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_E_I(impl, macro, sets) impl((BOOST_PP_SEQ_HEAD(sets)(nil), BOOST_PP_SEQ_TAIL(sets)(nil), (nil), macro), BOOST_PP_SEQ_FOR_EACH_PRODUCT_P, BOOST_PP_SEQ_FOR_EACH_PRODUCT_O, BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_0)
|
||||
# endif
|
||||
#
|
||||
# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_P(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_P_I data
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_P_I(cset, rset, res, macro) BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(cset))
|
||||
# else
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_P(r, data) BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(BOOST_PP_TUPLE_ELEM(4, 0, data)))
|
||||
# endif
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_O(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_O_I data
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_O_I(cset, rset, res, macro) (BOOST_PP_SEQ_TAIL(cset), rset, res, macro)
|
||||
# else
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_O(r, data) (BOOST_PP_SEQ_TAIL(BOOST_PP_TUPLE_ELEM(4, 0, data)), BOOST_PP_TUPLE_ELEM(4, 1, data), BOOST_PP_TUPLE_ELEM(4, 2, data), BOOST_PP_TUPLE_ELEM(4, 3, data))
|
||||
# endif
|
||||
#
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_C(data, i) BOOST_PP_IF(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(BOOST_PP_TUPLE_ELEM(4, 1, data))), BOOST_PP_SEQ_FOR_EACH_PRODUCT_N_ ## i, BOOST_PP_SEQ_FOR_EACH_PRODUCT_I)
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_I(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_I_I(r, BOOST_PP_TUPLE_ELEM(4, 0, data), BOOST_PP_TUPLE_ELEM(4, 1, data), BOOST_PP_TUPLE_ELEM(4, 2, data), BOOST_PP_TUPLE_ELEM(4, 3, data))
|
||||
# else
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_I(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_I_IM(r, BOOST_PP_TUPLE_REM_4 data)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_I_IM(r, im) BOOST_PP_SEQ_FOR_EACH_PRODUCT_I_I(r, im)
|
||||
# endif
|
||||
#
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_I_I(r, cset, rset, res, macro) macro(r, BOOST_PP_SEQ_TAIL(res (BOOST_PP_SEQ_HEAD(cset))))
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_H(data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_H_I data
|
||||
# else
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_H(data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_H_I(BOOST_PP_TUPLE_ELEM(4, 0, data), BOOST_PP_TUPLE_ELEM(4, 1, data), BOOST_PP_TUPLE_ELEM(4, 2, data), BOOST_PP_TUPLE_ELEM(4, 3, data))
|
||||
# endif
|
||||
#
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_H_I(cset, rset, res, macro) (BOOST_PP_SEQ_HEAD(rset)(nil), BOOST_PP_SEQ_TAIL(rset), res (BOOST_PP_SEQ_HEAD(cset)), macro)
|
||||
#
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_0(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_C(data, 0)(r, data)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_1(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_C(data, 1)(r, data)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_2(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_C(data, 2)(r, data)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_3(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_C(data, 3)(r, data)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_4(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_C(data, 4)(r, data)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_5(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_C(data, 5)(r, data)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_6(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_C(data, 6)(r, data)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_7(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_C(data, 7)(r, data)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_8(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_C(data, 8)(r, data)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_9(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_C(data, 9)(r, data)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_10(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_C(data, 10)(r, data)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_11(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_C(data, 11)(r, data)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_12(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_C(data, 12)(r, data)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_13(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_C(data, 13)(r, data)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_14(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_C(data, 14)(r, data)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_15(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_C(data, 15)(r, data)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_16(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_C(data, 16)(r, data)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_17(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_C(data, 17)(r, data)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_18(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_C(data, 18)(r, data)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_19(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_C(data, 19)(r, data)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_20(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_C(data, 20)(r, data)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_21(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_C(data, 21)(r, data)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_22(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_C(data, 22)(r, data)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_23(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_C(data, 23)(r, data)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_24(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_C(data, 24)(r, data)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_25(r, data) BOOST_PP_SEQ_FOR_EACH_PRODUCT_C(data, 25)(r, data)
|
||||
#
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_N_0(r, data) BOOST_PP_FOR_ ## r(BOOST_PP_SEQ_FOR_EACH_PRODUCT_H(data), BOOST_PP_SEQ_FOR_EACH_PRODUCT_P, BOOST_PP_SEQ_FOR_EACH_PRODUCT_O, BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_1)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_N_1(r, data) BOOST_PP_FOR_ ## r(BOOST_PP_SEQ_FOR_EACH_PRODUCT_H(data), BOOST_PP_SEQ_FOR_EACH_PRODUCT_P, BOOST_PP_SEQ_FOR_EACH_PRODUCT_O, BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_2)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_N_2(r, data) BOOST_PP_FOR_ ## r(BOOST_PP_SEQ_FOR_EACH_PRODUCT_H(data), BOOST_PP_SEQ_FOR_EACH_PRODUCT_P, BOOST_PP_SEQ_FOR_EACH_PRODUCT_O, BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_3)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_N_3(r, data) BOOST_PP_FOR_ ## r(BOOST_PP_SEQ_FOR_EACH_PRODUCT_H(data), BOOST_PP_SEQ_FOR_EACH_PRODUCT_P, BOOST_PP_SEQ_FOR_EACH_PRODUCT_O, BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_4)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_N_4(r, data) BOOST_PP_FOR_ ## r(BOOST_PP_SEQ_FOR_EACH_PRODUCT_H(data), BOOST_PP_SEQ_FOR_EACH_PRODUCT_P, BOOST_PP_SEQ_FOR_EACH_PRODUCT_O, BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_5)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_N_5(r, data) BOOST_PP_FOR_ ## r(BOOST_PP_SEQ_FOR_EACH_PRODUCT_H(data), BOOST_PP_SEQ_FOR_EACH_PRODUCT_P, BOOST_PP_SEQ_FOR_EACH_PRODUCT_O, BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_6)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_N_6(r, data) BOOST_PP_FOR_ ## r(BOOST_PP_SEQ_FOR_EACH_PRODUCT_H(data), BOOST_PP_SEQ_FOR_EACH_PRODUCT_P, BOOST_PP_SEQ_FOR_EACH_PRODUCT_O, BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_7)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_N_7(r, data) BOOST_PP_FOR_ ## r(BOOST_PP_SEQ_FOR_EACH_PRODUCT_H(data), BOOST_PP_SEQ_FOR_EACH_PRODUCT_P, BOOST_PP_SEQ_FOR_EACH_PRODUCT_O, BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_8)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_N_8(r, data) BOOST_PP_FOR_ ## r(BOOST_PP_SEQ_FOR_EACH_PRODUCT_H(data), BOOST_PP_SEQ_FOR_EACH_PRODUCT_P, BOOST_PP_SEQ_FOR_EACH_PRODUCT_O, BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_9)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_N_9(r, data) BOOST_PP_FOR_ ## r(BOOST_PP_SEQ_FOR_EACH_PRODUCT_H(data), BOOST_PP_SEQ_FOR_EACH_PRODUCT_P, BOOST_PP_SEQ_FOR_EACH_PRODUCT_O, BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_10)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_N_10(r, data) BOOST_PP_FOR_ ## r(BOOST_PP_SEQ_FOR_EACH_PRODUCT_H(data), BOOST_PP_SEQ_FOR_EACH_PRODUCT_P, BOOST_PP_SEQ_FOR_EACH_PRODUCT_O, BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_11)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_N_11(r, data) BOOST_PP_FOR_ ## r(BOOST_PP_SEQ_FOR_EACH_PRODUCT_H(data), BOOST_PP_SEQ_FOR_EACH_PRODUCT_P, BOOST_PP_SEQ_FOR_EACH_PRODUCT_O, BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_12)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_N_12(r, data) BOOST_PP_FOR_ ## r(BOOST_PP_SEQ_FOR_EACH_PRODUCT_H(data), BOOST_PP_SEQ_FOR_EACH_PRODUCT_P, BOOST_PP_SEQ_FOR_EACH_PRODUCT_O, BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_13)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_N_13(r, data) BOOST_PP_FOR_ ## r(BOOST_PP_SEQ_FOR_EACH_PRODUCT_H(data), BOOST_PP_SEQ_FOR_EACH_PRODUCT_P, BOOST_PP_SEQ_FOR_EACH_PRODUCT_O, BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_14)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_N_14(r, data) BOOST_PP_FOR_ ## r(BOOST_PP_SEQ_FOR_EACH_PRODUCT_H(data), BOOST_PP_SEQ_FOR_EACH_PRODUCT_P, BOOST_PP_SEQ_FOR_EACH_PRODUCT_O, BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_15)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_N_15(r, data) BOOST_PP_FOR_ ## r(BOOST_PP_SEQ_FOR_EACH_PRODUCT_H(data), BOOST_PP_SEQ_FOR_EACH_PRODUCT_P, BOOST_PP_SEQ_FOR_EACH_PRODUCT_O, BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_16)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_N_16(r, data) BOOST_PP_FOR_ ## r(BOOST_PP_SEQ_FOR_EACH_PRODUCT_H(data), BOOST_PP_SEQ_FOR_EACH_PRODUCT_P, BOOST_PP_SEQ_FOR_EACH_PRODUCT_O, BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_17)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_N_17(r, data) BOOST_PP_FOR_ ## r(BOOST_PP_SEQ_FOR_EACH_PRODUCT_H(data), BOOST_PP_SEQ_FOR_EACH_PRODUCT_P, BOOST_PP_SEQ_FOR_EACH_PRODUCT_O, BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_18)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_N_18(r, data) BOOST_PP_FOR_ ## r(BOOST_PP_SEQ_FOR_EACH_PRODUCT_H(data), BOOST_PP_SEQ_FOR_EACH_PRODUCT_P, BOOST_PP_SEQ_FOR_EACH_PRODUCT_O, BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_19)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_N_19(r, data) BOOST_PP_FOR_ ## r(BOOST_PP_SEQ_FOR_EACH_PRODUCT_H(data), BOOST_PP_SEQ_FOR_EACH_PRODUCT_P, BOOST_PP_SEQ_FOR_EACH_PRODUCT_O, BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_20)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_N_20(r, data) BOOST_PP_FOR_ ## r(BOOST_PP_SEQ_FOR_EACH_PRODUCT_H(data), BOOST_PP_SEQ_FOR_EACH_PRODUCT_P, BOOST_PP_SEQ_FOR_EACH_PRODUCT_O, BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_21)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_N_21(r, data) BOOST_PP_FOR_ ## r(BOOST_PP_SEQ_FOR_EACH_PRODUCT_H(data), BOOST_PP_SEQ_FOR_EACH_PRODUCT_P, BOOST_PP_SEQ_FOR_EACH_PRODUCT_O, BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_22)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_N_22(r, data) BOOST_PP_FOR_ ## r(BOOST_PP_SEQ_FOR_EACH_PRODUCT_H(data), BOOST_PP_SEQ_FOR_EACH_PRODUCT_P, BOOST_PP_SEQ_FOR_EACH_PRODUCT_O, BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_23)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_N_23(r, data) BOOST_PP_FOR_ ## r(BOOST_PP_SEQ_FOR_EACH_PRODUCT_H(data), BOOST_PP_SEQ_FOR_EACH_PRODUCT_P, BOOST_PP_SEQ_FOR_EACH_PRODUCT_O, BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_24)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_N_24(r, data) BOOST_PP_FOR_ ## r(BOOST_PP_SEQ_FOR_EACH_PRODUCT_H(data), BOOST_PP_SEQ_FOR_EACH_PRODUCT_P, BOOST_PP_SEQ_FOR_EACH_PRODUCT_O, BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_25)
|
||||
# define BOOST_PP_SEQ_FOR_EACH_PRODUCT_N_25(r, data) BOOST_PP_FOR_ ## r(BOOST_PP_SEQ_FOR_EACH_PRODUCT_H(data), BOOST_PP_SEQ_FOR_EACH_PRODUCT_P, BOOST_PP_SEQ_FOR_EACH_PRODUCT_O, BOOST_PP_SEQ_FOR_EACH_PRODUCT_M_26)
|
||||
#
|
||||
# endif
|
||||
@@ -0,0 +1,271 @@
|
||||
/* boost random/independent_bits.hpp header file
|
||||
*
|
||||
* Copyright Steven Watanabe 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_INDEPENDENT_BITS_HPP
|
||||
#define BOOST_RANDOM_INDEPENDENT_BITS_HPP
|
||||
|
||||
#include <istream>
|
||||
#include <iosfwd>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/integer/integer_mask.hpp>
|
||||
#include <boost/random/traits.hpp>
|
||||
#include <boost/random/detail/config.hpp>
|
||||
#include <boost/random/detail/integer_log2.hpp>
|
||||
#include <boost/random/detail/operators.hpp>
|
||||
#include <boost/random/detail/seed.hpp>
|
||||
#include <boost/random/detail/seed_impl.hpp>
|
||||
#include <boost/random/detail/signed_unsigned_tools.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace random {
|
||||
|
||||
/**
|
||||
* An instantiation of class template @c independent_bits_engine
|
||||
* model a \pseudo_random_number_generator. It generates random
|
||||
* numbers distributed between [0, 2^w) by combining one or
|
||||
* more invocations of the base engine.
|
||||
*
|
||||
* Requires: 0 < w <= std::numeric_limits<UIntType>::digits
|
||||
*/
|
||||
template<class Engine, std::size_t w, class UIntType>
|
||||
class independent_bits_engine
|
||||
{
|
||||
public:
|
||||
typedef Engine base_type;
|
||||
typedef UIntType result_type;
|
||||
typedef typename Engine::result_type base_result_type;
|
||||
|
||||
// Required by old Boost.Random concept
|
||||
BOOST_STATIC_CONSTANT(bool, has_fixed_range = false);
|
||||
|
||||
/** Returns the smallest value that the generator can produce. */
|
||||
static result_type min BOOST_PREVENT_MACRO_SUBSTITUTION ()
|
||||
{ return 0; }
|
||||
/** Returns the largest value that the generator can produce. */
|
||||
static result_type max BOOST_PREVENT_MACRO_SUBSTITUTION ()
|
||||
{ return max_imp(boost::is_integral<UIntType>()); }
|
||||
|
||||
/**
|
||||
* Constructs an @c independent_bits_engine using the
|
||||
* default constructor of the base generator.
|
||||
*/
|
||||
independent_bits_engine() { }
|
||||
|
||||
/**
|
||||
* Constructs an @c independent_bits_engine, using seed as
|
||||
* the constructor argument for both base generators.
|
||||
*/
|
||||
BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(independent_bits_engine,
|
||||
base_result_type, seed_arg)
|
||||
{
|
||||
_base.seed(seed_arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an @c independent_bits_engine, using seq as
|
||||
* the constructor argument for the base generator.
|
||||
*/
|
||||
BOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR(independent_bits_engine,
|
||||
SeedSeq, seq)
|
||||
{ _base.seed(seq); }
|
||||
|
||||
/** Constructs an @c independent_bits_engine by copying @c base. */
|
||||
independent_bits_engine(const base_type& base_arg) : _base(base_arg) {}
|
||||
|
||||
/**
|
||||
* Contructs an @c independent_bits_engine with
|
||||
* values from the range defined by the input iterators first
|
||||
* and last. first will be modified to point to the element
|
||||
* after the last one used.
|
||||
*
|
||||
* Throws: @c std::invalid_argument if the input range is too small.
|
||||
*
|
||||
* Exception Safety: Basic
|
||||
*/
|
||||
template<class It>
|
||||
independent_bits_engine(It& first, It last) : _base(first, last) { }
|
||||
|
||||
/**
|
||||
* Seeds an @c independent_bits_engine using the default
|
||||
* seed of the base generator.
|
||||
*/
|
||||
void seed() { _base.seed(); }
|
||||
|
||||
/**
|
||||
* Seeds an @c independent_bits_engine, using @c seed as the
|
||||
* seed for the base generator.
|
||||
*/
|
||||
BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(independent_bits_engine,
|
||||
base_result_type, seed_arg)
|
||||
{ _base.seed(seed_arg); }
|
||||
|
||||
/**
|
||||
* Seeds an @c independent_bits_engine, using @c seq to
|
||||
* seed the base generator.
|
||||
*/
|
||||
BOOST_RANDOM_DETAIL_SEED_SEQ_SEED(independent_bits_engine,
|
||||
SeedSeq, seq)
|
||||
{ _base.seed(seq); }
|
||||
|
||||
/**
|
||||
* Seeds an @c independent_bits_engine with
|
||||
* values from the range defined by the input iterators first
|
||||
* and last. first will be modified to point to the element
|
||||
* after the last one used.
|
||||
*
|
||||
* Throws: @c std::invalid_argument if the input range is too small.
|
||||
*
|
||||
* Exception Safety: Basic
|
||||
*/
|
||||
template<class It> void seed(It& first, It last)
|
||||
{ _base.seed(first, last); }
|
||||
|
||||
/** Returns the next value of the generator. */
|
||||
result_type operator()()
|
||||
{
|
||||
// While it may seem wasteful to recalculate this
|
||||
// every time, both msvc and gcc can propagate
|
||||
// constants, resolving this at compile time.
|
||||
base_unsigned range =
|
||||
detail::subtract<base_result_type>()((_base.max)(), (_base.min)());
|
||||
std::size_t m =
|
||||
(range == (std::numeric_limits<base_unsigned>::max)()) ?
|
||||
std::numeric_limits<base_unsigned>::digits :
|
||||
detail::integer_log2(range + 1);
|
||||
std::size_t n = (w + m - 1) / m;
|
||||
std::size_t w0, n0;
|
||||
base_unsigned y0, y1;
|
||||
base_unsigned y0_mask, y1_mask;
|
||||
calc_params(n, range, w0, n0, y0, y1, y0_mask, y1_mask);
|
||||
if(base_unsigned(range - y0 + 1) > y0 / n) {
|
||||
// increment n and try again.
|
||||
++n;
|
||||
calc_params(n, range, w0, n0, y0, y1, y0_mask, y1_mask);
|
||||
}
|
||||
|
||||
BOOST_ASSERT(n0*w0 + (n - n0)*(w0 + 1) == w);
|
||||
|
||||
result_type S = 0;
|
||||
for(std::size_t k = 0; k < n0; ++k) {
|
||||
base_unsigned u;
|
||||
do {
|
||||
u = detail::subtract<base_result_type>()(_base(), (_base.min)());
|
||||
} while(u > base_unsigned(y0 - 1));
|
||||
S = (S << w0) + (u & y0_mask);
|
||||
}
|
||||
for(std::size_t k = 0; k < (n - n0); ++k) {
|
||||
base_unsigned u;
|
||||
do {
|
||||
u = detail::subtract<base_result_type>()(_base(), (_base.min)());
|
||||
} while(u > base_unsigned(y1 - 1));
|
||||
S = (S << (w0 + 1)) + (u & y1_mask);
|
||||
}
|
||||
return S;
|
||||
}
|
||||
|
||||
/** Fills a range with random values */
|
||||
template<class Iter>
|
||||
void generate(Iter first, Iter last)
|
||||
{ detail::generate_from_int(*this, first, last); }
|
||||
|
||||
/** Advances the state of the generator by @c z. */
|
||||
void discard(boost::uintmax_t z)
|
||||
{
|
||||
for(boost::uintmax_t i = 0; i < z; ++i) {
|
||||
(*this)();
|
||||
}
|
||||
}
|
||||
|
||||
const base_type& base() const { return _base; }
|
||||
|
||||
/**
|
||||
* Writes the textual representation if the generator to a @c std::ostream.
|
||||
* The textual representation of the engine is the textual representation
|
||||
* of the base engine.
|
||||
*/
|
||||
BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, independent_bits_engine, r)
|
||||
{
|
||||
os << r._base;
|
||||
return os;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the state of an @c independent_bits_engine from a
|
||||
* @c std::istream.
|
||||
*/
|
||||
BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR(is, independent_bits_engine, r)
|
||||
{
|
||||
is >> r._base;
|
||||
return is;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns: true iff the two @c independent_bits_engines will
|
||||
* produce the same sequence of values.
|
||||
*/
|
||||
BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(independent_bits_engine, x, y)
|
||||
{ return x._base == y._base; }
|
||||
/**
|
||||
* Returns: true iff the two @c independent_bits_engines will
|
||||
* produce different sequences of values.
|
||||
*/
|
||||
BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR(independent_bits_engine)
|
||||
|
||||
private:
|
||||
|
||||
/// \cond show_private
|
||||
typedef typename boost::random::traits::make_unsigned<base_result_type>::type base_unsigned;
|
||||
|
||||
static UIntType max_imp(const boost::true_type&)
|
||||
{
|
||||
return boost::low_bits_mask_t<w>::sig_bits;
|
||||
}
|
||||
static UIntType max_imp(const boost::false_type&)
|
||||
{
|
||||
// We have a multiprecision integer type:
|
||||
BOOST_STATIC_ASSERT(std::numeric_limits<UIntType>::is_specialized);
|
||||
return w < std::numeric_limits<UIntType>::digits ? UIntType((UIntType(1) << w) - 1) : UIntType((((UIntType(1) << (w - 1)) - 1) << 1) | 1u);
|
||||
}
|
||||
|
||||
void calc_params(
|
||||
std::size_t n, base_unsigned range,
|
||||
std::size_t& w0, std::size_t& n0,
|
||||
base_unsigned& y0, base_unsigned& y1,
|
||||
base_unsigned& y0_mask, base_unsigned& y1_mask)
|
||||
{
|
||||
BOOST_ASSERT(w >= n);
|
||||
w0 = w/n;
|
||||
n0 = n - w % n;
|
||||
y0_mask = (base_unsigned(2) << (w0 - 1)) - 1;
|
||||
y1_mask = (y0_mask << 1) | 1;
|
||||
y0 = (range + 1) & ~y0_mask;
|
||||
y1 = (range + 1) & ~y1_mask;
|
||||
BOOST_ASSERT(y0 != 0 || base_unsigned(range + 1) == 0);
|
||||
}
|
||||
/// \endcond
|
||||
|
||||
Engine _base;
|
||||
};
|
||||
|
||||
#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
|
||||
template<class Engine, std::size_t w, class UIntType>
|
||||
const bool independent_bits_engine<Engine, w, UIntType>::has_fixed_range;
|
||||
#endif
|
||||
|
||||
} // namespace random
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_RANDOM_INDEPENDENT_BITS_HPP
|
||||
@@ -0,0 +1,230 @@
|
||||
// Copyright (c) 2006 Xiaogang Zhang
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_MATH_BESSEL_Y0_HPP
|
||||
#define BOOST_MATH_BESSEL_Y0_HPP
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4702) // Unreachable code (release mode only warning)
|
||||
#endif
|
||||
|
||||
#include <boost/math/special_functions/detail/bessel_j0.hpp>
|
||||
#include <boost/math/constants/constants.hpp>
|
||||
#include <boost/math/tools/rational.hpp>
|
||||
#include <boost/math/tools/big_constant.hpp>
|
||||
#include <boost/math/policies/error_handling.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
// Bessel function of the second kind of order zero
|
||||
// x <= 8, minimax rational approximations on root-bracketing intervals
|
||||
// x > 8, Hankel asymptotic expansion in Hart, Computer Approximations, 1968
|
||||
|
||||
namespace boost { namespace math { namespace detail{
|
||||
|
||||
template <typename T, typename Policy>
|
||||
T bessel_y0(T x, const Policy&);
|
||||
|
||||
template <class T, class Policy>
|
||||
struct bessel_y0_initializer
|
||||
{
|
||||
struct init
|
||||
{
|
||||
init()
|
||||
{
|
||||
do_init();
|
||||
}
|
||||
static void do_init()
|
||||
{
|
||||
bessel_y0(T(1), Policy());
|
||||
}
|
||||
void force_instantiate()const{}
|
||||
};
|
||||
static const init initializer;
|
||||
static void force_instantiate()
|
||||
{
|
||||
initializer.force_instantiate();
|
||||
}
|
||||
};
|
||||
|
||||
template <class T, class Policy>
|
||||
const typename bessel_y0_initializer<T, Policy>::init bessel_y0_initializer<T, Policy>::initializer;
|
||||
|
||||
template <typename T, typename Policy>
|
||||
T bessel_y0(T x, const Policy& pol)
|
||||
{
|
||||
bessel_y0_initializer<T, Policy>::force_instantiate();
|
||||
|
||||
static const T P1[] = {
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.0723538782003176831e+11)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -8.3716255451260504098e+09)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 2.0422274357376619816e+08)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -2.1287548474401797963e+06)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.0102532948020907590e+04)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -1.8402381979244993524e+01)),
|
||||
};
|
||||
static const T Q1[] = {
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 5.8873865738997033405e+11)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 8.1617187777290363573e+09)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 5.5662956624278251596e+07)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 2.3889393209447253406e+05)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 6.6475986689240190091e+02)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.0)),
|
||||
};
|
||||
static const T P2[] = {
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -2.2213976967566192242e+13)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -5.5107435206722644429e+11)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 4.3600098638603061642e+10)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -6.9590439394619619534e+08)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 4.6905288611678631510e+06)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -1.4566865832663635920e+04)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.7427031242901594547e+01)),
|
||||
};
|
||||
static const T Q2[] = {
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 4.3386146580707264428e+14)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 5.4266824419412347550e+12)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 3.4015103849971240096e+10)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.3960202770986831075e+08)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 4.0669982352539552018e+05)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 8.3030857612070288823e+02)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.0)),
|
||||
};
|
||||
static const T P3[] = {
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -8.0728726905150210443e+15)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 6.7016641869173237784e+14)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -1.2829912364088687306e+11)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -1.9363051266772083678e+11)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 2.1958827170518100757e+09)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -1.0085539923498211426e+07)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 2.1363534169313901632e+04)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -1.7439661319197499338e+01)),
|
||||
};
|
||||
static const T Q3[] = {
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 3.4563724628846457519e+17)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 3.9272425569640309819e+15)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 2.2598377924042897629e+13)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 8.6926121104209825246e+10)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 2.4727219475672302327e+08)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 5.3924739209768057030e+05)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 8.7903362168128450017e+02)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.0)),
|
||||
};
|
||||
static const T PC[] = {
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 2.2779090197304684302e+04)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 4.1345386639580765797e+04)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 2.1170523380864944322e+04)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 3.4806486443249270347e+03)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.5376201909008354296e+02)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 8.8961548424210455236e-01)),
|
||||
};
|
||||
static const T QC[] = {
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 2.2779090197304684318e+04)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 4.1370412495510416640e+04)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 2.1215350561880115730e+04)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 3.5028735138235608207e+03)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.5711159858080893649e+02)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.0)),
|
||||
};
|
||||
static const T PS[] = {
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -8.9226600200800094098e+01)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -1.8591953644342993800e+02)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -1.1183429920482737611e+02)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -2.2300261666214198472e+01)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -1.2441026745835638459e+00)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -8.8033303048680751817e-03)),
|
||||
};
|
||||
static const T QS[] = {
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 5.7105024128512061905e+03)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.1951131543434613647e+04)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 7.2642780169211018836e+03)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.4887231232283756582e+03)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 9.0593769594993125859e+01)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.0)),
|
||||
};
|
||||
static const T x1 = static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 8.9357696627916752158e-01)),
|
||||
x2 = static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 3.9576784193148578684e+00)),
|
||||
x3 = static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 7.0860510603017726976e+00)),
|
||||
x11 = static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 2.280e+02)),
|
||||
x12 = static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 2.9519662791675215849e-03)),
|
||||
x21 = static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.0130e+03)),
|
||||
x22 = static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 6.4716931485786837568e-04)),
|
||||
x31 = static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.8140e+03)),
|
||||
x32 = static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 1.1356030177269762362e-04))
|
||||
;
|
||||
T value, factor, r, rc, rs;
|
||||
|
||||
BOOST_MATH_STD_USING
|
||||
using namespace boost::math::tools;
|
||||
using namespace boost::math::constants;
|
||||
|
||||
static const char* function = "boost::math::bessel_y0<%1%>(%1%,%1%)";
|
||||
|
||||
if (x < 0)
|
||||
{
|
||||
return policies::raise_domain_error<T>(function,
|
||||
"Got x = %1% but x must be non-negative, complex result not supported.", x, pol);
|
||||
}
|
||||
if (x == 0)
|
||||
{
|
||||
return -policies::raise_overflow_error<T>(function, 0, pol);
|
||||
}
|
||||
if (x <= 3) // x in (0, 3]
|
||||
{
|
||||
T y = x * x;
|
||||
T z = 2 * log(x/x1) * bessel_j0(x) / pi<T>();
|
||||
r = evaluate_rational(P1, Q1, y);
|
||||
factor = (x + x1) * ((x - x11/256) - x12);
|
||||
value = z + factor * r;
|
||||
}
|
||||
else if (x <= 5.5f) // x in (3, 5.5]
|
||||
{
|
||||
T y = x * x;
|
||||
T z = 2 * log(x/x2) * bessel_j0(x) / pi<T>();
|
||||
r = evaluate_rational(P2, Q2, y);
|
||||
factor = (x + x2) * ((x - x21/256) - x22);
|
||||
value = z + factor * r;
|
||||
}
|
||||
else if (x <= 8) // x in (5.5, 8]
|
||||
{
|
||||
T y = x * x;
|
||||
T z = 2 * log(x/x3) * bessel_j0(x) / pi<T>();
|
||||
r = evaluate_rational(P3, Q3, y);
|
||||
factor = (x + x3) * ((x - x31/256) - x32);
|
||||
value = z + factor * r;
|
||||
}
|
||||
else // x in (8, \infty)
|
||||
{
|
||||
T y = 8 / x;
|
||||
T y2 = y * y;
|
||||
rc = evaluate_rational(PC, QC, y2);
|
||||
rs = evaluate_rational(PS, QS, y2);
|
||||
factor = constants::one_div_root_pi<T>() / sqrt(x);
|
||||
//
|
||||
// The following code is really just:
|
||||
//
|
||||
// T z = x - 0.25f * pi<T>();
|
||||
// value = factor * (rc * sin(z) + y * rs * cos(z));
|
||||
//
|
||||
// But using the sin/cos addition formulae and constant values for
|
||||
// sin/cos of PI/4 which then cancel part of the "factor" term as they're all
|
||||
// 1 / sqrt(2):
|
||||
//
|
||||
T sx = sin(x);
|
||||
T cx = cos(x);
|
||||
value = factor * (rc * (sx - cx) + y * rs * (cx + sx));
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
}}} // namespaces
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // BOOST_MATH_BESSEL_Y0_HPP
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
// Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard.
|
||||
// Copyright (C) 2005-2008 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)
|
||||
|
||||
// See http://www.boost.org/libs/unordered for documentation
|
||||
|
||||
#ifndef BOOST_UNORDERED_SET_HPP_INCLUDED
|
||||
#define BOOST_UNORDERED_SET_HPP_INCLUDED
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/unordered/unordered_set.hpp>
|
||||
|
||||
#endif // BOOST_UNORDERED_SET_HPP_INCLUDED
|
||||
@@ -0,0 +1,199 @@
|
||||
|
||||
/*
|
||||
[auto_generated]
|
||||
boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp
|
||||
|
||||
[begin_description]
|
||||
Base class for const_step_iterator and adaptive_iterator.
|
||||
[end_description]
|
||||
|
||||
Copyright 2012-2013 Karsten Ahnert
|
||||
Copyright 2012-2013 Mario Mulansky
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or
|
||||
copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_ODE_ITERATOR_BASE_HPP_INCLUDED
|
||||
#define BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_ODE_ITERATOR_BASE_HPP_INCLUDED
|
||||
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
|
||||
#include <boost/numeric/odeint/util/unwrap_reference.hpp>
|
||||
#include <boost/numeric/odeint/util/detail/less_with_sign.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace odeint {
|
||||
namespace detail {
|
||||
|
||||
struct ode_state_iterator_tag {};
|
||||
struct ode_state_time_iterator_tag {};
|
||||
|
||||
template< class Iterator , class Stepper , class System , class State , typename Tag >
|
||||
class ode_iterator_base;
|
||||
|
||||
|
||||
/* Specialization for the state iterator that has only state_type as its value_type */
|
||||
template< class Iterator , class Stepper , class System , class State >
|
||||
class ode_iterator_base< Iterator , Stepper , System , State , ode_state_iterator_tag >
|
||||
: public boost::iterator_facade
|
||||
<
|
||||
Iterator ,
|
||||
typename traits::state_type< Stepper >::type const ,
|
||||
boost::single_pass_traversal_tag
|
||||
>
|
||||
{
|
||||
private:
|
||||
|
||||
typedef Stepper stepper_type;
|
||||
typedef System system_type;
|
||||
typedef typename boost::numeric::odeint::unwrap_reference< stepper_type >::type unwrapped_stepper_type;
|
||||
typedef State state_type;
|
||||
typedef typename unwrapped_stepper_type::time_type time_type;
|
||||
typedef typename unwrapped_stepper_type::value_type ode_value_type;
|
||||
|
||||
public:
|
||||
|
||||
ode_iterator_base( stepper_type stepper , system_type sys , time_type t , time_type dt )
|
||||
: m_stepper( stepper ) , m_system( sys ) ,
|
||||
m_t( t ) , m_dt( dt ) , m_at_end( false )
|
||||
{ }
|
||||
|
||||
ode_iterator_base( stepper_type stepper , system_type sys )
|
||||
: m_stepper( stepper ) , m_system( sys ) ,
|
||||
m_t() , m_dt() , m_at_end( true )
|
||||
{ }
|
||||
|
||||
// this function is only for testing
|
||||
bool same( const ode_iterator_base &iter ) const
|
||||
{
|
||||
return (
|
||||
//( static_cast<Iterator>(*this).get_state() ==
|
||||
// static_cast<Iterator>(iter).get_state ) &&
|
||||
( m_t == iter.m_t ) &&
|
||||
( m_dt == iter.m_dt ) &&
|
||||
( m_at_end == iter.m_at_end )
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
friend class boost::iterator_core_access;
|
||||
|
||||
bool equal( ode_iterator_base const& other ) const
|
||||
{
|
||||
if( m_at_end == other.m_at_end )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const state_type& dereference() const
|
||||
{
|
||||
return static_cast<const Iterator*>(this)->get_state();
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
stepper_type m_stepper;
|
||||
system_type m_system;
|
||||
time_type m_t;
|
||||
time_type m_dt;
|
||||
bool m_at_end;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* Specialization for the state-time iterator that has pair<state_type,time_type> as its value_type */
|
||||
|
||||
template< class Iterator , class Stepper , class System , class State >
|
||||
class ode_iterator_base< Iterator , Stepper , System , State , ode_state_time_iterator_tag >
|
||||
: public boost::iterator_facade
|
||||
<
|
||||
Iterator ,
|
||||
std::pair< const State , const typename traits::time_type< Stepper >::type > ,
|
||||
boost::single_pass_traversal_tag ,
|
||||
std::pair< const State& , const typename traits::time_type< Stepper >::type& >
|
||||
>
|
||||
{
|
||||
private:
|
||||
|
||||
typedef Stepper stepper_type;
|
||||
typedef System system_type;
|
||||
typedef typename boost::numeric::odeint::unwrap_reference< stepper_type >::type unwrapped_stepper_type;
|
||||
typedef State state_type;
|
||||
typedef typename unwrapped_stepper_type::time_type time_type;
|
||||
typedef typename unwrapped_stepper_type::value_type ode_value_type;
|
||||
|
||||
public:
|
||||
|
||||
ode_iterator_base( stepper_type stepper , system_type sys ,
|
||||
time_type t , time_type dt )
|
||||
: m_stepper( stepper ) , m_system( sys ) ,
|
||||
m_t( t ) , m_dt( dt ) , m_at_end( false )
|
||||
{ }
|
||||
|
||||
ode_iterator_base( stepper_type stepper , system_type sys )
|
||||
: m_stepper( stepper ) , m_system( sys ) , m_at_end( true )
|
||||
{ }
|
||||
|
||||
bool same( ode_iterator_base const& iter )
|
||||
{
|
||||
return (
|
||||
//( static_cast<Iterator>(*this).get_state() ==
|
||||
// static_cast<Iterator>(iter).get_state ) &&
|
||||
( m_t == iter.m_t ) &&
|
||||
( m_dt == iter.m_dt ) &&
|
||||
( m_at_end == iter.m_at_end )
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
friend class boost::iterator_core_access;
|
||||
|
||||
bool equal( ode_iterator_base const& other ) const
|
||||
{
|
||||
if( m_at_end == other.m_at_end )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
std::pair< const state_type& , const time_type& > dereference() const
|
||||
{
|
||||
return std::pair< const state_type & , const time_type & >(
|
||||
static_cast<const Iterator*>(this)->get_state() , m_t );
|
||||
}
|
||||
|
||||
stepper_type m_stepper;
|
||||
system_type m_system;
|
||||
time_type m_t;
|
||||
time_type m_dt;
|
||||
bool m_at_end;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // namespace detail
|
||||
} // namespace odeint
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
|
||||
|
||||
#endif // BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_ODE_ITERATOR_BASE_HPP_INCLUDED
|
||||
@@ -0,0 +1,151 @@
|
||||
subroutine osd174(llr,norder,decoded,niterations,cw)
|
||||
!
|
||||
! An ordered-statistics decoder based on ideas from:
|
||||
! "Soft-decision decoding of linear block codes based on ordered statistics,"
|
||||
! by Marc P. C. Fossorier and Shu Lin,
|
||||
! IEEE Trans Inf Theory, Vol 41, No 5, Sep 1995
|
||||
!
|
||||
|
||||
include "ldpc_174_87_params.f90"
|
||||
|
||||
integer*1 gen(K,N)
|
||||
integer*1 genmrb(K,N)
|
||||
integer*1 temp(K),m0(K),me(K)
|
||||
integer indices(N)
|
||||
integer*1 codeword(N),cw(N),hdec(N)
|
||||
integer*1 decoded(K)
|
||||
integer indx(N)
|
||||
real llr(N),rx(N),absrx(N)
|
||||
logical first
|
||||
data first/.true./
|
||||
|
||||
save first,gen
|
||||
|
||||
if( first ) then ! fill the generator matrix
|
||||
gen=0
|
||||
do i=1,M
|
||||
do j=1,22
|
||||
read(g(i)(j:j),"(Z1)") istr
|
||||
do jj=1, 4
|
||||
irow=(j-1)*4+jj
|
||||
if( irow .le. K ) then
|
||||
if( btest(istr,4-jj) ) gen(irow,i)=1
|
||||
endif
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
do irow=1,K
|
||||
gen(irow,M+irow)=1
|
||||
enddo
|
||||
first=.false.
|
||||
endif
|
||||
|
||||
! re-order received vector to place systematic msg bits at the end
|
||||
rx=llr(colorder+1)
|
||||
|
||||
! hard decode the received word
|
||||
hdec=0
|
||||
where(rx .ge. 0) hdec=1
|
||||
|
||||
! use magnitude of received symbols as a measure of reliability.
|
||||
absrx=abs(rx)
|
||||
call indexx(absrx,N,indx)
|
||||
! re-order the columns of the generator matrix in order of increasing reliability.
|
||||
do i=1,N
|
||||
genmrb(1:K,N+1-i)=gen(1:K,indx(N+1-i))
|
||||
enddo
|
||||
|
||||
! do gaussian elimination to create a generator matrix with the most reliable
|
||||
! received bits as the systematic bits. if it happens that the K most reliable
|
||||
! bits are not independent, then we dip into the bits just below the K best bits
|
||||
! to find K independent most reliable bits. the "indices" array tracks column
|
||||
! permutations caused by reliability sorting and gaussian elimination.
|
||||
do i=1,N
|
||||
indices(i)=indx(i)
|
||||
enddo
|
||||
do id=1,K ! diagonal element indices
|
||||
do ic=id,K+20 ! The 20 is ad hoc - beware
|
||||
icol=N-K+ic
|
||||
if( icol .gt. N ) icol=M+1-(icol-N)
|
||||
iflag=0
|
||||
if( genmrb(id,icol) .eq. 1 ) then
|
||||
iflag=1
|
||||
if( icol-M .ne. id ) then ! reorder column
|
||||
temp(1:K)=genmrb(1:K,M+id)
|
||||
genmrb(1:K,M+id)=genmrb(1:K,icol)
|
||||
genmrb(1:K,icol)=temp(1:K)
|
||||
itmp=indices(M+id)
|
||||
indices(M+id)=indices(icol)
|
||||
indices(icol)=itmp
|
||||
endif
|
||||
do ii=1,K
|
||||
if( ii .ne. id .and. genmrb(ii,N-K+id) .eq. 1 ) then
|
||||
genmrb(ii,1:N)=mod(genmrb(ii,1:N)+genmrb(id,1:N),2)
|
||||
endif
|
||||
enddo
|
||||
exit
|
||||
endif
|
||||
enddo
|
||||
enddo
|
||||
|
||||
! use the hard decisions for the K MRB bits to define the order 0
|
||||
! message, m0. Encode m0 using the modified generator matrix to
|
||||
! find the order 0 codeword. Flip all combinations of N bits in m0
|
||||
! and re-encode to find the list of order N codewords. Test all such
|
||||
! codewords against the received word to decide which codeword is
|
||||
! most likely to be correct.
|
||||
m0=0
|
||||
where (rx(indices(M+1:N)).ge.0.0) m0=1
|
||||
|
||||
nhardmin=N
|
||||
corrmax=-1.0e32
|
||||
j0=0
|
||||
j1=0
|
||||
j2=0
|
||||
j3=0
|
||||
if( norder.ge.4 ) j0=K
|
||||
if( norder.ge.3 ) j1=K
|
||||
if( norder.ge.2 ) j2=K
|
||||
if( norder.ge.1 ) j3=K
|
||||
nt=0
|
||||
do i1=0,j0
|
||||
do i2=i1,j1
|
||||
do i3=i2,j2
|
||||
do i4=i3,j3
|
||||
nt=nt+1
|
||||
me=m0
|
||||
if( i1 .ne. 0 ) me(i1)=1-me(i1)
|
||||
if( i2 .ne. 0 ) me(i2)=1-me(i2)
|
||||
if( i3 .ne. 0 ) me(i3)=1-me(i3)
|
||||
if( i4 .ne. 0 ) me(i4)=1-me(i4)
|
||||
|
||||
! me is the m0 + error pattern. encode this message using genmrb to
|
||||
! produce a codeword. test the codeword against the received vector
|
||||
! and save it if it's the best that we've seen so far.
|
||||
do i=1,N
|
||||
nsum=sum(iand(me,genmrb(1:K,i)))
|
||||
codeword(i)=mod(nsum,2)
|
||||
enddo
|
||||
! undo the bit re-ordering to put the "real" message bits at the end
|
||||
codeword(indices)=codeword
|
||||
nhard=count(codeword .ne. hdec)
|
||||
! corr=sum(codeword*rx) ! to save time use nhard to pick best codeword
|
||||
if( nhard .lt. nhardmin ) then
|
||||
! if( corr .gt. corrmax ) then
|
||||
cw=codeword
|
||||
nhardmin=nhard
|
||||
! corrmax=corr
|
||||
i1min=i1
|
||||
i2min=i2
|
||||
i3min=i3
|
||||
i4min=i4
|
||||
if( nhardmin .le. 15 ) goto 200 ! early exit - tune for each code
|
||||
endif
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
200 decoded=cw(M+1:N)
|
||||
niterations=nhardmin
|
||||
return
|
||||
end subroutine osd174
|
||||
@@ -0,0 +1,182 @@
|
||||
// boost\math\tools\promotion.hpp
|
||||
|
||||
// Copyright John Maddock 2006.
|
||||
// Copyright Paul A. Bristow 2006.
|
||||
|
||||
// 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)
|
||||
|
||||
// Promote arguments functions to allow math functions to have arguments
|
||||
// provided as integer OR real (floating-point, built-in or UDT)
|
||||
// (called ArithmeticType in functions that use promotion)
|
||||
// that help to reduce the risk of creating multiple instantiations.
|
||||
// Allows creation of an inline wrapper that forwards to a foo(RT, RT) function,
|
||||
// so you never get to instantiate any mixed foo(RT, IT) functions.
|
||||
|
||||
#ifndef BOOST_MATH_PROMOTION_HPP
|
||||
#define BOOST_MATH_PROMOTION_HPP
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
// Boost type traits:
|
||||
#include <boost/math/tools/config.hpp>
|
||||
#include <boost/type_traits/is_floating_point.hpp> // for boost::is_floating_point;
|
||||
#include <boost/type_traits/is_integral.hpp> // for boost::is_integral
|
||||
#include <boost/type_traits/is_convertible.hpp> // for boost::is_convertible
|
||||
#include <boost/type_traits/is_same.hpp>// for boost::is_same
|
||||
#include <boost/type_traits/remove_cv.hpp>// for boost::remove_cv
|
||||
// Boost Template meta programming:
|
||||
#include <boost/mpl/if.hpp> // for boost::mpl::if_c.
|
||||
#include <boost/mpl/and.hpp> // for boost::mpl::if_c.
|
||||
#include <boost/mpl/or.hpp> // for boost::mpl::if_c.
|
||||
#include <boost/mpl/not.hpp> // for boost::mpl::if_c.
|
||||
|
||||
#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
|
||||
#include <boost/static_assert.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace math
|
||||
{
|
||||
namespace tools
|
||||
{
|
||||
// If either T1 or T2 is an integer type,
|
||||
// pretend it was a double (for the purposes of further analysis).
|
||||
// Then pick the wider of the two floating-point types
|
||||
// as the actual signature to forward to.
|
||||
// For example:
|
||||
// foo(int, short) -> double foo(double, double);
|
||||
// foo(int, float) -> double foo(double, double);
|
||||
// Note: NOT float foo(float, float)
|
||||
// foo(int, double) -> foo(double, double);
|
||||
// foo(double, float) -> double foo(double, double);
|
||||
// foo(double, float) -> double foo(double, double);
|
||||
// foo(any-int-or-float-type, long double) -> foo(long double, long double);
|
||||
// but ONLY float foo(float, float) is unchanged.
|
||||
// So the only way to get an entirely float version is to call foo(1.F, 2.F),
|
||||
// But since most (all?) the math functions convert to double internally,
|
||||
// probably there would not be the hoped-for gain by using float here.
|
||||
|
||||
// This follows the C-compatible conversion rules of pow, etc
|
||||
// where pow(int, float) is converted to pow(double, double).
|
||||
|
||||
template <class T>
|
||||
struct promote_arg
|
||||
{ // If T is integral type, then promote to double.
|
||||
typedef typename mpl::if_<is_integral<T>, double, T>::type type;
|
||||
};
|
||||
// These full specialisations reduce mpl::if_ usage and speed up
|
||||
// compilation:
|
||||
template <> struct promote_arg<float> { typedef float type; };
|
||||
template <> struct promote_arg<double>{ typedef double type; };
|
||||
template <> struct promote_arg<long double> { typedef long double type; };
|
||||
template <> struct promote_arg<int> { typedef double type; };
|
||||
|
||||
template <class T1, class T2>
|
||||
struct promote_args_2
|
||||
{ // Promote, if necessary, & pick the wider of the two floating-point types.
|
||||
// for both parameter types, if integral promote to double.
|
||||
typedef typename promote_arg<T1>::type T1P; // T1 perhaps promoted.
|
||||
typedef typename promote_arg<T2>::type T2P; // T2 perhaps promoted.
|
||||
|
||||
typedef typename mpl::if_<
|
||||
typename mpl::and_<is_floating_point<T1P>, is_floating_point<T2P> >::type, // both T1P and T2P are floating-point?
|
||||
#ifdef BOOST_MATH_USE_FLOAT128
|
||||
typename mpl::if_< typename mpl::or_<is_same<__float128, T1P>, is_same<__float128, T2P> >::type, // either long double?
|
||||
__float128,
|
||||
#endif
|
||||
typename mpl::if_< typename mpl::or_<is_same<long double, T1P>, is_same<long double, T2P> >::type, // either long double?
|
||||
long double, // then result type is long double.
|
||||
typename mpl::if_< typename mpl::or_<is_same<double, T1P>, is_same<double, T2P> >::type, // either double?
|
||||
double, // result type is double.
|
||||
float // else result type is float.
|
||||
>::type
|
||||
#ifdef BOOST_MATH_USE_FLOAT128
|
||||
>::type
|
||||
#endif
|
||||
>::type,
|
||||
// else one or the other is a user-defined type:
|
||||
typename mpl::if_< typename mpl::and_<mpl::not_<is_floating_point<T2P> >, ::boost::is_convertible<T1P, T2P> >, T2P, T1P>::type>::type type;
|
||||
}; // promote_arg2
|
||||
// These full specialisations reduce mpl::if_ usage and speed up
|
||||
// compilation:
|
||||
template <> struct promote_args_2<float, float> { typedef float type; };
|
||||
template <> struct promote_args_2<double, double>{ typedef double type; };
|
||||
template <> struct promote_args_2<long double, long double> { typedef long double type; };
|
||||
template <> struct promote_args_2<int, int> { typedef double type; };
|
||||
template <> struct promote_args_2<int, float> { typedef double type; };
|
||||
template <> struct promote_args_2<float, int> { typedef double type; };
|
||||
template <> struct promote_args_2<int, double> { typedef double type; };
|
||||
template <> struct promote_args_2<double, int> { typedef double type; };
|
||||
template <> struct promote_args_2<int, long double> { typedef long double type; };
|
||||
template <> struct promote_args_2<long double, int> { typedef long double type; };
|
||||
template <> struct promote_args_2<float, double> { typedef double type; };
|
||||
template <> struct promote_args_2<double, float> { typedef double type; };
|
||||
template <> struct promote_args_2<float, long double> { typedef long double type; };
|
||||
template <> struct promote_args_2<long double, float> { typedef long double type; };
|
||||
template <> struct promote_args_2<double, long double> { typedef long double type; };
|
||||
template <> struct promote_args_2<long double, double> { typedef long double type; };
|
||||
|
||||
template <class T1, class T2=float, class T3=float, class T4=float, class T5=float, class T6=float>
|
||||
struct promote_args
|
||||
{
|
||||
typedef typename promote_args_2<
|
||||
typename remove_cv<T1>::type,
|
||||
typename promote_args_2<
|
||||
typename remove_cv<T2>::type,
|
||||
typename promote_args_2<
|
||||
typename remove_cv<T3>::type,
|
||||
typename promote_args_2<
|
||||
typename remove_cv<T4>::type,
|
||||
typename promote_args_2<
|
||||
typename remove_cv<T5>::type, typename remove_cv<T6>::type
|
||||
>::type
|
||||
>::type
|
||||
>::type
|
||||
>::type
|
||||
>::type type;
|
||||
|
||||
#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
|
||||
//
|
||||
// Guard against use of long double if it's not supported:
|
||||
//
|
||||
BOOST_STATIC_ASSERT_MSG((0 == ::boost::is_same<type, long double>::value), "Sorry, but this platform does not have sufficient long double support for the special functions to be reliably implemented.");
|
||||
#endif
|
||||
};
|
||||
|
||||
//
|
||||
// This struct is the same as above, but has no static assert on long double usage,
|
||||
// it should be used only on functions that can be implemented for long double
|
||||
// even when std lib support is missing or broken for that type.
|
||||
//
|
||||
template <class T1, class T2=float, class T3=float, class T4=float, class T5=float, class T6=float>
|
||||
struct promote_args_permissive
|
||||
{
|
||||
typedef typename promote_args_2<
|
||||
typename remove_cv<T1>::type,
|
||||
typename promote_args_2<
|
||||
typename remove_cv<T2>::type,
|
||||
typename promote_args_2<
|
||||
typename remove_cv<T3>::type,
|
||||
typename promote_args_2<
|
||||
typename remove_cv<T4>::type,
|
||||
typename promote_args_2<
|
||||
typename remove_cv<T5>::type, typename remove_cv<T6>::type
|
||||
>::type
|
||||
>::type
|
||||
>::type
|
||||
>::type
|
||||
>::type type;
|
||||
};
|
||||
|
||||
} // namespace tools
|
||||
} // namespace math
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_MATH_PROMOTION_HPP
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// 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_LAMBDA_HPP
|
||||
#define BOOST_COMPUTE_LAMBDA_HPP
|
||||
|
||||
#include <boost/compute/lambda/context.hpp>
|
||||
#include <boost/compute/lambda/functional.hpp>
|
||||
#include <boost/compute/lambda/get.hpp>
|
||||
#include <boost/compute/lambda/make_pair.hpp>
|
||||
#include <boost/compute/lambda/make_tuple.hpp>
|
||||
#include <boost/compute/lambda/placeholders.hpp>
|
||||
#include <boost/compute/lambda/result_of.hpp>
|
||||
|
||||
#endif // BOOST_COMPUTE_LAMBDA_HPP
|
||||
@@ -0,0 +1,158 @@
|
||||
// (C) Copyright John Maddock 2005-2006.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_MATH_TOOLS_SERIES_INCLUDED
|
||||
#define BOOST_MATH_TOOLS_SERIES_INCLUDED
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/config/no_tr1/cmath.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/math/tools/config.hpp>
|
||||
|
||||
namespace boost{ namespace math{ namespace tools{
|
||||
|
||||
//
|
||||
// Simple series summation come first:
|
||||
//
|
||||
template <class Functor, class U, class V>
|
||||
inline typename Functor::result_type sum_series(Functor& func, const U& factor, boost::uintmax_t& max_terms, const V& init_value) BOOST_NOEXCEPT_IF(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval<Functor>()()))
|
||||
{
|
||||
BOOST_MATH_STD_USING
|
||||
|
||||
typedef typename Functor::result_type result_type;
|
||||
|
||||
boost::uintmax_t counter = max_terms;
|
||||
|
||||
result_type result = init_value;
|
||||
result_type next_term;
|
||||
do{
|
||||
next_term = func();
|
||||
result += next_term;
|
||||
}
|
||||
while((fabs(factor * result) < fabs(next_term)) && --counter);
|
||||
|
||||
// set max_terms to the actual number of terms of the series evaluated:
|
||||
max_terms = max_terms - counter;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class Functor, class U>
|
||||
inline typename Functor::result_type sum_series(Functor& func, const U& factor, boost::uintmax_t& max_terms) BOOST_NOEXCEPT_IF(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval<Functor>()()))
|
||||
{
|
||||
typename Functor::result_type init_value = 0;
|
||||
return sum_series(func, factor, max_terms, init_value);
|
||||
}
|
||||
|
||||
template <class Functor, class U>
|
||||
inline typename Functor::result_type sum_series(Functor& func, int bits, boost::uintmax_t& max_terms, const U& init_value) BOOST_NOEXCEPT_IF(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval<Functor>()()))
|
||||
{
|
||||
BOOST_MATH_STD_USING
|
||||
typedef typename Functor::result_type result_type;
|
||||
result_type factor = ldexp(result_type(1), 1 - bits);
|
||||
return sum_series(func, factor, max_terms, init_value);
|
||||
}
|
||||
|
||||
template <class Functor>
|
||||
inline typename Functor::result_type sum_series(Functor& func, int bits) BOOST_NOEXCEPT_IF(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval<Functor>()()))
|
||||
{
|
||||
BOOST_MATH_STD_USING
|
||||
typedef typename Functor::result_type result_type;
|
||||
boost::uintmax_t iters = (std::numeric_limits<boost::uintmax_t>::max)();
|
||||
result_type init_val = 0;
|
||||
return sum_series(func, bits, iters, init_val);
|
||||
}
|
||||
|
||||
template <class Functor>
|
||||
inline typename Functor::result_type sum_series(Functor& func, int bits, boost::uintmax_t& max_terms) BOOST_NOEXCEPT_IF(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval<Functor>()()))
|
||||
{
|
||||
BOOST_MATH_STD_USING
|
||||
typedef typename Functor::result_type result_type;
|
||||
result_type init_val = 0;
|
||||
return sum_series(func, bits, max_terms, init_val);
|
||||
}
|
||||
|
||||
template <class Functor, class U>
|
||||
inline typename Functor::result_type sum_series(Functor& func, int bits, const U& init_value) BOOST_NOEXCEPT_IF(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval<Functor>()()))
|
||||
{
|
||||
BOOST_MATH_STD_USING
|
||||
boost::uintmax_t iters = (std::numeric_limits<boost::uintmax_t>::max)();
|
||||
return sum_series(func, bits, iters, init_value);
|
||||
}
|
||||
|
||||
//
|
||||
// Algorithm kahan_sum_series invokes Functor func until the N'th
|
||||
// term is too small to have any effect on the total, the terms
|
||||
// are added using the Kahan summation method.
|
||||
//
|
||||
// CAUTION: Optimizing compilers combined with extended-precision
|
||||
// machine registers conspire to render this algorithm partly broken:
|
||||
// double rounding of intermediate terms (first to a long double machine
|
||||
// register, and then to a double result) cause the rounding error computed
|
||||
// by the algorithm to be off by up to 1ulp. However this occurs rarely, and
|
||||
// in any case the result is still much better than a naive summation.
|
||||
//
|
||||
template <class Functor>
|
||||
inline typename Functor::result_type kahan_sum_series(Functor& func, int bits) BOOST_NOEXCEPT_IF(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval<Functor>()()))
|
||||
{
|
||||
BOOST_MATH_STD_USING
|
||||
|
||||
typedef typename Functor::result_type result_type;
|
||||
|
||||
result_type factor = pow(result_type(2), bits);
|
||||
result_type result = func();
|
||||
result_type next_term, y, t;
|
||||
result_type carry = 0;
|
||||
do{
|
||||
next_term = func();
|
||||
y = next_term - carry;
|
||||
t = result + y;
|
||||
carry = t - result;
|
||||
carry -= y;
|
||||
result = t;
|
||||
}
|
||||
while(fabs(result) < fabs(factor * next_term));
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class Functor>
|
||||
inline typename Functor::result_type kahan_sum_series(Functor& func, int bits, boost::uintmax_t& max_terms) BOOST_NOEXCEPT_IF(BOOST_MATH_IS_FLOAT(typename Functor::result_type) && noexcept(std::declval<Functor>()()))
|
||||
{
|
||||
BOOST_MATH_STD_USING
|
||||
|
||||
typedef typename Functor::result_type result_type;
|
||||
|
||||
boost::uintmax_t counter = max_terms;
|
||||
|
||||
result_type factor = ldexp(result_type(1), bits);
|
||||
result_type result = func();
|
||||
result_type next_term, y, t;
|
||||
result_type carry = 0;
|
||||
do{
|
||||
next_term = func();
|
||||
y = next_term - carry;
|
||||
t = result + y;
|
||||
carry = t - result;
|
||||
carry -= y;
|
||||
result = t;
|
||||
}
|
||||
while((fabs(result) < fabs(factor * next_term)) && --counter);
|
||||
|
||||
// set max_terms to the actual number of terms of the series evaluated:
|
||||
max_terms = max_terms - counter;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace tools
|
||||
} // namespace math
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_MATH_TOOLS_SERIES_INCLUDED
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_TEMPLATE_ARITY_FWD_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_TEMPLATE_ARITY_FWD_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2001-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$
|
||||
|
||||
namespace boost { namespace mpl { namespace aux {
|
||||
|
||||
template< typename F > struct template_arity;
|
||||
|
||||
}}}
|
||||
|
||||
#endif // BOOST_MPL_AUX_TEMPLATE_ARITY_FWD_HPP_INCLUDED
|
||||
@@ -0,0 +1,97 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTERPROCESS_DETAIL_WINAPI_WRAPPER_COMMON_HPP
|
||||
#define BOOST_INTERPROCESS_DETAIL_WINAPI_WRAPPER_COMMON_HPP
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
# include <boost/config.hpp>
|
||||
#endif
|
||||
#
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
#include <boost/interprocess/detail/win32_api.hpp>
|
||||
#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
|
||||
#include <boost/interprocess/errors.hpp>
|
||||
#include <boost/interprocess/exceptions.hpp>
|
||||
#include <limits>
|
||||
|
||||
namespace boost {
|
||||
namespace interprocess {
|
||||
namespace ipcdetail {
|
||||
|
||||
inline void winapi_wrapper_wait_for_single_object(void *handle)
|
||||
{
|
||||
unsigned long ret = winapi::wait_for_single_object(handle, winapi::infinite_time);
|
||||
if(ret != winapi::wait_object_0){
|
||||
if(ret != winapi::wait_abandoned){
|
||||
error_info err = system_error_code();
|
||||
throw interprocess_exception(err);
|
||||
}
|
||||
else{ //Special case for orphaned mutexes
|
||||
winapi::release_mutex(handle);
|
||||
throw interprocess_exception(owner_dead_error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline bool winapi_wrapper_try_wait_for_single_object(void *handle)
|
||||
{
|
||||
unsigned long ret = winapi::wait_for_single_object(handle, 0);
|
||||
if(ret == winapi::wait_object_0){
|
||||
return true;
|
||||
}
|
||||
else if(ret == winapi::wait_timeout){
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
error_info err = system_error_code();
|
||||
throw interprocess_exception(err);
|
||||
}
|
||||
}
|
||||
|
||||
inline bool winapi_wrapper_timed_wait_for_single_object(void *handle, const boost::posix_time::ptime &abs_time)
|
||||
{
|
||||
//Windows does not support infinity abs_time so check it
|
||||
if(abs_time == boost::posix_time::pos_infin){
|
||||
winapi_wrapper_wait_for_single_object(handle);
|
||||
return true;
|
||||
}
|
||||
const boost::posix_time::ptime cur_time = microsec_clock::universal_time();
|
||||
//Windows uses relative wait times so check for negative waits
|
||||
//and implement as 0 wait to allow try-semantics as POSIX mandates.
|
||||
unsigned long ret = winapi::wait_for_single_object
|
||||
( handle
|
||||
, (abs_time <= cur_time) ? 0u
|
||||
: (abs_time - cur_time).total_milliseconds()
|
||||
);
|
||||
if(ret == winapi::wait_object_0){
|
||||
return true;
|
||||
}
|
||||
else if(ret == winapi::wait_timeout){
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
error_info err = system_error_code();
|
||||
throw interprocess_exception(err);
|
||||
}
|
||||
}
|
||||
|
||||
} //namespace ipcdetail {
|
||||
} //namespace interprocess {
|
||||
} //namespace boost {
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_INTERPROCESS_DETAIL_WINAPI_MUTEX_WRAPPER_HPP
|
||||
@@ -0,0 +1,35 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Thorsten Ottosen 2003-2004. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
|
||||
#ifndef BOOST_RANGE_DETAIL_SIZER_HPP
|
||||
#define BOOST_RANGE_DETAIL_SIZER_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/range/config.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// constant array size
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
template< typename T, std::size_t sz >
|
||||
char (& sizer( const T BOOST_RANGE_ARRAY_REF()[sz] ) )[sz];
|
||||
|
||||
template< typename T, std::size_t sz >
|
||||
char (& sizer( T BOOST_RANGE_ARRAY_REF()[sz] ) )[sz];
|
||||
|
||||
} // namespace 'boost'
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,120 @@
|
||||
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
|
||||
// unit/quantity manipulation and conversion
|
||||
//
|
||||
// Copyright (C) 2003-2008 Matthias Christian Schabel
|
||||
// Copyright (C) 2008 Steven Watanabe
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_UNITS_DETAIL_ONE_HPP
|
||||
#define BOOST_UNITS_DETAIL_ONE_HPP
|
||||
|
||||
#include <boost/units/operators.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace units {
|
||||
|
||||
struct one { one() {} };
|
||||
|
||||
// workaround for pathscale.
|
||||
inline one make_one() {
|
||||
one result;
|
||||
return(result);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
struct multiply_typeof_helper<one, T>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct multiply_typeof_helper<T, one>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct multiply_typeof_helper<one, one>
|
||||
{
|
||||
typedef one type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
inline T operator*(const one&, const T& t)
|
||||
{
|
||||
return(t);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline T operator*(const T& t, const one&)
|
||||
{
|
||||
return(t);
|
||||
}
|
||||
|
||||
inline one operator*(const one&, const one&)
|
||||
{
|
||||
one result;
|
||||
return(result);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
struct divide_typeof_helper<T, one>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct divide_typeof_helper<one, T>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct divide_typeof_helper<one, one>
|
||||
{
|
||||
typedef one type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
inline T operator/(const T& t, const one&)
|
||||
{
|
||||
return(t);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline T operator/(const one&, const T& t)
|
||||
{
|
||||
return(1/t);
|
||||
}
|
||||
|
||||
inline one operator/(const one&, const one&)
|
||||
{
|
||||
one result;
|
||||
return(result);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline bool operator>(const boost::units::one&, const T& t) {
|
||||
return(1 > t);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
T one_to_double(const T& t) { return t; }
|
||||
|
||||
inline double one_to_double(const one&) { return 1.0; }
|
||||
|
||||
template<class T>
|
||||
struct one_to_double_type { typedef T type; };
|
||||
|
||||
template<>
|
||||
struct one_to_double_type<one> { typedef double type; };
|
||||
|
||||
} // namespace units
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,112 @@
|
||||
/* Boost interval/detail/sparc_rounding_control.hpp file
|
||||
*
|
||||
* Copyright 2000 Jens Maurer
|
||||
* Copyright 2002 Hervé Brönnimann, Guillaume Melquiond, Sylvain Pion
|
||||
*
|
||||
* 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)
|
||||
*
|
||||
* The basic code in this file was kindly provided by Jeremy Siek.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_NUMERIC_INTERVAL_DETAIL_SPARC_ROUNDING_CONTROL_HPP
|
||||
#define BOOST_NUMERIC_INTERVAL_DETAIL_SPARC_ROUNDING_CONTROL_HPP
|
||||
|
||||
#if !defined(sparc) && !defined(__sparc__)
|
||||
# error This header is only intended for SPARC CPUs.
|
||||
#endif
|
||||
|
||||
#ifdef __SUNPRO_CC
|
||||
# include <ieeefp.h>
|
||||
#endif
|
||||
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace interval_lib {
|
||||
namespace detail {
|
||||
|
||||
struct sparc_rounding_control
|
||||
{
|
||||
typedef unsigned int rounding_mode;
|
||||
|
||||
static void set_rounding_mode(const rounding_mode& mode)
|
||||
{
|
||||
# if defined(__GNUC__)
|
||||
__asm__ __volatile__("ld %0, %%fsr" : : "m"(mode));
|
||||
# elif defined (__SUNPRO_CC)
|
||||
fpsetround(fp_rnd(mode));
|
||||
# elif defined(__KCC)
|
||||
asm("sethi %hi(mode), %o1");
|
||||
asm("ld [%o1+%lo(mode)], %fsr");
|
||||
# else
|
||||
# error Unsupported compiler for Sparc rounding control.
|
||||
# endif
|
||||
}
|
||||
|
||||
static void get_rounding_mode(rounding_mode& mode)
|
||||
{
|
||||
# if defined(__GNUC__)
|
||||
__asm__ __volatile__("st %%fsr, %0" : "=m"(mode));
|
||||
# elif defined (__SUNPRO_CC)
|
||||
mode = fpgetround();
|
||||
# elif defined(__KCC)
|
||||
# error KCC on Sun SPARC get_round_mode: please fix me
|
||||
asm("st %fsr, [mode]");
|
||||
# else
|
||||
# error Unsupported compiler for Sparc rounding control.
|
||||
# endif
|
||||
}
|
||||
|
||||
#if defined(__SUNPRO_CC)
|
||||
static void downward() { set_rounding_mode(FP_RM); }
|
||||
static void upward() { set_rounding_mode(FP_RP); }
|
||||
static void to_nearest() { set_rounding_mode(FP_RN); }
|
||||
static void toward_zero() { set_rounding_mode(FP_RZ); }
|
||||
#else
|
||||
static void downward() { set_rounding_mode(0xc0000000); }
|
||||
static void upward() { set_rounding_mode(0x80000000); }
|
||||
static void to_nearest() { set_rounding_mode(0x00000000); }
|
||||
static void toward_zero() { set_rounding_mode(0x40000000); }
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
extern "C" {
|
||||
float rintf(float);
|
||||
double rint(double);
|
||||
}
|
||||
|
||||
template<>
|
||||
struct rounding_control<float>:
|
||||
detail::sparc_rounding_control
|
||||
{
|
||||
static const float& force_rounding(const float& x) { return x; }
|
||||
static float to_int(const float& x) { return rintf(x); }
|
||||
};
|
||||
|
||||
template<>
|
||||
struct rounding_control<double>:
|
||||
detail::sparc_rounding_control
|
||||
{
|
||||
static const double& force_rounding(const double& x) { return x; }
|
||||
static double to_int(const double& x) { return rint(x); }
|
||||
};
|
||||
|
||||
template<>
|
||||
struct rounding_control<long double>:
|
||||
detail::sparc_rounding_control
|
||||
{
|
||||
static const long double& force_rounding(const long double& x) { return x; }
|
||||
static long double to_int(const long double& x) { return rint(x); }
|
||||
};
|
||||
|
||||
} // namespace interval_lib
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#undef BOOST_NUMERIC_INTERVAL_NO_HARDWARE
|
||||
|
||||
#endif /* BOOST_NUMERIC_INTERVAL_DETAIL_SPARC_ROUNDING_CONTROL_HPP */
|
||||
@@ -0,0 +1,354 @@
|
||||
|
||||
#if !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
///// header body
|
||||
|
||||
#ifndef BOOST_MPL_AUX_FULL_LAMBDA_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_FULL_LAMBDA_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2001-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$
|
||||
|
||||
#if !defined(BOOST_MPL_PREPROCESSING_MODE)
|
||||
# include <boost/mpl/lambda_fwd.hpp>
|
||||
# include <boost/mpl/bind_fwd.hpp>
|
||||
# include <boost/mpl/protect.hpp>
|
||||
# include <boost/mpl/quote.hpp>
|
||||
# include <boost/mpl/arg.hpp>
|
||||
# include <boost/mpl/bool.hpp>
|
||||
# include <boost/mpl/int_fwd.hpp>
|
||||
# include <boost/mpl/aux_/template_arity.hpp>
|
||||
# include <boost/mpl/aux_/na_spec.hpp>
|
||||
# include <boost/mpl/aux_/config/ttp.hpp>
|
||||
# if defined(BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING)
|
||||
# include <boost/mpl/if.hpp>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <boost/mpl/aux_/lambda_arity_param.hpp>
|
||||
#include <boost/mpl/aux_/config/use_preprocessed.hpp>
|
||||
|
||||
#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
|
||||
&& !defined(BOOST_MPL_PREPROCESSING_MODE)
|
||||
|
||||
# define BOOST_MPL_PREPROCESSED_HEADER full_lambda.hpp
|
||||
# include <boost/mpl/aux_/include_preprocessed.hpp>
|
||||
|
||||
#else
|
||||
|
||||
# include <boost/mpl/limits/arity.hpp>
|
||||
# include <boost/mpl/aux_/preprocessor/default_params.hpp>
|
||||
# include <boost/mpl/aux_/preprocessor/params.hpp>
|
||||
# include <boost/mpl/aux_/preprocessor/enum.hpp>
|
||||
# include <boost/mpl/aux_/preprocessor/repeat.hpp>
|
||||
# include <boost/mpl/aux_/config/dmc_ambiguous_ctps.hpp>
|
||||
|
||||
# include <boost/preprocessor/iterate.hpp>
|
||||
# include <boost/preprocessor/comma_if.hpp>
|
||||
# include <boost/preprocessor/inc.hpp>
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
// local macros, #undef-ined at the end of the header
|
||||
# define AUX778076_LAMBDA_PARAMS(i_, param) \
|
||||
BOOST_MPL_PP_PARAMS(i_, param) \
|
||||
/**/
|
||||
|
||||
# define AUX778076_BIND_PARAMS(param) \
|
||||
BOOST_MPL_PP_PARAMS( \
|
||||
BOOST_MPL_LIMIT_METAFUNCTION_ARITY \
|
||||
, param \
|
||||
) \
|
||||
/**/
|
||||
|
||||
# define AUX778076_BIND_N_PARAMS(i_, param) \
|
||||
BOOST_PP_COMMA_IF(i_) \
|
||||
BOOST_MPL_PP_PARAMS(i_, param) \
|
||||
/**/
|
||||
|
||||
# define AUX778076_ARITY_PARAM(param) \
|
||||
BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(param) \
|
||||
/**/
|
||||
|
||||
|
||||
#define n_ BOOST_MPL_LIMIT_METAFUNCTION_ARITY
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
BOOST_MPL_PP_DEFAULT_PARAMS(n_,bool C,false)
|
||||
>
|
||||
struct lambda_or
|
||||
: true_
|
||||
{
|
||||
};
|
||||
|
||||
template<>
|
||||
struct lambda_or< BOOST_MPL_PP_ENUM(n_,false) >
|
||||
: false_
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
#undef n_
|
||||
|
||||
template<
|
||||
typename T
|
||||
, typename Tag
|
||||
AUX778076_ARITY_PARAM(typename Arity)
|
||||
>
|
||||
struct lambda
|
||||
{
|
||||
typedef false_ is_le;
|
||||
typedef T result_;
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T
|
||||
>
|
||||
struct is_lambda_expression
|
||||
: lambda<T>::is_le
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
template< int N, typename Tag >
|
||||
struct lambda< arg<N>,Tag AUX778076_ARITY_PARAM(int_<-1>) >
|
||||
{
|
||||
typedef true_ is_le;
|
||||
typedef mpl::arg<N> result_; // qualified for the sake of MIPSpro 7.41
|
||||
typedef mpl::protect<result_> type;
|
||||
};
|
||||
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, <boost/mpl/aux_/full_lambda.hpp>))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
/// special case for 'protect'
|
||||
template< typename T, typename Tag >
|
||||
struct lambda< mpl::protect<T>,Tag AUX778076_ARITY_PARAM(int_<1>) >
|
||||
{
|
||||
typedef false_ is_le;
|
||||
typedef mpl::protect<T> result_;
|
||||
typedef result_ type;
|
||||
};
|
||||
|
||||
/// specializations for the main 'bind' form
|
||||
template<
|
||||
typename F, AUX778076_BIND_PARAMS(typename T)
|
||||
, typename Tag
|
||||
>
|
||||
struct lambda<
|
||||
bind<F,AUX778076_BIND_PARAMS(T)>
|
||||
, Tag
|
||||
AUX778076_ARITY_PARAM(int_<BOOST_PP_INC(BOOST_MPL_LIMIT_METAFUNCTION_ARITY)>)
|
||||
>
|
||||
{
|
||||
typedef false_ is_le;
|
||||
typedef bind<F, AUX778076_BIND_PARAMS(T)> result_;
|
||||
typedef result_ type;
|
||||
};
|
||||
|
||||
|
||||
#if defined(BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING)
|
||||
|
||||
template<
|
||||
typename F
|
||||
, typename Tag1
|
||||
, typename Tag2
|
||||
, typename Arity
|
||||
>
|
||||
struct lambda<
|
||||
lambda<F,Tag1,Arity>
|
||||
, Tag2
|
||||
, int_<3>
|
||||
>
|
||||
{
|
||||
typedef lambda< F,Tag2 > l1;
|
||||
typedef lambda< Tag1,Tag2 > l2;
|
||||
|
||||
typedef typename l1::is_le is_le;
|
||||
typedef bind1< quote1<aux::template_arity>, typename l1::result_ > arity_;
|
||||
typedef lambda< typename if_<is_le,arity_,Arity>::type,Tag2 > l3;
|
||||
|
||||
typedef aux::le_result3<is_le, Tag2, mpl::lambda, l1, l2, l3> le_result_;
|
||||
typedef typename le_result_::result_ result_;
|
||||
typedef typename le_result_::type type;
|
||||
};
|
||||
|
||||
#elif !defined(BOOST_MPL_CFG_DMC_AMBIGUOUS_CTPS)
|
||||
|
||||
/// workaround for MWCW 8.3+/EDG < 303, leads to ambiguity on Digital Mars
|
||||
template<
|
||||
typename F, typename Tag1, typename Tag2
|
||||
>
|
||||
struct lambda<
|
||||
lambda< F,Tag1 >
|
||||
, Tag2
|
||||
>
|
||||
{
|
||||
typedef lambda< F,Tag2 > l1;
|
||||
typedef lambda< Tag1,Tag2 > l2;
|
||||
|
||||
typedef typename l1::is_le is_le;
|
||||
typedef aux::le_result2<is_le, Tag2, mpl::lambda, l1, l2> le_result_;
|
||||
typedef typename le_result_::result_ result_;
|
||||
typedef typename le_result_::type type;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
# undef AUX778076_ARITY_PARAM
|
||||
# undef AUX778076_BIND_N_PARAMS
|
||||
# undef AUX778076_BIND_PARAMS
|
||||
# undef AUX778076_LAMBDA_PARAMS
|
||||
|
||||
#if !defined(BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING)
|
||||
BOOST_MPL_AUX_NA_SPEC(2, lambda)
|
||||
#else
|
||||
BOOST_MPL_AUX_NA_SPEC2(2, 3, lambda)
|
||||
#endif
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
|
||||
#endif // BOOST_MPL_AUX_FULL_LAMBDA_HPP_INCLUDED
|
||||
|
||||
///// iteration, depth == 1
|
||||
|
||||
// For gcc 4.4 compatability, we must include the
|
||||
// BOOST_PP_ITERATION_DEPTH test inside an #else clause.
|
||||
#else // BOOST_PP_IS_ITERATING
|
||||
#if BOOST_PP_ITERATION_DEPTH() == 1
|
||||
#define i_ BOOST_PP_FRAME_ITERATION(1)
|
||||
|
||||
#if i_ > 0
|
||||
|
||||
namespace aux {
|
||||
|
||||
# define AUX778076_RESULT(unused, i_, T) \
|
||||
BOOST_PP_COMMA_IF(i_) \
|
||||
typename BOOST_PP_CAT(T, BOOST_PP_INC(i_))::result_ \
|
||||
/**/
|
||||
|
||||
# define AUX778076_TYPE(unused, i_, T) \
|
||||
BOOST_PP_COMMA_IF(i_) \
|
||||
typename BOOST_PP_CAT(T, BOOST_PP_INC(i_))::type \
|
||||
/**/
|
||||
|
||||
template<
|
||||
typename IsLE, typename Tag
|
||||
, template< AUX778076_LAMBDA_PARAMS(i_, typename P) > class F
|
||||
, AUX778076_LAMBDA_PARAMS(i_, typename L)
|
||||
>
|
||||
struct BOOST_PP_CAT(le_result,i_)
|
||||
{
|
||||
typedef F<
|
||||
BOOST_MPL_PP_REPEAT(i_, AUX778076_TYPE, L)
|
||||
> result_;
|
||||
|
||||
typedef result_ type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename Tag
|
||||
, template< AUX778076_LAMBDA_PARAMS(i_, typename P) > class F
|
||||
, AUX778076_LAMBDA_PARAMS(i_, typename L)
|
||||
>
|
||||
struct BOOST_PP_CAT(le_result,i_)< true_,Tag,F,AUX778076_LAMBDA_PARAMS(i_, L) >
|
||||
{
|
||||
typedef BOOST_PP_CAT(bind,i_)<
|
||||
BOOST_PP_CAT(quote,i_)<F,Tag>
|
||||
, BOOST_MPL_PP_REPEAT(i_, AUX778076_RESULT, L)
|
||||
> result_;
|
||||
|
||||
typedef mpl::protect<result_> type;
|
||||
};
|
||||
|
||||
# undef AUX778076_TYPE
|
||||
# undef AUX778076_RESULT
|
||||
|
||||
} // namespace aux
|
||||
|
||||
|
||||
# define AUX778076_LAMBDA_TYPEDEF(unused, i_, T) \
|
||||
typedef lambda< BOOST_PP_CAT(T, BOOST_PP_INC(i_)), Tag > \
|
||||
BOOST_PP_CAT(l,BOOST_PP_INC(i_)); \
|
||||
/**/
|
||||
|
||||
# define AUX778076_IS_LE_TYPEDEF(unused, i_, unused2) \
|
||||
typedef typename BOOST_PP_CAT(l,BOOST_PP_INC(i_))::is_le \
|
||||
BOOST_PP_CAT(is_le,BOOST_PP_INC(i_)); \
|
||||
/**/
|
||||
|
||||
# define AUX778076_IS_LAMBDA_EXPR(unused, i_, unused2) \
|
||||
BOOST_PP_COMMA_IF(i_) \
|
||||
BOOST_PP_CAT(is_le,BOOST_PP_INC(i_))::value \
|
||||
/**/
|
||||
|
||||
template<
|
||||
template< AUX778076_LAMBDA_PARAMS(i_, typename P) > class F
|
||||
, AUX778076_LAMBDA_PARAMS(i_, typename T)
|
||||
, typename Tag
|
||||
>
|
||||
struct lambda<
|
||||
F<AUX778076_LAMBDA_PARAMS(i_, T)>
|
||||
, Tag
|
||||
AUX778076_ARITY_PARAM(int_<i_>)
|
||||
>
|
||||
{
|
||||
BOOST_MPL_PP_REPEAT(i_, AUX778076_LAMBDA_TYPEDEF, T)
|
||||
BOOST_MPL_PP_REPEAT(i_, AUX778076_IS_LE_TYPEDEF, unused)
|
||||
|
||||
typedef typename aux::lambda_or<
|
||||
BOOST_MPL_PP_REPEAT(i_, AUX778076_IS_LAMBDA_EXPR, unused)
|
||||
>::type is_le;
|
||||
|
||||
typedef aux::BOOST_PP_CAT(le_result,i_)<
|
||||
is_le, Tag, F, AUX778076_LAMBDA_PARAMS(i_, l)
|
||||
> le_result_;
|
||||
|
||||
typedef typename le_result_::result_ result_;
|
||||
typedef typename le_result_::type type;
|
||||
};
|
||||
|
||||
|
||||
# undef AUX778076_IS_LAMBDA_EXPR
|
||||
# undef AUX778076_IS_LE_TYPEDEF
|
||||
# undef AUX778076_LAMBDA_TYPEDEF
|
||||
|
||||
#endif // i_ > 0
|
||||
|
||||
template<
|
||||
typename F AUX778076_BIND_N_PARAMS(i_, typename T)
|
||||
, typename Tag
|
||||
>
|
||||
struct lambda<
|
||||
BOOST_PP_CAT(bind,i_)<F AUX778076_BIND_N_PARAMS(i_, T)>
|
||||
, Tag
|
||||
AUX778076_ARITY_PARAM(int_<BOOST_PP_INC(i_)>)
|
||||
>
|
||||
{
|
||||
typedef false_ is_le;
|
||||
typedef BOOST_PP_CAT(bind,i_)<
|
||||
F
|
||||
AUX778076_BIND_N_PARAMS(i_, T)
|
||||
> result_;
|
||||
|
||||
typedef result_ type;
|
||||
};
|
||||
|
||||
#undef i_
|
||||
#endif // BOOST_PP_ITERATION_DEPTH()
|
||||
#endif // BOOST_PP_IS_ITERATING
|
||||
@@ -0,0 +1,99 @@
|
||||
/* Boost interval/detail/ppc_rounding_control.hpp file
|
||||
*
|
||||
* Copyright 2000 Jens Maurer
|
||||
* Copyright 2002 Hervé Brönnimann, Guillaume Melquiond, Sylvain Pion
|
||||
* Copyright 2005 Guillaume Melquiond
|
||||
*
|
||||
* 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_INTERVAL_DETAIL_PPC_ROUNDING_CONTROL_HPP
|
||||
#define BOOST_NUMERIC_INTERVAL_DETAIL_PPC_ROUNDING_CONTROL_HPP
|
||||
|
||||
#if !defined(powerpc) && !defined(__powerpc__) && !defined(__ppc__)
|
||||
#error This header only works on PPC CPUs.
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__ ) || (__IBMCPP__ >= 700)
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace interval_lib {
|
||||
namespace detail {
|
||||
|
||||
typedef union {
|
||||
::boost::long_long_type imode;
|
||||
double dmode;
|
||||
} rounding_mode_struct;
|
||||
|
||||
static const rounding_mode_struct mode_upward = { 0xFFF8000000000002LL };
|
||||
static const rounding_mode_struct mode_downward = { 0xFFF8000000000003LL };
|
||||
static const rounding_mode_struct mode_to_nearest = { 0xFFF8000000000000LL };
|
||||
static const rounding_mode_struct mode_toward_zero = { 0xFFF8000000000001LL };
|
||||
|
||||
struct ppc_rounding_control
|
||||
{
|
||||
typedef double rounding_mode;
|
||||
|
||||
static void set_rounding_mode(const rounding_mode mode)
|
||||
{ __asm__ __volatile__ ("mtfsf 255,%0" : : "f"(mode)); }
|
||||
|
||||
static void get_rounding_mode(rounding_mode& mode)
|
||||
{ __asm__ __volatile__ ("mffs %0" : "=f"(mode)); }
|
||||
|
||||
static void downward() { set_rounding_mode(mode_downward.dmode); }
|
||||
static void upward() { set_rounding_mode(mode_upward.dmode); }
|
||||
static void to_nearest() { set_rounding_mode(mode_to_nearest.dmode); }
|
||||
static void toward_zero() { set_rounding_mode(mode_toward_zero.dmode); }
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
// Do not declare the following C99 symbols if <math.h> provides them.
|
||||
// Otherwise, conflicts may occur, due to differences between prototypes.
|
||||
#if !defined(_ISOC99_SOURCE) && !defined(__USE_ISOC99)
|
||||
extern "C" {
|
||||
float rintf(float);
|
||||
double rint(double);
|
||||
}
|
||||
#endif
|
||||
|
||||
template<>
|
||||
struct rounding_control<float>:
|
||||
detail::ppc_rounding_control
|
||||
{
|
||||
static float force_rounding(const float r)
|
||||
{
|
||||
float tmp;
|
||||
__asm__ __volatile__ ("frsp %0, %1" : "=f" (tmp) : "f" (r));
|
||||
return tmp;
|
||||
}
|
||||
static float to_int(const float& x) { return rintf(x); }
|
||||
};
|
||||
|
||||
template<>
|
||||
struct rounding_control<double>:
|
||||
detail::ppc_rounding_control
|
||||
{
|
||||
static const double & force_rounding(const double& r) { return r; }
|
||||
static double to_int(const double& r) { return rint(r); }
|
||||
};
|
||||
|
||||
template<>
|
||||
struct rounding_control<long double>:
|
||||
detail::ppc_rounding_control
|
||||
{
|
||||
static const long double & force_rounding(const long double& r) { return r; }
|
||||
static long double to_int(const long double& r) { return rint(r); }
|
||||
};
|
||||
|
||||
} // namespace interval_lib
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#undef BOOST_NUMERIC_INTERVAL_NO_HARDWARE
|
||||
#endif
|
||||
|
||||
#endif /* BOOST_NUMERIC_INTERVAL_DETAIL_PPC_ROUNDING_CONTROL_HPP */
|
||||
@@ -0,0 +1,658 @@
|
||||
/* Copyright 2003-2015 Joaquin M Lopez Munoz.
|
||||
* 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/multi_index for library home page.
|
||||
*
|
||||
* The internal implementation of red-black trees is based on that of SGI STL
|
||||
* stl_tree.h file:
|
||||
*
|
||||
* Copyright (c) 1996,1997
|
||||
* Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Silicon Graphics makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1994
|
||||
* Hewlett-Packard Company
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Hewlett-Packard Company makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BOOST_MULTI_INDEX_DETAIL_ORD_INDEX_NODE_HPP
|
||||
#define BOOST_MULTI_INDEX_DETAIL_ORD_INDEX_NODE_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <cstddef>
|
||||
#include <boost/detail/allocator_utilities.hpp>
|
||||
#include <boost/multi_index/detail/raw_ptr.hpp>
|
||||
|
||||
#if !defined(BOOST_MULTI_INDEX_DISABLE_COMPRESSED_ORDERED_INDEX_NODES)
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/multi_index/detail/uintptr_type.hpp>
|
||||
#include <boost/type_traits/alignment_of.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace multi_index{
|
||||
|
||||
namespace detail{
|
||||
|
||||
/* definition of red-black nodes for ordered_index */
|
||||
|
||||
enum ordered_index_color{red=false,black=true};
|
||||
enum ordered_index_side{to_left=false,to_right=true};
|
||||
|
||||
template<typename AugmentPolicy,typename Allocator>
|
||||
struct ordered_index_node_impl; /* fwd decl. */
|
||||
|
||||
template<typename AugmentPolicy,typename Allocator>
|
||||
struct ordered_index_node_std_base
|
||||
{
|
||||
typedef typename
|
||||
boost::detail::allocator::rebind_to<
|
||||
Allocator,
|
||||
ordered_index_node_impl<AugmentPolicy,Allocator>
|
||||
>::type::pointer pointer;
|
||||
typedef typename
|
||||
boost::detail::allocator::rebind_to<
|
||||
Allocator,
|
||||
ordered_index_node_impl<AugmentPolicy,Allocator>
|
||||
>::type::const_pointer const_pointer;
|
||||
typedef ordered_index_color& color_ref;
|
||||
typedef pointer& parent_ref;
|
||||
|
||||
ordered_index_color& color(){return color_;}
|
||||
ordered_index_color color()const{return color_;}
|
||||
pointer& parent(){return parent_;}
|
||||
pointer parent()const{return parent_;}
|
||||
pointer& left(){return left_;}
|
||||
pointer left()const{return left_;}
|
||||
pointer& right(){return right_;}
|
||||
pointer right()const{return right_;}
|
||||
|
||||
private:
|
||||
ordered_index_color color_;
|
||||
pointer parent_;
|
||||
pointer left_;
|
||||
pointer right_;
|
||||
};
|
||||
|
||||
#if !defined(BOOST_MULTI_INDEX_DISABLE_COMPRESSED_ORDERED_INDEX_NODES)
|
||||
/* If ordered_index_node_impl has even alignment, we can use the least
|
||||
* significant bit of one of the ordered_index_node_impl pointers to
|
||||
* store color information. This typically reduces the size of
|
||||
* ordered_index_node_impl by 25%.
|
||||
*/
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
/* This code casts pointers to an integer type that has been computed
|
||||
* to be large enough to hold the pointer, however the metaprogramming
|
||||
* logic is not always spotted by the VC++ code analyser that issues a
|
||||
* long list of warnings.
|
||||
*/
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4312 4311)
|
||||
#endif
|
||||
|
||||
template<typename AugmentPolicy,typename Allocator>
|
||||
struct ordered_index_node_compressed_base
|
||||
{
|
||||
typedef ordered_index_node_impl<
|
||||
AugmentPolicy,Allocator>* pointer;
|
||||
typedef const ordered_index_node_impl<
|
||||
AugmentPolicy,Allocator>* const_pointer;
|
||||
|
||||
struct color_ref
|
||||
{
|
||||
color_ref(uintptr_type* r_):r(r_){}
|
||||
|
||||
operator ordered_index_color()const
|
||||
{
|
||||
return ordered_index_color(*r&uintptr_type(1));
|
||||
}
|
||||
|
||||
color_ref& operator=(ordered_index_color c)
|
||||
{
|
||||
*r&=~uintptr_type(1);
|
||||
*r|=uintptr_type(c);
|
||||
return *this;
|
||||
}
|
||||
|
||||
color_ref& operator=(const color_ref& x)
|
||||
{
|
||||
return operator=(x.operator ordered_index_color());
|
||||
}
|
||||
|
||||
private:
|
||||
uintptr_type* r;
|
||||
};
|
||||
|
||||
struct parent_ref
|
||||
{
|
||||
parent_ref(uintptr_type* r_):r(r_){}
|
||||
|
||||
operator pointer()const
|
||||
{
|
||||
return (pointer)(void*)(*r&~uintptr_type(1));
|
||||
}
|
||||
|
||||
parent_ref& operator=(pointer p)
|
||||
{
|
||||
*r=((uintptr_type)(void*)p)|(*r&uintptr_type(1));
|
||||
return *this;
|
||||
}
|
||||
|
||||
parent_ref& operator=(const parent_ref& x)
|
||||
{
|
||||
return operator=(x.operator pointer());
|
||||
}
|
||||
|
||||
pointer operator->()const
|
||||
{
|
||||
return operator pointer();
|
||||
}
|
||||
|
||||
private:
|
||||
uintptr_type* r;
|
||||
};
|
||||
|
||||
color_ref color(){return color_ref(&parentcolor_);}
|
||||
ordered_index_color color()const
|
||||
{
|
||||
return ordered_index_color(parentcolor_&uintptr_type(1));
|
||||
}
|
||||
|
||||
parent_ref parent(){return parent_ref(&parentcolor_);}
|
||||
pointer parent()const
|
||||
{
|
||||
return (pointer)(void*)(parentcolor_&~uintptr_type(1));
|
||||
}
|
||||
|
||||
pointer& left(){return left_;}
|
||||
pointer left()const{return left_;}
|
||||
pointer& right(){return right_;}
|
||||
pointer right()const{return right_;}
|
||||
|
||||
private:
|
||||
uintptr_type parentcolor_;
|
||||
pointer left_;
|
||||
pointer right_;
|
||||
};
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
template<typename AugmentPolicy,typename Allocator>
|
||||
struct ordered_index_node_impl_base:
|
||||
|
||||
#if !defined(BOOST_MULTI_INDEX_DISABLE_COMPRESSED_ORDERED_INDEX_NODES)
|
||||
AugmentPolicy::template augmented_node<
|
||||
typename mpl::if_c<
|
||||
!(has_uintptr_type::value)||
|
||||
(alignment_of<
|
||||
ordered_index_node_compressed_base<AugmentPolicy,Allocator>
|
||||
>::value%2)||
|
||||
!(is_same<
|
||||
typename boost::detail::allocator::rebind_to<
|
||||
Allocator,
|
||||
ordered_index_node_impl<AugmentPolicy,Allocator>
|
||||
>::type::pointer,
|
||||
ordered_index_node_impl<AugmentPolicy,Allocator>*>::value),
|
||||
ordered_index_node_std_base<AugmentPolicy,Allocator>,
|
||||
ordered_index_node_compressed_base<AugmentPolicy,Allocator>
|
||||
>::type
|
||||
>::type
|
||||
#else
|
||||
AugmentPolicy::template augmented_node<
|
||||
ordered_index_node_std_base<AugmentPolicy,Allocator>
|
||||
>::type
|
||||
#endif
|
||||
|
||||
{};
|
||||
|
||||
template<typename AugmentPolicy,typename Allocator>
|
||||
struct ordered_index_node_impl:
|
||||
ordered_index_node_impl_base<AugmentPolicy,Allocator>
|
||||
{
|
||||
private:
|
||||
typedef ordered_index_node_impl_base<AugmentPolicy,Allocator> super;
|
||||
|
||||
public:
|
||||
typedef typename super::color_ref color_ref;
|
||||
typedef typename super::parent_ref parent_ref;
|
||||
typedef typename super::pointer pointer;
|
||||
typedef typename super::const_pointer const_pointer;
|
||||
|
||||
/* interoperability with bidir_node_iterator */
|
||||
|
||||
static void increment(pointer& x)
|
||||
{
|
||||
if(x->right()!=pointer(0)){
|
||||
x=x->right();
|
||||
while(x->left()!=pointer(0))x=x->left();
|
||||
}
|
||||
else{
|
||||
pointer y=x->parent();
|
||||
while(x==y->right()){
|
||||
x=y;
|
||||
y=y->parent();
|
||||
}
|
||||
if(x->right()!=y)x=y;
|
||||
}
|
||||
}
|
||||
|
||||
static void decrement(pointer& x)
|
||||
{
|
||||
if(x->color()==red&&x->parent()->parent()==x){
|
||||
x=x->right();
|
||||
}
|
||||
else if(x->left()!=pointer(0)){
|
||||
pointer y=x->left();
|
||||
while(y->right()!=pointer(0))y=y->right();
|
||||
x=y;
|
||||
}else{
|
||||
pointer y=x->parent();
|
||||
while(x==y->left()){
|
||||
x=y;
|
||||
y=y->parent();
|
||||
}
|
||||
x=y;
|
||||
}
|
||||
}
|
||||
|
||||
/* algorithmic stuff */
|
||||
|
||||
static void rotate_left(pointer x,parent_ref root)
|
||||
{
|
||||
pointer y=x->right();
|
||||
x->right()=y->left();
|
||||
if(y->left()!=pointer(0))y->left()->parent()=x;
|
||||
y->parent()=x->parent();
|
||||
|
||||
if(x==root) root=y;
|
||||
else if(x==x->parent()->left())x->parent()->left()=y;
|
||||
else x->parent()->right()=y;
|
||||
y->left()=x;
|
||||
x->parent()=y;
|
||||
AugmentPolicy::rotate_left(x,y);
|
||||
}
|
||||
|
||||
static pointer minimum(pointer x)
|
||||
{
|
||||
while(x->left()!=pointer(0))x=x->left();
|
||||
return x;
|
||||
}
|
||||
|
||||
static pointer maximum(pointer x)
|
||||
{
|
||||
while(x->right()!=pointer(0))x=x->right();
|
||||
return x;
|
||||
}
|
||||
|
||||
static void rotate_right(pointer x,parent_ref root)
|
||||
{
|
||||
pointer y=x->left();
|
||||
x->left()=y->right();
|
||||
if(y->right()!=pointer(0))y->right()->parent()=x;
|
||||
y->parent()=x->parent();
|
||||
|
||||
if(x==root) root=y;
|
||||
else if(x==x->parent()->right())x->parent()->right()=y;
|
||||
else x->parent()->left()=y;
|
||||
y->right()=x;
|
||||
x->parent()=y;
|
||||
AugmentPolicy::rotate_right(x,y);
|
||||
}
|
||||
|
||||
static void rebalance(pointer x,parent_ref root)
|
||||
{
|
||||
x->color()=red;
|
||||
while(x!=root&&x->parent()->color()==red){
|
||||
if(x->parent()==x->parent()->parent()->left()){
|
||||
pointer y=x->parent()->parent()->right();
|
||||
if(y!=pointer(0)&&y->color()==red){
|
||||
x->parent()->color()=black;
|
||||
y->color()=black;
|
||||
x->parent()->parent()->color()=red;
|
||||
x=x->parent()->parent();
|
||||
}
|
||||
else{
|
||||
if(x==x->parent()->right()){
|
||||
x=x->parent();
|
||||
rotate_left(x,root);
|
||||
}
|
||||
x->parent()->color()=black;
|
||||
x->parent()->parent()->color()=red;
|
||||
rotate_right(x->parent()->parent(),root);
|
||||
}
|
||||
}
|
||||
else{
|
||||
pointer y=x->parent()->parent()->left();
|
||||
if(y!=pointer(0)&&y->color()==red){
|
||||
x->parent()->color()=black;
|
||||
y->color()=black;
|
||||
x->parent()->parent()->color()=red;
|
||||
x=x->parent()->parent();
|
||||
}
|
||||
else{
|
||||
if(x==x->parent()->left()){
|
||||
x=x->parent();
|
||||
rotate_right(x,root);
|
||||
}
|
||||
x->parent()->color()=black;
|
||||
x->parent()->parent()->color()=red;
|
||||
rotate_left(x->parent()->parent(),root);
|
||||
}
|
||||
}
|
||||
}
|
||||
root->color()=black;
|
||||
}
|
||||
|
||||
static void link(
|
||||
pointer x,ordered_index_side side,pointer position,pointer header)
|
||||
{
|
||||
if(side==to_left){
|
||||
position->left()=x; /* also makes leftmost=x when parent==header */
|
||||
if(position==header){
|
||||
header->parent()=x;
|
||||
header->right()=x;
|
||||
}
|
||||
else if(position==header->left()){
|
||||
header->left()=x; /* maintain leftmost pointing to min node */
|
||||
}
|
||||
}
|
||||
else{
|
||||
position->right()=x;
|
||||
if(position==header->right()){
|
||||
header->right()=x; /* maintain rightmost pointing to max node */
|
||||
}
|
||||
}
|
||||
x->parent()=position;
|
||||
x->left()=pointer(0);
|
||||
x->right()=pointer(0);
|
||||
AugmentPolicy::add(x,pointer(header->parent()));
|
||||
ordered_index_node_impl::rebalance(x,header->parent());
|
||||
}
|
||||
|
||||
static pointer rebalance_for_erase(
|
||||
pointer z,parent_ref root,pointer& leftmost,pointer& rightmost)
|
||||
{
|
||||
pointer y=z;
|
||||
pointer x=pointer(0);
|
||||
pointer x_parent=pointer(0);
|
||||
if(y->left()==pointer(0)){ /* z has at most one non-null child. y==z. */
|
||||
x=y->right(); /* x might be null */
|
||||
}
|
||||
else{
|
||||
if(y->right()==pointer(0)){ /* z has exactly one non-null child. y==z. */
|
||||
x=y->left(); /* x is not null */
|
||||
}
|
||||
else{ /* z has two non-null children. Set y to */
|
||||
y=y->right(); /* z's successor. x might be null. */
|
||||
while(y->left()!=pointer(0))y=y->left();
|
||||
x=y->right();
|
||||
}
|
||||
}
|
||||
AugmentPolicy::remove(y,pointer(root));
|
||||
if(y!=z){
|
||||
AugmentPolicy::copy(z,y);
|
||||
z->left()->parent()=y; /* relink y in place of z. y is z's successor */
|
||||
y->left()=z->left();
|
||||
if(y!=z->right()){
|
||||
x_parent=y->parent();
|
||||
if(x!=pointer(0))x->parent()=y->parent();
|
||||
y->parent()->left()=x; /* y must be a child of left */
|
||||
y->right()=z->right();
|
||||
z->right()->parent()=y;
|
||||
}
|
||||
else{
|
||||
x_parent=y;
|
||||
}
|
||||
|
||||
if(root==z) root=y;
|
||||
else if(z->parent()->left()==z)z->parent()->left()=y;
|
||||
else z->parent()->right()=y;
|
||||
y->parent()=z->parent();
|
||||
ordered_index_color c=y->color();
|
||||
y->color()=z->color();
|
||||
z->color()=c;
|
||||
y=z; /* y now points to node to be actually deleted */
|
||||
}
|
||||
else{ /* y==z */
|
||||
x_parent=y->parent();
|
||||
if(x!=pointer(0))x->parent()=y->parent();
|
||||
if(root==z){
|
||||
root=x;
|
||||
}
|
||||
else{
|
||||
if(z->parent()->left()==z)z->parent()->left()=x;
|
||||
else z->parent()->right()=x;
|
||||
}
|
||||
if(leftmost==z){
|
||||
if(z->right()==pointer(0)){ /* z->left() must be null also */
|
||||
leftmost=z->parent();
|
||||
}
|
||||
else{
|
||||
leftmost=minimum(x); /* makes leftmost==header if z==root */
|
||||
}
|
||||
}
|
||||
if(rightmost==z){
|
||||
if(z->left()==pointer(0)){ /* z->right() must be null also */
|
||||
rightmost=z->parent();
|
||||
}
|
||||
else{ /* x==z->left() */
|
||||
rightmost=maximum(x); /* makes rightmost==header if z==root */
|
||||
}
|
||||
}
|
||||
}
|
||||
if(y->color()!=red){
|
||||
while(x!=root&&(x==pointer(0)|| x->color()==black)){
|
||||
if(x==x_parent->left()){
|
||||
pointer w=x_parent->right();
|
||||
if(w->color()==red){
|
||||
w->color()=black;
|
||||
x_parent->color()=red;
|
||||
rotate_left(x_parent,root);
|
||||
w=x_parent->right();
|
||||
}
|
||||
if((w->left()==pointer(0)||w->left()->color()==black) &&
|
||||
(w->right()==pointer(0)||w->right()->color()==black)){
|
||||
w->color()=red;
|
||||
x=x_parent;
|
||||
x_parent=x_parent->parent();
|
||||
}
|
||||
else{
|
||||
if(w->right()==pointer(0 )
|
||||
|| w->right()->color()==black){
|
||||
if(w->left()!=pointer(0)) w->left()->color()=black;
|
||||
w->color()=red;
|
||||
rotate_right(w,root);
|
||||
w=x_parent->right();
|
||||
}
|
||||
w->color()=x_parent->color();
|
||||
x_parent->color()=black;
|
||||
if(w->right()!=pointer(0))w->right()->color()=black;
|
||||
rotate_left(x_parent,root);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else{ /* same as above,with right <-> left */
|
||||
pointer w=x_parent->left();
|
||||
if(w->color()==red){
|
||||
w->color()=black;
|
||||
x_parent->color()=red;
|
||||
rotate_right(x_parent,root);
|
||||
w=x_parent->left();
|
||||
}
|
||||
if((w->right()==pointer(0)||w->right()->color()==black) &&
|
||||
(w->left()==pointer(0)||w->left()->color()==black)){
|
||||
w->color()=red;
|
||||
x=x_parent;
|
||||
x_parent=x_parent->parent();
|
||||
}
|
||||
else{
|
||||
if(w->left()==pointer(0)||w->left()->color()==black){
|
||||
if(w->right()!=pointer(0))w->right()->color()=black;
|
||||
w->color()=red;
|
||||
rotate_left(w,root);
|
||||
w=x_parent->left();
|
||||
}
|
||||
w->color()=x_parent->color();
|
||||
x_parent->color()=black;
|
||||
if(w->left()!=pointer(0))w->left()->color()=black;
|
||||
rotate_right(x_parent,root);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(x!=pointer(0))x->color()=black;
|
||||
}
|
||||
return y;
|
||||
}
|
||||
|
||||
static void restore(pointer x,pointer position,pointer header)
|
||||
{
|
||||
if(position->left()==pointer(0)||position->left()==header){
|
||||
link(x,to_left,position,header);
|
||||
}
|
||||
else{
|
||||
decrement(position);
|
||||
link(x,to_right,position,header);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)
|
||||
/* invariant stuff */
|
||||
|
||||
static std::size_t black_count(pointer node,pointer root)
|
||||
{
|
||||
if(node==pointer(0))return 0;
|
||||
std::size_t sum=0;
|
||||
for(;;){
|
||||
if(node->color()==black)++sum;
|
||||
if(node==root)break;
|
||||
node=node->parent();
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
template<typename AugmentPolicy,typename Super>
|
||||
struct ordered_index_node_trampoline:
|
||||
ordered_index_node_impl<
|
||||
AugmentPolicy,
|
||||
typename boost::detail::allocator::rebind_to<
|
||||
typename Super::allocator_type,
|
||||
char
|
||||
>::type
|
||||
>
|
||||
{
|
||||
typedef ordered_index_node_impl<
|
||||
AugmentPolicy,
|
||||
typename boost::detail::allocator::rebind_to<
|
||||
typename Super::allocator_type,
|
||||
char
|
||||
>::type
|
||||
> impl_type;
|
||||
};
|
||||
|
||||
template<typename AugmentPolicy,typename Super>
|
||||
struct ordered_index_node:
|
||||
Super,ordered_index_node_trampoline<AugmentPolicy,Super>
|
||||
{
|
||||
private:
|
||||
typedef ordered_index_node_trampoline<AugmentPolicy,Super> trampoline;
|
||||
|
||||
public:
|
||||
typedef typename trampoline::impl_type impl_type;
|
||||
typedef typename trampoline::color_ref impl_color_ref;
|
||||
typedef typename trampoline::parent_ref impl_parent_ref;
|
||||
typedef typename trampoline::pointer impl_pointer;
|
||||
typedef typename trampoline::const_pointer const_impl_pointer;
|
||||
|
||||
impl_color_ref color(){return trampoline::color();}
|
||||
ordered_index_color color()const{return trampoline::color();}
|
||||
impl_parent_ref parent(){return trampoline::parent();}
|
||||
impl_pointer parent()const{return trampoline::parent();}
|
||||
impl_pointer& left(){return trampoline::left();}
|
||||
impl_pointer left()const{return trampoline::left();}
|
||||
impl_pointer& right(){return trampoline::right();}
|
||||
impl_pointer right()const{return trampoline::right();}
|
||||
|
||||
impl_pointer impl()
|
||||
{
|
||||
return static_cast<impl_pointer>(
|
||||
static_cast<impl_type*>(static_cast<trampoline*>(this)));
|
||||
}
|
||||
|
||||
const_impl_pointer impl()const
|
||||
{
|
||||
return static_cast<const_impl_pointer>(
|
||||
static_cast<const impl_type*>(static_cast<const trampoline*>(this)));
|
||||
}
|
||||
|
||||
static ordered_index_node* from_impl(impl_pointer x)
|
||||
{
|
||||
return
|
||||
static_cast<ordered_index_node*>(
|
||||
static_cast<trampoline*>(
|
||||
raw_ptr<impl_type*>(x)));
|
||||
}
|
||||
|
||||
static const ordered_index_node* from_impl(const_impl_pointer x)
|
||||
{
|
||||
return
|
||||
static_cast<const ordered_index_node*>(
|
||||
static_cast<const trampoline*>(
|
||||
raw_ptr<const impl_type*>(x)));
|
||||
}
|
||||
|
||||
/* interoperability with bidir_node_iterator */
|
||||
|
||||
static void increment(ordered_index_node*& x)
|
||||
{
|
||||
impl_pointer xi=x->impl();
|
||||
trampoline::increment(xi);
|
||||
x=from_impl(xi);
|
||||
}
|
||||
|
||||
static void decrement(ordered_index_node*& x)
|
||||
{
|
||||
impl_pointer xi=x->impl();
|
||||
trampoline::decrement(xi);
|
||||
x=from_impl(xi);
|
||||
}
|
||||
};
|
||||
|
||||
} /* namespace multi_index::detail */
|
||||
|
||||
} /* namespace multi_index */
|
||||
|
||||
} /* namespace boost */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,127 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2014-2015 Kohei Takahashi
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#ifndef FUSION_LIST_10262014_0537
|
||||
#define FUSION_LIST_10262014_0537
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/container/list/list_fwd.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Without variadics, we will use the PP version
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#if !defined(BOOST_FUSION_HAS_VARIADIC_LIST)
|
||||
# include <boost/fusion/container/list/detail/cpp03/list.hpp>
|
||||
#else
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// C++11 interface
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#include <utility>
|
||||
#include <boost/fusion/container/list/detail/list_to_cons.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct nil_;
|
||||
|
||||
template <>
|
||||
struct list<>
|
||||
: detail::list_to_cons<>::type
|
||||
{
|
||||
private:
|
||||
typedef detail::list_to_cons<> list_to_cons;
|
||||
typedef list_to_cons::type inherited_type;
|
||||
|
||||
public:
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
list()
|
||||
: inherited_type() {}
|
||||
|
||||
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
template <typename Sequence>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
list(Sequence const& rhs)
|
||||
: inherited_type(rhs) {}
|
||||
|
||||
template <typename Sequence>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
list&
|
||||
operator=(Sequence const& rhs)
|
||||
{
|
||||
inherited_type::operator=(rhs);
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
template <typename Sequence>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
list(Sequence&& rhs)
|
||||
: inherited_type(std::forward<Sequence>(rhs)) {}
|
||||
|
||||
template <typename Sequence>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
list&
|
||||
operator=(Sequence&& rhs)
|
||||
{
|
||||
inherited_type::operator=(std::forward<Sequence>(rhs));
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
template <typename ...T>
|
||||
struct list
|
||||
: detail::list_to_cons<T...>::type
|
||||
{
|
||||
private:
|
||||
typedef detail::list_to_cons<T...> list_to_cons;
|
||||
typedef typename list_to_cons::type inherited_type;
|
||||
|
||||
public:
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
list()
|
||||
: inherited_type() {}
|
||||
|
||||
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
template <typename Sequence>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
list(Sequence const& rhs)
|
||||
: inherited_type(rhs) {}
|
||||
#else
|
||||
template <typename Sequence>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
list(Sequence&& rhs)
|
||||
: inherited_type(std::forward<Sequence>(rhs)) {}
|
||||
#endif
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
explicit
|
||||
list(typename detail::call_param<T>::type ...args)
|
||||
: inherited_type(list_to_cons::call(args...)) {}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
template <typename Sequence>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
list&
|
||||
operator=(Sequence const& rhs)
|
||||
{
|
||||
inherited_type::operator=(rhs);
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
template <typename Sequence>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
list&
|
||||
operator=(Sequence&& rhs)
|
||||
{
|
||||
inherited_type::operator=(std::forward<Sequence>(rhs));
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,57 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// 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_FIND_HPP
|
||||
#define BOOST_COMPUTE_ALGORITHM_FIND_HPP
|
||||
|
||||
#include <boost/compute/lambda.hpp>
|
||||
#include <boost/compute/system.hpp>
|
||||
#include <boost/compute/command_queue.hpp>
|
||||
#include <boost/compute/algorithm/find_if.hpp>
|
||||
#include <boost/compute/type_traits/vector_size.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
|
||||
/// Returns an iterator pointing to the first element in the range
|
||||
/// [\p first, \p last) that equals \p value.
|
||||
template<class InputIterator, class T>
|
||||
inline InputIterator find(InputIterator first,
|
||||
InputIterator last,
|
||||
const T &value,
|
||||
command_queue &queue = system::default_queue())
|
||||
{
|
||||
typedef typename std::iterator_traits<InputIterator>::value_type value_type;
|
||||
|
||||
using ::boost::compute::_1;
|
||||
using ::boost::compute::lambda::all;
|
||||
|
||||
if(vector_size<value_type>::value == 1){
|
||||
return ::boost::compute::find_if(
|
||||
first,
|
||||
last,
|
||||
_1 == value,
|
||||
queue
|
||||
);
|
||||
}
|
||||
else {
|
||||
return ::boost::compute::find_if(
|
||||
first,
|
||||
last,
|
||||
all(_1 == value),
|
||||
queue
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_ALGORITHM_FIND_HPP
|
||||
@@ -0,0 +1,234 @@
|
||||
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
|
||||
// unit/quantity manipulation and conversion
|
||||
//
|
||||
// Copyright (C) 2003-2008 Matthias Christian Schabel
|
||||
// Copyright (C) 2007-2008 Steven Watanabe
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_UNITS_DETAIL_UNSCALE_HPP_INCLUDED
|
||||
#define BOOST_UNITS_DETAIL_UNSCALE_HPP_INCLUDED
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/size.hpp>
|
||||
#include <boost/mpl/begin.hpp>
|
||||
#include <boost/mpl/next.hpp>
|
||||
#include <boost/mpl/deref.hpp>
|
||||
#include <boost/mpl/plus.hpp>
|
||||
#include <boost/mpl/times.hpp>
|
||||
#include <boost/mpl/negate.hpp>
|
||||
#include <boost/mpl/less.hpp>
|
||||
|
||||
#include <boost/units/config.hpp>
|
||||
#include <boost/units/dimension.hpp>
|
||||
#include <boost/units/scale.hpp>
|
||||
#include <boost/units/static_rational.hpp>
|
||||
#include <boost/units/units_fwd.hpp>
|
||||
#include <boost/units/detail/one.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace units {
|
||||
|
||||
template<class T>
|
||||
struct heterogeneous_system;
|
||||
|
||||
template<class T, class D, class Scale>
|
||||
struct heterogeneous_system_impl;
|
||||
|
||||
template<class T, class E>
|
||||
struct heterogeneous_system_dim;
|
||||
|
||||
template<class S, class Scale>
|
||||
struct scaled_base_unit;
|
||||
|
||||
/// removes all scaling from a unit or a base unit.
|
||||
template<class T>
|
||||
struct unscale
|
||||
{
|
||||
#ifndef BOOST_UNITS_DOXYGEN
|
||||
typedef T type;
|
||||
#else
|
||||
typedef detail::unspecified type;
|
||||
#endif
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<class S, class Scale>
|
||||
struct unscale<scaled_base_unit<S, Scale> >
|
||||
{
|
||||
typedef typename unscale<S>::type type;
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<class D, class S>
|
||||
struct unscale<unit<D, S> >
|
||||
{
|
||||
typedef unit<D, typename unscale<S>::type> type;
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<class Scale>
|
||||
struct scale_list_dim;
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<class T>
|
||||
struct get_scale_list
|
||||
{
|
||||
typedef dimensionless_type type;
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<class S, class Scale>
|
||||
struct get_scale_list<scaled_base_unit<S, Scale> >
|
||||
{
|
||||
typedef typename mpl::times<list<scale_list_dim<Scale>, dimensionless_type>, typename get_scale_list<S>::type>::type type;
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<class D, class S>
|
||||
struct get_scale_list<unit<D, S> >
|
||||
{
|
||||
typedef typename get_scale_list<S>::type type;
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
struct scale_dim_tag {};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<class Scale>
|
||||
struct scale_list_dim : Scale
|
||||
{
|
||||
typedef scale_dim_tag tag;
|
||||
typedef scale_list_dim type;
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
#ifndef BOOST_UNITS_DOXYGEN
|
||||
|
||||
namespace mpl {
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<>
|
||||
struct less_impl<boost::units::scale_dim_tag, boost::units::scale_dim_tag>
|
||||
{
|
||||
template<class T0, class T1>
|
||||
struct apply : mpl::bool_<((T0::base) < (T1::base))> {};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
namespace units {
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<class Scale>
|
||||
struct is_empty_dim<scale_list_dim<Scale> > : mpl::false_ {};
|
||||
|
||||
template<long N>
|
||||
struct is_empty_dim<scale_list_dim<scale<N, static_rational<0, 1> > > > : mpl::true_ {};
|
||||
|
||||
template<int N>
|
||||
struct eval_scale_list_impl
|
||||
{
|
||||
template<class Begin>
|
||||
struct apply
|
||||
{
|
||||
typedef typename eval_scale_list_impl<N-1>::template apply<typename Begin::next> next_iteration;
|
||||
typedef typename multiply_typeof_helper<typename next_iteration::type, typename Begin::item::value_type>::type type;
|
||||
static type value()
|
||||
{
|
||||
return(next_iteration::value() * Begin::item::value());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct eval_scale_list_impl<0>
|
||||
{
|
||||
template<class Begin>
|
||||
struct apply
|
||||
{
|
||||
typedef one type;
|
||||
static one value()
|
||||
{
|
||||
one result;
|
||||
return(result);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<class T>
|
||||
struct eval_scale_list : detail::eval_scale_list_impl<T::size::value>::template apply<T> {};
|
||||
|
||||
} // namespace units
|
||||
|
||||
#ifndef BOOST_UNITS_DOXYGEN
|
||||
|
||||
namespace mpl {
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<>
|
||||
struct plus_impl<boost::units::scale_dim_tag, boost::units::scale_dim_tag>
|
||||
{
|
||||
template<class T0, class T1>
|
||||
struct apply
|
||||
{
|
||||
typedef boost::units::scale_list_dim<
|
||||
boost::units::scale<
|
||||
(T0::base),
|
||||
typename mpl::plus<typename T0::exponent, typename T1::exponent>::type
|
||||
>
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<>
|
||||
struct negate_impl<boost::units::scale_dim_tag>
|
||||
{
|
||||
template<class T0>
|
||||
struct apply
|
||||
{
|
||||
typedef boost::units::scale_list_dim<
|
||||
boost::units::scale<
|
||||
(T0::base),
|
||||
typename mpl::negate<typename T0::exponent>::type
|
||||
>
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<>
|
||||
struct times_impl<boost::units::scale_dim_tag, boost::units::detail::static_rational_tag>
|
||||
{
|
||||
template<class T0, class T1>
|
||||
struct apply
|
||||
{
|
||||
typedef boost::units::scale_list_dim<
|
||||
boost::units::scale<
|
||||
(T0::base),
|
||||
typename mpl::times<typename T0::exponent, T1>::type
|
||||
>
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace mpl
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,74 @@
|
||||
// lambda_fwd.hpp - Boost Lambda Library -------------------------------
|
||||
|
||||
// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see www.boost.org
|
||||
|
||||
// -------------------------------------------------------
|
||||
|
||||
#ifndef BOOST_LAMBDA_FWD_HPP
|
||||
#define BOOST_LAMBDA_FWD_HPP
|
||||
|
||||
namespace boost {
|
||||
namespace lambda {
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<class T> struct generate_error;
|
||||
|
||||
}
|
||||
// -- placeholders --------------------------------------------
|
||||
|
||||
template <int I> struct placeholder;
|
||||
|
||||
// function_adaptors
|
||||
template <class Func>
|
||||
struct function_adaptor;
|
||||
|
||||
template <int I, class Act> class action;
|
||||
|
||||
template <class Base>
|
||||
class lambda_functor;
|
||||
|
||||
template <class Act, class Args>
|
||||
class lambda_functor_base;
|
||||
|
||||
} // namespace lambda
|
||||
} // namespace boost
|
||||
|
||||
|
||||
// #define CALL_TEMPLATE_ARGS class A, class Env
|
||||
// #define CALL_FORMAL_ARGS A& a, Env& env
|
||||
// #define CALL_ACTUAL_ARGS a, env
|
||||
// #define CALL_ACTUAL_ARGS_NO_ENV a
|
||||
// #define CALL_REFERENCE_TYPES A&, Env&
|
||||
// #define CALL_PLAIN_TYPES A, Env
|
||||
#define CALL_TEMPLATE_ARGS class A, class B, class C, class Env
|
||||
#define CALL_FORMAL_ARGS A& a, B& b, C& c, Env& env
|
||||
#define CALL_ACTUAL_ARGS a, b, c, env
|
||||
#define CALL_ACTUAL_ARGS_NO_ENV a, b, c
|
||||
#define CALL_REFERENCE_TYPES A&, B&, C&, Env&
|
||||
#define CALL_PLAIN_TYPES A, B, C, Env
|
||||
|
||||
namespace boost {
|
||||
namespace lambda {
|
||||
namespace detail {
|
||||
|
||||
template<class A1, class A2, class A3, class A4>
|
||||
void do_nothing(A1&, A2&, A3&, A4&) {}
|
||||
|
||||
} // detail
|
||||
} // lambda
|
||||
} // boost
|
||||
|
||||
// prevent the warnings from unused arguments
|
||||
#define CALL_USE_ARGS \
|
||||
::boost::lambda::detail::do_nothing(a, b, c, env)
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
#ifndef BOOST_MPL_ORDER_FWD_HPP_INCLUDED
|
||||
#define BOOST_MPL_ORDER_FWD_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2003-2004
|
||||
// Copyright David Abrahams 2003-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$
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template< typename Tag > struct order_impl;
|
||||
template< typename AssociativeSequence, typename Key > struct order;
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_ORDER_FWD_HPP_INCLUDED
|
||||
@@ -0,0 +1,107 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// 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_STABLE_SORT_HPP
|
||||
#define BOOST_COMPUTE_ALGORITHM_STABLE_SORT_HPP
|
||||
|
||||
#include <iterator>
|
||||
|
||||
#include <boost/compute/system.hpp>
|
||||
#include <boost/compute/command_queue.hpp>
|
||||
#include <boost/compute/algorithm/detail/merge_sort_on_cpu.hpp>
|
||||
#include <boost/compute/algorithm/detail/merge_sort_on_gpu.hpp>
|
||||
#include <boost/compute/algorithm/detail/radix_sort.hpp>
|
||||
#include <boost/compute/algorithm/detail/insertion_sort.hpp>
|
||||
#include <boost/compute/algorithm/reverse.hpp>
|
||||
#include <boost/compute/functional/operator.hpp>
|
||||
#include <boost/compute/detail/iterator_range_size.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
namespace detail {
|
||||
|
||||
template<class Iterator, class Compare>
|
||||
inline void dispatch_gpu_stable_sort(Iterator first,
|
||||
Iterator last,
|
||||
Compare compare,
|
||||
command_queue &queue)
|
||||
{
|
||||
size_t count = detail::iterator_range_size(first, last);
|
||||
|
||||
if(count < 32){
|
||||
detail::serial_insertion_sort(
|
||||
first, last, compare, queue
|
||||
);
|
||||
} else {
|
||||
detail::merge_sort_on_gpu(
|
||||
first, last, compare, true /* stable */, queue
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline typename boost::enable_if_c<is_radix_sortable<T>::value>::type
|
||||
dispatch_gpu_stable_sort(buffer_iterator<T> first,
|
||||
buffer_iterator<T> last,
|
||||
less<T>,
|
||||
command_queue &queue)
|
||||
{
|
||||
::boost::compute::detail::radix_sort(first, last, queue);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline typename boost::enable_if_c<is_radix_sortable<T>::value>::type
|
||||
dispatch_gpu_stable_sort(buffer_iterator<T> first,
|
||||
buffer_iterator<T> last,
|
||||
greater<T>,
|
||||
command_queue &queue)
|
||||
{
|
||||
// radix sorts in descending order
|
||||
::boost::compute::detail::radix_sort(first, last, false, queue);
|
||||
}
|
||||
|
||||
} // end detail namespace
|
||||
|
||||
/// Sorts the values in the range [\p first, \p last) according to
|
||||
/// \p compare. The relative order of identical values is preserved.
|
||||
///
|
||||
/// \see sort(), is_sorted()
|
||||
template<class Iterator, class Compare>
|
||||
inline void stable_sort(Iterator first,
|
||||
Iterator last,
|
||||
Compare compare,
|
||||
command_queue &queue = system::default_queue())
|
||||
{
|
||||
if(queue.get_device().type() & device::gpu) {
|
||||
::boost::compute::detail::dispatch_gpu_stable_sort(
|
||||
first, last, compare, queue
|
||||
);
|
||||
return;
|
||||
}
|
||||
::boost::compute::detail::merge_sort_on_cpu(first, last, compare, queue);
|
||||
}
|
||||
|
||||
/// \overload
|
||||
template<class Iterator>
|
||||
inline void stable_sort(Iterator first,
|
||||
Iterator last,
|
||||
command_queue &queue = system::default_queue())
|
||||
{
|
||||
typedef typename std::iterator_traits<Iterator>::value_type value_type;
|
||||
|
||||
::boost::compute::less<value_type> less;
|
||||
|
||||
::boost::compute::stable_sort(first, last, less, queue);
|
||||
}
|
||||
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_ALGORITHM_STABLE_SORT_HPP
|
||||
@@ -0,0 +1,19 @@
|
||||
/*=============================================================================
|
||||
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_ALGORITHM_QUERY_10022005_0549)
|
||||
#define FUSION_ALGORITHM_QUERY_10022005_0549
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/algorithm/query/all.hpp>
|
||||
#include <boost/fusion/algorithm/query/any.hpp>
|
||||
#include <boost/fusion/algorithm/query/count.hpp>
|
||||
#include <boost/fusion/algorithm/query/count_if.hpp>
|
||||
#include <boost/fusion/algorithm/query/find.hpp>
|
||||
#include <boost/fusion/algorithm/query/find_if.hpp>
|
||||
#include <boost/fusion/algorithm/query/none.hpp>
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// Copyright (c) Antony Polukhin, 2013-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)
|
||||
//
|
||||
|
||||
#ifndef BOOST_TYPE_INDEX_CTTI_REGISTER_CLASS_HPP
|
||||
#define BOOST_TYPE_INDEX_CTTI_REGISTER_CLASS_HPP
|
||||
|
||||
/// \file ctti_register_class.hpp
|
||||
/// \brief Contains BOOST_TYPE_INDEX_REGISTER_CLASS macro implementation that uses boost::typeindex::ctti_type_index.
|
||||
/// Not intended for inclusion from user's code.
|
||||
|
||||
#include <boost/type_index/ctti_type_index.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
namespace boost { namespace typeindex { namespace detail {
|
||||
|
||||
template <class T>
|
||||
inline const ctti_data& ctti_construct_typeid_ref(const T*) BOOST_NOEXCEPT {
|
||||
return ctti_construct<T>();
|
||||
}
|
||||
|
||||
}}} // namespace boost::typeindex::detail
|
||||
|
||||
/// @cond
|
||||
#define BOOST_TYPE_INDEX_REGISTER_CLASS \
|
||||
virtual const boost::typeindex::detail::ctti_data& boost_type_index_type_id_runtime_() const BOOST_NOEXCEPT { \
|
||||
return boost::typeindex::detail::ctti_construct_typeid_ref(this); \
|
||||
} \
|
||||
/**/
|
||||
/// @endcond
|
||||
|
||||
#endif // BOOST_TYPE_INDEX_CTTI_REGISTER_CLASS_HPP
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2006-2007 Tobias Schwinger
|
||||
|
||||
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).
|
||||
==============================================================================*/
|
||||
|
||||
#if !defined(BOOST_FUSION_FUNCTIONAL_INVOCATION_LIMITS_HPP_INCLUDED)
|
||||
# define BOOST_FUSION_FUNCTIONAL_INVOCATION_LIMITS_HPP_INCLUDED
|
||||
|
||||
# if !defined(BOOST_FUSION_INVOKE_MAX_ARITY)
|
||||
# define BOOST_FUSION_INVOKE_MAX_ARITY 6
|
||||
# endif
|
||||
# if !defined(BOOST_FUSION_INVOKE_PROCEDURE_MAX_ARITY)
|
||||
# define BOOST_FUSION_INVOKE_PROCEDURE_MAX_ARITY 6
|
||||
# endif
|
||||
# if !defined(BOOST_FUSION_INVOKE_FUNCTION_OBJECT_MAX_ARITY)
|
||||
# define BOOST_FUSION_INVOKE_FUNCTION_OBJECT_MAX_ARITY 6
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2011 Eric Niebler
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_ITERATOR_RANGE_SEGMENTS_HPP_INCLUDED)
|
||||
#define BOOST_FUSION_ITERATOR_RANGE_SEGMENTS_HPP_INCLUDED
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/segments.hpp>
|
||||
#include <boost/fusion/support/is_segmented.hpp>
|
||||
#include <boost/fusion/view/iterator_range/detail/segmented_iterator_range.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct iterator_range_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct segments_impl;
|
||||
|
||||
template <>
|
||||
struct segments_impl<iterator_range_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
typedef
|
||||
detail::make_segmented_range<
|
||||
typename Sequence::begin_type
|
||||
, typename Sequence::end_type
|
||||
>
|
||||
impl;
|
||||
|
||||
BOOST_MPL_ASSERT((traits::is_segmented<typename impl::type>));
|
||||
|
||||
typedef
|
||||
typename result_of::segments<typename impl::type>::type
|
||||
type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type call(Sequence & seq)
|
||||
{
|
||||
return fusion::segments(impl::call(seq.first, seq.last));
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 252 KiB |
@@ -0,0 +1,21 @@
|
||||
|
||||
#ifndef BOOST_MPL_LOGICAL_HPP_INCLUDED
|
||||
#define BOOST_MPL_LOGICAL_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/or.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
|
||||
#endif // BOOST_MPL_LOGICAL_HPP_INCLUDED
|
||||
@@ -0,0 +1,623 @@
|
||||
// -*- Mode: C++ -*-
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
#ifdef QT5
|
||||
#include <QtWidgets>
|
||||
#else
|
||||
#include <QtGui>
|
||||
#endif
|
||||
#include <QThread>
|
||||
#include <QTimer>
|
||||
#include <QDateTime>
|
||||
#include <QList>
|
||||
#include <QAudioDeviceInfo>
|
||||
#include <QScopedPointer>
|
||||
#include <QDir>
|
||||
#include <QProgressDialog>
|
||||
#include <QAbstractSocket>
|
||||
#include <QHostAddress>
|
||||
#include <QPointer>
|
||||
#include <QSet>
|
||||
#include <QVector>
|
||||
#include <QFuture>
|
||||
#include <QFutureWatcher>
|
||||
|
||||
#include "AudioDevice.hpp"
|
||||
#include "commons.h"
|
||||
#include "Radio.hpp"
|
||||
#include "Modes.hpp"
|
||||
#include "FrequencyList.hpp"
|
||||
#include "Configuration.hpp"
|
||||
#include "WSPRBandHopping.hpp"
|
||||
#include "Transceiver.hpp"
|
||||
#include "DisplayManual.hpp"
|
||||
#include "psk_reporter.h"
|
||||
#include "logbook/logbook.h"
|
||||
#include "decodedtext.h"
|
||||
#include "commons.h"
|
||||
#include "astro.h"
|
||||
#include "MessageBox.hpp"
|
||||
#include "NetworkAccessManager.hpp"
|
||||
|
||||
#define NUM_JT4_SYMBOLS 206 //(72+31)*2, embedded sync
|
||||
#define NUM_JT65_SYMBOLS 126 //63 data + 63 sync
|
||||
#define NUM_JT9_SYMBOLS 85 //69 data + 16 sync
|
||||
#define NUM_WSPR_SYMBOLS 162 //(50+31)*2, embedded sync
|
||||
#define NUM_WSPR_LF_SYMBOLS 412 //300 data + 109 sync + 3 ramp
|
||||
#define NUM_ISCAT_SYMBOLS 1291 //30*11025/256
|
||||
#define NUM_MSK144_SYMBOLS 144 //s8 + d48 + s8 + d80
|
||||
#define NUM_QRA64_SYMBOLS 84 //63 data + 21 sync
|
||||
#define NUM_FT8_SYMBOLS 79
|
||||
#define NUM_CW_SYMBOLS 250
|
||||
#define TX_SAMPLE_RATE 48000
|
||||
#define N_WIDGETS 24
|
||||
|
||||
extern int volatile itone[NUM_ISCAT_SYMBOLS]; //Audio tones for all Tx symbols
|
||||
extern int volatile icw[NUM_CW_SYMBOLS]; //Dits for CW ID
|
||||
|
||||
//--------------------------------------------------------------- MainWindow
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
|
||||
class QSettings;
|
||||
class QLineEdit;
|
||||
class QFont;
|
||||
class QHostInfo;
|
||||
class EchoGraph;
|
||||
class FastGraph;
|
||||
class WideGraph;
|
||||
class LogQSO;
|
||||
class Transceiver;
|
||||
class MessageAveraging;
|
||||
class MessageClient;
|
||||
class QTime;
|
||||
class WSPRBandHopping;
|
||||
class HelpTextWindow;
|
||||
class WSPRNet;
|
||||
class SoundOutput;
|
||||
class Modulator;
|
||||
class SoundInput;
|
||||
class Detector;
|
||||
class SampleDownloader;
|
||||
class MultiSettings;
|
||||
class PhaseEqualizationDialog;
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
using Frequency = Radio::Frequency;
|
||||
using FrequencyDelta = Radio::FrequencyDelta;
|
||||
using Mode = Modes::Mode;
|
||||
|
||||
explicit MainWindow(QDir const& temp_directory, bool multiple, MultiSettings *,
|
||||
QSharedMemory *shdmem, unsigned downSampleFactor,
|
||||
QSplashScreen *,
|
||||
QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
public slots:
|
||||
void showSoundInError(const QString& errorMsg);
|
||||
void showSoundOutError(const QString& errorMsg);
|
||||
void showStatusMessage(const QString& statusMsg);
|
||||
void dataSink(qint64 frames);
|
||||
void fastSink(qint64 frames);
|
||||
void diskDat();
|
||||
void freezeDecode(int n);
|
||||
void guiUpdate();
|
||||
void doubleClickOnCall(bool shift, bool ctrl);
|
||||
void doubleClickOnCall2(bool shift, bool ctrl);
|
||||
void readFromStdout();
|
||||
void p1ReadFromStdout();
|
||||
void setXIT(int n, Frequency base = 0u);
|
||||
void setFreq4(int rxFreq, int txFreq);
|
||||
void msgAvgDecode2();
|
||||
void fastPick(int x0, int x1, int y);
|
||||
|
||||
protected:
|
||||
void keyPressEvent (QKeyEvent *) override;
|
||||
void closeEvent(QCloseEvent *) override;
|
||||
void childEvent(QChildEvent *) override;
|
||||
bool eventFilter(QObject *, QEvent *) override;
|
||||
|
||||
private slots:
|
||||
void on_tx1_editingFinished();
|
||||
void on_tx2_editingFinished();
|
||||
void on_tx3_editingFinished();
|
||||
void on_tx4_editingFinished();
|
||||
void on_tx5_currentTextChanged (QString const&);
|
||||
void on_tx6_editingFinished();
|
||||
void on_actionSettings_triggered();
|
||||
void on_monitorButton_clicked (bool);
|
||||
void on_actionAbout_triggered();
|
||||
void on_autoButton_clicked (bool);
|
||||
void on_stopTxButton_clicked();
|
||||
void on_stopButton_clicked();
|
||||
void on_actionRelease_Notes_triggered ();
|
||||
void on_actionOnline_User_Guide_triggered();
|
||||
void on_actionLocal_User_Guide_triggered();
|
||||
void on_actionWide_Waterfall_triggered();
|
||||
void on_actionOpen_triggered();
|
||||
void on_actionOpen_next_in_directory_triggered();
|
||||
void on_actionDecode_remaining_files_in_directory_triggered();
|
||||
void on_actionDelete_all_wav_files_in_SaveDir_triggered();
|
||||
void on_actionOpen_log_directory_triggered ();
|
||||
void on_actionNone_triggered();
|
||||
void on_actionSave_all_triggered();
|
||||
void on_actionKeyboard_shortcuts_triggered();
|
||||
void on_actionSpecial_mouse_commands_triggered();
|
||||
void on_DecodeButton_clicked (bool);
|
||||
void decode();
|
||||
void decodeBusy(bool b);
|
||||
void on_EraseButton_clicked();
|
||||
void on_txFirstCheckBox_stateChanged(int arg1);
|
||||
void set_dateTimeQSO(int m_ntx);
|
||||
void set_ntx(int n);
|
||||
void on_txrb1_toggled(bool status);
|
||||
void on_txrb2_toggled(bool status);
|
||||
void on_txrb3_toggled(bool status);
|
||||
void on_txrb4_toggled(bool status);
|
||||
void on_txrb5_toggled(bool status);
|
||||
void on_txrb6_toggled(bool status);
|
||||
void on_txb1_clicked();
|
||||
void on_txb2_clicked();
|
||||
void on_txb3_clicked();
|
||||
void on_txb4_clicked();
|
||||
void on_txb5_clicked();
|
||||
void on_txb6_clicked();
|
||||
void on_lookupButton_clicked();
|
||||
void on_addButton_clicked();
|
||||
void on_dxCallEntry_textChanged (QString const&);
|
||||
void on_dxGridEntry_textChanged (QString const&);
|
||||
void on_dxCallEntry_returnPressed ();
|
||||
void on_genStdMsgsPushButton_clicked();
|
||||
void on_logQSOButton_clicked();
|
||||
void on_actionJT9_triggered();
|
||||
void on_actionJT65_triggered();
|
||||
void on_actionJT9_JT65_triggered();
|
||||
void on_actionJT4_triggered();
|
||||
void on_actionFT8_triggered();
|
||||
void on_TxFreqSpinBox_valueChanged(int arg1);
|
||||
void on_actionSave_decoded_triggered();
|
||||
void on_actionQuickDecode_toggled (bool);
|
||||
void on_actionMediumDecode_toggled (bool);
|
||||
void on_actionDeepestDecode_toggled (bool);
|
||||
void on_inGain_valueChanged(int n);
|
||||
void bumpFqso(int n);
|
||||
void on_actionErase_ALL_TXT_triggered();
|
||||
void on_actionErase_wsjtx_log_adi_triggered();
|
||||
void startTx2();
|
||||
void startP1();
|
||||
void stopTx();
|
||||
void stopTx2();
|
||||
void on_pbCallCQ_clicked();
|
||||
void on_pbAnswerCaller_clicked();
|
||||
void on_pbSendRRR_clicked();
|
||||
void on_pbAnswerCQ_clicked();
|
||||
void on_pbSendReport_clicked();
|
||||
void on_pbSend73_clicked();
|
||||
void on_rbGenMsg_clicked(bool checked);
|
||||
void on_rbFreeText_clicked(bool checked);
|
||||
void on_freeTextMsg_currentTextChanged (QString const&);
|
||||
void on_rptSpinBox_valueChanged(int n);
|
||||
void killFile();
|
||||
void on_tuneButton_clicked (bool);
|
||||
void on_pbR2T_clicked();
|
||||
void on_pbT2R_clicked();
|
||||
void acceptQSO2(QDateTime const&, QString const& call, QString const& grid
|
||||
, Frequency dial_freq, QString const& mode
|
||||
, QString const& rpt_sent, QString const& rpt_received
|
||||
, QString const& tx_power, QString const& comments
|
||||
, QString const& name, QDateTime const&);
|
||||
void on_bandComboBox_currentIndexChanged (int index);
|
||||
void on_bandComboBox_activated (int index);
|
||||
void on_readFreq_clicked();
|
||||
void on_pbTxMode_clicked();
|
||||
void on_RxFreqSpinBox_valueChanged(int n);
|
||||
void on_cbTxLock_clicked(bool checked);
|
||||
void on_outAttenuation_valueChanged (int);
|
||||
void rigOpen ();
|
||||
void handle_transceiver_update (Transceiver::TransceiverState const&);
|
||||
void handle_transceiver_failure (QString const& reason);
|
||||
void on_actionAstronomical_data_toggled (bool);
|
||||
void on_actionShort_list_of_add_on_prefixes_and_suffixes_triggered();
|
||||
void band_changed (Frequency);
|
||||
void monitor (bool);
|
||||
void stop_tuning ();
|
||||
void stopTuneATU();
|
||||
void auto_tx_mode(bool);
|
||||
void on_actionMessage_averaging_triggered();
|
||||
void on_actionInclude_averaging_toggled (bool);
|
||||
void on_actionInclude_correlation_toggled (bool);
|
||||
void on_actionEnable_AP_DXcall_toggled (bool);
|
||||
void VHF_features_enabled(bool b);
|
||||
void on_sbSubmode_valueChanged(int n);
|
||||
void on_cbShMsgs_toggled(bool b);
|
||||
void on_cbSWL_toggled(bool b);
|
||||
void on_cbTx6_toggled(bool b);
|
||||
void on_cbMenus_toggled(bool b);
|
||||
void networkError (QString const&);
|
||||
void on_ClrAvgButton_clicked();
|
||||
void on_actionWSPR_triggered();
|
||||
void on_actionWSPR_LF_triggered();
|
||||
void on_syncSpinBox_valueChanged(int n);
|
||||
void on_TxPowerComboBox_currentIndexChanged(const QString &arg1);
|
||||
void on_sbTxPercent_valueChanged(int n);
|
||||
void on_cbUploadWSPR_Spots_toggled(bool b);
|
||||
void WSPR_config(bool b);
|
||||
void uploadSpots();
|
||||
void TxAgain();
|
||||
void uploadResponse(QString response);
|
||||
void on_WSPRfreqSpinBox_valueChanged(int n);
|
||||
void on_pbTxNext_clicked(bool b);
|
||||
void on_actionEcho_Graph_triggered();
|
||||
void on_actionEcho_triggered();
|
||||
void on_actionISCAT_triggered();
|
||||
void on_actionFast_Graph_triggered();
|
||||
void fast_decode_done();
|
||||
void on_actionMeasure_reference_spectrum_triggered();
|
||||
void on_actionErase_reference_spectrum_triggered();
|
||||
void on_actionMeasure_phase_response_triggered();
|
||||
void on_sbTR_valueChanged (int);
|
||||
void on_sbFtol_valueChanged (int);
|
||||
void on_cbFast9_clicked(bool b);
|
||||
void on_sbCQTxFreq_valueChanged(int n);
|
||||
void on_cbCQTx_toggled(bool b);
|
||||
void on_actionMSK144_triggered();
|
||||
void on_actionQRA64_triggered();
|
||||
void on_actionFreqCal_triggered();
|
||||
void splash_done ();
|
||||
|
||||
private:
|
||||
Q_SIGNAL void initializeAudioOutputStream (QAudioDeviceInfo,
|
||||
unsigned channels, unsigned msBuffered) const;
|
||||
Q_SIGNAL void stopAudioOutputStream () const;
|
||||
Q_SIGNAL void startAudioInputStream (QAudioDeviceInfo const&,
|
||||
int framesPerBuffer, AudioDevice * sink,
|
||||
unsigned downSampleFactor, AudioDevice::Channel) const;
|
||||
Q_SIGNAL void suspendAudioInputStream () const;
|
||||
Q_SIGNAL void resumeAudioInputStream () const;
|
||||
Q_SIGNAL void startDetector (AudioDevice::Channel) const;
|
||||
Q_SIGNAL void FFTSize (unsigned) const;
|
||||
Q_SIGNAL void detectorClose () const;
|
||||
Q_SIGNAL void finished () const;
|
||||
Q_SIGNAL void transmitFrequency (double) const;
|
||||
Q_SIGNAL void endTransmitMessage (bool quick = false) const;
|
||||
Q_SIGNAL void tune (bool = true) const;
|
||||
Q_SIGNAL void sendMessage (unsigned symbolsLength, double framesPerSymbol,
|
||||
double frequency, double toneSpacing,
|
||||
SoundOutput *, AudioDevice::Channel = AudioDevice::Mono,
|
||||
bool synchronize = true, bool fastMode = false, double dBSNR = 99.,
|
||||
int TRperiod=60) const;
|
||||
Q_SIGNAL void outAttenuationChanged (qreal) const;
|
||||
Q_SIGNAL void toggleShorthand () const;
|
||||
|
||||
private:
|
||||
void astroUpdate ();
|
||||
void writeAllTxt(QString message);
|
||||
void FT8_AutoSeq(QString message);
|
||||
void hideMenus(bool b);
|
||||
|
||||
NetworkAccessManager m_network_manager;
|
||||
bool m_valid;
|
||||
QSplashScreen * m_splash;
|
||||
QString m_revision;
|
||||
bool m_multiple;
|
||||
MultiSettings * m_multi_settings;
|
||||
QPushButton * m_configurations_button;
|
||||
QSettings * m_settings;
|
||||
QScopedPointer<Ui::MainWindow> ui;
|
||||
|
||||
// other windows
|
||||
Configuration m_config;
|
||||
WSPRBandHopping m_WSPR_band_hopping;
|
||||
bool m_WSPR_tx_next;
|
||||
MessageBox m_rigErrorMessageBox;
|
||||
QScopedPointer<SampleDownloader> m_sampleDownloader;
|
||||
QScopedPointer<PhaseEqualizationDialog> m_phaseEqualizationDialog;
|
||||
|
||||
QScopedPointer<WideGraph> m_wideGraph;
|
||||
QScopedPointer<EchoGraph> m_echoGraph;
|
||||
QScopedPointer<FastGraph> m_fastGraph;
|
||||
QScopedPointer<LogQSO> m_logDlg;
|
||||
QScopedPointer<Astro> m_astroWidget;
|
||||
QScopedPointer<HelpTextWindow> m_shortcuts;
|
||||
QScopedPointer<HelpTextWindow> m_prefixes;
|
||||
QScopedPointer<HelpTextWindow> m_mouseCmnds;
|
||||
QScopedPointer<MessageAveraging> m_msgAvgWidget;
|
||||
|
||||
Transceiver::TransceiverState m_rigState;
|
||||
Frequency m_lastDialFreq;
|
||||
QString m_lastBand;
|
||||
Frequency m_dialFreqRxWSPR; // best guess at WSPR QRG
|
||||
|
||||
Detector * m_detector;
|
||||
unsigned m_FFTSize;
|
||||
SoundInput * m_soundInput;
|
||||
Modulator * m_modulator;
|
||||
SoundOutput * m_soundOutput;
|
||||
QThread m_audioThread;
|
||||
|
||||
qint64 m_msErase;
|
||||
qint64 m_secBandChanged;
|
||||
qint64 m_freqMoon;
|
||||
Frequency m_freqNominal;
|
||||
Frequency m_freqTxNominal;
|
||||
Astro::Correction m_astroCorrection;
|
||||
|
||||
double m_s6;
|
||||
double m_tRemaining;
|
||||
|
||||
float m_DTtol;
|
||||
float m_t0;
|
||||
float m_t1;
|
||||
float m_t0Pick;
|
||||
float m_t1Pick;
|
||||
float m_fCPUmskrtd;
|
||||
|
||||
qint32 m_waterfallAvg;
|
||||
qint32 m_ntx;
|
||||
bool m_gen_message_is_cq;
|
||||
qint32 m_timeout;
|
||||
qint32 m_XIT;
|
||||
qint32 m_setftx;
|
||||
qint32 m_ndepth;
|
||||
qint32 m_sec0;
|
||||
qint32 m_RxLog;
|
||||
qint32 m_nutc0;
|
||||
qint32 m_ntr;
|
||||
qint32 m_tx;
|
||||
qint32 m_hsym;
|
||||
qint32 m_TRperiod;
|
||||
qint32 m_nsps;
|
||||
qint32 m_hsymStop;
|
||||
qint32 m_inGain;
|
||||
qint32 m_ncw;
|
||||
qint32 m_secID;
|
||||
qint32 m_idleMinutes;
|
||||
qint32 m_nSubMode;
|
||||
qint32 m_nclearave;
|
||||
qint32 m_minSync;
|
||||
qint32 m_dBm;
|
||||
qint32 m_pctx;
|
||||
qint32 m_nseq;
|
||||
qint32 m_nWSPRdecodes;
|
||||
qint32 m_k0;
|
||||
qint32 m_kdone;
|
||||
qint32 m_nPick;
|
||||
FrequencyList::const_iterator m_frequency_list_fcal_iter;
|
||||
qint32 m_nTx73;
|
||||
qint32 m_UTCdisk;
|
||||
qint32 m_wait;
|
||||
|
||||
bool m_btxok; //True if OK to transmit
|
||||
bool m_diskData;
|
||||
bool m_loopall;
|
||||
bool m_decoderBusy;
|
||||
bool m_txFirst;
|
||||
bool m_auto;
|
||||
bool m_restart;
|
||||
bool m_startAnother;
|
||||
bool m_saveDecoded;
|
||||
bool m_saveAll;
|
||||
bool m_widebandDecode;
|
||||
bool m_call3Modified;
|
||||
bool m_dataAvailable;
|
||||
bool m_bDecoded;
|
||||
bool m_noSuffix;
|
||||
bool m_blankLine;
|
||||
bool m_decodedText2;
|
||||
bool m_freeText;
|
||||
bool m_sentFirst73;
|
||||
int m_currentMessageType;
|
||||
QString m_currentMessage;
|
||||
int m_lastMessageType;
|
||||
QString m_lastMessageSent;
|
||||
bool m_lockTxFreq;
|
||||
bool m_bShMsgs;
|
||||
bool m_bSWL;
|
||||
bool m_uploadSpots;
|
||||
bool m_uploading;
|
||||
bool m_txNext;
|
||||
bool m_grid6;
|
||||
bool m_tuneup;
|
||||
bool m_bTxTime;
|
||||
bool m_rxDone;
|
||||
bool m_bSimplex; // not using split even if it is available
|
||||
bool m_bEchoTxOK;
|
||||
bool m_bTransmittedEcho;
|
||||
bool m_bEchoTxed;
|
||||
bool m_bFastMode;
|
||||
bool m_bFast9;
|
||||
bool m_bFastDecodeCalled;
|
||||
bool m_bDoubleClickAfterCQnnn;
|
||||
bool m_bRefSpec;
|
||||
bool m_bClearRefSpec;
|
||||
bool m_bTrain;
|
||||
bool m_bUseRef;
|
||||
bool m_bFastDone;
|
||||
bool m_bAltV;
|
||||
bool m_bNoMoreFiles;
|
||||
bool m_bQRAsyncWarned;
|
||||
bool m_bDoubleClicked;
|
||||
|
||||
int m_ihsym;
|
||||
int m_nzap;
|
||||
int m_npts8;
|
||||
float m_px;
|
||||
float m_pxmax;
|
||||
float m_df3;
|
||||
int m_iptt0;
|
||||
bool m_btxok0;
|
||||
int m_nsendingsh;
|
||||
double m_onAirFreq0;
|
||||
bool m_first_error;
|
||||
|
||||
char m_msg[100][80];
|
||||
|
||||
// labels in status bar
|
||||
QLabel tx_status_label;
|
||||
QLabel config_label;
|
||||
QLabel mode_label;
|
||||
QLabel last_tx_label;
|
||||
QLabel auto_tx_label;
|
||||
QLabel band_hopping_label;
|
||||
QProgressBar progressBar;
|
||||
QLabel watchdog_label;
|
||||
|
||||
QFuture<void> m_wav_future;
|
||||
QFutureWatcher<void> m_wav_future_watcher;
|
||||
QFutureWatcher<void> watcher3;
|
||||
QFutureWatcher<QString> m_saveWAVWatcher;
|
||||
|
||||
QProcess proc_jt9;
|
||||
QProcess p1;
|
||||
QProcess p3;
|
||||
|
||||
WSPRNet *wsprNet;
|
||||
|
||||
QTimer m_guiTimer;
|
||||
QTimer ptt1Timer; //StartTx delay
|
||||
QTimer ptt0Timer; //StopTx delay
|
||||
QTimer logQSOTimer;
|
||||
QTimer killFileTimer;
|
||||
QTimer tuneButtonTimer;
|
||||
QTimer uploadTimer;
|
||||
QTimer tuneATU_Timer;
|
||||
QTimer TxAgainTimer;
|
||||
QTimer minuteTimer;
|
||||
QTimer splashTimer;
|
||||
QTimer p1Timer;
|
||||
|
||||
QString m_path;
|
||||
QString m_baseCall;
|
||||
QString m_hisCall;
|
||||
QString m_hisGrid;
|
||||
QString m_appDir;
|
||||
QString m_palette;
|
||||
QString m_dateTime;
|
||||
QString m_mode;
|
||||
QString m_modeTx;
|
||||
QString m_fnameWE; // save path without extension
|
||||
QString m_rpt;
|
||||
QString m_rptSent;
|
||||
QString m_rptRcvd;
|
||||
QString m_qsoStart;
|
||||
QString m_qsoStop;
|
||||
QString m_cmnd;
|
||||
QString m_cmndP1;
|
||||
QString m_msgSent0;
|
||||
QString m_fileToSave;
|
||||
QString m_calls;
|
||||
|
||||
QSet<QString> m_pfx;
|
||||
QSet<QString> m_sfx;
|
||||
|
||||
QDateTime m_dateTimeQSOOn;
|
||||
QDateTime m_dateTimeQSOOff;
|
||||
QDateTime m_dateTimeDefault;
|
||||
|
||||
QSharedMemory *mem_jt9;
|
||||
LogBook m_logBook;
|
||||
DecodedText m_QSOText;
|
||||
unsigned m_msAudioOutputBuffered;
|
||||
unsigned m_framesAudioInputBuffered;
|
||||
unsigned m_downSampleFactor;
|
||||
QThread::Priority m_audioThreadPriority;
|
||||
bool m_bandEdited;
|
||||
bool m_splitMode;
|
||||
bool m_monitoring;
|
||||
bool m_tx_when_ready;
|
||||
bool m_transmitting;
|
||||
bool m_tune;
|
||||
bool m_tx_watchdog; // true when watchdog triggered
|
||||
bool m_block_pwr_tooltip;
|
||||
bool m_PwrBandSetOK;
|
||||
bool m_bVHFwarned;
|
||||
Frequency m_lastMonitoredFrequency;
|
||||
double m_toneSpacing;
|
||||
int m_firstDecode;
|
||||
QProgressDialog m_optimizingProgress;
|
||||
QTimer m_heartbeat;
|
||||
MessageClient * m_messageClient;
|
||||
PSK_Reporter *psk_Reporter;
|
||||
DisplayManual m_manual;
|
||||
QHash<QString, QVariant> m_pwrBandTxMemory; // Remembers power level by band
|
||||
QHash<QString, QVariant> m_pwrBandTuneMemory; // Remembers power level by band for tuning
|
||||
QByteArray m_geometryNoControls;
|
||||
QVector<double> m_phaseEqCoefficients;
|
||||
|
||||
//---------------------------------------------------- private functions
|
||||
void readSettings();
|
||||
void setDecodedTextFont (QFont const&);
|
||||
void writeSettings();
|
||||
void createStatusBar();
|
||||
void updateStatusBar();
|
||||
void genStdMsgs(QString rpt);
|
||||
void genCQMsg();
|
||||
void clearDX ();
|
||||
void lookup();
|
||||
void ba2msg(QByteArray ba, char* message);
|
||||
void msgtype(QString t, QLineEdit* tx);
|
||||
void stub();
|
||||
void statusChanged();
|
||||
void fixStop();
|
||||
bool shortList(QString callsign);
|
||||
void transmit (double snr = 99.);
|
||||
void rigFailure (QString const& reason);
|
||||
void pskSetLocal ();
|
||||
void pskPost(DecodedText decodedtext);
|
||||
void displayDialFrequency ();
|
||||
void transmitDisplay (bool);
|
||||
void processMessage(QString const& messages, qint32 position, bool ctrl);
|
||||
void replyToCQ (QTime, qint32 snr, float delta_time, quint32 delta_frequency, QString const& mode, QString const& message_text);
|
||||
void replayDecodes ();
|
||||
void postDecode (bool is_new, QString const& message);
|
||||
void postWSPRDecode (bool is_new, QStringList message_parts);
|
||||
void enable_DXCC_entity (bool on);
|
||||
void switch_mode (Mode);
|
||||
void WSPR_scheduling ();
|
||||
void freqCalStep();
|
||||
void setRig (Frequency = 0); // zero frequency means no change
|
||||
void WSPR_history(Frequency dialFreq, int ndecodes);
|
||||
QString WSPR_hhmm(int n);
|
||||
void fast_config(bool b);
|
||||
void CQTxFreq();
|
||||
QString save_wave_file (QString const& name
|
||||
, short const * data
|
||||
, int seconds
|
||||
, QString const& my_callsign
|
||||
, QString const& my_grid
|
||||
, QString const& mode
|
||||
, qint32 sub_mode
|
||||
, Frequency frequency
|
||||
, QString const& his_call
|
||||
, QString const& his_grid) const;
|
||||
void read_wav_file (QString const& fname);
|
||||
void decodeDone ();
|
||||
void subProcessFailed (QProcess *, int exit_code, QProcess::ExitStatus);
|
||||
void subProcessError (QProcess *, QProcess::ProcessError);
|
||||
void statusUpdate () const;
|
||||
void update_watchdog_label ();
|
||||
void on_the_minute ();
|
||||
void add_child_to_event_filter (QObject *);
|
||||
void remove_child_from_event_filter (QObject *);
|
||||
void setup_status_bar (bool vhf);
|
||||
void tx_watchdog (bool triggered);
|
||||
int nWidgets(QString t);
|
||||
void displayWidgets(int n);
|
||||
void vhfWarning();
|
||||
QChar current_submode () const; // returns QChar {0} if sub mode is
|
||||
// not appropriate
|
||||
void write_transmit_entry (QString const& file_name);
|
||||
};
|
||||
|
||||
extern int killbyname(const char* progName);
|
||||
extern void getDev(int* numDevices,char hostAPI_DeviceName[][50],
|
||||
int minChan[], int maxChan[],
|
||||
int minSpeed[], int maxSpeed[]);
|
||||
extern int next_tx_state(int pctx);
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
@@ -0,0 +1,43 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2009 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_VIEW_REVERSE_VIEW_DETAIL_AT_IMPL_HPP
|
||||
#define BOOST_FUSION_VIEW_REVERSE_VIEW_DETAIL_AT_IMPL_HPP
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/at.hpp>
|
||||
#include <boost/mpl/minus.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
template <typename>
|
||||
struct at_impl;
|
||||
|
||||
template <>
|
||||
struct at_impl<reverse_view_tag>
|
||||
{
|
||||
template <typename Seq, typename N>
|
||||
struct apply
|
||||
{
|
||||
typedef mpl::minus<typename Seq::size, mpl::int_<1>, N> real_n;
|
||||
|
||||
typedef typename
|
||||
result_of::at<typename Seq::seq_type, real_n>::type
|
||||
type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
call(Seq& seq)
|
||||
{
|
||||
return fusion::at<real_n>(seq.seq);
|
||||
}
|
||||
};
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user