Initial Commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
# /* Copyright (C) 2001
|
||||
# * Housemarque Oy
|
||||
# * http://www.housemarque.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)
|
||||
# */
|
||||
#
|
||||
# /* Revised by Paul Mensonides (2002) */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# ifndef BOOST_PREPROCESSOR_PUNCTUATION_COMMA_IF_HPP
|
||||
# define BOOST_PREPROCESSOR_PUNCTUATION_COMMA_IF_HPP
|
||||
#
|
||||
# include <boost/preprocessor/config/config.hpp>
|
||||
# include <boost/preprocessor/control/if.hpp>
|
||||
# include <boost/preprocessor/facilities/empty.hpp>
|
||||
# include <boost/preprocessor/punctuation/comma.hpp>
|
||||
#
|
||||
# /* BOOST_PP_COMMA_IF */
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
|
||||
# define BOOST_PP_COMMA_IF(cond) BOOST_PP_IF(cond, BOOST_PP_COMMA, BOOST_PP_EMPTY)()
|
||||
# else
|
||||
# define BOOST_PP_COMMA_IF(cond) BOOST_PP_COMMA_IF_I(cond)
|
||||
# define BOOST_PP_COMMA_IF_I(cond) BOOST_PP_IF(cond, BOOST_PP_COMMA, BOOST_PP_EMPTY)()
|
||||
# endif
|
||||
#
|
||||
# endif
|
||||
@@ -0,0 +1,458 @@
|
||||
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
|
||||
// unit/quantity manipulation and conversion
|
||||
//
|
||||
// Copyright (C) 2003-2008 Matthias Christian Schabel
|
||||
// Copyright (C) 2007-2008 Steven Watanabe
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_UNITS_DETAIL_CONVERSION_IMPL_HPP
|
||||
#define BOOST_UNITS_DETAIL_CONVERSION_IMPL_HPP
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/divides.hpp>
|
||||
#include <boost/preprocessor/seq/enum.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#include <boost/units/heterogeneous_system.hpp>
|
||||
#include <boost/units/homogeneous_system.hpp>
|
||||
#include <boost/units/reduce_unit.hpp>
|
||||
#include <boost/units/static_rational.hpp>
|
||||
#include <boost/units/units_fwd.hpp>
|
||||
#include <boost/units/detail/dimension_list.hpp>
|
||||
#include <boost/units/detail/heterogeneous_conversion.hpp>
|
||||
#include <boost/units/detail/one.hpp>
|
||||
#include <boost/units/detail/static_rational_power.hpp>
|
||||
#include <boost/units/detail/unscale.hpp>
|
||||
|
||||
#include <boost/units/units_fwd.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace units {
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<class Source, class Dest>
|
||||
struct conversion_factor_helper;
|
||||
|
||||
template<class Source, class Dest>
|
||||
struct call_base_unit_converter;
|
||||
|
||||
}
|
||||
|
||||
/// INTERNAL ONLY
|
||||
struct undefined_base_unit_converter_base {
|
||||
static const bool is_defined = false;
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
struct no_default_conversion {
|
||||
static const bool is_defined = false;
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<class BaseUnit>
|
||||
struct unscaled_get_default_conversion : no_default_conversion { };
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<bool is_defined>
|
||||
struct unscaled_get_default_conversion_impl;
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<>
|
||||
struct unscaled_get_default_conversion_impl<true>
|
||||
{
|
||||
template<class T>
|
||||
struct apply
|
||||
{
|
||||
typedef typename unscaled_get_default_conversion<typename unscale<T>::type>::type type;
|
||||
};
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<>
|
||||
struct unscaled_get_default_conversion_impl<false>
|
||||
{
|
||||
template<class T>
|
||||
struct apply
|
||||
{
|
||||
typedef typename T::unit_type type;
|
||||
};
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<class BaseUnit>
|
||||
struct get_default_conversion
|
||||
{
|
||||
typedef typename unscaled_get_default_conversion_impl<
|
||||
unscaled_get_default_conversion<typename unscale<BaseUnit>::type>::is_defined
|
||||
>::template apply<BaseUnit>::type type;
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<class Source, class Destination>
|
||||
struct select_base_unit_converter
|
||||
{
|
||||
typedef Source source_type;
|
||||
typedef Destination destination_type;
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<class Source, class Dest>
|
||||
struct base_unit_converter_base : undefined_base_unit_converter_base {
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<class Source>
|
||||
struct base_unit_converter_base<Source, BOOST_UNITS_MAKE_HETEROGENEOUS_UNIT(Source, typename Source::dimension_type)>
|
||||
{
|
||||
static const bool is_defined = true;
|
||||
typedef one type;
|
||||
static type value() {
|
||||
one result;
|
||||
return(result);
|
||||
}
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<class Source, class Dest>
|
||||
struct base_unit_converter : base_unit_converter_base<Source, Dest> { };
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<class Source, class Dest>
|
||||
struct do_call_base_unit_converter {
|
||||
typedef select_base_unit_converter<typename unscale<Source>::type, typename unscale<Dest>::type> selector;
|
||||
typedef typename selector::source_type source_type;
|
||||
typedef typename selector::destination_type destination_type;
|
||||
typedef base_unit_converter<source_type, destination_type> converter;
|
||||
typedef typename mpl::divides<typename get_scale_list<Source>::type, typename get_scale_list<source_type>::type>::type source_factor;
|
||||
typedef typename mpl::divides<typename get_scale_list<Dest>::type, typename get_scale_list<destination_type>::type>::type destination_factor;
|
||||
typedef typename mpl::divides<source_factor, destination_factor>::type factor;
|
||||
typedef eval_scale_list<factor> eval_factor;
|
||||
typedef typename multiply_typeof_helper<typename converter::type, typename eval_factor::type>::type type;
|
||||
static type value()
|
||||
{
|
||||
return(converter::value() * eval_factor::value());
|
||||
}
|
||||
};
|
||||
|
||||
template<bool forward_is_defined, bool reverse_is_defined>
|
||||
struct call_base_unit_converter_base_unit_impl;
|
||||
|
||||
template<>
|
||||
struct call_base_unit_converter_base_unit_impl<true, true>
|
||||
{
|
||||
template<class Source, class Dest>
|
||||
struct apply
|
||||
: do_call_base_unit_converter<Source, typename Dest::unit_type>
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct call_base_unit_converter_base_unit_impl<true, false>
|
||||
{
|
||||
template<class Source, class Dest>
|
||||
struct apply
|
||||
: do_call_base_unit_converter<Source, typename Dest::unit_type>
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct call_base_unit_converter_base_unit_impl<false, true>
|
||||
{
|
||||
template<class Source, class Dest>
|
||||
struct apply
|
||||
{
|
||||
typedef do_call_base_unit_converter<Dest, typename Source::unit_type> converter;
|
||||
typedef typename divide_typeof_helper<one, typename converter::type>::type type;
|
||||
static type value() {
|
||||
one numerator;
|
||||
return(numerator / converter::value());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct call_base_unit_converter_base_unit_impl<false, false>
|
||||
{
|
||||
template<class Source, class Dest>
|
||||
struct apply
|
||||
{
|
||||
typedef typename reduce_unit<typename get_default_conversion<Source>::type>::type new_source;
|
||||
typedef typename reduce_unit<typename get_default_conversion<Dest>::type>::type new_dest;
|
||||
typedef call_base_unit_converter<Source, new_source> start;
|
||||
typedef detail::conversion_factor_helper<
|
||||
new_source,
|
||||
new_dest
|
||||
> conversion;
|
||||
typedef call_base_unit_converter<Dest, new_dest> end;
|
||||
typedef typename divide_typeof_helper<
|
||||
typename multiply_typeof_helper<
|
||||
typename start::type,
|
||||
typename conversion::type
|
||||
>::type,
|
||||
typename end::type
|
||||
>::type type;
|
||||
static type value() {
|
||||
return(start::value() * conversion::value() / end::value());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<int N>
|
||||
struct get_default_conversion_impl
|
||||
{
|
||||
template<class Begin>
|
||||
struct apply
|
||||
{
|
||||
typedef typename Begin::item source_pair;
|
||||
typedef typename source_pair::value_type exponent;
|
||||
typedef typename source_pair::tag_type source;
|
||||
typedef typename reduce_unit<typename get_default_conversion<source>::type>::type new_source;
|
||||
typedef typename get_default_conversion_impl<N-1>::template apply<typename Begin::next> next_iteration;
|
||||
typedef typename multiply_typeof_helper<typename power_typeof_helper<new_source, exponent>::type, typename next_iteration::unit_type>::type unit_type;
|
||||
typedef call_base_unit_converter<source, new_source> conversion;
|
||||
typedef typename multiply_typeof_helper<typename conversion::type, typename next_iteration::type>::type type;
|
||||
static type value() {
|
||||
return(static_rational_power<exponent>(conversion::value()) * next_iteration::value());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct get_default_conversion_impl<0>
|
||||
{
|
||||
template<class Begin>
|
||||
struct apply
|
||||
{
|
||||
typedef unit<dimensionless_type, heterogeneous_system<heterogeneous_system_impl<dimensionless_type, dimensionless_type, no_scale> > > unit_type;
|
||||
typedef one type;
|
||||
static one value() {
|
||||
one result;
|
||||
return(result);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<bool is_defined>
|
||||
struct call_base_unit_converter_impl;
|
||||
|
||||
template<>
|
||||
struct call_base_unit_converter_impl<true>
|
||||
{
|
||||
template<class Source, class Dest>
|
||||
struct apply
|
||||
: do_call_base_unit_converter<Source, Dest>
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct call_base_unit_converter_impl<false>
|
||||
{
|
||||
template<class Source, class Dest>
|
||||
struct apply {
|
||||
typedef typename reduce_unit<typename get_default_conversion<Source>::type>::type new_source;
|
||||
typedef typename Dest::system_type::type system_list;
|
||||
typedef typename get_default_conversion_impl<system_list::size::value>::template apply<system_list> impl;
|
||||
typedef typename impl::unit_type new_dest;
|
||||
typedef call_base_unit_converter<Source, new_source> start;
|
||||
typedef conversion_factor_helper<new_source, new_dest> conversion;
|
||||
typedef typename divide_typeof_helper<
|
||||
typename multiply_typeof_helper<
|
||||
typename start::type,
|
||||
typename conversion::type
|
||||
>::type,
|
||||
typename impl::type
|
||||
>::type type;
|
||||
static type value() {
|
||||
return(start::value() * conversion::value() / impl::value());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
#define BOOST_UNITS_DETAIL_BASE_UNIT_CONVERTER_IS_DEFINED(Source, Dest)\
|
||||
base_unit_converter<\
|
||||
typename select_base_unit_converter<typename unscale<Source>::type, typename unscale<Dest>::type>::source_type,\
|
||||
typename select_base_unit_converter<typename unscale<Source>::type, typename unscale<Dest>::type>::destination_type\
|
||||
>::is_defined
|
||||
|
||||
template<class Source, class Dest>
|
||||
struct call_base_unit_converter : call_base_unit_converter_impl<BOOST_UNITS_DETAIL_BASE_UNIT_CONVERTER_IS_DEFINED(Source, Dest)>::template apply<Source, Dest>
|
||||
{
|
||||
};
|
||||
|
||||
template<class Source, class Dest>
|
||||
struct call_base_unit_converter<Source, BOOST_UNITS_MAKE_HETEROGENEOUS_UNIT(Dest, typename Source::dimension_type)> :
|
||||
call_base_unit_converter_base_unit_impl<
|
||||
BOOST_UNITS_DETAIL_BASE_UNIT_CONVERTER_IS_DEFINED(Source, typename Dest::unit_type),
|
||||
BOOST_UNITS_DETAIL_BASE_UNIT_CONVERTER_IS_DEFINED(Dest, typename Source::unit_type)
|
||||
>::template apply<Source, Dest>
|
||||
{
|
||||
};
|
||||
|
||||
template<int N>
|
||||
struct conversion_impl
|
||||
{
|
||||
template<class Begin, class DestinationSystem>
|
||||
struct apply
|
||||
{
|
||||
typedef typename conversion_impl<N-1>::template apply<
|
||||
typename Begin::next,
|
||||
DestinationSystem
|
||||
> next_iteration;
|
||||
typedef typename Begin::item unit_pair;
|
||||
typedef typename unit_pair::tag_type unit;
|
||||
typedef typename unit::dimension_type dimensions;
|
||||
typedef typename reduce_unit<units::unit<dimensions, DestinationSystem> >::type reduced_unit;
|
||||
typedef detail::call_base_unit_converter<unit, reduced_unit> converter;
|
||||
typedef typename multiply_typeof_helper<typename converter::type, typename next_iteration::type>::type type;
|
||||
static type value() { return(static_rational_power<typename unit_pair::value_type>(converter::value()) * next_iteration::value()); }
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct conversion_impl<0>
|
||||
{
|
||||
template<class Begin, class DestinationSystem>
|
||||
struct apply
|
||||
{
|
||||
typedef one type;
|
||||
static type value() { one result; return(result); }
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/// forward to conversion_factor (intentionally allowing ADL)
|
||||
/// INTERNAL ONLY
|
||||
template<class Unit1, class T1, class Unit2, class T2>
|
||||
struct conversion_helper<quantity<Unit1, T1>, quantity<Unit2, T2> >
|
||||
{
|
||||
/// INTERNAL ONLY
|
||||
typedef quantity<Unit2, T2> destination_type;
|
||||
static destination_type convert(const quantity<Unit1, T1>& source)
|
||||
{
|
||||
Unit1 u1;
|
||||
Unit2 u2;
|
||||
return(destination_type::from_value(static_cast<T2>(source.value() * conversion_factor(u1, u2))));
|
||||
}
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<class Source, class Dest>
|
||||
struct conversion_factor_helper;
|
||||
|
||||
template<class D, class L1, class L2>
|
||||
struct conversion_factor_helper<unit<D, homogeneous_system<L1> >, unit<D, homogeneous_system<L2> > >
|
||||
: conversion_factor_helper<
|
||||
typename reduce_unit<unit<D, homogeneous_system<L1> > >::type,
|
||||
typename reduce_unit<unit<D, homogeneous_system<L2> > >::type
|
||||
>
|
||||
{
|
||||
//typedef typename reduce_unit<unit<D, homogeneous_system<L1> > >::type source_unit;
|
||||
//typedef typename source_unit::system_type::type unit_list;
|
||||
//typedef typename detail::conversion_impl<unit_list::size::value>::template apply<
|
||||
// unit_list,
|
||||
// homogeneous_system<L2>
|
||||
//> impl;
|
||||
//typedef typename impl::type type;
|
||||
//static type value()
|
||||
//{
|
||||
// return(impl::value());
|
||||
//}
|
||||
};
|
||||
|
||||
template<class D, class L1, class L2>
|
||||
struct conversion_factor_helper<unit<D, heterogeneous_system<L1> >, unit<D, homogeneous_system<L2> > >
|
||||
: conversion_factor_helper<
|
||||
typename reduce_unit<unit<D, heterogeneous_system<L1> > >::type,
|
||||
typename reduce_unit<unit<D, homogeneous_system<L2> > >::type
|
||||
>
|
||||
{
|
||||
//typedef typename detail::conversion_impl<L1::type::size::value>::template apply<
|
||||
// typename L1::type,
|
||||
// homogeneous_system<L2>
|
||||
//> impl;
|
||||
//typedef eval_scale_list<typename L1::scale> scale;
|
||||
//typedef typename multiply_typeof_helper<typename impl::type, typename scale::type>::type type;
|
||||
//static type value()
|
||||
//{
|
||||
// return(impl::value() * scale::value());
|
||||
//}
|
||||
};
|
||||
|
||||
// There is no simple algorithm for doing this conversion
|
||||
// other than just defining it as the reverse of the
|
||||
// heterogeneous->homogeneous case
|
||||
template<class D, class L1, class L2>
|
||||
struct conversion_factor_helper<unit<D, homogeneous_system<L1> >, unit<D, heterogeneous_system<L2> > >
|
||||
: conversion_factor_helper<
|
||||
typename reduce_unit<unit<D, homogeneous_system<L1> > >::type,
|
||||
typename reduce_unit<unit<D, heterogeneous_system<L2> > >::type
|
||||
>
|
||||
{
|
||||
//typedef typename detail::conversion_impl<L2::type::size::value>::template apply<
|
||||
// typename L2::type,
|
||||
// homogeneous_system<L1>
|
||||
//> impl;
|
||||
//typedef eval_scale_list<typename L2::scale> scale;
|
||||
//typedef typename multiply_typeof_helper<typename impl::type, typename scale::type>::type type;
|
||||
//static type value()
|
||||
//{
|
||||
// one numerator;
|
||||
// return(numerator / (impl::value() * scale::value()));
|
||||
//}
|
||||
};
|
||||
|
||||
/// Requires that all possible conversions
|
||||
/// between base units are defined.
|
||||
template<class D, class S1, class S2>
|
||||
struct conversion_factor_helper<unit<D, heterogeneous_system<S1> >, unit<D, heterogeneous_system<S2> > >
|
||||
{
|
||||
/// INTERNAL ONLY
|
||||
typedef typename detail::extract_base_units<S1::type::size::value>::template apply<
|
||||
typename S1::type,
|
||||
dimensionless_type
|
||||
>::type from_base_units;
|
||||
/// INTERNAL ONLY
|
||||
typedef typename detail::extract_base_units<S2::type::size::value>::template apply<
|
||||
typename S2::type,
|
||||
from_base_units
|
||||
>::type all_base_units;
|
||||
/// INTERNAL ONLY
|
||||
typedef typename detail::make_homogeneous_system<all_base_units>::type system;
|
||||
typedef typename detail::conversion_impl<S1::type::size::value>::template apply<
|
||||
typename S1::type,
|
||||
system
|
||||
> conversion1;
|
||||
typedef typename detail::conversion_impl<S2::type::size::value>::template apply<
|
||||
typename S2::type,
|
||||
system
|
||||
> conversion2;
|
||||
typedef eval_scale_list<typename mpl::divides<typename S1::scale, typename S2::scale>::type> scale;
|
||||
typedef typename multiply_typeof_helper<
|
||||
typename conversion1::type,
|
||||
typename divide_typeof_helper<typename scale::type, typename conversion2::type>::type
|
||||
>::type type;
|
||||
static type value()
|
||||
{
|
||||
return(conversion1::value() * (scale::value() / conversion2::value()));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace units
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_UNITS_CONVERSION_IMPL_HPP
|
||||
@@ -0,0 +1,137 @@
|
||||
#ifndef BOOST_ARCHIVE_TEXT_WIARCHIVE_HPP
|
||||
#define BOOST_ARCHIVE_TEXT_WIARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// text_wiarchive.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// 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)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#ifdef BOOST_NO_STD_WSTREAMBUF
|
||||
#error "wide char i/o not supported on this platform"
|
||||
#else
|
||||
|
||||
#include <istream>
|
||||
|
||||
#include <boost/archive/detail/auto_link_warchive.hpp>
|
||||
#include <boost/archive/basic_text_iprimitive.hpp>
|
||||
#include <boost/archive/basic_text_iarchive.hpp>
|
||||
#include <boost/archive/detail/register_archive.hpp>
|
||||
#include <boost/serialization/item_version_type.hpp>
|
||||
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
template<class Archive> class interface_iarchive;
|
||||
} // namespace detail
|
||||
|
||||
template<class Archive>
|
||||
class BOOST_SYMBOL_VISIBLE text_wiarchive_impl :
|
||||
public basic_text_iprimitive<std::wistream>,
|
||||
public basic_text_iarchive<Archive>
|
||||
{
|
||||
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
|
||||
// for some inexplicable reason insertion of "class" generates compile erro
|
||||
// on msvc 7.1
|
||||
friend detail::interface_iarchive<Archive>;
|
||||
friend load_access;
|
||||
#else
|
||||
friend class detail::interface_iarchive<Archive>;
|
||||
friend class load_access;
|
||||
#endif
|
||||
#endif
|
||||
template<class T>
|
||||
void load(T & t){
|
||||
basic_text_iprimitive<std::wistream>::load(t);
|
||||
}
|
||||
void load(version_type & t){
|
||||
unsigned int v;
|
||||
load(v);
|
||||
t = version_type(v);
|
||||
}
|
||||
void load(boost::serialization::item_version_type & t){
|
||||
unsigned int v;
|
||||
load(v);
|
||||
t = boost::serialization::item_version_type(v);
|
||||
}
|
||||
BOOST_WARCHIVE_DECL void
|
||||
load(char * t);
|
||||
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
||||
BOOST_WARCHIVE_DECL void
|
||||
load(wchar_t * t);
|
||||
#endif
|
||||
BOOST_WARCHIVE_DECL void
|
||||
load(std::string &s);
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
BOOST_WARCHIVE_DECL void
|
||||
load(std::wstring &ws);
|
||||
#endif
|
||||
template<class T>
|
||||
void load_override(T & t){
|
||||
basic_text_iarchive<Archive>::load_override(t);
|
||||
}
|
||||
BOOST_WARCHIVE_DECL
|
||||
text_wiarchive_impl(std::wistream & is, unsigned int flags);
|
||||
~text_wiarchive_impl(){};
|
||||
};
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
class BOOST_SYMBOL_VISIBLE text_wiarchive :
|
||||
public text_wiarchive_impl<text_wiarchive>{
|
||||
public:
|
||||
text_wiarchive(std::wistream & is, unsigned int flags = 0) :
|
||||
text_wiarchive_impl<text_wiarchive>(is, flags)
|
||||
{}
|
||||
~text_wiarchive(){}
|
||||
};
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
// required by export
|
||||
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_wiarchive)
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // BOOST_NO_STD_WSTREAMBUF
|
||||
#endif // BOOST_ARCHIVE_TEXT_WIARCHIVE_HPP
|
||||
@@ -0,0 +1,127 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Thorsten Ottosen 2006. 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_AS_LITERAL_HPP
|
||||
#define BOOST_RANGE_AS_LITERAL_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
#include <boost/range/detail/as_literal.hpp>
|
||||
#else
|
||||
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/range/detail/str_types.hpp>
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <cstring>
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
#include <cwchar>
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range_detail
|
||||
{
|
||||
inline std::size_t length( const char* s )
|
||||
{
|
||||
return strlen( s );
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
inline std::size_t length( const wchar_t* s )
|
||||
{
|
||||
return wcslen( s );
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// Remark: the compiler cannot choose between T* and T[sz]
|
||||
// overloads, so we must put the T* internal to the
|
||||
// unconstrained version.
|
||||
//
|
||||
|
||||
inline bool is_char_ptr( char* )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool is_char_ptr( const char* )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
inline bool is_char_ptr( wchar_t* )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool is_char_ptr( const wchar_t* )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
template< class T >
|
||||
inline long is_char_ptr( const T& /* r */ )
|
||||
{
|
||||
return 0L;
|
||||
}
|
||||
|
||||
template< class T >
|
||||
inline iterator_range<T*>
|
||||
make_range( T* const r, bool )
|
||||
{
|
||||
return iterator_range<T*>( r, r + length(r) );
|
||||
}
|
||||
|
||||
template< class T >
|
||||
inline iterator_range<BOOST_DEDUCED_TYPENAME range_iterator<T>::type>
|
||||
make_range( T& r, long )
|
||||
{
|
||||
return boost::make_iterator_range( r );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
template< class Range >
|
||||
inline iterator_range<BOOST_DEDUCED_TYPENAME range_iterator<Range>::type>
|
||||
as_literal( Range& r )
|
||||
{
|
||||
return range_detail::make_range( r, range_detail::is_char_ptr(r) );
|
||||
}
|
||||
|
||||
template< class Range >
|
||||
inline iterator_range<BOOST_DEDUCED_TYPENAME range_iterator<const Range>::type>
|
||||
as_literal( const Range& r )
|
||||
{
|
||||
return range_detail::make_range( r, range_detail::is_char_ptr(r) );
|
||||
}
|
||||
|
||||
template< class Char, std::size_t sz >
|
||||
inline iterator_range<Char*> as_literal( Char (&arr)[sz] )
|
||||
{
|
||||
return range_detail::make_range( arr, range_detail::is_char_ptr(arr) );
|
||||
}
|
||||
|
||||
template< class Char, std::size_t sz >
|
||||
inline iterator_range<const Char*> as_literal( const Char (&arr)[sz] )
|
||||
{
|
||||
return range_detail::make_range( arr, range_detail::is_char_ptr(arr) );
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,139 @@
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
// Preprocessed version of "boost/mpl/vector/vector10.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<
|
||||
typename T0
|
||||
>
|
||||
struct vector1
|
||||
: v_item<
|
||||
T0
|
||||
, vector0< >
|
||||
>
|
||||
{
|
||||
typedef vector1 type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1
|
||||
>
|
||||
struct vector2
|
||||
: v_item<
|
||||
T1
|
||||
, vector1<T0>
|
||||
>
|
||||
{
|
||||
typedef vector2 type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2
|
||||
>
|
||||
struct vector3
|
||||
: v_item<
|
||||
T2
|
||||
, vector2< T0,T1 >
|
||||
>
|
||||
{
|
||||
typedef vector3 type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3
|
||||
>
|
||||
struct vector4
|
||||
: v_item<
|
||||
T3
|
||||
, vector3< T0,T1,T2 >
|
||||
>
|
||||
{
|
||||
typedef vector4 type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
>
|
||||
struct vector5
|
||||
: v_item<
|
||||
T4
|
||||
, vector4< T0,T1,T2,T3 >
|
||||
>
|
||||
{
|
||||
typedef vector5 type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5
|
||||
>
|
||||
struct vector6
|
||||
: v_item<
|
||||
T5
|
||||
, vector5< T0,T1,T2,T3,T4 >
|
||||
>
|
||||
{
|
||||
typedef vector6 type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename T6
|
||||
>
|
||||
struct vector7
|
||||
: v_item<
|
||||
T6
|
||||
, vector6< T0,T1,T2,T3,T4,T5 >
|
||||
>
|
||||
{
|
||||
typedef vector7 type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename T6, typename T7
|
||||
>
|
||||
struct vector8
|
||||
: v_item<
|
||||
T7
|
||||
, vector7< T0,T1,T2,T3,T4,T5,T6 >
|
||||
>
|
||||
{
|
||||
typedef vector8 type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename T6, typename T7, typename T8
|
||||
>
|
||||
struct vector9
|
||||
: v_item<
|
||||
T8
|
||||
, vector8< T0,T1,T2,T3,T4,T5,T6,T7 >
|
||||
>
|
||||
{
|
||||
typedef vector9 type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename T6, typename T7, typename T8, typename T9
|
||||
>
|
||||
struct vector10
|
||||
: v_item<
|
||||
T9
|
||||
, vector9< T0,T1,T2,T3,T4,T5,T6,T7,T8 >
|
||||
>
|
||||
{
|
||||
typedef vector10 type;
|
||||
};
|
||||
|
||||
}}
|
||||
@@ -0,0 +1,17 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (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_IDENTITY_HPP
|
||||
# define BOOST_PREPROCESSOR_IDENTITY_HPP
|
||||
#
|
||||
# include <boost/preprocessor/facilities/identity.hpp>
|
||||
#
|
||||
# endif
|
||||
@@ -0,0 +1,58 @@
|
||||
// Copyright Kevlin Henney, 2000-2005.
|
||||
// Copyright Alexander Nasonov, 2006-2010.
|
||||
// Copyright Antony Polukhin, 2011-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)
|
||||
//
|
||||
// what: lexical_cast custom keyword cast
|
||||
// who: contributed by Kevlin Henney,
|
||||
// enhanced with contributions from Terje Slettebo,
|
||||
// with additional fixes and suggestions from Gennaro Prota,
|
||||
// Beman Dawes, Dave Abrahams, Daryle Walker, Peter Dimov,
|
||||
// Alexander Nasonov, Antony Polukhin, Justin Viiret, Michael Hofmann,
|
||||
// Cheng Yang, Matthew Bradbury, David W. Birdsall, Pavel Korzh and other Boosters
|
||||
// when: November 2000, March 2003, June 2005, June 2006, March 2011 - 2014
|
||||
|
||||
#ifndef BOOST_LEXICAL_CAST_DETAIL_IS_CHARACTER_HPP
|
||||
#define BOOST_LEXICAL_CAST_DETAIL_IS_CHARACTER_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace detail // is_character<...>
|
||||
{
|
||||
// returns true, if T is one of the character types
|
||||
template < typename T >
|
||||
struct is_character
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::mpl::bool_<
|
||||
boost::is_same< T, char >::value ||
|
||||
#if !defined(BOOST_NO_STRINGSTREAM) && !defined(BOOST_NO_STD_WSTRING)
|
||||
boost::is_same< T, wchar_t >::value ||
|
||||
#endif
|
||||
#ifndef BOOST_NO_CXX11_CHAR16_T
|
||||
boost::is_same< T, char16_t >::value ||
|
||||
#endif
|
||||
#ifndef BOOST_NO_CXX11_CHAR32_T
|
||||
boost::is_same< T, char32_t >::value ||
|
||||
#endif
|
||||
boost::is_same< T, unsigned char >::value ||
|
||||
boost::is_same< T, signed char >::value
|
||||
> type;
|
||||
|
||||
BOOST_STATIC_CONSTANT(bool, value = (type::value) );
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BOOST_LEXICAL_CAST_DETAIL_IS_CHARACTER_HPP
|
||||
|
||||
@@ -0,0 +1,388 @@
|
||||
// (C) Copyright Gennadiy Rozental 2001.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/libs/test for the library home page.
|
||||
//
|
||||
// File : $RCSfile$
|
||||
//
|
||||
// Version : $Revision$
|
||||
//
|
||||
// Description : named function parameters library
|
||||
// ***************************************************************************
|
||||
|
||||
#ifndef BOOST_TEST_UTILS_NAMED_PARAM
|
||||
#define BOOST_TEST_UTILS_NAMED_PARAM
|
||||
|
||||
// Boost
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
// Boost.Test
|
||||
#include <boost/test/utils/rtti.hpp>
|
||||
#include <boost/test/utils/assign_op.hpp>
|
||||
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
|
||||
#include <boost/test/detail/throw_exception.hpp>
|
||||
|
||||
// Boost
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
#include <boost/test/detail/suppress_warnings.hpp>
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
namespace boost {
|
||||
namespace nfp { // named function parameters
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** forward declarations ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
template<typename unique_id, bool required> struct keyword;
|
||||
template<typename T, typename unique_id, bool required = false> struct typed_keyword;
|
||||
|
||||
template<typename T, typename unique_id, typename RefType=T&> struct named_parameter;
|
||||
template<typename NP1,typename NP2> struct named_parameter_combine;
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** is_named_param_pack ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
/// is_named_param_pack<T>::value is true if T is parameters pack
|
||||
|
||||
template<typename T>
|
||||
struct is_named_param_pack : public mpl::false_ {};
|
||||
|
||||
template<typename T, typename unique_id, typename RefType>
|
||||
struct is_named_param_pack<named_parameter<T,unique_id,RefType> > : public mpl::true_ {};
|
||||
|
||||
template<typename NP, typename Rest>
|
||||
struct is_named_param_pack<named_parameter_combine<NP,Rest> > : public mpl::true_ {};
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** param_type ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
/// param_type<Params,Keyword,Default>::type is is the type of the parameter
|
||||
/// corresponding to the Keyword (if parameter is present) or Default
|
||||
|
||||
template<typename NP, typename Keyword, typename DefaultType=void>
|
||||
struct param_type
|
||||
: mpl::if_<typename is_same<typename NP::id,typename Keyword::id>::type,
|
||||
typename remove_cv<typename NP::data_type>::type,
|
||||
DefaultType> {};
|
||||
|
||||
template<typename NP, typename Rest, typename Keyword, typename DefaultType>
|
||||
struct param_type<named_parameter_combine<NP,Rest>,Keyword,DefaultType>
|
||||
: mpl::if_<typename is_same<typename NP::id,typename Keyword::id>::type,
|
||||
typename remove_cv<typename NP::data_type>::type,
|
||||
typename param_type<Rest,Keyword,DefaultType>::type> {};
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** has_param ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
/// has_param<Params,Keyword>::value is true id Params has parameter corresponding
|
||||
/// to the Keyword
|
||||
|
||||
template<typename NP, typename Keyword>
|
||||
struct has_param : is_same<typename NP::id,typename Keyword::id> {};
|
||||
|
||||
template<typename NP, typename Rest, typename Keyword>
|
||||
struct has_param<named_parameter_combine<NP,Rest>,Keyword>
|
||||
: mpl::or_<typename is_same<typename NP::id,typename Keyword::id>::type,
|
||||
typename has_param<Rest,Keyword>::type> {};
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** access_to_invalid_parameter ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
namespace nfp_detail {
|
||||
|
||||
struct access_to_invalid_parameter {};
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
inline void
|
||||
report_access_to_invalid_parameter( bool v )
|
||||
{
|
||||
BOOST_TEST_I_ASSRT( !v, access_to_invalid_parameter() );
|
||||
}
|
||||
|
||||
} // namespace nfp_detail
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** nil ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
struct nil {
|
||||
template<typename T>
|
||||
#if defined(__GNUC__) || defined(__HP_aCC) || defined(__EDG__) || defined(__SUNPRO_CC)
|
||||
operator T() const
|
||||
#else
|
||||
operator T const&() const
|
||||
#endif
|
||||
{ nfp_detail::report_access_to_invalid_parameter(true); static T* v = 0; return *v; }
|
||||
|
||||
template<typename T>
|
||||
T any_cast() const
|
||||
{ nfp_detail::report_access_to_invalid_parameter(true); static typename remove_reference<T>::type* v = 0; return *v; }
|
||||
|
||||
template<typename Arg1>
|
||||
nil operator()( Arg1 const& )
|
||||
{ nfp_detail::report_access_to_invalid_parameter(true); return nil(); }
|
||||
|
||||
template<typename Arg1,typename Arg2>
|
||||
nil operator()( Arg1 const&, Arg2 const& )
|
||||
{ nfp_detail::report_access_to_invalid_parameter(true); return nil(); }
|
||||
|
||||
template<typename Arg1,typename Arg2,typename Arg3>
|
||||
nil operator()( Arg1 const&, Arg2 const&, Arg3 const& )
|
||||
{ nfp_detail::report_access_to_invalid_parameter(true); return nil(); }
|
||||
|
||||
// Visitation support
|
||||
template<typename Visitor>
|
||||
void apply_to( Visitor& /*v*/ ) const {}
|
||||
|
||||
static nil& inst() { static nil s_inst; return s_inst; }
|
||||
private:
|
||||
nil() {}
|
||||
};
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** named_parameter_base ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
namespace nfp_detail {
|
||||
|
||||
template<typename Derived>
|
||||
struct named_parameter_base {
|
||||
template<typename NP>
|
||||
named_parameter_combine<NP,Derived>
|
||||
operator,( NP const& np ) const { return named_parameter_combine<NP,Derived>( np, *static_cast<Derived const*>(this) ); }
|
||||
};
|
||||
|
||||
} // namespace nfp_detail
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** named_parameter_combine ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
template<typename NP, typename Rest = nil>
|
||||
struct named_parameter_combine
|
||||
: Rest
|
||||
, nfp_detail::named_parameter_base<named_parameter_combine<NP,Rest> > {
|
||||
typedef typename NP::ref_type res_type;
|
||||
typedef named_parameter_combine<NP,Rest> self_type;
|
||||
|
||||
// Constructor
|
||||
named_parameter_combine( NP const& np, Rest const& r )
|
||||
: Rest( r )
|
||||
, m_param( np )
|
||||
{
|
||||
}
|
||||
|
||||
// Access methods
|
||||
res_type operator[]( keyword<typename NP::id,true> kw ) const { return m_param[kw]; }
|
||||
res_type operator[]( keyword<typename NP::id,false> kw ) const { return m_param[kw]; }
|
||||
using Rest::operator[];
|
||||
|
||||
bool has( keyword<typename NP::id,false> kw ) const { return m_param.has( kw ); }
|
||||
using Rest::has;
|
||||
|
||||
void erase( keyword<typename NP::id,false> kw ) const { m_param.erase( kw ); }
|
||||
using Rest::erase;
|
||||
|
||||
using nfp_detail::named_parameter_base<named_parameter_combine<NP,Rest> >::operator,;
|
||||
|
||||
// Visitation support
|
||||
template<typename Visitor>
|
||||
void apply_to( Visitor& V ) const
|
||||
{
|
||||
m_param.apply_to( V );
|
||||
|
||||
Rest::apply_to( V );
|
||||
}
|
||||
private:
|
||||
// Data members
|
||||
NP m_param;
|
||||
};
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** named_parameter ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
template<typename T, typename unique_id, typename RefType>
|
||||
struct named_parameter
|
||||
: nfp_detail::named_parameter_base<named_parameter<T,unique_id,RefType> >
|
||||
{
|
||||
typedef T data_type;
|
||||
typedef RefType ref_type;
|
||||
typedef unique_id id;
|
||||
|
||||
// Constructor
|
||||
explicit named_parameter( ref_type v )
|
||||
: m_value( v )
|
||||
, m_erased( false )
|
||||
{}
|
||||
named_parameter( named_parameter const& np )
|
||||
: m_value( np.m_value )
|
||||
, m_erased( np.m_erased )
|
||||
{}
|
||||
|
||||
// Access methods
|
||||
ref_type operator[]( keyword<unique_id,true> ) const { return m_erased ? nil::inst().template any_cast<ref_type>() : m_value; }
|
||||
ref_type operator[]( keyword<unique_id,false> ) const { return m_erased ? nil::inst().template any_cast<ref_type>() : m_value; }
|
||||
template<typename UnknownId>
|
||||
nil operator[]( keyword<UnknownId,false> ) const { return nil::inst(); }
|
||||
|
||||
bool has( keyword<unique_id,false> ) const { return !m_erased; }
|
||||
template<typename UnknownId>
|
||||
bool has( keyword<UnknownId,false> ) const { return false; }
|
||||
|
||||
void erase( keyword<unique_id,false> ) const { m_erased = true; }
|
||||
template<typename UnknownId>
|
||||
void erase( keyword<UnknownId,false> ) const {}
|
||||
|
||||
// Visitation support
|
||||
template<typename Visitor>
|
||||
void apply_to( Visitor& V ) const
|
||||
{
|
||||
V.set_parameter( rtti::type_id<unique_id>(), m_value );
|
||||
}
|
||||
|
||||
private:
|
||||
// Data members
|
||||
ref_type m_value;
|
||||
mutable bool m_erased;
|
||||
};
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** no_params ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
typedef named_parameter<char, struct no_params_type_t,char> no_params_type;
|
||||
|
||||
namespace {
|
||||
no_params_type no_params( '\0' );
|
||||
} // local namespace
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** keyword ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
template<typename unique_id, bool required = false>
|
||||
struct keyword {
|
||||
typedef unique_id id;
|
||||
|
||||
template<typename T>
|
||||
named_parameter<T const,unique_id>
|
||||
operator=( T const& t ) const { return named_parameter<T const,unique_id>( t ); }
|
||||
|
||||
template<typename T>
|
||||
named_parameter<T,unique_id>
|
||||
operator=( T& t ) const { return named_parameter<T,unique_id>( t ); }
|
||||
|
||||
named_parameter<char const*,unique_id,char const*>
|
||||
operator=( char const* t ) const { return named_parameter<char const*,unique_id,char const*>( t ); }
|
||||
};
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** typed_keyword ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
template<typename T, typename unique_id, bool required>
|
||||
struct typed_keyword : keyword<unique_id,required> {
|
||||
named_parameter<T const,unique_id>
|
||||
operator=( T const& t ) const { return named_parameter<T const,unique_id>( t ); }
|
||||
|
||||
named_parameter<T,unique_id>
|
||||
operator=( T& t ) const { return named_parameter<T,unique_id>( t ); }
|
||||
};
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
template<typename unique_id, bool required>
|
||||
struct typed_keyword<bool,unique_id,required>
|
||||
: keyword<unique_id,required>
|
||||
, named_parameter<bool,unique_id,bool> {
|
||||
typedef unique_id id;
|
||||
|
||||
typed_keyword() : named_parameter<bool,unique_id,bool>( true ) {}
|
||||
|
||||
named_parameter<bool,unique_id,bool>
|
||||
operator!() const { return named_parameter<bool,unique_id,bool>( false ); }
|
||||
};
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** opt_assign ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
template<typename T, typename Params, typename Keyword>
|
||||
inline typename enable_if_c<!has_param<Params,Keyword>::value,void>::type
|
||||
opt_assign( T& /*target*/, Params const& /*p*/, Keyword /*k*/ )
|
||||
{
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
template<typename T, typename Params, typename Keyword>
|
||||
inline typename enable_if_c<has_param<Params,Keyword>::value,void>::type
|
||||
opt_assign( T& target, Params const& p, Keyword k )
|
||||
{
|
||||
using namespace unit_test;
|
||||
|
||||
assign_op( target, p[k], static_cast<int>(0) );
|
||||
}
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** opt_get ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
template<typename T, typename Params, typename Keyword>
|
||||
inline T
|
||||
opt_get( Params const& p, Keyword k, T default_val )
|
||||
{
|
||||
opt_assign( default_val, p, k );
|
||||
|
||||
return default_val;
|
||||
}
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** opt_get ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
template<typename Params, typename NP>
|
||||
inline typename enable_if_c<!has_param<Params,keyword<typename NP::id> >::value,
|
||||
named_parameter_combine<NP,Params> >::type
|
||||
opt_append( Params const& params, NP const& np )
|
||||
{
|
||||
return (params,np);
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
template<typename Params, typename NP>
|
||||
inline typename enable_if_c<has_param<Params,keyword<typename NP::id> >::value,Params>::type
|
||||
opt_append( Params const& params, NP const& )
|
||||
{
|
||||
return params;
|
||||
}
|
||||
|
||||
} // namespace nfp
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/test/detail/enable_warnings.hpp>
|
||||
|
||||
#endif // BOOST_TEST_UTILS_NAMED_PARAM
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,131 @@
|
||||
// (C) Copyright Gennadiy Rozental 2001.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/libs/test for the library home page.
|
||||
//
|
||||
// File : $RCSfile$
|
||||
//
|
||||
// Version : $Revision$
|
||||
//
|
||||
// Description : model of actual argument (both typed and abstract interface)
|
||||
// ***************************************************************************
|
||||
|
||||
#ifndef BOOST_TEST_UTILS_RUNTIME_ARGUMENT_HPP
|
||||
#define BOOST_TEST_UTILS_RUNTIME_ARGUMENT_HPP
|
||||
|
||||
// Boost.Test Runtime parameters
|
||||
#include <boost/test/utils/runtime/fwd.hpp>
|
||||
#include <boost/test/utils/runtime/errors.hpp>
|
||||
|
||||
// Boost.Test
|
||||
#include <boost/test/utils/class_properties.hpp>
|
||||
#include <boost/test/utils/rtti.hpp>
|
||||
#include <boost/test/utils/basic_cstring/compare.hpp>
|
||||
#include <boost/test/detail/throw_exception.hpp>
|
||||
|
||||
// STL
|
||||
#include <cassert>
|
||||
|
||||
#include <boost/test/detail/suppress_warnings.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace runtime {
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** runtime::argument ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
class argument {
|
||||
public:
|
||||
// Constructor
|
||||
argument( rtti::id_t value_type )
|
||||
: p_value_type( value_type )
|
||||
{}
|
||||
|
||||
// Destructor
|
||||
virtual ~argument() {}
|
||||
|
||||
// Public properties
|
||||
rtti::id_t const p_value_type;
|
||||
};
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** runtime::typed_argument ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
template<typename T>
|
||||
class typed_argument : public argument {
|
||||
public:
|
||||
// Constructor
|
||||
explicit typed_argument( T const& v )
|
||||
: argument( rtti::type_id<T>() )
|
||||
, p_value( v )
|
||||
{}
|
||||
|
||||
unit_test::readwrite_property<T> p_value;
|
||||
};
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** runtime::arguments_store ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
class arguments_store {
|
||||
public:
|
||||
typedef std::map<cstring, argument_ptr> storage_type;
|
||||
|
||||
/// Returns number of arguments in the store; mostly used for testing
|
||||
std::size_t size() const { return m_arguments.size(); }
|
||||
|
||||
/// Clears the store for reuse
|
||||
void clear() { m_arguments.clear(); }
|
||||
|
||||
/// Returns true if there is an argument corresponding to the specified parameter name
|
||||
bool has( cstring parameter_name ) const
|
||||
{
|
||||
return m_arguments.find( parameter_name ) != m_arguments.end();
|
||||
}
|
||||
|
||||
/// Provides types access to argument value by parameter name
|
||||
template<typename T>
|
||||
T const& get( cstring parameter_name ) const {
|
||||
return const_cast<arguments_store*>(this)->get<T>( parameter_name );
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T& get( cstring parameter_name ) {
|
||||
storage_type::const_iterator found = m_arguments.find( parameter_name );
|
||||
BOOST_TEST_I_ASSRT( found != m_arguments.end(),
|
||||
access_to_missing_argument()
|
||||
<< "There is no argument provided for parameter "
|
||||
<< parameter_name );
|
||||
|
||||
argument_ptr arg = found->second;
|
||||
|
||||
BOOST_TEST_I_ASSRT( arg->p_value_type == rtti::type_id<T>(),
|
||||
arg_type_mismatch()
|
||||
<< "Access with invalid type for argument corresponding to parameter "
|
||||
<< parameter_name );
|
||||
|
||||
return static_cast<typed_argument<T>&>( *arg ).p_value.value;
|
||||
}
|
||||
|
||||
/// Set's the argument value for specified parameter name
|
||||
template<typename T>
|
||||
void set( cstring parameter_name, T const& value )
|
||||
{
|
||||
m_arguments[parameter_name] = argument_ptr( new typed_argument<T>( value ) );
|
||||
}
|
||||
|
||||
private:
|
||||
// Data members
|
||||
storage_type m_arguments;
|
||||
};
|
||||
|
||||
} // namespace runtime
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/test/detail/enable_warnings.hpp>
|
||||
|
||||
#endif // BOOST_TEST_UTILS_RUNTIME_ARGUMENT_HPP
|
||||
@@ -0,0 +1,91 @@
|
||||
#ifndef MESSAGE_SERVER_HPP__
|
||||
#define MESSAGE_SERVER_HPP__
|
||||
|
||||
#include <QObject>
|
||||
#include <QTime>
|
||||
#include <QDateTime>
|
||||
#include <QHostAddress>
|
||||
|
||||
#include "udp_export.h"
|
||||
#include "Radio.hpp"
|
||||
|
||||
#include "pimpl_h.hpp"
|
||||
|
||||
class QString;
|
||||
|
||||
//
|
||||
// MessageServer - a reference implementation of a message server
|
||||
// matching the MessageClient class at the other end
|
||||
// of the wire
|
||||
//
|
||||
// This class is fully functioning and suitable for use in C++
|
||||
// applications that use the Qt framework. Other applications should
|
||||
// use this classes' implementation as a reference implementation.
|
||||
//
|
||||
class UDP_EXPORT MessageServer
|
||||
: public QObject
|
||||
{
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
using port_type = quint16;
|
||||
using Frequency = Radio::Frequency;
|
||||
|
||||
MessageServer (QObject * parent = nullptr,
|
||||
QString const& version = QString {}, QString const& revision = QString {});
|
||||
|
||||
// start or restart the server, if the multicast_group_address
|
||||
// argument is given it is assumed to be a multicast group address
|
||||
// which the server will join
|
||||
Q_SLOT void start (port_type port,
|
||||
QHostAddress const& multicast_group_address = QHostAddress {});
|
||||
|
||||
// ask the client with identification 'id' to make the same action
|
||||
// as a double click on the decode would
|
||||
//
|
||||
// note that the client is not obliged to take any action and only
|
||||
// takes any action if the decode is present and is a CQ or QRZ message
|
||||
Q_SLOT void reply (QString const& id, QTime time, qint32 snr, float delta_time, quint32 delta_frequency
|
||||
, QString const& mode, QString const& message, bool low_confidence, quint8 modifiers);
|
||||
|
||||
// ask the client with identification 'id' to replay all decodes
|
||||
Q_SLOT void replay (QString const& id);
|
||||
|
||||
// ask the client with identification 'id' to halt transmitting
|
||||
// auto_only just disables auto Tx, otherwise halt is immediate
|
||||
Q_SLOT void halt_tx (QString const& id, bool auto_only);
|
||||
|
||||
// ask the client with identification 'id' to set the free text
|
||||
// message and optionally send it ASAP
|
||||
Q_SLOT void free_text (QString const& id, QString const& text, bool send);
|
||||
|
||||
// the following signals are emitted when a client broadcasts the
|
||||
// matching message
|
||||
Q_SIGNAL void client_opened (QString const& id, QString const& version, QString const& revision);
|
||||
Q_SIGNAL void status_update (QString const& id, Frequency, QString const& mode, QString const& dx_call
|
||||
, QString const& report, QString const& tx_mode, bool tx_enabled
|
||||
, bool transmitting, bool decoding, qint32 rx_df, qint32 tx_df
|
||||
, QString const& de_call, QString const& de_grid, QString const& dx_grid
|
||||
, bool watchdog_timeout, QString const& sub_mode, bool fast_mode);
|
||||
Q_SIGNAL void client_closed (QString const& id);
|
||||
Q_SIGNAL void decode (bool is_new, QString const& id, QTime time, qint32 snr, float delta_time
|
||||
, quint32 delta_frequency, QString const& mode, QString const& message
|
||||
, bool low_confidence, bool off_air);
|
||||
Q_SIGNAL void WSPR_decode (bool is_new, QString const& id, QTime time, qint32 snr, float delta_time, Frequency
|
||||
, qint32 drift, QString const& callsign, QString const& grid, qint32 power
|
||||
, bool off_air);
|
||||
Q_SIGNAL void qso_logged (QString const& id, QDateTime time_off, QString const& dx_call, QString const& dx_grid
|
||||
, Frequency dial_frequency, QString const& mode, QString const& report_sent
|
||||
, QString const& report_received, QString const& tx_power, QString const& comments
|
||||
, QString const& name, QDateTime time_on);
|
||||
Q_SIGNAL void clear_decodes (QString const& id);
|
||||
|
||||
// this signal is emitted when a network error occurs
|
||||
Q_SIGNAL void error (QString const&) const;
|
||||
|
||||
private:
|
||||
class UDP_NO_EXPORT impl;
|
||||
pimpl<impl> m_;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,27 @@
|
||||
|
||||
#ifndef BOOST_MPL_ITERATOR_TAG_HPP_INCLUDED
|
||||
#define BOOST_MPL_ITERATOR_TAG_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/int.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
struct forward_iterator_tag : int_<0> { typedef forward_iterator_tag type; };
|
||||
struct bidirectional_iterator_tag : int_<1> { typedef bidirectional_iterator_tag type; };
|
||||
struct random_access_iterator_tag : int_<2> { typedef random_access_iterator_tag type; };
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_ITERATOR_TAG_HPP_INCLUDED
|
||||
@@ -0,0 +1,85 @@
|
||||
//
|
||||
// boost/assert.hpp - BOOST_ASSERT(expr)
|
||||
// BOOST_ASSERT_MSG(expr, msg)
|
||||
// BOOST_VERIFY(expr)
|
||||
// BOOST_VERIFY_MSG(expr, msg)
|
||||
// BOOST_ASSERT_IS_VOID
|
||||
//
|
||||
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
|
||||
// Copyright (c) 2007, 2014 Peter Dimov
|
||||
// Copyright (c) Beman Dawes 2011
|
||||
// Copyright (c) 2015 Ion Gaztanaga
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// Note: There are no include guards. This is intentional.
|
||||
//
|
||||
// See http://www.boost.org/libs/assert/assert.html for documentation.
|
||||
//
|
||||
|
||||
//
|
||||
// Stop inspect complaining about use of 'assert':
|
||||
//
|
||||
// boostinspect:naassert_macro
|
||||
//
|
||||
|
||||
//
|
||||
// BOOST_ASSERT, BOOST_ASSERT_MSG, BOOST_ASSERT_IS_VOID
|
||||
//
|
||||
|
||||
#undef BOOST_ASSERT
|
||||
#undef BOOST_ASSERT_MSG
|
||||
#undef BOOST_ASSERT_IS_VOID
|
||||
|
||||
#if defined(BOOST_DISABLE_ASSERTS) || ( defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && defined(NDEBUG) )
|
||||
|
||||
# define BOOST_ASSERT(expr) ((void)0)
|
||||
# define BOOST_ASSERT_MSG(expr, msg) ((void)0)
|
||||
# define BOOST_ASSERT_IS_VOID
|
||||
|
||||
#elif defined(BOOST_ENABLE_ASSERT_HANDLER) || ( defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && !defined(NDEBUG) )
|
||||
|
||||
#include <boost/config.hpp> // for BOOST_LIKELY
|
||||
#include <boost/current_function.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
void assertion_failed(char const * expr, char const * function, char const * file, long line); // user defined
|
||||
void assertion_failed_msg(char const * expr, char const * msg, char const * function, char const * file, long line); // user defined
|
||||
} // namespace boost
|
||||
|
||||
#define BOOST_ASSERT(expr) (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
|
||||
#define BOOST_ASSERT_MSG(expr, msg) (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed_msg(#expr, msg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
|
||||
|
||||
#else
|
||||
|
||||
# include <assert.h> // .h to support old libraries w/o <cassert> - effect is the same
|
||||
|
||||
# define BOOST_ASSERT(expr) assert(expr)
|
||||
# define BOOST_ASSERT_MSG(expr, msg) assert((expr)&&(msg))
|
||||
#if defined(NDEBUG)
|
||||
# define BOOST_ASSERT_IS_VOID
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// BOOST_VERIFY, BOOST_VERIFY_MSG
|
||||
//
|
||||
|
||||
#undef BOOST_VERIFY
|
||||
#undef BOOST_VERIFY_MSG
|
||||
|
||||
#if defined(BOOST_DISABLE_ASSERTS) || ( !defined(BOOST_ENABLE_ASSERT_HANDLER) && defined(NDEBUG) )
|
||||
|
||||
# define BOOST_VERIFY(expr) ((void)(expr))
|
||||
# define BOOST_VERIFY_MSG(expr, msg) ((void)(expr))
|
||||
|
||||
#else
|
||||
|
||||
# define BOOST_VERIFY(expr) BOOST_ASSERT(expr)
|
||||
# define BOOST_VERIFY_MSG(expr, msg) BOOST_ASSERT_MSG(expr,msg)
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,68 @@
|
||||
// Copyright Neil Groves 2009. 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_ALGORITHM_STABLE_SORT_HPP_INCLUDED
|
||||
#define BOOST_RANGE_ALGORITHM_STABLE_SORT_HPP_INCLUDED
|
||||
|
||||
#include <boost/concept_check.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range
|
||||
{
|
||||
|
||||
/// \brief template function stable_sort
|
||||
///
|
||||
/// range-based version of the stable_sort std algorithm
|
||||
///
|
||||
/// \pre RandomAccessRange is a model of the RandomAccessRangeConcept
|
||||
/// \pre BinaryPredicate is a model of the BinaryPredicateConcept
|
||||
template<class RandomAccessRange>
|
||||
inline RandomAccessRange& stable_sort(RandomAccessRange& rng)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<RandomAccessRange> ));
|
||||
std::stable_sort(boost::begin(rng), boost::end(rng));
|
||||
return rng;
|
||||
}
|
||||
|
||||
/// \overload
|
||||
template<class RandomAccessRange>
|
||||
inline const RandomAccessRange& stable_sort(const RandomAccessRange& rng)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
|
||||
std::stable_sort(boost::begin(rng), boost::end(rng));
|
||||
return rng;
|
||||
}
|
||||
|
||||
/// \overload
|
||||
template<class RandomAccessRange, class BinaryPredicate>
|
||||
inline RandomAccessRange& stable_sort(RandomAccessRange& rng, BinaryPredicate sort_pred)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<RandomAccessRange> ));
|
||||
std::stable_sort(boost::begin(rng), boost::end(rng), sort_pred);
|
||||
return rng;
|
||||
}
|
||||
|
||||
/// \overload
|
||||
template<class RandomAccessRange, class BinaryPredicate>
|
||||
inline const RandomAccessRange& stable_sort(const RandomAccessRange& rng, BinaryPredicate sort_pred)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
|
||||
std::stable_sort(boost::begin(rng), boost::end(rng), sort_pred);
|
||||
return rng;
|
||||
}
|
||||
|
||||
} // namespace range
|
||||
using range::stable_sort;
|
||||
} // namespace boost
|
||||
|
||||
#endif // include guard
|
||||
@@ -0,0 +1,100 @@
|
||||
<HTML><HEAD>
|
||||
|
||||
<TITLE> Support Programs </TITLE>
|
||||
|
||||
</HEAD><BODY>
|
||||
|
||||
|
||||
<H1> Support Programs </H1>
|
||||
|
||||
The following programs provide support for testing and performance
|
||||
assessment.
|
||||
|
||||
|
||||
<P><A NAME="rand-src"><HR><B>rand-src</B>: Generate random message bits.
|
||||
|
||||
<BLOCKQUOTE><PRE>
|
||||
rand-src <I>source-file seed n-bits</I>
|
||||
</PRE></BLOCKQUOTE>
|
||||
|
||||
<P>Creates a file of random messages bits called
|
||||
<TT><I>source-file</I></TT>, which is suitable for testing the
|
||||
correctness and performance of other programs. The bits in the file
|
||||
are independent, and are equally likely to be 0 or 1. They are
|
||||
generated pseudo-randomly based on <TT><I>seed</I></TT>. The actual
|
||||
random number seed used will be <TT><I>seed</I></TT> times 10 plus 2,
|
||||
so that the stream of pseudo-random numbers will not be the same as
|
||||
any that might have been used by another program.
|
||||
|
||||
<P>The <TT><I>n-bits</I></TT> argument specifies the number of bits to
|
||||
produce. It can be a single number, or it can consist of a block size
|
||||
and a number of blocks, written with <TT>x</TT> separating these
|
||||
numbers, with no spaces. Each block is written as a single line, with
|
||||
the bits in the block represented by the characters '0' and '1', with
|
||||
no intervening spaces. If the bit count is given by a single number,
|
||||
the block size is assumed to be one.
|
||||
|
||||
<P><B>Example:</B> The following command produces a file containing
|
||||
3 blocks, each consisting of 15 random bits, produced using the pseudo-random
|
||||
number stream identified by the <TT><I>seed</I></TT> of 17:
|
||||
<UL><PRE>
|
||||
<LI>rand-src rsrc 17 15x3
|
||||
</PRE></UL>
|
||||
The contents of the file <TT>rsrc</TT> after this command might be something
|
||||
like the following:
|
||||
<BLOCKQUOTE><PRE>
|
||||
111011000110000
|
||||
010010110010111
|
||||
100000000000111
|
||||
</BLOCKQUOTE></PRE>
|
||||
|
||||
|
||||
<P><A NAME="verify"><HR><B>verify</B>: Verify that decoded blocks are
|
||||
codewords, and that they match the source.
|
||||
|
||||
<BLOCKQUOTE><PRE>
|
||||
verify [ -t ] <I>pchk-file decoded-file</I> [ <I>gen-file</I> [ <I>source-file</I> ] ]
|
||||
</PRE></BLOCKQUOTE>
|
||||
|
||||
<P>Checks whether or not the blocks in <TT><I>decoded-file</I></TT>
|
||||
are codewords, according to the parity check matrix in
|
||||
<TT><I>pchk-file</I></TT>. If <TT><I>gen-file</I></TT> is specified,
|
||||
the message bits of the blocks are also checked against the
|
||||
corresponding blocks of <TT><I>source-file</I></TT>, or against zero
|
||||
if <TT><I>source-file</I></TT> is not given. (Normally, one would
|
||||
leave out <TT><I>source-file</I></TT> only if the <A
|
||||
HREF="channel.html#transmit"><TT>transmit</TT></A> command was used
|
||||
with an argument specifying that zeros are to be transmitted, rather
|
||||
than a file of encoded data.)
|
||||
|
||||
<P>A summary of the results is displayed on standard error, giving the
|
||||
total numbers of blocks, the number with parity check errors, and, if
|
||||
<TT><I>gen-file</I></TT> was specified, the number of blocks with
|
||||
source errors and the number with errors of both kinds. If
|
||||
<TT><I>gen-file</I></TT> was specified, a second
|
||||
summary line displays the bit error rate from
|
||||
comparing the decoded message bits with the true message bits (zeros
|
||||
if no <TT><I>source file</I></TT> was given).
|
||||
|
||||
<P>If the <B>-t</B> option is given, block-by-block results are
|
||||
printed on standard output in two or three columns, giving the block
|
||||
number (from zero), the number of parity check errors for that block,
|
||||
and the number of errors in source bits. The last column is omitted
|
||||
if <TT><I>gen-file</I></TT> is not specified. The columns are
|
||||
preceded by a line of headers, so the file is suitable for reading
|
||||
into the S-Plus or R statistics packages, with a command such as
|
||||
<BLOCKQUOTE><PRE>
|
||||
data <- read.table(<I>file</I>,header=T)
|
||||
</PRE></BLOCKQUOTE>
|
||||
|
||||
<P>Warning messages are displayed on standard error if the number of
|
||||
bits in <TT><I>decoded-file</I></TT> is not a multiple of the block
|
||||
length, or if <TT><I>source-file</I></TT> is too short. Newlines
|
||||
in these files are ignored, even though they would normally occur
|
||||
at the ends of blocks.
|
||||
|
||||
<HR>
|
||||
|
||||
<A HREF="index.html">Back to index for LDPC software</A>
|
||||
|
||||
</BODY></HTML>
|
||||
@@ -0,0 +1,430 @@
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-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)
|
||||
//
|
||||
|
||||
// Preprocessed version of "boost/mpl/map/map50.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<>
|
||||
struct m_at_impl<40>
|
||||
{
|
||||
template< typename Map > struct result_
|
||||
{
|
||||
typedef typename Map::item40 type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct m_item_impl<41>
|
||||
{
|
||||
template< typename Key, typename T, typename Base > struct result_
|
||||
: m_item_< Key,T,Base >
|
||||
{
|
||||
typedef pair< Key,T > item40;
|
||||
};
|
||||
};
|
||||
|
||||
template<
|
||||
typename P0, typename P1, typename P2, typename P3, typename P4
|
||||
, typename P5, typename P6, typename P7, typename P8, typename P9
|
||||
, typename P10, typename P11, typename P12, typename P13, typename P14
|
||||
, typename P15, typename P16, typename P17, typename P18, typename P19
|
||||
, typename P20, typename P21, typename P22, typename P23, typename P24
|
||||
, typename P25, typename P26, typename P27, typename P28, typename P29
|
||||
, typename P30, typename P31, typename P32, typename P33, typename P34
|
||||
, typename P35, typename P36, typename P37, typename P38, typename P39
|
||||
, typename P40
|
||||
>
|
||||
struct map41
|
||||
: m_item<
|
||||
41
|
||||
, typename P40::first
|
||||
, typename P40::second
|
||||
, map40< P0,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,P23,P24,P25,P26,P27,P28,P29,P30,P31,P32,P33,P34,P35,P36,P37,P38,P39 >
|
||||
>
|
||||
{
|
||||
typedef map41 type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct m_at_impl<41>
|
||||
{
|
||||
template< typename Map > struct result_
|
||||
{
|
||||
typedef typename Map::item41 type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct m_item_impl<42>
|
||||
{
|
||||
template< typename Key, typename T, typename Base > struct result_
|
||||
: m_item_< Key,T,Base >
|
||||
{
|
||||
typedef pair< Key,T > item41;
|
||||
};
|
||||
};
|
||||
|
||||
template<
|
||||
typename P0, typename P1, typename P2, typename P3, typename P4
|
||||
, typename P5, typename P6, typename P7, typename P8, typename P9
|
||||
, typename P10, typename P11, typename P12, typename P13, typename P14
|
||||
, typename P15, typename P16, typename P17, typename P18, typename P19
|
||||
, typename P20, typename P21, typename P22, typename P23, typename P24
|
||||
, typename P25, typename P26, typename P27, typename P28, typename P29
|
||||
, typename P30, typename P31, typename P32, typename P33, typename P34
|
||||
, typename P35, typename P36, typename P37, typename P38, typename P39
|
||||
, typename P40, typename P41
|
||||
>
|
||||
struct map42
|
||||
: m_item<
|
||||
42
|
||||
, typename P41::first
|
||||
, typename P41::second
|
||||
, map41< P0,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,P23,P24,P25,P26,P27,P28,P29,P30,P31,P32,P33,P34,P35,P36,P37,P38,P39,P40 >
|
||||
>
|
||||
{
|
||||
typedef map42 type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct m_at_impl<42>
|
||||
{
|
||||
template< typename Map > struct result_
|
||||
{
|
||||
typedef typename Map::item42 type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct m_item_impl<43>
|
||||
{
|
||||
template< typename Key, typename T, typename Base > struct result_
|
||||
: m_item_< Key,T,Base >
|
||||
{
|
||||
typedef pair< Key,T > item42;
|
||||
};
|
||||
};
|
||||
|
||||
template<
|
||||
typename P0, typename P1, typename P2, typename P3, typename P4
|
||||
, typename P5, typename P6, typename P7, typename P8, typename P9
|
||||
, typename P10, typename P11, typename P12, typename P13, typename P14
|
||||
, typename P15, typename P16, typename P17, typename P18, typename P19
|
||||
, typename P20, typename P21, typename P22, typename P23, typename P24
|
||||
, typename P25, typename P26, typename P27, typename P28, typename P29
|
||||
, typename P30, typename P31, typename P32, typename P33, typename P34
|
||||
, typename P35, typename P36, typename P37, typename P38, typename P39
|
||||
, typename P40, typename P41, typename P42
|
||||
>
|
||||
struct map43
|
||||
: m_item<
|
||||
43
|
||||
, typename P42::first
|
||||
, typename P42::second
|
||||
, map42< P0,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,P23,P24,P25,P26,P27,P28,P29,P30,P31,P32,P33,P34,P35,P36,P37,P38,P39,P40,P41 >
|
||||
>
|
||||
{
|
||||
typedef map43 type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct m_at_impl<43>
|
||||
{
|
||||
template< typename Map > struct result_
|
||||
{
|
||||
typedef typename Map::item43 type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct m_item_impl<44>
|
||||
{
|
||||
template< typename Key, typename T, typename Base > struct result_
|
||||
: m_item_< Key,T,Base >
|
||||
{
|
||||
typedef pair< Key,T > item43;
|
||||
};
|
||||
};
|
||||
|
||||
template<
|
||||
typename P0, typename P1, typename P2, typename P3, typename P4
|
||||
, typename P5, typename P6, typename P7, typename P8, typename P9
|
||||
, typename P10, typename P11, typename P12, typename P13, typename P14
|
||||
, typename P15, typename P16, typename P17, typename P18, typename P19
|
||||
, typename P20, typename P21, typename P22, typename P23, typename P24
|
||||
, typename P25, typename P26, typename P27, typename P28, typename P29
|
||||
, typename P30, typename P31, typename P32, typename P33, typename P34
|
||||
, typename P35, typename P36, typename P37, typename P38, typename P39
|
||||
, typename P40, typename P41, typename P42, typename P43
|
||||
>
|
||||
struct map44
|
||||
: m_item<
|
||||
44
|
||||
, typename P43::first
|
||||
, typename P43::second
|
||||
, map43< P0,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,P23,P24,P25,P26,P27,P28,P29,P30,P31,P32,P33,P34,P35,P36,P37,P38,P39,P40,P41,P42 >
|
||||
>
|
||||
{
|
||||
typedef map44 type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct m_at_impl<44>
|
||||
{
|
||||
template< typename Map > struct result_
|
||||
{
|
||||
typedef typename Map::item44 type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct m_item_impl<45>
|
||||
{
|
||||
template< typename Key, typename T, typename Base > struct result_
|
||||
: m_item_< Key,T,Base >
|
||||
{
|
||||
typedef pair< Key,T > item44;
|
||||
};
|
||||
};
|
||||
|
||||
template<
|
||||
typename P0, typename P1, typename P2, typename P3, typename P4
|
||||
, typename P5, typename P6, typename P7, typename P8, typename P9
|
||||
, typename P10, typename P11, typename P12, typename P13, typename P14
|
||||
, typename P15, typename P16, typename P17, typename P18, typename P19
|
||||
, typename P20, typename P21, typename P22, typename P23, typename P24
|
||||
, typename P25, typename P26, typename P27, typename P28, typename P29
|
||||
, typename P30, typename P31, typename P32, typename P33, typename P34
|
||||
, typename P35, typename P36, typename P37, typename P38, typename P39
|
||||
, typename P40, typename P41, typename P42, typename P43, typename P44
|
||||
>
|
||||
struct map45
|
||||
: m_item<
|
||||
45
|
||||
, typename P44::first
|
||||
, typename P44::second
|
||||
, map44< P0,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,P23,P24,P25,P26,P27,P28,P29,P30,P31,P32,P33,P34,P35,P36,P37,P38,P39,P40,P41,P42,P43 >
|
||||
>
|
||||
{
|
||||
typedef map45 type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct m_at_impl<45>
|
||||
{
|
||||
template< typename Map > struct result_
|
||||
{
|
||||
typedef typename Map::item45 type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct m_item_impl<46>
|
||||
{
|
||||
template< typename Key, typename T, typename Base > struct result_
|
||||
: m_item_< Key,T,Base >
|
||||
{
|
||||
typedef pair< Key,T > item45;
|
||||
};
|
||||
};
|
||||
|
||||
template<
|
||||
typename P0, typename P1, typename P2, typename P3, typename P4
|
||||
, typename P5, typename P6, typename P7, typename P8, typename P9
|
||||
, typename P10, typename P11, typename P12, typename P13, typename P14
|
||||
, typename P15, typename P16, typename P17, typename P18, typename P19
|
||||
, typename P20, typename P21, typename P22, typename P23, typename P24
|
||||
, typename P25, typename P26, typename P27, typename P28, typename P29
|
||||
, typename P30, typename P31, typename P32, typename P33, typename P34
|
||||
, typename P35, typename P36, typename P37, typename P38, typename P39
|
||||
, typename P40, typename P41, typename P42, typename P43, typename P44
|
||||
, typename P45
|
||||
>
|
||||
struct map46
|
||||
: m_item<
|
||||
46
|
||||
, typename P45::first
|
||||
, typename P45::second
|
||||
, map45< P0,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,P23,P24,P25,P26,P27,P28,P29,P30,P31,P32,P33,P34,P35,P36,P37,P38,P39,P40,P41,P42,P43,P44 >
|
||||
>
|
||||
{
|
||||
typedef map46 type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct m_at_impl<46>
|
||||
{
|
||||
template< typename Map > struct result_
|
||||
{
|
||||
typedef typename Map::item46 type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct m_item_impl<47>
|
||||
{
|
||||
template< typename Key, typename T, typename Base > struct result_
|
||||
: m_item_< Key,T,Base >
|
||||
{
|
||||
typedef pair< Key,T > item46;
|
||||
};
|
||||
};
|
||||
|
||||
template<
|
||||
typename P0, typename P1, typename P2, typename P3, typename P4
|
||||
, typename P5, typename P6, typename P7, typename P8, typename P9
|
||||
, typename P10, typename P11, typename P12, typename P13, typename P14
|
||||
, typename P15, typename P16, typename P17, typename P18, typename P19
|
||||
, typename P20, typename P21, typename P22, typename P23, typename P24
|
||||
, typename P25, typename P26, typename P27, typename P28, typename P29
|
||||
, typename P30, typename P31, typename P32, typename P33, typename P34
|
||||
, typename P35, typename P36, typename P37, typename P38, typename P39
|
||||
, typename P40, typename P41, typename P42, typename P43, typename P44
|
||||
, typename P45, typename P46
|
||||
>
|
||||
struct map47
|
||||
: m_item<
|
||||
47
|
||||
, typename P46::first
|
||||
, typename P46::second
|
||||
, map46< P0,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,P23,P24,P25,P26,P27,P28,P29,P30,P31,P32,P33,P34,P35,P36,P37,P38,P39,P40,P41,P42,P43,P44,P45 >
|
||||
>
|
||||
{
|
||||
typedef map47 type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct m_at_impl<47>
|
||||
{
|
||||
template< typename Map > struct result_
|
||||
{
|
||||
typedef typename Map::item47 type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct m_item_impl<48>
|
||||
{
|
||||
template< typename Key, typename T, typename Base > struct result_
|
||||
: m_item_< Key,T,Base >
|
||||
{
|
||||
typedef pair< Key,T > item47;
|
||||
};
|
||||
};
|
||||
|
||||
template<
|
||||
typename P0, typename P1, typename P2, typename P3, typename P4
|
||||
, typename P5, typename P6, typename P7, typename P8, typename P9
|
||||
, typename P10, typename P11, typename P12, typename P13, typename P14
|
||||
, typename P15, typename P16, typename P17, typename P18, typename P19
|
||||
, typename P20, typename P21, typename P22, typename P23, typename P24
|
||||
, typename P25, typename P26, typename P27, typename P28, typename P29
|
||||
, typename P30, typename P31, typename P32, typename P33, typename P34
|
||||
, typename P35, typename P36, typename P37, typename P38, typename P39
|
||||
, typename P40, typename P41, typename P42, typename P43, typename P44
|
||||
, typename P45, typename P46, typename P47
|
||||
>
|
||||
struct map48
|
||||
: m_item<
|
||||
48
|
||||
, typename P47::first
|
||||
, typename P47::second
|
||||
, map47< P0,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,P23,P24,P25,P26,P27,P28,P29,P30,P31,P32,P33,P34,P35,P36,P37,P38,P39,P40,P41,P42,P43,P44,P45,P46 >
|
||||
>
|
||||
{
|
||||
typedef map48 type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct m_at_impl<48>
|
||||
{
|
||||
template< typename Map > struct result_
|
||||
{
|
||||
typedef typename Map::item48 type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct m_item_impl<49>
|
||||
{
|
||||
template< typename Key, typename T, typename Base > struct result_
|
||||
: m_item_< Key,T,Base >
|
||||
{
|
||||
typedef pair< Key,T > item48;
|
||||
};
|
||||
};
|
||||
|
||||
template<
|
||||
typename P0, typename P1, typename P2, typename P3, typename P4
|
||||
, typename P5, typename P6, typename P7, typename P8, typename P9
|
||||
, typename P10, typename P11, typename P12, typename P13, typename P14
|
||||
, typename P15, typename P16, typename P17, typename P18, typename P19
|
||||
, typename P20, typename P21, typename P22, typename P23, typename P24
|
||||
, typename P25, typename P26, typename P27, typename P28, typename P29
|
||||
, typename P30, typename P31, typename P32, typename P33, typename P34
|
||||
, typename P35, typename P36, typename P37, typename P38, typename P39
|
||||
, typename P40, typename P41, typename P42, typename P43, typename P44
|
||||
, typename P45, typename P46, typename P47, typename P48
|
||||
>
|
||||
struct map49
|
||||
: m_item<
|
||||
49
|
||||
, typename P48::first
|
||||
, typename P48::second
|
||||
, map48< P0,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,P23,P24,P25,P26,P27,P28,P29,P30,P31,P32,P33,P34,P35,P36,P37,P38,P39,P40,P41,P42,P43,P44,P45,P46,P47 >
|
||||
>
|
||||
{
|
||||
typedef map49 type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct m_at_impl<49>
|
||||
{
|
||||
template< typename Map > struct result_
|
||||
{
|
||||
typedef typename Map::item49 type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct m_item_impl<50>
|
||||
{
|
||||
template< typename Key, typename T, typename Base > struct result_
|
||||
: m_item_< Key,T,Base >
|
||||
{
|
||||
typedef pair< Key,T > item49;
|
||||
};
|
||||
};
|
||||
|
||||
template<
|
||||
typename P0, typename P1, typename P2, typename P3, typename P4
|
||||
, typename P5, typename P6, typename P7, typename P8, typename P9
|
||||
, typename P10, typename P11, typename P12, typename P13, typename P14
|
||||
, typename P15, typename P16, typename P17, typename P18, typename P19
|
||||
, typename P20, typename P21, typename P22, typename P23, typename P24
|
||||
, typename P25, typename P26, typename P27, typename P28, typename P29
|
||||
, typename P30, typename P31, typename P32, typename P33, typename P34
|
||||
, typename P35, typename P36, typename P37, typename P38, typename P39
|
||||
, typename P40, typename P41, typename P42, typename P43, typename P44
|
||||
, typename P45, typename P46, typename P47, typename P48, typename P49
|
||||
>
|
||||
struct map50
|
||||
: m_item<
|
||||
50
|
||||
, typename P49::first
|
||||
, typename P49::second
|
||||
, map49< P0,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,P23,P24,P25,P26,P27,P28,P29,P30,P31,P32,P33,P34,P35,P36,P37,P38,P39,P40,P41,P42,P43,P44,P45,P46,P47,P48 >
|
||||
>
|
||||
{
|
||||
typedef map50 type;
|
||||
};
|
||||
|
||||
}}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MessageAveraging</class>
|
||||
<widget class="QWidget" name="MessageAveraging">
|
||||
<property name="windowTitle">
|
||||
<string>Message Averaging</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="header_label">
|
||||
<property name="text">
|
||||
<string> UTC Sync DT Freq </string>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QPlainTextEdit" name="msgAvgPlainTextEdit">
|
||||
<property name="lineWrapMode">
|
||||
<enum>QPlainTextEdit::NoWrap</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,119 @@
|
||||
#ifndef BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP
|
||||
#define BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_text_oarchive.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// 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)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
// archives stored as text - note these ar templated on the basic
|
||||
// stream templates to accommodate wide (and other?) kind of characters
|
||||
//
|
||||
// note the fact that on libraries without wide characters, ostream is
|
||||
// is not a specialization of basic_ostream which in fact is not defined
|
||||
// in such cases. So we can't use basic_ostream<OStream::char_type> but rather
|
||||
// use two template parameters
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/archive/detail/common_oarchive.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
template<class Archive> class interface_oarchive;
|
||||
} // namespace detail
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// class basic_text_oarchive
|
||||
template<class Archive>
|
||||
class BOOST_SYMBOL_VISIBLE basic_text_oarchive :
|
||||
public detail::common_oarchive<Archive>
|
||||
{
|
||||
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
|
||||
// for some inexplicable reason insertion of "class" generates compile erro
|
||||
// on msvc 7.1
|
||||
friend detail::interface_oarchive<Archive>;
|
||||
#else
|
||||
friend class detail::interface_oarchive<Archive>;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
enum {
|
||||
none,
|
||||
eol,
|
||||
space
|
||||
} delimiter;
|
||||
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
newtoken();
|
||||
|
||||
void newline(){
|
||||
delimiter = eol;
|
||||
}
|
||||
|
||||
// default processing - kick back to base class. Note the
|
||||
// extra stuff to get it passed borland compilers
|
||||
typedef detail::common_oarchive<Archive> detail_common_oarchive;
|
||||
template<class T>
|
||||
void save_override(T & t){
|
||||
this->detail_common_oarchive::save_override(t);
|
||||
}
|
||||
|
||||
// start new objects on a new line
|
||||
void save_override(const object_id_type & t){
|
||||
this->This()->newline();
|
||||
this->detail_common_oarchive::save_override(t);
|
||||
}
|
||||
|
||||
// text file don't include the optional information
|
||||
void save_override(const class_id_optional_type & /* t */){}
|
||||
|
||||
void save_override(const class_name_type & t){
|
||||
const std::string s(t);
|
||||
* this->This() << s;
|
||||
}
|
||||
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
init();
|
||||
|
||||
basic_text_oarchive(unsigned int flags) :
|
||||
detail::common_oarchive<Archive>(flags),
|
||||
delimiter(none)
|
||||
{}
|
||||
~basic_text_oarchive(){}
|
||||
};
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#endif // BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP
|
||||
@@ -0,0 +1,118 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_SINGLE_ELEMENT_ITER_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_SINGLE_ELEMENT_ITER_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/iterator_tags.hpp>
|
||||
#include <boost/mpl/advance_fwd.hpp>
|
||||
#include <boost/mpl/distance_fwd.hpp>
|
||||
#include <boost/mpl/next_prior.hpp>
|
||||
#include <boost/mpl/deref.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/aux_/nttp_decl.hpp>
|
||||
#include <boost/mpl/aux_/value_wknd.hpp>
|
||||
#include <boost/mpl/aux_/config/ctps.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
|
||||
namespace aux {
|
||||
|
||||
template< typename T, BOOST_MPL_AUX_NTTP_DECL(int, is_last_) >
|
||||
struct sel_iter;
|
||||
|
||||
template< typename T >
|
||||
struct sel_iter<T,0>
|
||||
{
|
||||
typedef random_access_iterator_tag category;
|
||||
typedef sel_iter<T,1> next;
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template< typename T >
|
||||
struct sel_iter<T,1>
|
||||
{
|
||||
typedef random_access_iterator_tag category;
|
||||
typedef sel_iter<T,0> prior;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
template< typename T, BOOST_MPL_AUX_NTTP_DECL(int, is_last_), typename Distance >
|
||||
struct advance< aux::sel_iter<T,is_last_>,Distance>
|
||||
{
|
||||
typedef aux::sel_iter<
|
||||
T
|
||||
, ( is_last_ + BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Distance) )
|
||||
> type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T
|
||||
, BOOST_MPL_AUX_NTTP_DECL(int, l1)
|
||||
, BOOST_MPL_AUX_NTTP_DECL(int, l2)
|
||||
>
|
||||
struct distance< aux::sel_iter<T,l1>, aux::sel_iter<T,l2> >
|
||||
: int_<( l2 - l1 )>
|
||||
{
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
namespace aux {
|
||||
|
||||
struct sel_iter_tag;
|
||||
|
||||
template< typename T, BOOST_MPL_AUX_NTTP_DECL(int, is_last_) >
|
||||
struct sel_iter
|
||||
{
|
||||
enum { pos_ = is_last_ };
|
||||
typedef aux::sel_iter_tag tag;
|
||||
typedef random_access_iterator_tag category;
|
||||
|
||||
typedef sel_iter<T,(is_last_ + 1)> next;
|
||||
typedef sel_iter<T,(is_last_ - 1)> prior;
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
template<> struct advance_impl<aux::sel_iter_tag>
|
||||
{
|
||||
template< typename Iterator, typename N > struct apply
|
||||
{
|
||||
enum { pos_ = Iterator::pos_, n_ = N::value };
|
||||
typedef aux::sel_iter<
|
||||
typename Iterator::type
|
||||
, (pos_ + n_)
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
template<> struct distance_impl<aux::sel_iter_tag>
|
||||
{
|
||||
template< typename Iter1, typename Iter2 > struct apply
|
||||
{
|
||||
enum { pos1_ = Iter1::pos_, pos2_ = Iter2::pos_ };
|
||||
typedef int_<( pos2_ - pos1_ )> type;
|
||||
BOOST_STATIC_CONSTANT(int, value = ( pos2_ - pos1_ ));
|
||||
};
|
||||
};
|
||||
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_AUX_SINGLE_ELEMENT_ITER_HPP_INCLUDED
|
||||
@@ -0,0 +1,62 @@
|
||||
#ifndef BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED
|
||||
#define BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// bind/placeholders.hpp - _N definitions
|
||||
//
|
||||
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
||||
// Copyright 2015 Peter Dimov
|
||||
//
|
||||
// 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/bind/bind.html for documentation.
|
||||
//
|
||||
|
||||
#include <boost/bind/arg.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace placeholders
|
||||
{
|
||||
|
||||
#if defined(__BORLANDC__) || defined(__GNUC__) && (__GNUC__ < 4)
|
||||
|
||||
inline boost::arg<1> _1() { return boost::arg<1>(); }
|
||||
inline boost::arg<2> _2() { return boost::arg<2>(); }
|
||||
inline boost::arg<3> _3() { return boost::arg<3>(); }
|
||||
inline boost::arg<4> _4() { return boost::arg<4>(); }
|
||||
inline boost::arg<5> _5() { return boost::arg<5>(); }
|
||||
inline boost::arg<6> _6() { return boost::arg<6>(); }
|
||||
inline boost::arg<7> _7() { return boost::arg<7>(); }
|
||||
inline boost::arg<8> _8() { return boost::arg<8>(); }
|
||||
inline boost::arg<9> _9() { return boost::arg<9>(); }
|
||||
|
||||
#else
|
||||
|
||||
BOOST_STATIC_CONSTEXPR boost::arg<1> _1;
|
||||
BOOST_STATIC_CONSTEXPR boost::arg<2> _2;
|
||||
BOOST_STATIC_CONSTEXPR boost::arg<3> _3;
|
||||
BOOST_STATIC_CONSTEXPR boost::arg<4> _4;
|
||||
BOOST_STATIC_CONSTEXPR boost::arg<5> _5;
|
||||
BOOST_STATIC_CONSTEXPR boost::arg<6> _6;
|
||||
BOOST_STATIC_CONSTEXPR boost::arg<7> _7;
|
||||
BOOST_STATIC_CONSTEXPR boost::arg<8> _8;
|
||||
BOOST_STATIC_CONSTEXPR boost::arg<9> _9;
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace placeholders
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED
|
||||
@@ -0,0 +1,223 @@
|
||||
#include "displaytext.h"
|
||||
|
||||
#include <QMouseEvent>
|
||||
#include <QDateTime>
|
||||
#include <QTextCharFormat>
|
||||
#include <QTextCursor>
|
||||
#include <QTextBlock>
|
||||
|
||||
#include "qt_helpers.hpp"
|
||||
|
||||
#include "moc_displaytext.cpp"
|
||||
|
||||
DisplayText::DisplayText(QWidget *parent) :
|
||||
QTextEdit(parent)
|
||||
{
|
||||
setReadOnly (true);
|
||||
viewport ()->setCursor (Qt::ArrowCursor);
|
||||
setWordWrapMode (QTextOption::NoWrap);
|
||||
document ()->setMaximumBlockCount (5000); // max lines to limit heap usage
|
||||
}
|
||||
|
||||
void DisplayText::setContentFont(QFont const& font)
|
||||
{
|
||||
char_font_ = font;
|
||||
selectAll ();
|
||||
auto cursor = textCursor ();
|
||||
cursor.beginEditBlock ();
|
||||
auto char_format = cursor.charFormat ();
|
||||
char_format.setFont (char_font_);
|
||||
cursor.mergeCharFormat (char_format);
|
||||
cursor.clearSelection ();
|
||||
cursor.movePosition (QTextCursor::End);
|
||||
|
||||
// position so viewport scrolled to left
|
||||
cursor.movePosition (QTextCursor::Up);
|
||||
cursor.movePosition (QTextCursor::StartOfLine);
|
||||
cursor.endEditBlock ();
|
||||
|
||||
setTextCursor (cursor);
|
||||
ensureCursorVisible ();
|
||||
}
|
||||
|
||||
void DisplayText::mouseDoubleClickEvent(QMouseEvent *e)
|
||||
{
|
||||
bool ctrl = (e->modifiers() & Qt::ControlModifier);
|
||||
bool alt = (e->modifiers() & Qt::AltModifier);
|
||||
emit(selectCallsign(alt,ctrl));
|
||||
QTextEdit::mouseDoubleClickEvent(e);
|
||||
}
|
||||
|
||||
void DisplayText::insertLineSpacer(QString const& line)
|
||||
{
|
||||
appendText (line, "#d3d3d3");
|
||||
}
|
||||
|
||||
void DisplayText::appendText(QString const& text, QColor bg)
|
||||
{
|
||||
auto cursor = textCursor ();
|
||||
cursor.movePosition (QTextCursor::End);
|
||||
auto block_format = cursor.blockFormat ();
|
||||
block_format.setBackground (bg);
|
||||
if (0 == cursor.position ())
|
||||
{
|
||||
cursor.setBlockFormat (block_format);
|
||||
auto char_format = cursor.charFormat ();
|
||||
char_format.setFont (char_font_);
|
||||
cursor.setCharFormat (char_format);
|
||||
}
|
||||
else
|
||||
{
|
||||
cursor.insertBlock (block_format);
|
||||
}
|
||||
cursor.insertText (text);
|
||||
|
||||
// position so viewport scrolled to left
|
||||
cursor.movePosition (QTextCursor::StartOfLine);
|
||||
setTextCursor (cursor);
|
||||
ensureCursorVisible ();
|
||||
document ()->setMaximumBlockCount (document ()->maximumBlockCount ());
|
||||
}
|
||||
|
||||
|
||||
QString DisplayText::appendDXCCWorkedB4(QString message, QString const& callsign, QColor * bg,
|
||||
LogBook const& logBook, QColor color_CQ,
|
||||
QColor color_DXCC,
|
||||
QColor color_NewCall)
|
||||
{
|
||||
// allow for seconds
|
||||
unsigned padding {message.indexOf (" ") > 4 ? 2U : 0U};
|
||||
QString call = callsign;
|
||||
QString countryName;
|
||||
bool callWorkedBefore;
|
||||
bool countryWorkedBefore;
|
||||
|
||||
if(call.length()==2) {
|
||||
int i0=message.indexOf("CQ "+call);
|
||||
call=message.mid(i0+6,-1);
|
||||
i0=call.indexOf(" ");
|
||||
call=call.mid(0,i0);
|
||||
}
|
||||
if(call.length()<3) return message;
|
||||
if(!call.contains(QRegExp("[0-9]|[A-Z]"))) return message;
|
||||
|
||||
logBook.match(/*in*/call,/*out*/countryName,callWorkedBefore,countryWorkedBefore);
|
||||
int charsAvail = 52 + padding;
|
||||
|
||||
// the decoder (seems) to always generate 41 chars. For a normal CQ
|
||||
// call, the last five are spaces
|
||||
//
|
||||
// A maximum length call is "QRZ VP2X/GM4WJS IO91" "CQ AA ..." or CQ
|
||||
// nnn ..." don't allow grid squares so are not longer. Here we align
|
||||
// the added info at least after the longest CQ/QRZ message plus one
|
||||
// space so that it can be stripped off algorithmically later.
|
||||
//
|
||||
int nmin = 46 + padding;
|
||||
int s3 = message.indexOf (" ", nmin);
|
||||
if (s3 < nmin) s3 = nmin; // always want at least the characters to position 45
|
||||
s3 += 1; // convert the index into a character count
|
||||
message = message.left(s3); // reduce trailing white space
|
||||
charsAvail -= s3;
|
||||
if (charsAvail > 4)
|
||||
{
|
||||
if (!countryWorkedBefore) // therefore not worked call either
|
||||
{
|
||||
message += "!";
|
||||
*bg = color_DXCC;
|
||||
}
|
||||
else
|
||||
if (!callWorkedBefore) // but have worked the country
|
||||
{
|
||||
message += "~";
|
||||
*bg = color_NewCall;
|
||||
}
|
||||
else
|
||||
{
|
||||
message += " "; // have worked this call before
|
||||
*bg = color_CQ;
|
||||
}
|
||||
charsAvail -= 1;
|
||||
|
||||
// do some obvious abbreviations
|
||||
countryName.replace ("Islands", "Is.");
|
||||
countryName.replace ("Island", "Is.");
|
||||
countryName.replace ("North ", "N. ");
|
||||
countryName.replace ("Northern ", "N. ");
|
||||
countryName.replace ("South ", "S. ");
|
||||
countryName.replace ("East ", "E. ");
|
||||
countryName.replace ("Eastern ", "E. ");
|
||||
countryName.replace ("West ", "W. ");
|
||||
countryName.replace ("Western ", "W. ");
|
||||
countryName.replace ("Central ", "C. ");
|
||||
countryName.replace (" and ", " & ");
|
||||
countryName.replace ("Republic", "Rep.");
|
||||
countryName.replace ("United States", "U.S.A.");
|
||||
countryName.replace ("Fed. Rep. of ", "");
|
||||
countryName.replace ("French ", "Fr.");
|
||||
countryName.replace ("Asiatic", "AS");
|
||||
countryName.replace ("European", "EU");
|
||||
countryName.replace ("African", "AF");
|
||||
|
||||
message += countryName;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
void DisplayText::displayDecodedText(DecodedText const& decodedText, QString const& myCall,
|
||||
bool displayDXCCEntity, LogBook const& logBook,
|
||||
QColor color_CQ, QColor color_MyCall,
|
||||
QColor color_DXCC, QColor color_NewCall)
|
||||
{
|
||||
QColor bg {Qt::white};
|
||||
bool CQcall = false;
|
||||
if (decodedText.string ().contains (" CQ ")
|
||||
|| decodedText.string ().contains (" CQDX ")
|
||||
|| decodedText.string ().contains (" QRZ "))
|
||||
{
|
||||
CQcall = true;
|
||||
bg = color_CQ;
|
||||
}
|
||||
if (myCall != "" and (
|
||||
decodedText.indexOf (" " + myCall + " ") >= 0
|
||||
or decodedText.indexOf (" " + myCall + "/") >= 0
|
||||
or decodedText.indexOf ("/" + myCall + " ") >= 0
|
||||
or decodedText.indexOf ("<" + myCall + " ") >= 0
|
||||
or decodedText.indexOf (" " + myCall + ">") >= 0)) {
|
||||
bg = color_MyCall;
|
||||
}
|
||||
// if enabled add the DXCC entity and B4 status to the end of the
|
||||
// preformated text line t1
|
||||
auto message = decodedText.string ();
|
||||
if (displayDXCCEntity && CQcall)
|
||||
message = appendDXCCWorkedB4 (message, decodedText.CQersCall (), &bg, logBook, color_CQ,
|
||||
color_DXCC, color_NewCall);
|
||||
appendText (message, bg);
|
||||
}
|
||||
|
||||
|
||||
void DisplayText::displayTransmittedText(QString text, QString modeTx, qint32 txFreq,
|
||||
QColor color_TxMsg, bool bFastMode)
|
||||
{
|
||||
QString t1=" @ ";
|
||||
if(modeTx=="FT8") t1=" ~ ";
|
||||
if(modeTx=="JT4") t1=" $ ";
|
||||
if(modeTx=="JT65") t1=" # ";
|
||||
if(modeTx=="MSK144") t1=" & ";
|
||||
QString t2;
|
||||
t2.sprintf("%4d",txFreq);
|
||||
QString t;
|
||||
if(bFastMode or modeTx=="FT8") {
|
||||
t = QDateTime::currentDateTimeUtc().toString("hhmmss") + \
|
||||
" Tx " + t2 + t1 + text;
|
||||
} else {
|
||||
t = QDateTime::currentDateTimeUtc().toString("hhmm") + \
|
||||
" Tx " + t2 + t1 + text;
|
||||
}
|
||||
appendText (t, color_TxMsg);
|
||||
}
|
||||
|
||||
void DisplayText::displayQSY(QString text)
|
||||
{
|
||||
QString t = QDateTime::currentDateTimeUtc().toString("hhmmss") + " " + text;
|
||||
appendText (t, "hotpink");
|
||||
}
|
||||
@@ -0,0 +1,598 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file default.hpp
|
||||
/// Contains definition of the _default transform, which gives operators their
|
||||
/// usual C++ meanings and uses Boost.Typeof to deduce return types.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PROTO_TRANSFORM_DEFAULT_HPP_EAN_04_04_2008
|
||||
#define BOOST_PROTO_TRANSFORM_DEFAULT_HPP_EAN_04_04_2008
|
||||
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
#include <boost/preprocessor/arithmetic/add.hpp>
|
||||
#include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_shifted.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/get_pointer.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits/is_member_pointer.hpp>
|
||||
#include <boost/type_traits/is_member_object_pointer.hpp>
|
||||
#include <boost/type_traits/is_member_function_pointer.hpp>
|
||||
#include <boost/proto/proto_fwd.hpp>
|
||||
#include <boost/proto/traits.hpp>
|
||||
#include <boost/proto/transform/impl.hpp>
|
||||
#include <boost/proto/transform/arg.hpp>
|
||||
#include <boost/proto/detail/decltype.hpp>
|
||||
|
||||
namespace boost { namespace proto
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template<typename Grammar, typename Tag>
|
||||
struct default_case
|
||||
: not_<_>
|
||||
{};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_case<Grammar, tag::terminal>
|
||||
: when<terminal<_>, _value>
|
||||
{};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_cases
|
||||
{
|
||||
template<typename Tag>
|
||||
struct case_
|
||||
: default_case<Grammar, Tag>
|
||||
{};
|
||||
};
|
||||
|
||||
#define BOOST_PROTO_UNARY_DEFAULT_EVAL(OP, TAG, MAKE) \
|
||||
template<typename Grammar> \
|
||||
struct BOOST_PP_CAT(default_, TAG) \
|
||||
: transform<BOOST_PP_CAT(default_, TAG)<Grammar> > \
|
||||
{ \
|
||||
template<typename Expr, typename State, typename Data> \
|
||||
struct impl \
|
||||
: transform_impl<Expr, State, Data> \
|
||||
{ \
|
||||
private: \
|
||||
typedef typename result_of::child_c<Expr, 0>::type e0; \
|
||||
typedef typename Grammar::template impl<e0, State, Data>::result_type r0; \
|
||||
public: \
|
||||
BOOST_PROTO_DECLTYPE_(OP proto::detail::MAKE<r0>(), result_type) \
|
||||
result_type operator ()( \
|
||||
typename impl::expr_param e \
|
||||
, typename impl::state_param s \
|
||||
, typename impl::data_param d \
|
||||
) const \
|
||||
{ \
|
||||
typename Grammar::template impl<e0, State, Data> t0; \
|
||||
return OP t0(proto::child_c<0>(e), s, d); \
|
||||
} \
|
||||
}; \
|
||||
}; \
|
||||
\
|
||||
template<typename Grammar> \
|
||||
struct default_case<Grammar, tag::TAG> \
|
||||
: when<unary_expr<tag::TAG, Grammar>, BOOST_PP_CAT(default_, TAG)<Grammar> > \
|
||||
{}; \
|
||||
/**/
|
||||
|
||||
#define BOOST_PROTO_BINARY_DEFAULT_EVAL(OP, TAG, LMAKE, RMAKE) \
|
||||
template<typename Grammar> \
|
||||
struct BOOST_PP_CAT(default_, TAG) \
|
||||
: transform<BOOST_PP_CAT(default_, TAG)<Grammar> > \
|
||||
{ \
|
||||
template<typename Expr, typename State, typename Data> \
|
||||
struct impl \
|
||||
: transform_impl<Expr, State, Data> \
|
||||
{ \
|
||||
private: \
|
||||
typedef typename result_of::child_c<Expr, 0>::type e0; \
|
||||
typedef typename result_of::child_c<Expr, 1>::type e1; \
|
||||
typedef typename Grammar::template impl<e0, State, Data>::result_type r0; \
|
||||
typedef typename Grammar::template impl<e1, State, Data>::result_type r1; \
|
||||
public: \
|
||||
BOOST_PROTO_DECLTYPE_( \
|
||||
proto::detail::LMAKE<r0>() OP proto::detail::RMAKE<r1>() \
|
||||
, result_type \
|
||||
) \
|
||||
result_type operator ()( \
|
||||
typename impl::expr_param e \
|
||||
, typename impl::state_param s \
|
||||
, typename impl::data_param d \
|
||||
) const \
|
||||
{ \
|
||||
typename Grammar::template impl<e0, State, Data> t0; \
|
||||
typename Grammar::template impl<e1, State, Data> t1; \
|
||||
return t0(proto::child_c<0>(e), s, d) \
|
||||
OP t1(proto::child_c<1>(e), s, d); \
|
||||
} \
|
||||
}; \
|
||||
}; \
|
||||
\
|
||||
template<typename Grammar> \
|
||||
struct default_case<Grammar, tag::TAG> \
|
||||
: when<binary_expr<tag::TAG, Grammar, Grammar>, BOOST_PP_CAT(default_, TAG)<Grammar> > \
|
||||
{}; \
|
||||
/**/
|
||||
|
||||
BOOST_PROTO_UNARY_DEFAULT_EVAL(+, unary_plus, make)
|
||||
BOOST_PROTO_UNARY_DEFAULT_EVAL(-, negate, make)
|
||||
BOOST_PROTO_UNARY_DEFAULT_EVAL(*, dereference, make)
|
||||
BOOST_PROTO_UNARY_DEFAULT_EVAL(~, complement, make)
|
||||
BOOST_PROTO_UNARY_DEFAULT_EVAL(&, address_of, make)
|
||||
BOOST_PROTO_UNARY_DEFAULT_EVAL(!, logical_not, make)
|
||||
BOOST_PROTO_UNARY_DEFAULT_EVAL(++, pre_inc, make_mutable)
|
||||
BOOST_PROTO_UNARY_DEFAULT_EVAL(--, pre_dec, make_mutable)
|
||||
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(<<, shift_left, make_mutable, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(>>, shift_right, make_mutable, make_mutable)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(*, multiplies, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(/, divides, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(%, modulus, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(+, plus, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(-, minus, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(<, less, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(>, greater, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(<=, less_equal, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(>=, greater_equal, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(==, equal_to, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(!=, not_equal_to, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(||, logical_or, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(&&, logical_and, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(&, bitwise_and, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(|, bitwise_or, make, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(^, bitwise_xor, make, make)
|
||||
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(=, assign, make_mutable, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(<<=, shift_left_assign, make_mutable, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(>>=, shift_right_assign, make_mutable, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(*=, multiplies_assign, make_mutable, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(/=, divides_assign, make_mutable, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(%=, modulus_assign, make_mutable, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(+=, plus_assign, make_mutable, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(-=, minus_assign, make_mutable, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(&=, bitwise_and_assign, make_mutable, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(|=, bitwise_or_assign, make_mutable, make)
|
||||
BOOST_PROTO_BINARY_DEFAULT_EVAL(^=, bitwise_xor_assign, make_mutable, make)
|
||||
|
||||
#undef BOOST_PROTO_UNARY_DEFAULT_EVAL
|
||||
#undef BOOST_PROTO_BINARY_DEFAULT_EVAL
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename Grammar, typename Expr, typename State, typename Data>
|
||||
struct is_member_function_invocation
|
||||
: is_member_function_pointer<
|
||||
typename uncvref<
|
||||
typename Grammar::template impl<
|
||||
typename result_of::child_c<Expr, 1>::type
|
||||
, State
|
||||
, Data
|
||||
>::result_type
|
||||
>::type
|
||||
>
|
||||
{};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename Grammar, typename Expr, typename State, typename Data, bool IsMemFunCall>
|
||||
struct default_mem_ptr_impl
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
private:
|
||||
typedef typename result_of::child_c<Expr, 0>::type e0;
|
||||
typedef typename result_of::child_c<Expr, 1>::type e1;
|
||||
typedef typename Grammar::template impl<e0, State, Data>::result_type r0;
|
||||
typedef typename Grammar::template impl<e1, State, Data>::result_type r1;
|
||||
public:
|
||||
typedef typename detail::mem_ptr_fun<r0, r1>::result_type result_type;
|
||||
result_type operator ()(
|
||||
typename default_mem_ptr_impl::expr_param e
|
||||
, typename default_mem_ptr_impl::state_param s
|
||||
, typename default_mem_ptr_impl::data_param d
|
||||
) const
|
||||
{
|
||||
typename Grammar::template impl<e0, State, Data> t0;
|
||||
typename Grammar::template impl<e1, State, Data> t1;
|
||||
return detail::mem_ptr_fun<r0, r1>()(
|
||||
t0(proto::child_c<0>(e), s, d)
|
||||
, t1(proto::child_c<1>(e), s, d)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<typename Grammar, typename Expr, typename State, typename Data>
|
||||
struct default_mem_ptr_impl<Grammar, Expr, State, Data, true>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
private:
|
||||
typedef typename result_of::child_c<Expr, 0>::type e0;
|
||||
typedef typename result_of::child_c<Expr, 1>::type e1;
|
||||
typedef typename Grammar::template impl<e0, State, Data>::result_type r0;
|
||||
typedef typename Grammar::template impl<e1, State, Data>::result_type r1;
|
||||
public:
|
||||
typedef detail::memfun<r0, r1> result_type;
|
||||
result_type const operator ()(
|
||||
typename default_mem_ptr_impl::expr_param e
|
||||
, typename default_mem_ptr_impl::state_param s
|
||||
, typename default_mem_ptr_impl::data_param d
|
||||
) const
|
||||
{
|
||||
typename Grammar::template impl<e0, State, Data> t0;
|
||||
typename Grammar::template impl<e1, State, Data> t1;
|
||||
return detail::memfun<r0, r1>(
|
||||
t0(proto::child_c<0>(e), s, d)
|
||||
, t1(proto::child_c<1>(e), s, d)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_mem_ptr
|
||||
: transform<default_mem_ptr<Grammar> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: default_mem_ptr_impl<
|
||||
Grammar
|
||||
, Expr
|
||||
, State
|
||||
, Data
|
||||
, is_member_function_invocation<Grammar, Expr, State, Data>::value
|
||||
>
|
||||
{};
|
||||
};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_case<Grammar, tag::mem_ptr>
|
||||
: when<mem_ptr<Grammar, Grammar>, default_mem_ptr<Grammar> >
|
||||
{};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_post_inc
|
||||
: transform<default_post_inc<Grammar> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
private:
|
||||
typedef typename result_of::child_c<Expr, 0>::type e0;
|
||||
typedef typename Grammar::template impl<e0, State, Data>::result_type r0;
|
||||
public:
|
||||
BOOST_PROTO_DECLTYPE_(proto::detail::make_mutable<r0>() ++, result_type)
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
typename Grammar::template impl<e0, State, Data> t0;
|
||||
return t0(proto::child_c<0>(e), s, d) ++;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_case<Grammar, tag::post_inc>
|
||||
: when<post_inc<Grammar>, default_post_inc<Grammar> >
|
||||
{};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_post_dec
|
||||
: transform<default_post_dec<Grammar> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
private:
|
||||
typedef typename result_of::child_c<Expr, 0>::type e0;
|
||||
typedef typename Grammar::template impl<e0, State, Data>::result_type r0;
|
||||
public:
|
||||
BOOST_PROTO_DECLTYPE_(proto::detail::make_mutable<r0>() --, result_type)
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
typename Grammar::template impl<e0, State, Data> t0;
|
||||
return t0(proto::child_c<0>(e), s, d) --;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_case<Grammar, tag::post_dec>
|
||||
: when<post_dec<Grammar>, default_post_dec<Grammar> >
|
||||
{};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_subscript
|
||||
: transform<default_subscript<Grammar> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
private:
|
||||
typedef typename result_of::child_c<Expr, 0>::type e0;
|
||||
typedef typename result_of::child_c<Expr, 1>::type e1;
|
||||
typedef typename Grammar::template impl<e0, State, Data>::result_type r0;
|
||||
typedef typename Grammar::template impl<e1, State, Data>::result_type r1;
|
||||
public:
|
||||
BOOST_PROTO_DECLTYPE_(
|
||||
proto::detail::make_subscriptable<r0>() [ proto::detail::make<r1>() ]
|
||||
, result_type
|
||||
)
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
typename Grammar::template impl<e0, State, Data> t0;
|
||||
typename Grammar::template impl<e1, State, Data> t1;
|
||||
return t0(proto::child_c<0>(e), s, d) [
|
||||
t1(proto::child_c<1>(e), s, d) ];
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_case<Grammar, tag::subscript>
|
||||
: when<subscript<Grammar, Grammar>, default_subscript<Grammar> >
|
||||
{};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_if_else_
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
private:
|
||||
typedef typename result_of::child_c<Expr, 0>::type e0;
|
||||
typedef typename result_of::child_c<Expr, 1>::type e1;
|
||||
typedef typename result_of::child_c<Expr, 2>::type e2;
|
||||
typedef typename Grammar::template impl<e0, State, Data>::result_type r0;
|
||||
typedef typename Grammar::template impl<e1, State, Data>::result_type r1;
|
||||
typedef typename Grammar::template impl<e2, State, Data>::result_type r2;
|
||||
public:
|
||||
BOOST_PROTO_DECLTYPE_(
|
||||
proto::detail::make<r0>()
|
||||
? proto::detail::make<r1>()
|
||||
: proto::detail::make<r2>()
|
||||
, result_type
|
||||
)
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
typename Grammar::template impl<e0, State, Data> t0;
|
||||
typename Grammar::template impl<e1, State, Data> t1;
|
||||
typename Grammar::template impl<e2, State, Data> t2;
|
||||
return t0(proto::child_c<0>(e), s, d)
|
||||
? t1(proto::child_c<1>(e), s, d)
|
||||
: t2(proto::child_c<2>(e), s, d);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_case<Grammar, tag::if_else_>
|
||||
: when<if_else_<Grammar, Grammar, Grammar>, default_if_else_<Grammar> >
|
||||
{};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_comma
|
||||
: transform<default_comma<Grammar> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
private:
|
||||
typedef typename result_of::child_c<Expr, 0>::type e0;
|
||||
typedef typename result_of::child_c<Expr, 1>::type e1;
|
||||
typedef typename Grammar::template impl<e0, State, Data>::result_type r0;
|
||||
typedef typename Grammar::template impl<e1, State, Data>::result_type r1;
|
||||
public:
|
||||
typedef typename proto::detail::comma_result<r0, r1>::type result_type;
|
||||
result_type operator ()(
|
||||
typename impl::expr_param e
|
||||
, typename impl::state_param s
|
||||
, typename impl::data_param d
|
||||
) const
|
||||
{
|
||||
typename Grammar::template impl<e0, State, Data> t0;
|
||||
typename Grammar::template impl<e1, State, Data> t1;
|
||||
return t0(proto::child_c<0>(e), s, d)
|
||||
, t1(proto::child_c<1>(e), s, d);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_case<Grammar, tag::comma>
|
||||
: when<comma<Grammar, Grammar>, default_comma<Grammar> >
|
||||
{};
|
||||
|
||||
template<typename Grammar, typename Expr, typename State, typename Data, long Arity>
|
||||
struct default_function_impl;
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_function
|
||||
: transform<default_function<Grammar> >
|
||||
{
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: default_function_impl<
|
||||
Grammar
|
||||
, Expr
|
||||
, State
|
||||
, Data
|
||||
, transform_impl<Expr, State, Data>::expr::proto_arity_c
|
||||
>
|
||||
{};
|
||||
};
|
||||
|
||||
template<typename Grammar>
|
||||
struct default_case<Grammar, tag::function>
|
||||
: when<function<Grammar, vararg<Grammar> >, default_function<Grammar> >
|
||||
{};
|
||||
|
||||
#define BOOST_PROTO_DEFAULT_EVAL_TYPE(Z, N, DATA) \
|
||||
typedef \
|
||||
typename result_of::child_c<DATA, N>::type \
|
||||
BOOST_PP_CAT(e, N); \
|
||||
\
|
||||
typedef \
|
||||
typename Grammar::template impl<BOOST_PP_CAT(e, N), State, Data>::result_type \
|
||||
BOOST_PP_CAT(r, N); \
|
||||
/**/
|
||||
|
||||
#define BOOST_PROTO_DEFAULT_EVAL(Z, N, DATA) \
|
||||
typename Grammar::template impl<BOOST_PP_CAT(e, N), State, Data>()( \
|
||||
proto::child_c<N>(DATA), s, d \
|
||||
) \
|
||||
/**/
|
||||
|
||||
template<typename Grammar, typename Expr, typename State, typename Data>
|
||||
struct default_function_impl<Grammar, Expr, State, Data, 1>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
BOOST_PROTO_DEFAULT_EVAL_TYPE(~, 0, Expr)
|
||||
|
||||
typedef
|
||||
typename proto::detail::result_of_fixup<r0>::type
|
||||
function_type;
|
||||
|
||||
typedef
|
||||
typename BOOST_PROTO_RESULT_OF<function_type()>::type
|
||||
result_type;
|
||||
|
||||
result_type operator ()(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return BOOST_PROTO_DEFAULT_EVAL(~, 0, e)();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Grammar, typename Expr, typename State, typename Data>
|
||||
struct default_function_impl<Grammar, Expr, State, Data, 2>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
BOOST_PROTO_DEFAULT_EVAL_TYPE(~, 0, Expr)
|
||||
BOOST_PROTO_DEFAULT_EVAL_TYPE(~, 1, Expr)
|
||||
|
||||
typedef
|
||||
typename proto::detail::result_of_fixup<r0>::type
|
||||
function_type;
|
||||
|
||||
typedef
|
||||
typename detail::result_of_<function_type(r1)>::type
|
||||
result_type;
|
||||
|
||||
result_type operator ()(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return this->invoke(
|
||||
e
|
||||
, s
|
||||
, d
|
||||
, is_member_function_pointer<function_type>()
|
||||
, is_member_object_pointer<function_type>()
|
||||
);
|
||||
}
|
||||
|
||||
private:
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::false_
|
||||
, mpl::false_
|
||||
) const
|
||||
{
|
||||
return BOOST_PROTO_DEFAULT_EVAL(~, 0, e)(BOOST_PROTO_DEFAULT_EVAL(~, 1, e));
|
||||
}
|
||||
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::true_
|
||||
, mpl::false_
|
||||
) const
|
||||
{
|
||||
BOOST_PROTO_USE_GET_POINTER();
|
||||
typedef typename detail::class_member_traits<function_type>::class_type class_type;
|
||||
return (
|
||||
BOOST_PROTO_GET_POINTER(class_type, (BOOST_PROTO_DEFAULT_EVAL(~, 1, e))) ->*
|
||||
BOOST_PROTO_DEFAULT_EVAL(~, 0, e)
|
||||
)();
|
||||
}
|
||||
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::false_
|
||||
, mpl::true_
|
||||
) const
|
||||
{
|
||||
BOOST_PROTO_USE_GET_POINTER();
|
||||
typedef typename detail::class_member_traits<function_type>::class_type class_type;
|
||||
return (
|
||||
BOOST_PROTO_GET_POINTER(class_type, (BOOST_PROTO_DEFAULT_EVAL(~, 1, e))) ->*
|
||||
BOOST_PROTO_DEFAULT_EVAL(~, 0, e)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
#include <boost/proto/transform/detail/default_function_impl.hpp>
|
||||
|
||||
#undef BOOST_PROTO_DEFAULT_EVAL_TYPE
|
||||
#undef BOOST_PROTO_DEFAULT_EVAL
|
||||
}
|
||||
|
||||
template<typename Grammar /*= detail::_default*/>
|
||||
struct _default
|
||||
: switch_<detail::default_cases<Grammar> >
|
||||
{};
|
||||
|
||||
template<typename Grammar>
|
||||
struct is_callable<_default<Grammar> >
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
namespace detail
|
||||
{
|
||||
// Loopy indirection that allows proto::_default<> to be
|
||||
// used without specifying a Grammar argument.
|
||||
struct _default
|
||||
: proto::_default<>
|
||||
{};
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// 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_FUNCTIONAL_COMMON_HPP
|
||||
#define BOOST_COMPUTE_FUNCTIONAL_COMMON_HPP
|
||||
|
||||
#include <boost/compute/functional/detail/macros.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
|
||||
BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(clamp, T (T, T, T), class T)
|
||||
BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(degrees, T (T), class T)
|
||||
BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(radians, T (T), class T)
|
||||
BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(sign, T (T), class T)
|
||||
BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(smoothstep, T (T, T, T), class T)
|
||||
BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(step, T (T, T), class T)
|
||||
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_FUNCTIONAL_COMMON_HPP
|
||||
@@ -0,0 +1,292 @@
|
||||
#ifndef BOOST_THREAD_PTHREAD_THREAD_DATA_HPP
|
||||
#define BOOST_THREAD_PTHREAD_THREAD_DATA_HPP
|
||||
// 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)
|
||||
// (C) Copyright 2007 Anthony Williams
|
||||
// (C) Copyright 2011-2012 Vicente J. Botet Escriba
|
||||
|
||||
#include <boost/thread/detail/config.hpp>
|
||||
#include <boost/thread/exceptions.hpp>
|
||||
#include <boost/thread/lock_guard.hpp>
|
||||
#include <boost/thread/lock_types.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/pthread/condition_variable_fwd.hpp>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/enable_shared_from_this.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#ifdef BOOST_THREAD_USES_CHRONO
|
||||
#include <boost/chrono/system_clocks.hpp>
|
||||
#endif
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
# ifndef PAGE_SIZE
|
||||
# define PAGE_SIZE 4096
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <boost/config/abi_prefix.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
class thread_attributes {
|
||||
public:
|
||||
thread_attributes() BOOST_NOEXCEPT {
|
||||
int res = pthread_attr_init(&val_);
|
||||
BOOST_VERIFY(!res && "pthread_attr_init failed");
|
||||
}
|
||||
~thread_attributes() {
|
||||
int res = pthread_attr_destroy(&val_);
|
||||
BOOST_VERIFY(!res && "pthread_attr_destroy failed");
|
||||
}
|
||||
// stack
|
||||
void set_stack_size(std::size_t size) BOOST_NOEXCEPT {
|
||||
if (size==0) return;
|
||||
std::size_t page_size = getpagesize();
|
||||
#ifdef PTHREAD_STACK_MIN
|
||||
if (size<PTHREAD_STACK_MIN) size=PTHREAD_STACK_MIN;
|
||||
#endif
|
||||
size = ((size+page_size-1)/page_size)*page_size;
|
||||
int res = pthread_attr_setstacksize(&val_, size);
|
||||
BOOST_VERIFY(!res && "pthread_attr_setstacksize failed");
|
||||
}
|
||||
|
||||
std::size_t get_stack_size() const BOOST_NOEXCEPT {
|
||||
std::size_t size;
|
||||
int res = pthread_attr_getstacksize(&val_, &size);
|
||||
BOOST_VERIFY(!res && "pthread_attr_getstacksize failed");
|
||||
return size;
|
||||
}
|
||||
#define BOOST_THREAD_DEFINES_THREAD_ATTRIBUTES_NATIVE_HANDLE
|
||||
|
||||
typedef pthread_attr_t native_handle_type;
|
||||
native_handle_type* native_handle() BOOST_NOEXCEPT {
|
||||
return &val_;
|
||||
}
|
||||
const native_handle_type* native_handle() const BOOST_NOEXCEPT {
|
||||
return &val_;
|
||||
}
|
||||
|
||||
private:
|
||||
pthread_attr_t val_;
|
||||
};
|
||||
|
||||
class thread;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
struct shared_state_base;
|
||||
struct tss_cleanup_function;
|
||||
struct thread_exit_callback_node;
|
||||
struct tss_data_node
|
||||
{
|
||||
boost::shared_ptr<boost::detail::tss_cleanup_function> func;
|
||||
void* value;
|
||||
|
||||
tss_data_node(boost::shared_ptr<boost::detail::tss_cleanup_function> func_,
|
||||
void* value_):
|
||||
func(func_),value(value_)
|
||||
{}
|
||||
};
|
||||
|
||||
struct thread_data_base;
|
||||
typedef boost::shared_ptr<thread_data_base> thread_data_ptr;
|
||||
|
||||
struct BOOST_THREAD_DECL thread_data_base:
|
||||
enable_shared_from_this<thread_data_base>
|
||||
{
|
||||
thread_data_ptr self;
|
||||
pthread_t thread_handle;
|
||||
boost::mutex data_mutex;
|
||||
boost::condition_variable done_condition;
|
||||
boost::mutex sleep_mutex;
|
||||
boost::condition_variable sleep_condition;
|
||||
bool done;
|
||||
bool join_started;
|
||||
bool joined;
|
||||
boost::detail::thread_exit_callback_node* thread_exit_callbacks;
|
||||
std::map<void const*,boost::detail::tss_data_node> tss_data;
|
||||
|
||||
//#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
|
||||
// These data must be at the end so that the access to the other fields doesn't change
|
||||
// when BOOST_THREAD_PROVIDES_INTERRUPTIONS is defined.
|
||||
// Another option is to have them always
|
||||
pthread_mutex_t* cond_mutex;
|
||||
pthread_cond_t* current_cond;
|
||||
//#endif
|
||||
typedef std::vector<std::pair<condition_variable*, mutex*>
|
||||
//, hidden_allocator<std::pair<condition_variable*, mutex*> >
|
||||
> notify_list_t;
|
||||
notify_list_t notify;
|
||||
|
||||
typedef std::vector<shared_ptr<shared_state_base> > async_states_t;
|
||||
async_states_t async_states_;
|
||||
|
||||
//#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
|
||||
// These data must be at the end so that the access to the other fields doesn't change
|
||||
// when BOOST_THREAD_PROVIDES_INTERRUPTIONS is defined.
|
||||
// Another option is to have them always
|
||||
bool interrupt_enabled;
|
||||
bool interrupt_requested;
|
||||
//#endif
|
||||
thread_data_base():
|
||||
thread_handle(0),
|
||||
done(false),join_started(false),joined(false),
|
||||
thread_exit_callbacks(0),
|
||||
//#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
|
||||
cond_mutex(0),
|
||||
current_cond(0),
|
||||
//#endif
|
||||
notify(),
|
||||
async_states_()
|
||||
//#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
|
||||
, interrupt_enabled(true)
|
||||
, interrupt_requested(false)
|
||||
//#endif
|
||||
{}
|
||||
virtual ~thread_data_base();
|
||||
|
||||
typedef pthread_t native_handle_type;
|
||||
|
||||
virtual void run()=0;
|
||||
virtual void notify_all_at_thread_exit(condition_variable* cv, mutex* m)
|
||||
{
|
||||
notify.push_back(std::pair<condition_variable*, mutex*>(cv, m));
|
||||
}
|
||||
|
||||
void make_ready_at_thread_exit(shared_ptr<shared_state_base> as)
|
||||
{
|
||||
async_states_.push_back(as);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
BOOST_THREAD_DECL thread_data_base* get_current_thread_data();
|
||||
|
||||
#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
|
||||
class interruption_checker
|
||||
{
|
||||
thread_data_base* const thread_info;
|
||||
pthread_mutex_t* m;
|
||||
bool set;
|
||||
|
||||
void check_for_interruption()
|
||||
{
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
if(thread_info->interrupt_requested)
|
||||
{
|
||||
thread_info->interrupt_requested=false;
|
||||
throw thread_interrupted(); // BOOST_NO_EXCEPTIONS protected
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void operator=(interruption_checker&);
|
||||
public:
|
||||
explicit interruption_checker(pthread_mutex_t* cond_mutex,pthread_cond_t* cond):
|
||||
thread_info(detail::get_current_thread_data()),m(cond_mutex),
|
||||
set(thread_info && thread_info->interrupt_enabled)
|
||||
{
|
||||
if(set)
|
||||
{
|
||||
lock_guard<mutex> guard(thread_info->data_mutex);
|
||||
check_for_interruption();
|
||||
thread_info->cond_mutex=cond_mutex;
|
||||
thread_info->current_cond=cond;
|
||||
BOOST_VERIFY(!pthread_mutex_lock(m));
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_VERIFY(!pthread_mutex_lock(m));
|
||||
}
|
||||
}
|
||||
~interruption_checker()
|
||||
{
|
||||
if(set)
|
||||
{
|
||||
BOOST_VERIFY(!pthread_mutex_unlock(m));
|
||||
lock_guard<mutex> guard(thread_info->data_mutex);
|
||||
thread_info->cond_mutex=NULL;
|
||||
thread_info->current_cond=NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_VERIFY(!pthread_mutex_unlock(m));
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace this_thread
|
||||
{
|
||||
namespace hidden
|
||||
{
|
||||
void BOOST_THREAD_DECL sleep_for(const timespec& ts);
|
||||
void BOOST_THREAD_DECL sleep_until(const timespec& ts);
|
||||
}
|
||||
|
||||
#ifdef BOOST_THREAD_USES_CHRONO
|
||||
#ifdef BOOST_THREAD_SLEEP_FOR_IS_STEADY
|
||||
|
||||
inline
|
||||
void BOOST_SYMBOL_VISIBLE sleep_for(const chrono::nanoseconds& ns)
|
||||
{
|
||||
return boost::this_thread::hidden::sleep_for(boost::detail::to_timespec(ns));
|
||||
}
|
||||
#endif
|
||||
#endif // BOOST_THREAD_USES_CHRONO
|
||||
|
||||
namespace no_interruption_point
|
||||
{
|
||||
namespace hidden
|
||||
{
|
||||
void BOOST_THREAD_DECL sleep_for(const timespec& ts);
|
||||
void BOOST_THREAD_DECL sleep_until(const timespec& ts);
|
||||
}
|
||||
|
||||
#ifdef BOOST_THREAD_USES_CHRONO
|
||||
#ifdef BOOST_THREAD_SLEEP_FOR_IS_STEADY
|
||||
|
||||
inline
|
||||
void BOOST_SYMBOL_VISIBLE sleep_for(const chrono::nanoseconds& ns)
|
||||
{
|
||||
return boost::this_thread::no_interruption_point::hidden::sleep_for(boost::detail::to_timespec(ns));
|
||||
}
|
||||
#endif
|
||||
#endif // BOOST_THREAD_USES_CHRONO
|
||||
|
||||
} // no_interruption_point
|
||||
|
||||
void BOOST_THREAD_DECL yield() BOOST_NOEXCEPT;
|
||||
|
||||
#if defined BOOST_THREAD_USES_DATETIME
|
||||
#ifdef __DECXXX
|
||||
/// Workaround of DECCXX issue of incorrect template substitution
|
||||
template<>
|
||||
#endif
|
||||
inline void sleep(system_time const& abs_time)
|
||||
{
|
||||
return boost::this_thread::hidden::sleep_until(boost::detail::to_timespec(abs_time));
|
||||
}
|
||||
|
||||
template<typename TimeDuration>
|
||||
inline BOOST_SYMBOL_VISIBLE void sleep(TimeDuration const& rel_time)
|
||||
{
|
||||
this_thread::sleep(get_system_time()+rel_time);
|
||||
}
|
||||
#endif // BOOST_THREAD_USES_DATETIME
|
||||
} // this_thread
|
||||
}
|
||||
|
||||
#include <boost/config/abi_suffix.hpp>
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,156 @@
|
||||
subroutine extract(s3,nadd,mode65,ntrials,naggressive,ndepth,nflip, &
|
||||
mycall_12,hiscall_12,hisgrid,nexp_decode,ncount,nhist,decoded, &
|
||||
ltext,nft,qual)
|
||||
|
||||
! Input:
|
||||
! s3 64-point spectra for each of 63 data symbols
|
||||
! nadd number of spectra summed into s3
|
||||
! nqd 0/1 to indicate decode attempt at QSO frequency
|
||||
|
||||
! Output:
|
||||
! ncount number of symbols requiring correction (-1 for no KV decode)
|
||||
! nhist maximum number of identical symbol values
|
||||
! decoded decoded message (if ncount >=0)
|
||||
! ltext true if decoded message is free text
|
||||
! nft 0=no decode; 1=FT decode; 2=hinted decode
|
||||
|
||||
use prog_args !shm_key, exe_dir, data_dir
|
||||
use packjt
|
||||
use jt65_mod
|
||||
use timer_module, only: timer
|
||||
|
||||
real s3(64,63)
|
||||
character decoded*22
|
||||
character*12 mycall_12,hiscall_12
|
||||
character*6 mycall,hiscall,hisgrid
|
||||
integer dat4(12)
|
||||
integer mrsym(63),mr2sym(63),mrprob(63),mr2prob(63)
|
||||
integer correct(63),tmp(63)
|
||||
logical ltext
|
||||
common/chansyms65/correct
|
||||
save
|
||||
|
||||
if(mode65.eq.-99) stop !Silence compiler warning
|
||||
mycall=mycall_12(1:6)
|
||||
hiscall=hiscall_12(1:6)
|
||||
qual=0.
|
||||
nbirdie=20
|
||||
npct=50
|
||||
afac1=1.1
|
||||
nft=0
|
||||
nfail=0
|
||||
decoded=' '
|
||||
call pctile(s3,4032,npct,base)
|
||||
s3=s3/base
|
||||
s3a=s3 !###
|
||||
|
||||
! Get most reliable and second-most-reliable symbol values, and their
|
||||
! probabilities
|
||||
1 call demod64a(s3,nadd,afac1,mrsym,mrprob,mr2sym,mr2prob,ntest,nlow)
|
||||
|
||||
call chkhist(mrsym,nhist,ipk) !Test for birdies and QRM
|
||||
if(nhist.ge.nbirdie) then
|
||||
nfail=nfail+1
|
||||
call pctile(s3,4032,npct,base)
|
||||
s3(ipk,1:63)=base
|
||||
if(nfail.gt.30) then
|
||||
decoded=' '
|
||||
ncount=-1
|
||||
go to 900
|
||||
endif
|
||||
go to 1
|
||||
endif
|
||||
|
||||
mrs=mrsym
|
||||
mrs2=mr2sym
|
||||
|
||||
call graycode65(mrsym,63,-1) !Remove gray code
|
||||
call interleave63(mrsym,-1) !Remove interleaving
|
||||
call interleave63(mrprob,-1)
|
||||
|
||||
call graycode65(mr2sym,63,-1) !Remove gray code and interleaving
|
||||
call interleave63(mr2sym,-1) !from second-most-reliable symbols
|
||||
call interleave63(mr2prob,-1)
|
||||
ntry=0
|
||||
|
||||
call timer('ftrsd ',0)
|
||||
param=0
|
||||
call ftrsd2(mrsym,mrprob,mr2sym,mr2prob,ntrials,correct,param,ntry)
|
||||
call timer('ftrsd ',1)
|
||||
ncandidates=param(0)
|
||||
nhard=param(1)
|
||||
nsoft=param(2)
|
||||
nerased=param(3)
|
||||
rtt=0.001*param(4)
|
||||
ntotal=param(5)
|
||||
qual=0.001*param(7)
|
||||
nd0=81
|
||||
r0=0.87
|
||||
if(naggressive.eq.10) then
|
||||
nd0=83
|
||||
r0=0.90
|
||||
endif
|
||||
if(ntotal.le.nd0 .and. rtt.le.r0) nft=1
|
||||
|
||||
if(nft.eq.0 .and. iand(ndepth,32).eq.32) then
|
||||
qmin=2.0 - 0.1*naggressive
|
||||
call timer('hint65 ',0)
|
||||
call hint65(s3,mrs,mrs2,nadd,nflip,mycall,hiscall,hisgrid,qual,decoded)
|
||||
if(qual.ge.qmin) then
|
||||
nft=2
|
||||
ncount=0
|
||||
else
|
||||
decoded=' '
|
||||
ntry=0
|
||||
endif
|
||||
call timer('hint65 ',1)
|
||||
go to 900
|
||||
endif
|
||||
|
||||
ncount=-1
|
||||
decoded=' '
|
||||
ltext=.false.
|
||||
if(nft.gt.0) then
|
||||
! Turn the corrected symbol array into channel symbols for subtraction;
|
||||
! pass it back to jt65a via common block "chansyms65".
|
||||
do i=1,12
|
||||
dat4(i)=correct(13-i)
|
||||
enddo
|
||||
do i=1,63
|
||||
tmp(i)=correct(64-i)
|
||||
enddo
|
||||
correct(1:63)=tmp(1:63)
|
||||
call interleave63(correct,63,1)
|
||||
call graycode65(correct,63,1)
|
||||
call unpackmsg(dat4,decoded,.false.,' ') !Unpack the user message
|
||||
ncount=0
|
||||
if(iand(dat4(10),8).ne.0) ltext=.true.
|
||||
endif
|
||||
900 continue
|
||||
if(nft.eq.1 .and. nhard.lt.0) decoded=' '
|
||||
|
||||
return
|
||||
end subroutine extract
|
||||
|
||||
subroutine getpp(workdat,p)
|
||||
|
||||
use jt65_mod
|
||||
integer workdat(63)
|
||||
integer a(63)
|
||||
|
||||
a(1:63)=workdat(63:1:-1)
|
||||
call interleave63(a,1)
|
||||
call graycode(a,63,1,a)
|
||||
|
||||
psum=0.
|
||||
do j=1,63
|
||||
i=a(j)+1
|
||||
x=s3a(i,j)
|
||||
s3a(i,j)=0.
|
||||
psum=psum + x
|
||||
s3a(i,j)=x
|
||||
enddo
|
||||
p=psum/63.0
|
||||
|
||||
return
|
||||
end subroutine getpp
|
||||
@@ -0,0 +1 @@
|
||||
gfortran -o chkfft chkfft3.f90 four2a.f90 gran.c /jtsdk/fftw3f/libfftw3f-3.dll
|
||||
@@ -0,0 +1,101 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2012-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_LOCKS_HPP
|
||||
#define BOOST_INTERPROCESS_DETAIL_LOCKS_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>
|
||||
|
||||
namespace boost {
|
||||
namespace interprocess {
|
||||
namespace ipcdetail {
|
||||
|
||||
template<class Lock>
|
||||
class internal_mutex_lock
|
||||
{
|
||||
typedef void (internal_mutex_lock::*unspecified_bool_type)();
|
||||
public:
|
||||
|
||||
typedef typename Lock::mutex_type::internal_mutex_type mutex_type;
|
||||
|
||||
|
||||
internal_mutex_lock(Lock &l)
|
||||
: l_(l)
|
||||
{}
|
||||
|
||||
mutex_type* mutex() const
|
||||
{ return l_ ? &l_.mutex()->internal_mutex() : 0; }
|
||||
|
||||
void lock() { l_.lock(); }
|
||||
|
||||
void unlock() { l_.unlock(); }
|
||||
|
||||
operator unspecified_bool_type() const
|
||||
{ return l_ ? &internal_mutex_lock::lock : 0; }
|
||||
|
||||
private:
|
||||
Lock &l_;
|
||||
};
|
||||
|
||||
template <class Lock>
|
||||
class lock_inverter
|
||||
{
|
||||
Lock &l_;
|
||||
public:
|
||||
lock_inverter(Lock &l)
|
||||
: l_(l)
|
||||
{}
|
||||
void lock() { l_.unlock(); }
|
||||
void unlock() { l_.lock(); }
|
||||
};
|
||||
|
||||
template <class Lock>
|
||||
class lock_to_sharable
|
||||
{
|
||||
Lock &l_;
|
||||
|
||||
public:
|
||||
explicit lock_to_sharable(Lock &l)
|
||||
: l_(l)
|
||||
{}
|
||||
void lock() { l_.lock_sharable(); }
|
||||
bool try_lock(){ return l_.try_lock_sharable(); }
|
||||
void unlock() { l_.unlock_sharable(); }
|
||||
};
|
||||
|
||||
template <class Lock>
|
||||
class lock_to_wait
|
||||
{
|
||||
Lock &l_;
|
||||
|
||||
public:
|
||||
explicit lock_to_wait(Lock &l)
|
||||
: l_(l)
|
||||
{}
|
||||
void lock() { l_.wait(); }
|
||||
bool try_lock(){ return l_.try_wait(); }
|
||||
};
|
||||
|
||||
} //namespace ipcdetail
|
||||
} //namespace interprocess
|
||||
} //namespace boost
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_INTERPROCESS_DETAIL_LOCKS_HPP
|
||||
@@ -0,0 +1,16 @@
|
||||
// Copyright David Abrahams 2002.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef SCOPE_DWA2002927_HPP
|
||||
# define SCOPE_DWA2002927_HPP
|
||||
|
||||
# include <boost/python/detail/config.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
void BOOST_PYTHON_DECL scope_setattr_doc(char const* name, object const& obj, char const* doc);
|
||||
|
||||
}}} // namespace boost::python::detail
|
||||
|
||||
#endif // SCOPE_DWA2002927_HPP
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2009 Helge Bahmann
|
||||
* Copyright (c) 2013 Tim Blechmann
|
||||
* Copyright (c) 2014 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file atomic/detail/caps_gcc_ppc.hpp
|
||||
*
|
||||
* This header defines feature capabilities macros
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_CAPS_GCC_PPC_HPP_INCLUDED_
|
||||
#define BOOST_ATOMIC_DETAIL_CAPS_GCC_PPC_HPP_INCLUDED_
|
||||
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_INT8_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_INT16_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_INT32_LOCK_FREE 2
|
||||
#if defined(__powerpc64__) || defined(__PPC64__)
|
||||
#define BOOST_ATOMIC_INT64_LOCK_FREE 2
|
||||
#endif
|
||||
#define BOOST_ATOMIC_POINTER_LOCK_FREE 2
|
||||
|
||||
#define BOOST_ATOMIC_THREAD_FENCE 2
|
||||
#define BOOST_ATOMIC_SIGNAL_FENCE 2
|
||||
|
||||
#endif // BOOST_ATOMIC_DETAIL_CAPS_GCC_PPC_HPP_INCLUDED_
|
||||
@@ -0,0 +1,38 @@
|
||||
#ifndef WSJTX_UDP_BEACONS_MODEL_HPP__
|
||||
#define WSJTX_UDP_BEACONS_MODEL_HPP__
|
||||
|
||||
#include <QStandardItemModel>
|
||||
|
||||
#include "MessageServer.hpp"
|
||||
|
||||
using Frequency = MessageServer::Frequency;
|
||||
|
||||
class QString;
|
||||
class QTime;
|
||||
|
||||
//
|
||||
// Beacons Model - simple data model for all beacon spots
|
||||
//
|
||||
// The model is a basic table with uniform row format. Rows consist of
|
||||
// QStandardItem instances containing the string representation of the
|
||||
// column data and if the underlying field is not a string then the
|
||||
// UserRole+1 role contains the underlying data item.
|
||||
//
|
||||
// Two slots are provided to add a new decode and remove all spots for
|
||||
// a client.
|
||||
//
|
||||
class BeaconsModel
|
||||
: public QStandardItemModel
|
||||
{
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
explicit BeaconsModel (QObject * parent = nullptr);
|
||||
|
||||
Q_SLOT void add_beacon_spot (bool is_new, QString const& client_id, QTime time, qint32 snr, float delta_time
|
||||
, Frequency frequency, qint32 drift, QString const& callsign, QString const& grid
|
||||
, qint32 power, bool off_air);
|
||||
Q_SLOT void clear_decodes (QString const& client_id);
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user