Initial Commit
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
// 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 DESTROY_DWA2002221_HPP
|
||||
# define DESTROY_DWA2002221_HPP
|
||||
|
||||
# include <boost/type_traits/is_array.hpp>
|
||||
# include <boost/detail/workaround.hpp>
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
template <bool array> struct value_destroyer;
|
||||
|
||||
template <>
|
||||
struct value_destroyer<false>
|
||||
{
|
||||
template <class T>
|
||||
static void execute(T const volatile* p)
|
||||
{
|
||||
p->~T();
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct value_destroyer<true>
|
||||
{
|
||||
template <class A, class T>
|
||||
static void execute(A*, T const volatile* const first)
|
||||
{
|
||||
for (T const volatile* p = first; p != first + sizeof(A)/sizeof(T); ++p)
|
||||
{
|
||||
value_destroyer<
|
||||
boost::is_array<T>::value
|
||||
>::execute(p);
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
static void execute(T const volatile* p)
|
||||
{
|
||||
execute(p, *p);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
inline void destroy_referent_impl(void* p, T& (*)())
|
||||
{
|
||||
// note: cv-qualification needed for MSVC6
|
||||
// must come *before* T for metrowerks
|
||||
value_destroyer<
|
||||
(boost::is_array<T>::value)
|
||||
>::execute((const volatile T*)p);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void destroy_referent(void* p, T(*)() = 0)
|
||||
{
|
||||
destroy_referent_impl(p, (T(*)())0);
|
||||
}
|
||||
|
||||
}}} // namespace boost::python::detail
|
||||
|
||||
#endif // DESTROY_DWA2002221_HPP
|
||||
@@ -0,0 +1,71 @@
|
||||
|
||||
// NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION
|
||||
|
||||
// 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$
|
||||
|
||||
#if defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#include <boost/preprocessor/enum_params.hpp>
|
||||
#include <boost/preprocessor/enum_shifted_params.hpp>
|
||||
#include <boost/preprocessor/dec.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
|
||||
#define i BOOST_PP_FRAME_ITERATION(1)
|
||||
|
||||
#if i == 1
|
||||
|
||||
template<
|
||||
typename T
|
||||
, BOOST_PP_ENUM_PARAMS(i, T C)
|
||||
>
|
||||
struct list1_c
|
||||
: l_item<
|
||||
long_<1>
|
||||
, integral_c<T,C0>
|
||||
, l_end
|
||||
>
|
||||
{
|
||||
typedef list1_c type;
|
||||
typedef T value_type;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
# define MPL_AUX_LIST_C_TAIL(list, i, C) \
|
||||
BOOST_PP_CAT(BOOST_PP_CAT(list,BOOST_PP_DEC(i)),_c)<T, \
|
||||
BOOST_PP_ENUM_SHIFTED_PARAMS(i, C) \
|
||||
> \
|
||||
/**/
|
||||
|
||||
template<
|
||||
typename T
|
||||
, BOOST_PP_ENUM_PARAMS(i, T C)
|
||||
>
|
||||
struct BOOST_PP_CAT(BOOST_PP_CAT(list,i),_c)
|
||||
: l_item<
|
||||
long_<i>
|
||||
, integral_c<T,C0>
|
||||
, MPL_AUX_LIST_C_TAIL(list,i,C)
|
||||
>
|
||||
{
|
||||
typedef BOOST_PP_CAT(BOOST_PP_CAT(list,i),_c) type;
|
||||
typedef T value_type;
|
||||
};
|
||||
|
||||
# undef MPL_AUX_LIST_C_TAIL
|
||||
|
||||
#endif // i == 1
|
||||
|
||||
#undef i
|
||||
|
||||
#endif // BOOST_PP_IS_ITERATING
|
||||
@@ -0,0 +1,82 @@
|
||||
/* boost random/uniform_real.hpp header file
|
||||
*
|
||||
* Copyright Jens Maurer 2000-2001
|
||||
* Distributed under the Boost Software License, Version 1.0. (See
|
||||
* accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* See http://www.boost.org for most recent version including documentation.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* Revision history
|
||||
* 2001-04-08 added min<max assertion (N. Becker)
|
||||
* 2001-02-18 moved to individual header files
|
||||
*/
|
||||
|
||||
#ifndef BOOST_RANDOM_UNIFORM_REAL_HPP
|
||||
#define BOOST_RANDOM_UNIFORM_REAL_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/random/uniform_real_distribution.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
/**
|
||||
* The distribution function uniform_real models a random distribution.
|
||||
* On each invocation, it returns a random floating-point value uniformly
|
||||
* distributed in the range [min..max).
|
||||
*
|
||||
* This class is deprecated. Please use @c uniform_real_distribution in
|
||||
* new code.
|
||||
*/
|
||||
template<class RealType = double>
|
||||
class uniform_real : public random::uniform_real_distribution<RealType>
|
||||
{
|
||||
typedef random::uniform_real_distribution<RealType> base_type;
|
||||
public:
|
||||
|
||||
class param_type : public base_type::param_type
|
||||
{
|
||||
public:
|
||||
typedef uniform_real distribution_type;
|
||||
/**
|
||||
* Constructs the parameters of a uniform_real distribution.
|
||||
*
|
||||
* Requires: min <= max
|
||||
*/
|
||||
explicit param_type(RealType min_arg = RealType(0.0),
|
||||
RealType max_arg = RealType(1.0))
|
||||
: base_type::param_type(min_arg, max_arg)
|
||||
{}
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs a uniform_real object. @c min and @c max are the
|
||||
* parameters of the distribution.
|
||||
*
|
||||
* Requires: min <= max
|
||||
*/
|
||||
explicit uniform_real(RealType min_arg = RealType(0.0),
|
||||
RealType max_arg = RealType(1.0))
|
||||
: base_type(min_arg, max_arg)
|
||||
{
|
||||
BOOST_ASSERT(min_arg < max_arg);
|
||||
}
|
||||
|
||||
/** Constructs a uniform_real distribution from its parameters. */
|
||||
explicit uniform_real(const param_type& parm)
|
||||
: base_type(parm)
|
||||
{}
|
||||
|
||||
/** Returns the parameters of the distribution */
|
||||
param_type param() const { return param_type(this->a(), this->b()); }
|
||||
/** Sets the parameters of the distribution. */
|
||||
void param(const param_type& parm) { this->base_type::param(parm); }
|
||||
};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_RANDOM_UNIFORM_REAL_HPP
|
||||
@@ -0,0 +1,34 @@
|
||||
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
|
||||
// unit/quantity manipulation and conversion
|
||||
//
|
||||
// Copyright (C) 2003-2008 Matthias Christian Schabel
|
||||
// Copyright (C) 2008 Steven Watanabe
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_UNITS_SI_ACTIVITY_HPP
|
||||
#define BOOST_UNITS_SI_ACTIVITY_HPP
|
||||
|
||||
#include <boost/units/systems/si/base.hpp>
|
||||
#include <boost/units/physical_dimensions/activity.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace units {
|
||||
|
||||
namespace si {
|
||||
|
||||
typedef unit<activity_dimension,si::system> activity;
|
||||
|
||||
BOOST_UNITS_STATIC_CONSTANT(becquerel,activity);
|
||||
BOOST_UNITS_STATIC_CONSTANT(becquerels,activity);
|
||||
|
||||
} // namespace si
|
||||
|
||||
} // namespace units
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_UNITS_SI_ACTIVITY_HPP
|
||||
@@ -0,0 +1,385 @@
|
||||
{
|
||||
<QApplication>
|
||||
Memcheck:Cond
|
||||
...
|
||||
fun:_ZN19QApplicationPrivate9constructEv
|
||||
fun:main
|
||||
}
|
||||
{
|
||||
<gtk::g_cclosure_marshal>
|
||||
Memcheck:Cond
|
||||
...
|
||||
fun:g_cclosure_marshal_VOID__OBJECTv
|
||||
}
|
||||
{
|
||||
<QScrollBar::paintEvent>
|
||||
Memcheck:Cond
|
||||
...
|
||||
fun:_ZN10QScrollBar10paintEventEP11QPaintEvent
|
||||
}
|
||||
{
|
||||
<QtWidgets>
|
||||
Memcheck:Cond
|
||||
...
|
||||
fun:gtk_adjustment_configure
|
||||
obj:/usr/lib/*/libQt5Widgets*
|
||||
obj:/usr/lib/*/libQt5Widgets*
|
||||
}
|
||||
{
|
||||
<QCoreApplication::exec>
|
||||
Memcheck:Cond
|
||||
...
|
||||
fun:_ZN16QCoreApplication4execEv
|
||||
fun:main
|
||||
}
|
||||
{
|
||||
<ld>
|
||||
Memcheck:Leak
|
||||
...
|
||||
obj:/lib/*/ld-*
|
||||
...
|
||||
}
|
||||
{
|
||||
<gtk-theme-engine>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:gtk_theme_engine_get
|
||||
}
|
||||
{
|
||||
<libgio>
|
||||
Memcheck:Leak
|
||||
...
|
||||
obj:/usr/lib/*/libgio-*
|
||||
...
|
||||
}
|
||||
{
|
||||
<gtk-x11>
|
||||
Memcheck:Leak
|
||||
...
|
||||
obj:/usr/lib/*/libgtk-x11-*
|
||||
...
|
||||
}
|
||||
{
|
||||
<gtk-x11>
|
||||
Memcheck:Cond
|
||||
...
|
||||
obj:/usr/lib/*/libgtk-x11-*
|
||||
...
|
||||
}
|
||||
{
|
||||
<QStyleFactory::create>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:_ZN13QStyleFactory6createERK7QString
|
||||
fun:_ZN12QApplication5styleEv
|
||||
...
|
||||
}
|
||||
{
|
||||
<raico_blur_create>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:raico_blur_create
|
||||
...
|
||||
}
|
||||
{
|
||||
<pango-leaks>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:pango*
|
||||
...
|
||||
}
|
||||
{
|
||||
<dbus>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:*dbus*
|
||||
...
|
||||
}
|
||||
{
|
||||
<QtWidgets-leak>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:*QPaintEvent
|
||||
fun:_ZN7QWidget5eventEP6QEvent
|
||||
}
|
||||
{
|
||||
<libglib>
|
||||
Memcheck:Leak
|
||||
...
|
||||
obj:/lib/*/libglib-*
|
||||
}
|
||||
{
|
||||
<libpango>
|
||||
Memcheck:Leak
|
||||
...
|
||||
obj:/usr/lib/*/libpango*
|
||||
...
|
||||
}
|
||||
{
|
||||
<gdk-x11>
|
||||
Memcheck:Leak
|
||||
...
|
||||
obj:/usr/lib/*/libgdk-x11*
|
||||
...
|
||||
}
|
||||
{
|
||||
<libpixbufloader-svg>
|
||||
Memcheck:Leak
|
||||
...
|
||||
obj:/usr/lib/*/gdk-pixbuf*/*/loaders/libpixbufloader-svg.so
|
||||
}
|
||||
{
|
||||
<libdconfsettings>
|
||||
Memcheck:Leak
|
||||
...
|
||||
obj:/usr/lib/*/gio/modules/libdconfsettings.so
|
||||
...
|
||||
}
|
||||
{
|
||||
<libibus>
|
||||
Memcheck:Leak
|
||||
obj:/usr/lib/*/libibus-*
|
||||
...
|
||||
}
|
||||
{
|
||||
<libpulse>
|
||||
Memcheck:Leak
|
||||
...
|
||||
obj:/usr/lib/*/libpulse*
|
||||
...
|
||||
}
|
||||
{
|
||||
<Qt::start_thread>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:start_thread
|
||||
fun:clone
|
||||
}
|
||||
{
|
||||
<QCoreApplication>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:_ZN16QCoreApplicationC1ER23QCoreApplicationPrivate
|
||||
}
|
||||
{
|
||||
<QFontMetrics>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:_ZNK13QFontMetricsF7leadingEv
|
||||
obj:/usr/lib/*/libQt5Gui*
|
||||
}
|
||||
{
|
||||
<QAudioDeviceInfo::defaultInputDevice>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:_ZN16QAudioDeviceInfo18defaultInputDeviceEv
|
||||
...
|
||||
}
|
||||
{
|
||||
<libfontconfig>
|
||||
Memcheck:Leak
|
||||
...
|
||||
obj:/usr/lib/*/libfontconfig*.so.1.8.0
|
||||
...
|
||||
}
|
||||
{
|
||||
<QFontDatabase::findFont>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:_ZN13QFontDatabase8findFontEiPK12QFontPrivateRK8QFontDefb
|
||||
...
|
||||
}
|
||||
{
|
||||
<QSerialPort::availablePorts>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:_ZN15QSerialPortInfo14availablePortsEv
|
||||
...
|
||||
}
|
||||
{
|
||||
<main_context_dispatch>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:g_main_context_dispatch
|
||||
...
|
||||
}
|
||||
{
|
||||
<hb_shape_full>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:hb_shape_full
|
||||
...
|
||||
}
|
||||
{
|
||||
<QPlatformWindow>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:_ZN15QPlatformWindowC1EP7QWindow
|
||||
...
|
||||
}
|
||||
{
|
||||
<QSurfaceFormat>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:_ZN14QSurfaceFormatC1Ev
|
||||
...
|
||||
}
|
||||
{
|
||||
<QWindow::create>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:_ZN7QWindow6createEv
|
||||
...
|
||||
}
|
||||
{
|
||||
<QWidgetPrivate::syncBackingStore>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:_ZN14QWidgetPrivate16syncBackingStoreEv
|
||||
}
|
||||
{
|
||||
<QWindow::setVisible>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:_ZN7QWindow10setVisibleEb
|
||||
...
|
||||
}
|
||||
{
|
||||
<QMimData>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:_ZN9QMimeDataC1Ev
|
||||
...
|
||||
}
|
||||
{
|
||||
<QWindowPrivate::setCursor>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:_ZN14QWindowPrivate9setCursorEPK7QCursor
|
||||
...
|
||||
}
|
||||
{
|
||||
<libfreetype>
|
||||
Memcheck:Leak
|
||||
...
|
||||
obj:/usr/lib/*/libfreetype*
|
||||
...
|
||||
}
|
||||
{
|
||||
<libdbus>
|
||||
Memcheck:Leak
|
||||
...
|
||||
obj:*/lib/*/libdbus*
|
||||
...
|
||||
}
|
||||
{
|
||||
<libcairo-leak>
|
||||
Memcheck:Leak
|
||||
...
|
||||
obj:/usr/lib/*/libcairo*
|
||||
...
|
||||
}
|
||||
{
|
||||
<cairo>
|
||||
Memcheck:Cond
|
||||
...
|
||||
obj:/usr/lib/*/libcairo*
|
||||
...
|
||||
}
|
||||
{
|
||||
<QFactoryLoader::instance>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:_ZNK14QFactoryLoader8instanceEi
|
||||
...
|
||||
}
|
||||
{
|
||||
<QThreadStorageData::get>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:_ZNK18QThreadStorageData3getEv
|
||||
...
|
||||
}
|
||||
{
|
||||
<register_types>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:_Z14register_typesv
|
||||
...
|
||||
}
|
||||
{
|
||||
<libibus>
|
||||
Memcheck:Leak
|
||||
...
|
||||
obj:/usr/lib/*/libibus*
|
||||
...
|
||||
}
|
||||
{
|
||||
<QPlatformintegrationFactory::create>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:_ZN27QPlatformIntegrationFactory6createERK7QStringRK11QStringListRiPPcS2_
|
||||
...
|
||||
}
|
||||
{
|
||||
<QPlatformInputContextFactory::create>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:_ZN28QPlatformInputContextFactory6createEv*
|
||||
...
|
||||
}
|
||||
{
|
||||
<QProcess::start>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:_ZN8QProcess5startERK7QStringRK11QStringList6QFlagsIN9QIODevice12OpenModeFlagEE
|
||||
...
|
||||
}
|
||||
{
|
||||
<libicuuc>
|
||||
Memcheck:Leak
|
||||
...
|
||||
obj:/usr/lib/*/libicuuc*
|
||||
...
|
||||
}
|
||||
{
|
||||
<X11>
|
||||
Memcheck:Leak
|
||||
...
|
||||
obj:/usr/lib/*/libX11*
|
||||
...
|
||||
}
|
||||
{
|
||||
<libxml2>
|
||||
Memcheck:Leak
|
||||
...
|
||||
obj:/usr/lib/*/libxml2*
|
||||
...
|
||||
}
|
||||
{
|
||||
<librsvg>
|
||||
Memcheck:Cond
|
||||
obj:/usr/lib/*/librsvg*
|
||||
...
|
||||
}
|
||||
{
|
||||
<libxcb>
|
||||
Memcheck:Leak
|
||||
...
|
||||
obj:/usr/lib/*/libxcb*
|
||||
...
|
||||
}
|
||||
{
|
||||
<QFont::fromString>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:_ZN5QFont10fromStringERK7QString
|
||||
...
|
||||
}
|
||||
{
|
||||
<QFontDatabase::load>
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:_ZN13QFontDatabase4loadEPK12QFontPrivatei
|
||||
...
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
# /* 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_ARITHMETIC_DETAIL_DIV_BASE_HPP
|
||||
# define BOOST_PREPROCESSOR_ARITHMETIC_DETAIL_DIV_BASE_HPP
|
||||
#
|
||||
# include <boost/preprocessor/arithmetic/inc.hpp>
|
||||
# include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
# include <boost/preprocessor/comparison/less_equal.hpp>
|
||||
# include <boost/preprocessor/config/config.hpp>
|
||||
# include <boost/preprocessor/control/while.hpp>
|
||||
# include <boost/preprocessor/tuple/elem.hpp>
|
||||
# include <boost/preprocessor/tuple/rem.hpp>
|
||||
#
|
||||
# /* BOOST_PP_DIV_BASE */
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
|
||||
# define BOOST_PP_DIV_BASE(x, y) BOOST_PP_WHILE(BOOST_PP_DIV_BASE_P, BOOST_PP_DIV_BASE_O, (0, x, y))
|
||||
# else
|
||||
# define BOOST_PP_DIV_BASE(x, y) BOOST_PP_DIV_BASE_I(x, y)
|
||||
# define BOOST_PP_DIV_BASE_I(x, y) BOOST_PP_WHILE(BOOST_PP_DIV_BASE_P, BOOST_PP_DIV_BASE_O, (0, x, y))
|
||||
# endif
|
||||
#
|
||||
# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
|
||||
# define BOOST_PP_DIV_BASE_P(d, rxy) BOOST_PP_DIV_BASE_P_IM(d, BOOST_PP_TUPLE_REM_3 rxy)
|
||||
# define BOOST_PP_DIV_BASE_P_IM(d, im) BOOST_PP_DIV_BASE_P_I(d, im)
|
||||
# else
|
||||
# define BOOST_PP_DIV_BASE_P(d, rxy) BOOST_PP_DIV_BASE_P_I(d, BOOST_PP_TUPLE_ELEM(3, 0, rxy), BOOST_PP_TUPLE_ELEM(3, 1, rxy), BOOST_PP_TUPLE_ELEM(3, 2, rxy))
|
||||
# endif
|
||||
#
|
||||
# define BOOST_PP_DIV_BASE_P_I(d, r, x, y) BOOST_PP_LESS_EQUAL_D(d, y, x)
|
||||
#
|
||||
# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
|
||||
# define BOOST_PP_DIV_BASE_O(d, rxy) BOOST_PP_DIV_BASE_O_IM(d, BOOST_PP_TUPLE_REM_3 rxy)
|
||||
# define BOOST_PP_DIV_BASE_O_IM(d, im) BOOST_PP_DIV_BASE_O_I(d, im)
|
||||
# else
|
||||
# define BOOST_PP_DIV_BASE_O(d, rxy) BOOST_PP_DIV_BASE_O_I(d, BOOST_PP_TUPLE_ELEM(3, 0, rxy), BOOST_PP_TUPLE_ELEM(3, 1, rxy), BOOST_PP_TUPLE_ELEM(3, 2, rxy))
|
||||
# endif
|
||||
#
|
||||
# define BOOST_PP_DIV_BASE_O_I(d, r, x, y) (BOOST_PP_INC(r), BOOST_PP_SUB_D(d, x, y), y)
|
||||
#
|
||||
# /* BOOST_PP_DIV_BASE_D */
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
|
||||
# define BOOST_PP_DIV_BASE_D(d, x, y) BOOST_PP_WHILE_ ## d(BOOST_PP_DIV_BASE_P, BOOST_PP_DIV_BASE_O, (0, x, y))
|
||||
# else
|
||||
# define BOOST_PP_DIV_BASE_D(d, x, y) BOOST_PP_DIV_BASE_D_I(d, x, y)
|
||||
# define BOOST_PP_DIV_BASE_D_I(d, x, y) BOOST_PP_WHILE_ ## d(BOOST_PP_DIV_BASE_P, BOOST_PP_DIV_BASE_O, (0, x, y))
|
||||
# endif
|
||||
#
|
||||
# endif
|
||||
@@ -0,0 +1,36 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Based on Peter Dimov's proposal
|
||||
// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf
|
||||
// issue 6.18.
|
||||
|
||||
#if !defined(BOOST_FUNCTIONAL_HASH_FWD_HPP)
|
||||
#define BOOST_FUNCTIONAL_HASH_FWD_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <cstddef>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template <class T> struct hash;
|
||||
|
||||
template <class T> void hash_combine(std::size_t& seed, T const& v);
|
||||
|
||||
template <class It> std::size_t hash_range(It, It);
|
||||
template <class It> void hash_range(std::size_t&, It, It);
|
||||
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
|
||||
template <class T> inline std::size_t hash_range(T*, T*);
|
||||
template <class T> inline void hash_range(std::size_t&, T*, T*);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,45 @@
|
||||
subroutine genwspr_fsk8(msg,msgsent,itone)
|
||||
|
||||
! Encode a WSPR-LF 8-FSK message, producing array itone().
|
||||
|
||||
use crc
|
||||
include 'wspr_fsk8_params.f90'
|
||||
|
||||
character*22 msg,msgsent
|
||||
character*60 cbits
|
||||
integer*1,target :: idat(9)
|
||||
integer*1 msgbits(KK),codeword(3*ND)
|
||||
integer itone(NN)
|
||||
integer icos7(0:6)
|
||||
data icos7/2,5,6,0,4,1,3/ !Costas 7x7 tone pattern
|
||||
|
||||
idat=0
|
||||
call wqencode(msg,ntype0,idat) !Source encoding
|
||||
id7=idat(7)
|
||||
if(id7.lt.0) id7=id7+256
|
||||
id7=id7/64
|
||||
icrc=crc10(c_loc(idat),9) !Compute the 10-bit CRC
|
||||
idat(8)=icrc/256 !Insert CRC into idat(8:9)
|
||||
idat(9)=iand(icrc,255)
|
||||
call wqdecode(idat,msgsent,itype)
|
||||
|
||||
write(cbits,1004) idat(1:6),id7,icrc
|
||||
1004 format(6b8.8,b2.2,b10.10)
|
||||
read(cbits,1006) msgbits
|
||||
1006 format(60i1)
|
||||
|
||||
! call chkcrc10(msgbits,nbadcrc)
|
||||
! print*,msgsent,itype,crc10_check(c_loc(idat),9),nbadcrc
|
||||
|
||||
call encode300(msgbits,codeword) !Encode the test message
|
||||
|
||||
! Message structure: S7 D100 S7
|
||||
itone(1:7)=icos7
|
||||
itone(NN-6:NN)=icos7
|
||||
do j=1,ND
|
||||
i=3*j -2
|
||||
itone(j+7)=codeword(i)*4 + codeword(i+1)*2 + codeword(i+2)
|
||||
enddo
|
||||
|
||||
return
|
||||
end subroutine genwspr_fsk8
|
||||
@@ -0,0 +1,45 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2009 Christopher Schmidt
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUSION_CONTAINER_MAP_DETAIL_BEGIN_IMPL_HPP
|
||||
#define BOOST_FUSION_CONTAINER_MAP_DETAIL_BEGIN_IMPL_HPP
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/iterator/basic_iterator.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
template <typename>
|
||||
struct begin_impl;
|
||||
|
||||
template <>
|
||||
struct begin_impl<map_tag>
|
||||
{
|
||||
template <typename Seq>
|
||||
struct apply
|
||||
{
|
||||
typedef
|
||||
basic_iterator<
|
||||
map_iterator_tag
|
||||
, typename Seq::category
|
||||
, Seq
|
||||
, 0
|
||||
>
|
||||
type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
call(Seq& seq)
|
||||
{
|
||||
return type(seq,0);
|
||||
}
|
||||
};
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,51 @@
|
||||
128
|
||||
48
|
||||
9
|
||||
1 17 34 51 66 81 99 113 127
|
||||
2 18 35 50 67 82 100 114 128
|
||||
3 19 36 52 68 82 101 115 0
|
||||
2 20 36 51 69 83 102 116 0
|
||||
4 19 37 53 66 84 103 117 0
|
||||
5 21 38 54 70 85 92 114 0
|
||||
6 22 39 55 66 85 96 118 0
|
||||
7 23 32 56 71 86 103 119 0
|
||||
8 20 40 55 72 86 104 120 0
|
||||
9 19 41 57 73 87 105 118 0
|
||||
10 24 36 56 74 88 106 120 0
|
||||
10 17 33 47 75 89 107 121 126
|
||||
11 21 42 51 76 87 108 122 0
|
||||
1 25 40 58 74 84 109 122 126
|
||||
12 22 42 49 77 90 110 123 0
|
||||
13 26 43 59 68 89 104 113 0
|
||||
13 22 44 57 75 91 106 124 0
|
||||
12 23 37 46 78 88 109 113 128
|
||||
3 27 34 60 65 87 111 123 0
|
||||
6 27 45 61 79 89 98 114 0
|
||||
14 28 34 62 72 92 107 122 125
|
||||
8 27 42 59 71 92 112 117 0
|
||||
15 20 46 57 79 93 101 117 0
|
||||
9 29 45 62 74 94 108 119 128
|
||||
8 30 38 63 73 95 110 124 0
|
||||
16 29 47 64 69 96 110 125 0
|
||||
16 23 48 63 76 94 111 120 0
|
||||
7 25 39 52 70 97 108 116 127
|
||||
4 26 45 63 67 83 90 121 0
|
||||
15 28 39 50 76 88 103 115 0
|
||||
15 26 33 58 65 97 102 125 128
|
||||
14 31 47 52 77 81 93 120 0
|
||||
14 24 37 61 71 82 99 116 0
|
||||
4 31 40 54 80 91 107 119 0
|
||||
5 32 41 58 77 98 111 124 127
|
||||
9 18 49 65 79 85 104 124 0
|
||||
10 30 43 60 69 84 112 119 127
|
||||
1 18 43 48 73 91 98 121 0
|
||||
3 21 46 64 67 86 112 118 0
|
||||
5 24 48 55 75 93 105 122 0
|
||||
2 32 44 62 80 95 99 118 0
|
||||
16 28 41 59 80 83 100 123 0
|
||||
11 33 35 53 72 96 109 115 0
|
||||
11 25 44 60 78 90 100 117 0
|
||||
6 31 35 56 70 95 102 123 126
|
||||
12 17 50 54 68 94 106 125 0
|
||||
13 29 38 53 78 97 105 121 0
|
||||
7 30 49 61 64 81 101 126 0
|
||||
@@ -0,0 +1,539 @@
|
||||
// Copyright (C) 2006 Douglas Gregor <doug.gregor -at- gmail.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)
|
||||
|
||||
// Authors: Douglas Gregor
|
||||
|
||||
/** @file serialize.hpp
|
||||
*
|
||||
* This file provides Boost.Serialization support for Python objects
|
||||
* within Boost.MPI. Python objects can be serialized in one of two
|
||||
* ways. The default serialization method involves using the Python
|
||||
* "pickle" module to pickle the Python objects, transmits the
|
||||
* pickled representation, and unpickles the result when
|
||||
* received. For C++ types that have been exposed to Python and
|
||||
* registered with register_serialized(), objects are directly
|
||||
* serialized for transmissing, skipping the pickling step.
|
||||
*/
|
||||
#ifndef BOOST_MPI_PYTHON_SERIALIZE_HPP
|
||||
#define BOOST_MPI_PYTHON_SERIALIZE_HPP
|
||||
|
||||
#include <boost/mpi/python/config.hpp>
|
||||
|
||||
#include <boost/python/object.hpp>
|
||||
#include <boost/python/str.hpp>
|
||||
#include <boost/python/extract.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <map>
|
||||
|
||||
#include <boost/function/function3.hpp>
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/array.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <boost/type_traits/is_fundamental.hpp>
|
||||
|
||||
#define BOOST_MPI_PYTHON_FORWARD_ONLY
|
||||
#include <boost/mpi/python.hpp>
|
||||
|
||||
/************************************************************************
|
||||
* Boost.Python Serialization Section *
|
||||
************************************************************************/
|
||||
#if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_IS_CONVERTIBLE)
|
||||
/**
|
||||
* @brief Declare IArchive and OArchive as a Boost.Serialization
|
||||
* archives that can be used for Python objects.
|
||||
*
|
||||
* This macro can only be expanded from the global namespace. It only
|
||||
* requires that Archiver be forward-declared. IArchiver and OArchiver
|
||||
* will only support Serialization of Python objects by pickling
|
||||
* them. If the Archiver type should also support "direct"
|
||||
* serialization (for C++ types), use
|
||||
* BOOST_PYTHON_DIRECT_SERIALIZATION_ARCHIVE instead.
|
||||
*/
|
||||
# define BOOST_PYTHON_SERIALIZATION_ARCHIVE(IArchiver, OArchiver) \
|
||||
namespace boost { namespace python { namespace api { \
|
||||
template<typename R, typename T> \
|
||||
struct enable_binary< IArchiver , R, T> {}; \
|
||||
\
|
||||
template<typename R, typename T> \
|
||||
struct enable_binary< OArchiver , R, T> {}; \
|
||||
} } }
|
||||
# else
|
||||
# define BOOST_PYTHON_SERIALIZATION_ARCHIVE(IArchiver, OArchiver)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Declare IArchiver and OArchiver as a Boost.Serialization
|
||||
* archives that can be used for Python objects and C++ objects
|
||||
* wrapped in Python.
|
||||
*
|
||||
* This macro can only be expanded from the global namespace. It only
|
||||
* requires that IArchiver and OArchiver be forward-declared. However,
|
||||
* note that you will also need to write
|
||||
* BOOST_PYTHON_DIRECT_SERIALIZATION_ARCHIVE_IMPL(IArchiver,
|
||||
* OArchiver) in one of your translation units.
|
||||
|
||||
DPG PICK UP HERE
|
||||
*/
|
||||
#define BOOST_PYTHON_DIRECT_SERIALIZATION_ARCHIVE(IArchiver, OArchiver) \
|
||||
BOOST_PYTHON_SERIALIZATION_ARCHIVE(IArchiver, OArchiver) \
|
||||
namespace boost { namespace python { namespace detail { \
|
||||
template<> \
|
||||
BOOST_MPI_PYTHON_DECL direct_serialization_table< IArchiver , OArchiver >& \
|
||||
get_direct_serialization_table< IArchiver , OArchiver >(); \
|
||||
} \
|
||||
\
|
||||
template<> \
|
||||
struct has_direct_serialization< IArchiver , OArchiver> : mpl::true_ { }; \
|
||||
\
|
||||
template<> \
|
||||
struct output_archiver< IArchiver > { typedef OArchiver type; }; \
|
||||
\
|
||||
template<> \
|
||||
struct input_archiver< OArchiver > { typedef IArchiver type; }; \
|
||||
} }
|
||||
|
||||
/**
|
||||
* @brief Define the implementation for Boost.Serialization archivers
|
||||
* that can be used for Python objects and C++ objects wrapped in
|
||||
* Python.
|
||||
*
|
||||
* This macro can only be expanded from the global namespace. It only
|
||||
* requires that IArchiver and OArchiver be forward-declared. Before
|
||||
* using this macro, you will need to declare IArchiver and OArchiver
|
||||
* as direct serialization archives with
|
||||
* BOOST_PYTHON_DIRECT_SERIALIZATION_ARCHIVE(IArchiver, OArchiver).
|
||||
*/
|
||||
#define BOOST_PYTHON_DIRECT_SERIALIZATION_ARCHIVE_IMPL(IArchiver, OArchiver) \
|
||||
namespace boost { namespace python { namespace detail { \
|
||||
template \
|
||||
class BOOST_MPI_PYTHON_DECL direct_serialization_table< IArchiver , OArchiver >; \
|
||||
\
|
||||
template<> \
|
||||
BOOST_MPI_PYTHON_DECL \
|
||||
direct_serialization_table< IArchiver , OArchiver >& \
|
||||
get_direct_serialization_table< IArchiver , OArchiver >( ) \
|
||||
{ \
|
||||
static direct_serialization_table< IArchiver, OArchiver > table; \
|
||||
return table; \
|
||||
} \
|
||||
} } }
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
/**
|
||||
* INTERNAL ONLY
|
||||
*
|
||||
* Provides access to the Python "pickle" module from within C++.
|
||||
*/
|
||||
class BOOST_MPI_PYTHON_DECL pickle {
|
||||
struct data_t;
|
||||
|
||||
public:
|
||||
static str dumps(object obj, int protocol = -1);
|
||||
static object loads(str s);
|
||||
|
||||
private:
|
||||
static void initialize_data();
|
||||
|
||||
static data_t* data;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Whether the input/output archiver pair has "direct"
|
||||
* serialization for C++ objects exposed in Python.
|
||||
*
|
||||
* Users do not typically need to specialize this trait, as it will be
|
||||
* specialized as part of the macro
|
||||
* BOOST_PYTHON_DIRECT_SERIALIZATION_ARCHIVE.
|
||||
*/
|
||||
template<typename IArchiver, typename OArchiver>
|
||||
struct has_direct_serialization : mpl::false_ { };
|
||||
|
||||
/**
|
||||
* @brief A metafunction that determines the output archiver for the
|
||||
* given input archiver.
|
||||
*
|
||||
* Users do not typically need to specialize this trait, as it will be
|
||||
* specialized as part of the macro
|
||||
* BOOST_PYTHON_DIRECT_SERIALIZATION_ARCHIVE.
|
||||
*/
|
||||
template<typename IArchiver> struct output_archiver { };
|
||||
|
||||
/**
|
||||
* @brief A metafunction that determines the input archiver for the
|
||||
* given output archiver.
|
||||
*
|
||||
* Users do not typically need to specialize this trait, as it will be
|
||||
* specialized as part of the macro
|
||||
* BOOST_PYTHON_DIRECT_SERIALIZATION_ARCHIVE.
|
||||
*
|
||||
*/
|
||||
template<typename OArchiver> struct input_archiver { };
|
||||
|
||||
namespace detail {
|
||||
|
||||
/**
|
||||
* INTERNAL ONLY
|
||||
*
|
||||
* This class contains the direct-serialization code for the given
|
||||
* IArchiver/OArchiver pair. It is intended to be used as a
|
||||
* singleton class, and will be accessed when (de-)serializing a
|
||||
* Boost.Python object with an archiver that supports direct
|
||||
* serializations. Do not create instances of this class directly:
|
||||
* instead, use get_direct_serialization_table.
|
||||
*/
|
||||
template<typename IArchiver, typename OArchiver>
|
||||
class BOOST_MPI_PYTHON_DECL direct_serialization_table
|
||||
{
|
||||
public:
|
||||
typedef boost::function3<void, OArchiver&, const object&, const unsigned int>
|
||||
saver_t;
|
||||
typedef boost::function3<void, IArchiver&, object&, const unsigned int>
|
||||
loader_t;
|
||||
|
||||
typedef std::map<PyTypeObject*, std::pair<int, saver_t> > savers_t;
|
||||
typedef std::map<int, loader_t> loaders_t;
|
||||
|
||||
/**
|
||||
* Retrieve the saver (serializer) associated with the Python
|
||||
* object @p obj.
|
||||
*
|
||||
* @param obj The object we want to save. Only its (Python) type
|
||||
* is important.
|
||||
*
|
||||
* @param descriptor The value of the descriptor associated to
|
||||
* the returned saver. Will be set to zero if no saver was found
|
||||
* for @p obj.
|
||||
*
|
||||
* @returns a function object that can be used to serialize this
|
||||
* object (and other objects of the same type), if possible. If
|
||||
* no saver can be found, returns an empty function object..
|
||||
*/
|
||||
saver_t saver(const object& obj, int& descriptor)
|
||||
{
|
||||
typename savers_t::iterator pos = savers.find(obj.ptr()->ob_type);
|
||||
if (pos != savers.end()) {
|
||||
descriptor = pos->second.first;
|
||||
return pos->second.second;
|
||||
}
|
||||
else {
|
||||
descriptor = 0;
|
||||
return saver_t();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the loader (deserializer) associated with the given
|
||||
* descriptor.
|
||||
*
|
||||
* @param descriptor The descriptor number provided by saver()
|
||||
* when determining the saver for this type.
|
||||
*
|
||||
* @returns a function object that can be used to deserialize an
|
||||
* object whose type is the same as that corresponding to the
|
||||
* descriptor. If the descriptor is unknown, the return value
|
||||
* will be an empty function object.
|
||||
*/
|
||||
loader_t loader(int descriptor)
|
||||
{
|
||||
typename loaders_t::iterator pos = loaders.find(descriptor);
|
||||
if (pos != loaders.end())
|
||||
return pos->second;
|
||||
else
|
||||
return loader_t();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the type T for direct serialization.
|
||||
*
|
||||
* @param value A sample value of the type @c T. This may be used
|
||||
* to compute the Python type associated with the C++ type @c T.
|
||||
*
|
||||
* @param type The Python type associated with the C++ type @c
|
||||
* T. If not provided, it will be computed from the same value @p
|
||||
* value.
|
||||
*/
|
||||
template<typename T>
|
||||
void register_type(const T& value = T(), PyTypeObject* type = 0)
|
||||
{
|
||||
// If the user did not provide us with a Python type, figure it
|
||||
// out for ourselves.
|
||||
if (!type) {
|
||||
object obj(value);
|
||||
type = obj.ptr()->ob_type;
|
||||
}
|
||||
|
||||
register_type(default_saver<T>(), default_loader<T>(type), value, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the type T for direct serialization.
|
||||
*
|
||||
* @param saver A function object that will serialize a
|
||||
* Boost.Python object (that represents a C++ object of type @c
|
||||
* T) to an @c OArchive.
|
||||
*
|
||||
* @param loader A function object that will deserialize from an
|
||||
* @c IArchive into a Boost.Python object that represents a C++
|
||||
* object of type @c T.
|
||||
*
|
||||
* @param value A sample value of the type @c T. This may be used
|
||||
* to compute the Python type associated with the C++ type @c T.
|
||||
*
|
||||
* @param type The Python type associated with the C++ type @c
|
||||
* T. If not provided, it will be computed from the same value @p
|
||||
* value.
|
||||
*/
|
||||
template<typename T>
|
||||
void register_type(const saver_t& saver, const loader_t& loader,
|
||||
const T& value = T(), PyTypeObject* type = 0)
|
||||
{
|
||||
// If the user did not provide us with a Python type, figure it
|
||||
// out for ourselves.
|
||||
if (!type) {
|
||||
object obj(value);
|
||||
type = obj.ptr()->ob_type;
|
||||
}
|
||||
|
||||
int descriptor = savers.size() + 1;
|
||||
if (savers.find(type) != savers.end())
|
||||
return;
|
||||
|
||||
savers[type] = std::make_pair(descriptor, saver);
|
||||
loaders[descriptor] = loader;
|
||||
}
|
||||
|
||||
protected:
|
||||
template<typename T>
|
||||
struct default_saver {
|
||||
void operator()(OArchiver& ar, const object& obj, const unsigned int) {
|
||||
T value = extract<T>(obj)();
|
||||
ar << value;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct default_loader {
|
||||
default_loader(PyTypeObject* type) : type(type) { }
|
||||
|
||||
void operator()(IArchiver& ar, object& obj, const unsigned int) {
|
||||
// If we can, extract the object in place.
|
||||
if (!is_fundamental<T>::value && obj && obj.ptr()->ob_type == type) {
|
||||
ar >> extract<T&>(obj)();
|
||||
} else {
|
||||
T value;
|
||||
ar >> value;
|
||||
obj = object(value);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
PyTypeObject* type;
|
||||
};
|
||||
|
||||
savers_t savers;
|
||||
loaders_t loaders;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Retrieve the direct-serialization table for an
|
||||
* IArchiver/OArchiver pair.
|
||||
*
|
||||
* This function is responsible for returning a reference to the
|
||||
* singleton direct-serialization table. Its primary template is
|
||||
* left undefined, to force the use of an explicit specialization
|
||||
* with a definition in a single translation unit. Use the macro
|
||||
* BOOST_PYTHON_DIRECT_SERIALIZATION_ARCHIVE_IMPL to define this
|
||||
* explicit specialization.
|
||||
*/
|
||||
template<typename IArchiver, typename OArchiver>
|
||||
direct_serialization_table<IArchiver, OArchiver>&
|
||||
get_direct_serialization_table();
|
||||
} // end namespace detail
|
||||
|
||||
/**
|
||||
* @brief Register the type T for direct serialization.
|
||||
*
|
||||
* The @c register_serialized function registers a C++ type for direct
|
||||
* serialization with the given @c IArchiver/@c OArchiver pair. Direct
|
||||
* serialization elides the use of the Python @c pickle package when
|
||||
* serializing Python objects that represent C++ values. Direct
|
||||
* serialization can be beneficial both to improve serialization
|
||||
* performance (Python pickling can be very inefficient) and to permit
|
||||
* serialization for Python-wrapped C++ objects that do not support
|
||||
* pickling.
|
||||
*
|
||||
* @param value A sample value of the type @c T. This may be used
|
||||
* to compute the Python type associated with the C++ type @c T.
|
||||
*
|
||||
* @param type The Python type associated with the C++ type @c
|
||||
* T. If not provided, it will be computed from the same value @p
|
||||
* value.
|
||||
*/
|
||||
template<typename IArchiver, typename OArchiver, typename T>
|
||||
void
|
||||
register_serialized(const T& value = T(), PyTypeObject* type = 0)
|
||||
{
|
||||
detail::direct_serialization_table<IArchiver, OArchiver>& table =
|
||||
detail::get_direct_serialization_table<IArchiver, OArchiver>();
|
||||
table.register_type(value, type);
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
|
||||
/// Save a Python object by pickling it.
|
||||
template<typename Archiver>
|
||||
void
|
||||
save_impl(Archiver& ar, const boost::python::object& obj,
|
||||
const unsigned int /*version*/,
|
||||
mpl::false_ /*has_direct_serialization*/)
|
||||
{
|
||||
boost::python::str py_string = boost::python::pickle::dumps(obj);
|
||||
int len = boost::python::extract<int>(py_string.attr("__len__")());
|
||||
const char* string = boost::python::extract<const char*>(py_string);
|
||||
ar << len << boost::serialization::make_array(string, len);
|
||||
}
|
||||
|
||||
/// Try to save a Python object by directly serializing it; fall back
|
||||
/// on pickling if required.
|
||||
template<typename Archiver>
|
||||
void
|
||||
save_impl(Archiver& ar, const boost::python::object& obj,
|
||||
const unsigned int version,
|
||||
mpl::true_ /*has_direct_serialization*/)
|
||||
{
|
||||
typedef Archiver OArchiver;
|
||||
typedef typename input_archiver<OArchiver>::type IArchiver;
|
||||
typedef typename direct_serialization_table<IArchiver, OArchiver>::saver_t
|
||||
saver_t;
|
||||
|
||||
direct_serialization_table<IArchiver, OArchiver>& table =
|
||||
get_direct_serialization_table<IArchiver, OArchiver>();
|
||||
|
||||
int descriptor = 0;
|
||||
if (saver_t saver = table.saver(obj, descriptor)) {
|
||||
ar << descriptor;
|
||||
saver(ar, obj, version);
|
||||
} else {
|
||||
// Pickle it
|
||||
ar << descriptor;
|
||||
detail::save_impl(ar, obj, version, mpl::false_());
|
||||
}
|
||||
}
|
||||
|
||||
/// Load a Python object by unpickling it
|
||||
template<typename Archiver>
|
||||
void
|
||||
load_impl(Archiver& ar, boost::python::object& obj,
|
||||
const unsigned int /*version*/,
|
||||
mpl::false_ /*has_direct_serialization*/)
|
||||
{
|
||||
int len;
|
||||
ar >> len;
|
||||
|
||||
std::auto_ptr<char> string(new char[len]);
|
||||
ar >> boost::serialization::make_array(string.get(), len);
|
||||
boost::python::str py_string(string.get(), len);
|
||||
obj = boost::python::pickle::loads(py_string);
|
||||
}
|
||||
|
||||
/// Try to load a Python object by directly deserializing it; fall back
|
||||
/// on unpickling if required.
|
||||
template<typename Archiver>
|
||||
void
|
||||
load_impl(Archiver& ar, boost::python::object& obj,
|
||||
const unsigned int version,
|
||||
mpl::true_ /*has_direct_serialization*/)
|
||||
{
|
||||
typedef Archiver IArchiver;
|
||||
typedef typename output_archiver<IArchiver>::type OArchiver;
|
||||
typedef typename direct_serialization_table<IArchiver, OArchiver>::loader_t
|
||||
loader_t;
|
||||
|
||||
direct_serialization_table<IArchiver, OArchiver>& table =
|
||||
get_direct_serialization_table<IArchiver, OArchiver>();
|
||||
|
||||
int descriptor;
|
||||
ar >> descriptor;
|
||||
|
||||
if (descriptor) {
|
||||
loader_t loader = table.loader(descriptor);
|
||||
BOOST_ASSERT(loader);
|
||||
|
||||
loader(ar, obj, version);
|
||||
} else {
|
||||
// Unpickle it
|
||||
detail::load_impl(ar, obj, version, mpl::false_());
|
||||
}
|
||||
}
|
||||
|
||||
} // end namespace detail
|
||||
|
||||
template<typename Archiver>
|
||||
void
|
||||
save(Archiver& ar, const boost::python::object& obj,
|
||||
const unsigned int version)
|
||||
{
|
||||
typedef Archiver OArchiver;
|
||||
typedef typename input_archiver<OArchiver>::type IArchiver;
|
||||
|
||||
detail::save_impl(ar, obj, version,
|
||||
has_direct_serialization<IArchiver, OArchiver>());
|
||||
}
|
||||
|
||||
template<typename Archiver>
|
||||
void
|
||||
load(Archiver& ar, boost::python::object& obj,
|
||||
const unsigned int version)
|
||||
{
|
||||
typedef Archiver IArchiver;
|
||||
typedef typename output_archiver<IArchiver>::type OArchiver;
|
||||
|
||||
detail::load_impl(ar, obj, version,
|
||||
has_direct_serialization<IArchiver, OArchiver>());
|
||||
}
|
||||
|
||||
template<typename Archive>
|
||||
inline void
|
||||
serialize(Archive& ar, boost::python::object& obj, const unsigned int version)
|
||||
{
|
||||
boost::serialization::split_free(ar, obj, version);
|
||||
}
|
||||
|
||||
} } // end namespace boost::python
|
||||
|
||||
/************************************************************************
|
||||
* Boost.MPI-Specific Section *
|
||||
************************************************************************/
|
||||
namespace boost { namespace mpi {
|
||||
class packed_iarchive;
|
||||
class packed_oarchive;
|
||||
} } // end namespace boost::mpi
|
||||
|
||||
BOOST_PYTHON_DIRECT_SERIALIZATION_ARCHIVE(
|
||||
::boost::mpi::packed_iarchive,
|
||||
::boost::mpi::packed_oarchive)
|
||||
|
||||
namespace boost { namespace mpi { namespace python {
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
register_serialized(const T& value, PyTypeObject* type)
|
||||
{
|
||||
using boost::python::register_serialized;
|
||||
register_serialized<packed_iarchive, packed_oarchive>(value, type);
|
||||
}
|
||||
|
||||
} } } // end namespace boost::mpi::python
|
||||
|
||||
#endif // BOOST_MPI_PYTHON_SERIALIZE_HPP
|
||||
@@ -0,0 +1,518 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright (C) 2002-2006 Marcin Kalicinski
|
||||
// Copyright (C) 2009 Sebastian Redl
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see www.boost.org
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifndef BOOST_PROPERTY_TREE_PTREE_HPP_INCLUDED
|
||||
#define BOOST_PROPERTY_TREE_PTREE_HPP_INCLUDED
|
||||
|
||||
#include <boost/property_tree/ptree_fwd.hpp>
|
||||
#include <boost/property_tree/string_path.hpp>
|
||||
#include <boost/property_tree/stream_translator.hpp>
|
||||
#include <boost/property_tree/exceptions.hpp>
|
||||
#include <boost/property_tree/detail/ptree_utils.hpp>
|
||||
|
||||
#include <boost/multi_index_container.hpp>
|
||||
#include <boost/multi_index/indexed_by.hpp>
|
||||
#include <boost/multi_index/sequenced_index.hpp>
|
||||
#include <boost/multi_index/ordered_index.hpp>
|
||||
#include <boost/multi_index/member.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <utility> // for std::pair
|
||||
|
||||
namespace boost { namespace property_tree
|
||||
{
|
||||
|
||||
/**
|
||||
* Property tree main structure. A property tree is a hierarchical data
|
||||
* structure which has one element of type @p Data in each node, as well
|
||||
* as an ordered sequence of sub-nodes, which are additionally identified
|
||||
* by a non-unique key of type @p Key.
|
||||
*
|
||||
* Key equivalency is defined by @p KeyCompare, a predicate defining a
|
||||
* strict weak ordering.
|
||||
*
|
||||
* Property tree defines a Container-like interface to the (key-node) pairs
|
||||
* of its direct sub-nodes. The iterators are bidirectional. The sequence
|
||||
* of nodes is held in insertion order, not key order.
|
||||
*/
|
||||
template<class Key, class Data, class KeyCompare>
|
||||
class basic_ptree
|
||||
{
|
||||
#if defined(BOOST_PROPERTY_TREE_DOXYGEN_INVOKED)
|
||||
public:
|
||||
#endif
|
||||
// Internal types
|
||||
/**
|
||||
* Simpler way to refer to this basic_ptree\<C,K,P,A\> type.
|
||||
* Note that this is private, and made public only for doxygen.
|
||||
*/
|
||||
typedef basic_ptree<Key, Data, KeyCompare> self_type;
|
||||
|
||||
public:
|
||||
// Basic types
|
||||
typedef Key key_type;
|
||||
typedef Data data_type;
|
||||
typedef KeyCompare key_compare;
|
||||
|
||||
// Container view types
|
||||
typedef std::pair<const Key, self_type> value_type;
|
||||
typedef std::size_t size_type;
|
||||
|
||||
// The problem with the iterators is that I can't make them complete
|
||||
// until the container is complete. Sucks. Especially for the reverses.
|
||||
class iterator;
|
||||
class const_iterator;
|
||||
class reverse_iterator;
|
||||
class const_reverse_iterator;
|
||||
|
||||
// Associative view types
|
||||
class assoc_iterator;
|
||||
class const_assoc_iterator;
|
||||
|
||||
// Property tree view types
|
||||
typedef typename path_of<Key>::type path_type;
|
||||
|
||||
|
||||
// The big five
|
||||
|
||||
/** Creates a node with no children and default-constructed data. */
|
||||
basic_ptree();
|
||||
/** Creates a node with no children and a copy of the given data. */
|
||||
explicit basic_ptree(const data_type &data);
|
||||
basic_ptree(const self_type &rhs);
|
||||
~basic_ptree();
|
||||
/** Basic guarantee only. */
|
||||
self_type &operator =(const self_type &rhs);
|
||||
|
||||
/** Swap with other tree. Only constant-time and nothrow if the
|
||||
* data type's swap is.
|
||||
*/
|
||||
void swap(self_type &rhs);
|
||||
|
||||
// Container view functions
|
||||
|
||||
/** The number of direct children of this node. */
|
||||
size_type size() const;
|
||||
size_type max_size() const;
|
||||
/** Whether there are any direct children. */
|
||||
bool empty() const;
|
||||
|
||||
iterator begin();
|
||||
const_iterator begin() const;
|
||||
iterator end();
|
||||
const_iterator end() const;
|
||||
reverse_iterator rbegin();
|
||||
const_reverse_iterator rbegin() const;
|
||||
reverse_iterator rend();
|
||||
const_reverse_iterator rend() const;
|
||||
|
||||
value_type &front();
|
||||
const value_type &front() const;
|
||||
value_type &back();
|
||||
const value_type &back() const;
|
||||
|
||||
/** Insert a copy of the given tree with its key just before the given
|
||||
* position in this node. This operation invalidates no iterators.
|
||||
* @return An iterator to the newly created child.
|
||||
*/
|
||||
iterator insert(iterator where, const value_type &value);
|
||||
|
||||
/** Range insert. Equivalent to:
|
||||
* @code
|
||||
* for(; first != last; ++first) insert(where, *first);
|
||||
* @endcode
|
||||
*/
|
||||
template<class It> void insert(iterator where, It first, It last);
|
||||
|
||||
/** Erase the child pointed at by the iterator. This operation
|
||||
* invalidates the given iterator, as well as its equivalent
|
||||
* assoc_iterator.
|
||||
* @return A valid iterator pointing to the element after the erased.
|
||||
*/
|
||||
iterator erase(iterator where);
|
||||
|
||||
/** Range erase. Equivalent to:
|
||||
* @code
|
||||
* while(first != last;) first = erase(first);
|
||||
* @endcode
|
||||
*/
|
||||
iterator erase(iterator first, iterator last);
|
||||
|
||||
/** Equivalent to insert(begin(), value). */
|
||||
iterator push_front(const value_type &value);
|
||||
|
||||
/** Equivalent to insert(end(), value). */
|
||||
iterator push_back(const value_type &value);
|
||||
|
||||
/** Equivalent to erase(begin()). */
|
||||
void pop_front();
|
||||
|
||||
/** Equivalent to erase(boost::prior(end())). */
|
||||
void pop_back();
|
||||
|
||||
/** Reverses the order of direct children in the property tree. */
|
||||
void reverse();
|
||||
|
||||
/** Sorts the direct children of this node according to the predicate.
|
||||
* The predicate is passed the whole pair of key and child.
|
||||
*/
|
||||
template<class Compare> void sort(Compare comp);
|
||||
|
||||
/** Sorts the direct children of this node according to key order. */
|
||||
void sort();
|
||||
|
||||
// Equality
|
||||
|
||||
/** Two property trees are the same if they have the same data, the keys
|
||||
* and order of their children are the same, and the children compare
|
||||
* equal, recursively.
|
||||
*/
|
||||
bool operator ==(const self_type &rhs) const;
|
||||
bool operator !=(const self_type &rhs) const;
|
||||
|
||||
// Associative view
|
||||
|
||||
/** Returns an iterator to the first child, in key order. */
|
||||
assoc_iterator ordered_begin();
|
||||
/** Returns an iterator to the first child, in key order. */
|
||||
const_assoc_iterator ordered_begin() const;
|
||||
|
||||
/** Returns the not-found iterator. Equivalent to end() in a real
|
||||
* associative container.
|
||||
*/
|
||||
assoc_iterator not_found();
|
||||
/** Returns the not-found iterator. Equivalent to end() in a real
|
||||
* associative container.
|
||||
*/
|
||||
const_assoc_iterator not_found() const;
|
||||
|
||||
/** Find a child with the given key, or not_found() if there is none.
|
||||
* There is no guarantee about which child is returned if multiple have
|
||||
* the same key.
|
||||
*/
|
||||
assoc_iterator find(const key_type &key);
|
||||
|
||||
/** Find a child with the given key, or not_found() if there is none.
|
||||
* There is no guarantee about which child is returned if multiple have
|
||||
* the same key.
|
||||
*/
|
||||
const_assoc_iterator find(const key_type &key) const;
|
||||
|
||||
/** Find the range of children that have the given key. */
|
||||
std::pair<assoc_iterator, assoc_iterator>
|
||||
equal_range(const key_type &key);
|
||||
|
||||
/** Find the range of children that have the given key. */
|
||||
std::pair<const_assoc_iterator, const_assoc_iterator>
|
||||
equal_range(const key_type &key) const;
|
||||
|
||||
/** Count the number of direct children with the given key. */
|
||||
size_type count(const key_type &key) const;
|
||||
|
||||
/** Erase all direct children with the given key and return the count.
|
||||
*/
|
||||
size_type erase(const key_type &key);
|
||||
|
||||
/** Get the iterator that points to the same element as the argument.
|
||||
* @note A valid assoc_iterator range (a, b) does not imply that
|
||||
* (to_iterator(a), to_iterator(b)) is a valid range.
|
||||
*/
|
||||
iterator to_iterator(assoc_iterator it);
|
||||
|
||||
/** Get the iterator that points to the same element as the argument.
|
||||
* @note A valid const_assoc_iterator range (a, b) does not imply that
|
||||
* (to_iterator(a), to_iterator(b)) is a valid range.
|
||||
*/
|
||||
const_iterator to_iterator(const_assoc_iterator it) const;
|
||||
|
||||
// Property tree view
|
||||
|
||||
/** Reference to the actual data in this node. */
|
||||
data_type &data();
|
||||
|
||||
/** Reference to the actual data in this node. */
|
||||
const data_type &data() const;
|
||||
|
||||
/** Clear this tree completely, of both data and children. */
|
||||
void clear();
|
||||
|
||||
/** Get the child at the given path, or throw @c ptree_bad_path.
|
||||
* @note Depending on the path, the result at each level may not be
|
||||
* completely deterministic, i.e. if the same key appears multiple
|
||||
* times, which child is chosen is not specified. This can lead
|
||||
* to the path not being resolved even though there is a
|
||||
* descendant with this path. Example:
|
||||
* @code
|
||||
* a -> b -> c
|
||||
* -> b
|
||||
* @endcode
|
||||
* The path "a.b.c" will succeed if the resolution of "b" chooses
|
||||
* the first such node, but fail if it chooses the second.
|
||||
*/
|
||||
self_type &get_child(const path_type &path);
|
||||
|
||||
/** Get the child at the given path, or throw @c ptree_bad_path. */
|
||||
const self_type &get_child(const path_type &path) const;
|
||||
|
||||
/** Get the child at the given path, or return @p default_value. */
|
||||
self_type &get_child(const path_type &path, self_type &default_value);
|
||||
|
||||
/** Get the child at the given path, or return @p default_value. */
|
||||
const self_type &get_child(const path_type &path,
|
||||
const self_type &default_value) const;
|
||||
|
||||
/** Get the child at the given path, or return boost::null. */
|
||||
optional<self_type &> get_child_optional(const path_type &path);
|
||||
|
||||
/** Get the child at the given path, or return boost::null. */
|
||||
optional<const self_type &>
|
||||
get_child_optional(const path_type &path) const;
|
||||
|
||||
/** Set the node at the given path to the given value. Create any
|
||||
* missing parents. If the node at the path already exists, replace it.
|
||||
* @return A reference to the inserted subtree.
|
||||
* @note Because of the way paths work, it is not generally guaranteed
|
||||
* that a node newly created can be accessed using the same path.
|
||||
* @note If the path could refer to multiple nodes, it is unspecified
|
||||
* which one gets replaced.
|
||||
*/
|
||||
self_type &put_child(const path_type &path, const self_type &value);
|
||||
|
||||
/** Add the node at the given path. Create any missing parents. If there
|
||||
* already is a node at the path, add another one with the same key.
|
||||
* @param path Path to the child. The last fragment must not have an
|
||||
* index.
|
||||
* @return A reference to the inserted subtree.
|
||||
* @note Because of the way paths work, it is not generally guaranteed
|
||||
* that a node newly created can be accessed using the same path.
|
||||
*/
|
||||
self_type &add_child(const path_type &path, const self_type &value);
|
||||
|
||||
/** Take the value of this node and attempt to translate it to a
|
||||
* @c Type object using the supplied translator.
|
||||
* @throw ptree_bad_data if the conversion fails.
|
||||
*/
|
||||
template<class Type, class Translator>
|
||||
typename boost::enable_if<detail::is_translator<Translator>, Type>::type
|
||||
get_value(Translator tr) const;
|
||||
|
||||
/** Take the value of this node and attempt to translate it to a
|
||||
* @c Type object using the default translator.
|
||||
* @throw ptree_bad_data if the conversion fails.
|
||||
*/
|
||||
template<class Type>
|
||||
Type get_value() const;
|
||||
|
||||
/** Take the value of this node and attempt to translate it to a
|
||||
* @c Type object using the supplied translator. Return @p default_value
|
||||
* if this fails.
|
||||
*/
|
||||
template<class Type, class Translator>
|
||||
Type get_value(const Type &default_value, Translator tr) const;
|
||||
|
||||
/** Make get_value do the right thing for string literals. */
|
||||
template <class Ch, class Translator>
|
||||
typename boost::enable_if<
|
||||
detail::is_character<Ch>,
|
||||
std::basic_string<Ch>
|
||||
>::type
|
||||
get_value(const Ch *default_value, Translator tr) const;
|
||||
|
||||
/** Take the value of this node and attempt to translate it to a
|
||||
* @c Type object using the default translator. Return @p default_value
|
||||
* if this fails.
|
||||
*/
|
||||
template<class Type>
|
||||
typename boost::disable_if<detail::is_translator<Type>, Type>::type
|
||||
get_value(const Type &default_value) const;
|
||||
|
||||
/** Make get_value do the right thing for string literals. */
|
||||
template <class Ch>
|
||||
typename boost::enable_if<
|
||||
detail::is_character<Ch>,
|
||||
std::basic_string<Ch>
|
||||
>::type
|
||||
get_value(const Ch *default_value) const;
|
||||
|
||||
/** Take the value of this node and attempt to translate it to a
|
||||
* @c Type object using the supplied translator. Return boost::null if
|
||||
* this fails.
|
||||
*/
|
||||
template<class Type, class Translator>
|
||||
optional<Type> get_value_optional(Translator tr) const;
|
||||
|
||||
/** Take the value of this node and attempt to translate it to a
|
||||
* @c Type object using the default translator. Return boost::null if
|
||||
* this fails.
|
||||
*/
|
||||
template<class Type>
|
||||
optional<Type> get_value_optional() const;
|
||||
|
||||
/** Replace the value at this node with the given value, translated
|
||||
* to the tree's data type using the supplied translator.
|
||||
* @throw ptree_bad_data if the conversion fails.
|
||||
*/
|
||||
template<class Type, class Translator>
|
||||
void put_value(const Type &value, Translator tr);
|
||||
|
||||
/** Replace the value at this node with the given value, translated
|
||||
* to the tree's data type using the default translator.
|
||||
* @throw ptree_bad_data if the conversion fails.
|
||||
*/
|
||||
template<class Type>
|
||||
void put_value(const Type &value);
|
||||
|
||||
/** Shorthand for get_child(path).get_value(tr). */
|
||||
template<class Type, class Translator>
|
||||
typename boost::enable_if<detail::is_translator<Translator>, Type>::type
|
||||
get(const path_type &path, Translator tr) const;
|
||||
|
||||
/** Shorthand for get_child(path).get_value\<Type\>(). */
|
||||
template<class Type>
|
||||
Type get(const path_type &path) const;
|
||||
|
||||
/** Shorthand for get_child(path, empty_ptree())
|
||||
* .get_value(default_value, tr).
|
||||
* That is, return the translated value if possible, and the default
|
||||
* value if the node doesn't exist or conversion fails.
|
||||
*/
|
||||
template<class Type, class Translator>
|
||||
Type get(const path_type &path,
|
||||
const Type &default_value,
|
||||
Translator tr) const;
|
||||
|
||||
/** Make get do the right thing for string literals. */
|
||||
template <class Ch, class Translator>
|
||||
typename boost::enable_if<
|
||||
detail::is_character<Ch>,
|
||||
std::basic_string<Ch>
|
||||
>::type
|
||||
get(const path_type &path, const Ch *default_value, Translator tr)const;
|
||||
|
||||
/** Shorthand for get_child(path, empty_ptree())
|
||||
* .get_value(default_value).
|
||||
* That is, return the translated value if possible, and the default
|
||||
* value if the node doesn't exist or conversion fails.
|
||||
*/
|
||||
template<class Type>
|
||||
typename boost::disable_if<detail::is_translator<Type>, Type>::type
|
||||
get(const path_type &path, const Type &default_value) const;
|
||||
|
||||
/** Make get do the right thing for string literals. */
|
||||
template <class Ch>
|
||||
typename boost::enable_if<
|
||||
detail::is_character<Ch>,
|
||||
std::basic_string<Ch>
|
||||
>::type
|
||||
get(const path_type &path, const Ch *default_value) const;
|
||||
|
||||
/** Shorthand for:
|
||||
* @code
|
||||
* if(optional\<self_type&\> node = get_child_optional(path))
|
||||
* return node->get_value_optional(tr);
|
||||
* return boost::null;
|
||||
* @endcode
|
||||
* That is, return the value if it exists and can be converted, or nil.
|
||||
*/
|
||||
template<class Type, class Translator>
|
||||
optional<Type> get_optional(const path_type &path, Translator tr) const;
|
||||
|
||||
/** Shorthand for:
|
||||
* @code
|
||||
* if(optional\<const self_type&\> node = get_child_optional(path))
|
||||
* return node->get_value_optional();
|
||||
* return boost::null;
|
||||
* @endcode
|
||||
* That is, return the value if it exists and can be converted, or nil.
|
||||
*/
|
||||
template<class Type>
|
||||
optional<Type> get_optional(const path_type &path) const;
|
||||
|
||||
/** Set the value of the node at the given path to the supplied value,
|
||||
* translated to the tree's data type. If the node doesn't exist, it is
|
||||
* created, including all its missing parents.
|
||||
* @return The node that had its value changed.
|
||||
* @throw ptree_bad_data if the conversion fails.
|
||||
*/
|
||||
template<class Type, class Translator>
|
||||
self_type &put(const path_type &path, const Type &value, Translator tr);
|
||||
|
||||
/** Set the value of the node at the given path to the supplied value,
|
||||
* translated to the tree's data type. If the node doesn't exist, it is
|
||||
* created, including all its missing parents.
|
||||
* @return The node that had its value changed.
|
||||
* @throw ptree_bad_data if the conversion fails.
|
||||
*/
|
||||
template<class Type>
|
||||
self_type &put(const path_type &path, const Type &value);
|
||||
|
||||
/** If the node identified by the path does not exist, create it,
|
||||
* including all its missing parents.
|
||||
* If the node already exists, add a sibling with the same key.
|
||||
* Set the newly created node's value to the given paremeter,
|
||||
* translated with the supplied translator.
|
||||
* @param path Path to the child. The last fragment must not have an
|
||||
* index.
|
||||
* @param value The value to add.
|
||||
* @param tr The translator to use.
|
||||
* @return The node that was added.
|
||||
* @throw ptree_bad_data if the conversion fails.
|
||||
*/
|
||||
template<class Type, class Translator>
|
||||
self_type &add(const path_type &path,
|
||||
const Type &value,
|
||||
Translator tr);
|
||||
|
||||
/** If the node identified by the path does not exist, create it,
|
||||
* including all its missing parents.
|
||||
* If the node already exists, add a sibling with the same key.
|
||||
* Set the newly created node's value to the given paremeter,
|
||||
* translated with the supplied translator.
|
||||
* @param path Path to the child. The last fragment must not have an
|
||||
* index.
|
||||
* @param value The value to add.
|
||||
* @return The node that was added.
|
||||
* @throw ptree_bad_data if the conversion fails.
|
||||
*/
|
||||
template<class Type>
|
||||
self_type &add(const path_type &path, const Type &value);
|
||||
|
||||
private:
|
||||
// Hold the data of this node
|
||||
data_type m_data;
|
||||
// Hold the children - this is a void* because we can't complete the
|
||||
// container type within the class.
|
||||
void* m_children;
|
||||
|
||||
// Getter tree-walk. Not const-safe! Gets the node the path refers to,
|
||||
// or null. Destroys p's value.
|
||||
self_type* walk_path(path_type& p) const;
|
||||
|
||||
// Modifer tree-walk. Gets the parent of the node referred to by the
|
||||
// path, creating nodes as necessary. p is the path to the remaining
|
||||
// child.
|
||||
self_type& force_path(path_type& p);
|
||||
|
||||
// This struct contains typedefs for the concrete types.
|
||||
struct subs;
|
||||
friend struct subs;
|
||||
friend class iterator;
|
||||
friend class const_iterator;
|
||||
friend class reverse_iterator;
|
||||
friend class const_reverse_iterator;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#include <boost/property_tree/detail/ptree_implementation.hpp>
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,56 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2011 Eric Niebler
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUSION_ALGORITHM_ITERATION_REVERSE_FOLD_FWD_HPP
|
||||
#define BOOST_FUSION_ALGORITHM_ITERATION_REVERSE_FOLD_FWD_HPP
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template<typename Seq, typename State, typename F>
|
||||
struct reverse_fold;
|
||||
}
|
||||
|
||||
template<typename Seq, typename State, typename F>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename result_of::reverse_fold<
|
||||
Seq
|
||||
, State const
|
||||
, F
|
||||
>::type
|
||||
reverse_fold(Seq& seq, State const& state, F f);
|
||||
|
||||
template<typename Seq, typename State, typename F>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename result_of::reverse_fold<
|
||||
Seq const
|
||||
, State const
|
||||
, F
|
||||
>::type
|
||||
reverse_fold(Seq const& seq, State const& state, F f);
|
||||
|
||||
template<typename Seq, typename State, typename F>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename result_of::reverse_fold<
|
||||
Seq
|
||||
, State
|
||||
, F
|
||||
>::type
|
||||
reverse_fold(Seq& seq, State& state, F f);
|
||||
|
||||
template<typename Seq, typename State, typename F>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename result_of::reverse_fold<
|
||||
Seq const
|
||||
, State
|
||||
, F
|
||||
>::type
|
||||
reverse_fold(Seq const& seq, State& state, F f);
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,208 @@
|
||||
#include "displaytext.h"
|
||||
|
||||
#include <QMouseEvent>
|
||||
#include <QDateTime>
|
||||
#include <QTextCharFormat>
|
||||
#include <QFont>
|
||||
#include <QTextCursor>
|
||||
|
||||
#include "qt_helpers.hpp"
|
||||
|
||||
#include "moc_displaytext.cpp"
|
||||
|
||||
DisplayText::DisplayText(QWidget *parent) :
|
||||
QTextEdit(parent)
|
||||
{
|
||||
setReadOnly (true);
|
||||
viewport ()->setCursor (Qt::ArrowCursor);
|
||||
setWordWrapMode (QTextOption::NoWrap);
|
||||
setStyleSheet ("");
|
||||
}
|
||||
|
||||
void DisplayText::setContentFont(QFont const& font)
|
||||
{
|
||||
setFont (font);
|
||||
m_charFormat.setFont (font);
|
||||
selectAll ();
|
||||
auto cursor = textCursor ();
|
||||
cursor.mergeCharFormat (m_charFormat);
|
||||
cursor.clearSelection ();
|
||||
cursor.movePosition (QTextCursor::End);
|
||||
|
||||
// position so viewport scrolled to left
|
||||
cursor.movePosition (QTextCursor::Up);
|
||||
cursor.movePosition (QTextCursor::StartOfLine);
|
||||
|
||||
setTextCursor (cursor);
|
||||
ensureCursorVisible ();
|
||||
}
|
||||
|
||||
void DisplayText::mouseDoubleClickEvent(QMouseEvent *e)
|
||||
{
|
||||
bool ctrl = (e->modifiers() & Qt::ControlModifier);
|
||||
bool shift = (e->modifiers() & Qt::ShiftModifier);
|
||||
emit(selectCallsign(shift,ctrl));
|
||||
QTextEdit::mouseDoubleClickEvent(e);
|
||||
}
|
||||
|
||||
void DisplayText::insertLineSpacer(QString const& line)
|
||||
{
|
||||
appendText (line, "#d3d3d3");
|
||||
}
|
||||
|
||||
void DisplayText::appendText(QString const& text, QString const& bg)
|
||||
{
|
||||
QString escaped {text.trimmed().replace('<',"<").replace('>',">").replace(' ', " ")};
|
||||
QString s = "<table border=0 cellspacing=0 width=100%><tr><td bgcolor=\"" +
|
||||
bg + "\">" + escaped + "</td></tr></table>";
|
||||
auto cursor = textCursor ();
|
||||
cursor.movePosition (QTextCursor::End);
|
||||
auto pos = cursor.position ();
|
||||
cursor.insertHtml (s);
|
||||
cursor.setPosition (pos, QTextCursor::MoveAnchor);
|
||||
cursor.movePosition (QTextCursor::End, QTextCursor::KeepAnchor);
|
||||
cursor.mergeCharFormat (m_charFormat);
|
||||
cursor.clearSelection ();
|
||||
|
||||
// position so viewport scrolled to left
|
||||
cursor.movePosition (QTextCursor::Up);
|
||||
cursor.movePosition (QTextCursor::StartOfLine);
|
||||
setTextCursor (cursor);
|
||||
ensureCursorVisible ();
|
||||
}
|
||||
|
||||
|
||||
void DisplayText::_appendDXCCWorkedB4(DecodedText& t1, QString& bg,
|
||||
LogBook logBook, QColor color_CQ,
|
||||
QColor color_DXCC,
|
||||
QColor color_NewCall)
|
||||
{
|
||||
QString call = t1.CQersCall ();
|
||||
QString countryName;
|
||||
bool callWorkedBefore;
|
||||
bool countryWorkedBefore;
|
||||
|
||||
if(call.length()==2) {
|
||||
int i0=t1.indexOf("CQ "+call);
|
||||
call=t1.mid(i0+6,-1);
|
||||
i0=call.indexOf(" ");
|
||||
call=call.mid(0,i0);
|
||||
}
|
||||
if(call.length()<3) return;
|
||||
if(!call.contains(QRegExp("[0-9]")) or !call.contains(QRegExp("[A-Z]"))) return;
|
||||
|
||||
logBook.match(/*in*/call,/*out*/countryName,callWorkedBefore,countryWorkedBefore);
|
||||
int charsAvail = 48;
|
||||
|
||||
// the decoder (seems) to always generate 41 chars. For a normal CQ call, the last five are spaces
|
||||
// TODO this magic 37 characters is also referenced in MainWindow::doubleClickOnCall()
|
||||
int nmin=37;
|
||||
int i=t1.indexOf(" CQ ");
|
||||
int k=t1.string().mid(i+4,3).toInt();
|
||||
if(k>0 and k<999) nmin += 4;
|
||||
int s3 = t1.indexOf(" ",nmin);
|
||||
if (s3 < nmin) s3 = nmin; // always want at least the characters to position 35
|
||||
s3 += 1; // convert the index into a character count
|
||||
t1 = t1.left(s3); // reduce trailing white space
|
||||
charsAvail -= s3;
|
||||
if (charsAvail > 4)
|
||||
{
|
||||
if (!countryWorkedBefore) // therefore not worked call either
|
||||
{
|
||||
t1 += "!";
|
||||
bg=color_DXCC.name();
|
||||
}
|
||||
else
|
||||
if (!callWorkedBefore) // but have worked the country
|
||||
{
|
||||
t1 += "~";
|
||||
bg=color_NewCall.name();
|
||||
}
|
||||
else
|
||||
{
|
||||
t1 += " "; // have worked this call before
|
||||
bg=color_CQ.name();
|
||||
}
|
||||
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");
|
||||
t1 += countryName;
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayText::displayDecodedText(DecodedText decodedText, QString myCall,
|
||||
bool displayDXCCEntity, LogBook logBook,
|
||||
QColor color_CQ, QColor color_MyCall,
|
||||
QColor color_DXCC, QColor color_NewCall)
|
||||
{
|
||||
QString bg="white";
|
||||
bool CQcall = false;
|
||||
if (decodedText.string ().contains (" CQ ")
|
||||
|| decodedText.string ().contains (" CQDX ")
|
||||
|| decodedText.string ().contains (" QRZ "))
|
||||
{
|
||||
CQcall = true;
|
||||
bg=color_CQ.name();
|
||||
}
|
||||
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.name();
|
||||
}
|
||||
// if enabled add the DXCC entity and B4 status to the end of the preformated text line t1
|
||||
if (displayDXCCEntity && CQcall)
|
||||
_appendDXCCWorkedB4(/*mod*/decodedText,bg,logBook,color_CQ,
|
||||
color_DXCC,color_NewCall);
|
||||
appendText(decodedText.string(),bg);
|
||||
}
|
||||
|
||||
|
||||
void DisplayText::displayTransmittedText(QString text, QString modeTx, qint32 txFreq,
|
||||
QColor color_TxMsg, bool bFastMode)
|
||||
{
|
||||
QString bg=color_TxMsg.name();
|
||||
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,bg);
|
||||
}
|
||||
|
||||
void DisplayText::displayQSY(QString text)
|
||||
{
|
||||
QString t = QDateTime::currentDateTimeUtc().toString("hhmmss") + " " + text;
|
||||
QString bg="hot pink";
|
||||
appendText(t,bg);
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2005 Eric Niebler
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_CONS_07172005_0843)
|
||||
#define FUSION_CONS_07172005_0843
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/support/void.hpp>
|
||||
#include <boost/fusion/support/detail/enabler.hpp>
|
||||
#include <boost/fusion/container/list/cons_fwd.hpp>
|
||||
#include <boost/fusion/support/detail/access.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||
#include <boost/fusion/iterator/next.hpp>
|
||||
#include <boost/fusion/iterator/deref.hpp>
|
||||
#include <boost/fusion/container/list/nil.hpp>
|
||||
#include <boost/fusion/container/list/cons_iterator.hpp>
|
||||
#include <boost/fusion/container/list/detail/begin_impl.hpp>
|
||||
#include <boost/fusion/container/list/detail/end_impl.hpp>
|
||||
#include <boost/fusion/container/list/detail/at_impl.hpp>
|
||||
#include <boost/fusion/container/list/detail/value_at_impl.hpp>
|
||||
#include <boost/fusion/container/list/detail/empty_impl.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/type_traits/is_base_of.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/fusion/support/sequence_base.hpp>
|
||||
#include <boost/fusion/support/is_sequence.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct cons_tag;
|
||||
struct forward_traversal_tag;
|
||||
struct fusion_sequence_tag;
|
||||
|
||||
template <typename Car, typename Cdr /*= nil_*/>
|
||||
struct cons : sequence_base<cons<Car, Cdr> >
|
||||
{
|
||||
typedef mpl::int_<Cdr::size::value+1> size;
|
||||
typedef cons_tag fusion_tag;
|
||||
typedef fusion_sequence_tag tag; // this gets picked up by MPL
|
||||
typedef mpl::false_ is_view;
|
||||
typedef forward_traversal_tag category;
|
||||
typedef Car car_type;
|
||||
typedef Cdr cdr_type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
cons()
|
||||
: car(), cdr() {}
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
explicit cons(typename detail::call_param<Car>::type in_car)
|
||||
: car(in_car), cdr() {}
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
cons(
|
||||
typename detail::call_param<Car>::type in_car
|
||||
, typename detail::call_param<Cdr>::type in_cdr)
|
||||
: car(in_car), cdr(in_cdr) {}
|
||||
|
||||
template <typename Car2, typename Cdr2>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
cons(cons<Car2, Cdr2> const& rhs)
|
||||
: car(rhs.car), cdr(rhs.cdr) {}
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
cons(cons const& rhs)
|
||||
: car(rhs.car), cdr(rhs.cdr) {}
|
||||
|
||||
template <typename Sequence>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
cons(
|
||||
Sequence const& seq
|
||||
, typename boost::enable_if<
|
||||
mpl::and_<
|
||||
traits::is_sequence<Sequence>
|
||||
, mpl::not_<is_base_of<cons, Sequence> >
|
||||
, mpl::not_<is_convertible<Sequence, Car> > > // use copy to car instead
|
||||
, detail::enabler_
|
||||
>::type = detail::enabler
|
||||
)
|
||||
: car(*fusion::begin(seq))
|
||||
, cdr(fusion::next(fusion::begin(seq)), mpl::true_()) {}
|
||||
|
||||
template <typename Iterator>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
cons(Iterator const& iter, mpl::true_ /*this_is_an_iterator*/)
|
||||
: car(*iter)
|
||||
, cdr(fusion::next(iter), mpl::true_()) {}
|
||||
|
||||
template <typename Car2, typename Cdr2>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
cons& operator=(cons<Car2, Cdr2> const& rhs)
|
||||
{
|
||||
car = rhs.car;
|
||||
cdr = rhs.cdr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
cons& operator=(cons const& rhs)
|
||||
{
|
||||
car = rhs.car;
|
||||
cdr = rhs.cdr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename Sequence>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
typename boost::enable_if<
|
||||
mpl::and_<
|
||||
traits::is_sequence<Sequence>
|
||||
, mpl::not_<is_convertible<Sequence, Car> > >
|
||||
, cons&>::type
|
||||
operator=(Sequence const& seq)
|
||||
{
|
||||
typedef typename result_of::begin<Sequence const>::type Iterator;
|
||||
Iterator iter = fusion::begin(seq);
|
||||
this->assign_from_iter(iter);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
void assign_from_iter(Iterator const& iter)
|
||||
{
|
||||
car = *iter;
|
||||
cdr.assign_from_iter(fusion::next(iter));
|
||||
}
|
||||
|
||||
car_type car;
|
||||
cdr_type cdr;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
|
||||
|
||||
#include <boost/proto/detail/preprocessed/and_n.hpp>
|
||||
|
||||
#elif !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/and_n.hpp")
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file and_n.hpp
|
||||
/// Definitions of and_N, and_impl
|
||||
//
|
||||
// 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)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (2, BOOST_PP_MAX(BOOST_PROTO_MAX_ARITY, BOOST_PROTO_MAX_LOGICAL_ARITY), <boost/proto/detail/and_n.hpp>))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#else // BOOST_PP_IS_ITERATING
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
// Assymetry here between the handling of and_N and or_N because
|
||||
// and_N is used by lambda_matches up to BOOST_PROTO_MAX_ARITY,
|
||||
// regardless of how low BOOST_PROTO_MAX_LOGICAL_ARITY is.
|
||||
template<bool B, BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(N), typename P)>
|
||||
struct BOOST_PP_CAT(and_, N)
|
||||
#if 2 == N
|
||||
: mpl::bool_<P0::value>
|
||||
{};
|
||||
#else
|
||||
: BOOST_PP_CAT(and_, BOOST_PP_DEC(N))<
|
||||
P0::value BOOST_PP_COMMA_IF(BOOST_PP_SUB(N,2))
|
||||
BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_DEC(N), P)
|
||||
>
|
||||
{};
|
||||
#endif
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(N), typename P)>
|
||||
struct BOOST_PP_CAT(and_, N)<false, BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(N), P)>
|
||||
: mpl::false_
|
||||
{};
|
||||
|
||||
#if N <= BOOST_PROTO_MAX_LOGICAL_ARITY
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS(N, typename G), typename Expr, typename State, typename Data>
|
||||
struct _and_impl<proto::and_<BOOST_PP_ENUM_PARAMS(N, G)>, Expr, State, Data>
|
||||
: proto::transform_impl<Expr, State, Data>
|
||||
{
|
||||
#define M0(Z, N, DATA) \
|
||||
typedef \
|
||||
typename proto::when<proto::_, BOOST_PP_CAT(G, N)> \
|
||||
::template impl<Expr, State, Data> \
|
||||
BOOST_PP_CAT(Gimpl, N); \
|
||||
/**/
|
||||
BOOST_PP_REPEAT(N, M0, ~)
|
||||
#undef M0
|
||||
|
||||
typedef typename BOOST_PP_CAT(Gimpl, BOOST_PP_DEC(N))::result_type result_type;
|
||||
|
||||
result_type operator()(
|
||||
typename _and_impl::expr_param e
|
||||
, typename _and_impl::state_param s
|
||||
, typename _and_impl::data_param d
|
||||
) const
|
||||
{
|
||||
// Fix: jfalcou - 12/29/2010
|
||||
// Avoid the use of comma operator here so as not to find Proto's
|
||||
// by accident.
|
||||
// expands to G0()(e,s,d); G1()(e,s,d); ... G{N-1}()(e,s,d);
|
||||
#define M0(Z,N,DATA) BOOST_PP_CAT(Gimpl,N)()(e,s,d);
|
||||
BOOST_PP_REPEAT(BOOST_PP_DEC(N),M0,~)
|
||||
return BOOST_PP_CAT(Gimpl,BOOST_PP_DEC(N))()(e,s,d);
|
||||
#undef M0
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#undef N
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,146 @@
|
||||
// (C) Copyright John Maddock 2007.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// This file is machine generated, do not edit by hand
|
||||
|
||||
// Polynomial evaluation using second order Horners rule
|
||||
#ifndef BOOST_MATH_TOOLS_POLY_EVAL_18_HPP
|
||||
#define BOOST_MATH_TOOLS_POLY_EVAL_18_HPP
|
||||
|
||||
namespace boost{ namespace math{ namespace tools{ namespace detail{
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T*, const V&, const mpl::int_<0>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(0);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(a[1] * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
return static_cast<V>((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
return static_cast<V>(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
return static_cast<V>(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
return static_cast<V>((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
return static_cast<V>((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
return static_cast<V>(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
return static_cast<V>(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
return static_cast<V>((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
return static_cast<V>((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
return static_cast<V>(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
return static_cast<V>(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
return static_cast<V>((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
return static_cast<V>((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
V x2 = x * x;
|
||||
return static_cast<V>(((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]);
|
||||
}
|
||||
|
||||
|
||||
}}}} // namespaces
|
||||
|
||||
#endif // include guard
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_TYPE_WRAPPER_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_TYPE_WRAPPER_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
// Copyright Peter Dimov 2000-2003
|
||||
//
|
||||
// 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/aux_/config/ctps.hpp>
|
||||
|
||||
namespace boost { namespace mpl { namespace aux {
|
||||
|
||||
template< typename T > struct type_wrapper
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
// agurt 08/may/03: a complicated way to extract the wrapped type; need it
|
||||
// mostly for the sake of GCC (3.2.x), which ICEs if you try to extract the
|
||||
// nested 'type' from 'type_wrapper<T>' when the latter was the result of a
|
||||
// 'typeof' expression
|
||||
template< typename T > struct wrapped_type;
|
||||
|
||||
template< typename T > struct wrapped_type< type_wrapper<T> >
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
#else
|
||||
template< typename W > struct wrapped_type
|
||||
{
|
||||
typedef typename W::type type;
|
||||
};
|
||||
#endif
|
||||
|
||||
}}}
|
||||
|
||||
#endif // BOOST_MPL_AUX_TYPE_WRAPPER_HPP_INCLUDED
|
||||
@@ -0,0 +1,102 @@
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
// Preprocessed version of "boost/mpl/less.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<
|
||||
typename Tag1
|
||||
, typename Tag2
|
||||
|
||||
, BOOST_MPL_AUX_NTTP_DECL(int, tag1_) = BOOST_MPL_AUX_MSVC_VALUE_WKND(Tag1)::value
|
||||
, BOOST_MPL_AUX_NTTP_DECL(int, tag2_) = BOOST_MPL_AUX_MSVC_VALUE_WKND(Tag2)::value
|
||||
>
|
||||
struct less_impl
|
||||
: if_c<
|
||||
( tag1_ > tag2_ )
|
||||
, aux::cast2nd_impl< less_impl< Tag1,Tag1 >,Tag1, Tag2 >
|
||||
, aux::cast1st_impl< less_impl< Tag2,Tag2 >,Tag1, Tag2 >
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
/// for Digital Mars C++/compilers with no CTPS/TTP support
|
||||
template<> struct less_impl< na,na >
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template<> struct less_impl< na,integral_c_tag >
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template<> struct less_impl< integral_c_tag,na >
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template< typename T > struct less_tag
|
||||
{
|
||||
typedef typename T::tag type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename BOOST_MPL_AUX_NA_PARAM(N1)
|
||||
, typename BOOST_MPL_AUX_NA_PARAM(N2)
|
||||
>
|
||||
struct less
|
||||
: aux::msvc_eti_base< typename apply_wrap2<
|
||||
less_impl<
|
||||
typename less_tag<N1>::type
|
||||
, typename less_tag<N2>::type
|
||||
>
|
||||
, N1
|
||||
, N2
|
||||
>::type >::type
|
||||
|
||||
{
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(2, less, (N1, N2))
|
||||
|
||||
};
|
||||
|
||||
BOOST_MPL_AUX_NA_SPEC2(2, 2, less)
|
||||
|
||||
}}
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<>
|
||||
struct less_impl< integral_c_tag,integral_c_tag >
|
||||
{
|
||||
template< typename N1, typename N2 > struct apply
|
||||
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
( BOOST_MPL_AUX_VALUE_WKND(N2)::value >
|
||||
BOOST_MPL_AUX_VALUE_WKND(N1)::value )
|
||||
);
|
||||
typedef bool_<value> type;
|
||||
};
|
||||
};
|
||||
|
||||
}}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 162 KiB |
@@ -0,0 +1,87 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_PRIOR_IMPL_20060124_2006)
|
||||
#define FUSION_PRIOR_IMPL_20060124_2006
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/view/zip_view/zip_view_iterator_fwd.hpp>
|
||||
#include <boost/fusion/iterator/prior.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/transform.hpp>
|
||||
#include <boost/fusion/support/unused.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct zip_view_iterator_tag;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
struct poly_prior
|
||||
{
|
||||
template<typename Sig>
|
||||
struct result;
|
||||
|
||||
template<typename It>
|
||||
struct result<poly_prior(It)>
|
||||
{
|
||||
typedef typename remove_const<
|
||||
typename remove_reference<It>::type>::type it;
|
||||
typedef typename mpl::eval_if<is_same<it, unused_type>,
|
||||
mpl::identity<unused_type>,
|
||||
result_of::prior<it> >::type type;
|
||||
};
|
||||
|
||||
template<typename It>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
typename result<poly_prior(It)>::type
|
||||
operator()(const It& it) const
|
||||
{
|
||||
return fusion::prior(it);
|
||||
}
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
unused_type operator()(unused_type const&) const
|
||||
{
|
||||
return unused_type();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct prior_impl;
|
||||
|
||||
template<>
|
||||
struct prior_impl<zip_view_iterator_tag>
|
||||
{
|
||||
template<typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef zip_view_iterator<
|
||||
typename result_of::transform<typename Iterator::iterators, detail::poly_prior>::type,
|
||||
typename Iterator::category> type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
call(Iterator const& it)
|
||||
|
||||
{
|
||||
return type(
|
||||
fusion::transform(it.iterators_, detail::poly_prior()));
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,33 @@
|
||||
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
|
||||
// unit/quantity manipulation and conversion
|
||||
//
|
||||
// Copyright (C) 2003-2008 Matthias Christian Schabel
|
||||
// Copyright (C) 2008 Steven Watanabe
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_UNITS_SI_AMOUNT_HPP
|
||||
#define BOOST_UNITS_SI_AMOUNT_HPP
|
||||
|
||||
#include <boost/units/systems/si/base.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace units {
|
||||
|
||||
namespace si {
|
||||
|
||||
typedef unit<amount_dimension,si::system> amount;
|
||||
|
||||
BOOST_UNITS_STATIC_CONSTANT(mole,amount);
|
||||
BOOST_UNITS_STATIC_CONSTANT(moles,amount);
|
||||
|
||||
} // namespace si
|
||||
|
||||
} // namespace units
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_UNITS_SI_AMOUNT_HPP
|
||||
@@ -0,0 +1,221 @@
|
||||
#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
|
||||
|
||||
#include <boost/proto/detail/preprocessed/traits.hpp>
|
||||
|
||||
#elif !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define BOOST_PROTO_CHILD(Z, N, DATA) \
|
||||
/** INTERNAL ONLY */ \
|
||||
typedef BOOST_PP_CAT(DATA, N) BOOST_PP_CAT(proto_child, N); \
|
||||
/**/
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/traits.hpp")
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file traits.hpp
|
||||
/// Definitions of proto::function, proto::nary_expr and proto::result_of::child_c
|
||||
//
|
||||
// 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)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (0, BOOST_PROTO_MAX_ARITY, <boost/proto/detail/traits.hpp>))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#undef BOOST_PROTO_CHILD
|
||||
|
||||
#else // BOOST_PP_IS_ITERATING
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
#if N > 0
|
||||
/// \brief A metafunction for generating function-call expression types,
|
||||
/// a grammar element for matching function-call expressions, and a
|
||||
/// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
|
||||
/// transform.
|
||||
template<BOOST_PP_ENUM_PARAMS(N, typename A)>
|
||||
struct function
|
||||
#if N != BOOST_PROTO_MAX_ARITY
|
||||
<
|
||||
BOOST_PP_ENUM_PARAMS(N, A)
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N), void BOOST_PP_INTERCEPT)
|
||||
>
|
||||
#endif
|
||||
: proto::transform<
|
||||
function<
|
||||
BOOST_PP_ENUM_PARAMS(N, A)
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N), void BOOST_PP_INTERCEPT)
|
||||
>
|
||||
, int
|
||||
>
|
||||
{
|
||||
typedef proto::expr<proto::tag::function, BOOST_PP_CAT(list, N)<BOOST_PP_ENUM_PARAMS(N, A)>, N> type;
|
||||
typedef proto::basic_expr<proto::tag::function, BOOST_PP_CAT(list, N)<BOOST_PP_ENUM_PARAMS(N, A)>, N> proto_grammar;
|
||||
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: detail::pass_through_impl<function, deduce_domain, Expr, State, Data>
|
||||
{};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
typedef proto::tag::function proto_tag;
|
||||
BOOST_PP_REPEAT(N, BOOST_PROTO_CHILD, A)
|
||||
BOOST_PP_REPEAT_FROM_TO(
|
||||
N
|
||||
, BOOST_PROTO_MAX_ARITY
|
||||
, BOOST_PROTO_CHILD
|
||||
, detail::if_vararg<BOOST_PP_CAT(A, BOOST_PP_DEC(N))> BOOST_PP_INTERCEPT
|
||||
)
|
||||
};
|
||||
|
||||
/// \brief A metafunction for generating n-ary expression types with a
|
||||
/// specified tag type,
|
||||
/// a grammar element for matching n-ary expressions, and a
|
||||
/// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
|
||||
/// transform.
|
||||
///
|
||||
/// Use <tt>nary_expr\<_, vararg\<_\> \></tt> as a grammar element to match any
|
||||
/// n-ary expression; that is, any non-terminal.
|
||||
template<typename Tag BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
|
||||
struct nary_expr
|
||||
#if N != BOOST_PROTO_MAX_ARITY
|
||||
<
|
||||
Tag
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N), void BOOST_PP_INTERCEPT)
|
||||
>
|
||||
#endif
|
||||
: proto::transform<
|
||||
nary_expr<
|
||||
Tag
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N), void BOOST_PP_INTERCEPT)
|
||||
>
|
||||
, int
|
||||
>
|
||||
{
|
||||
typedef proto::expr<Tag, BOOST_PP_CAT(list, N)<BOOST_PP_ENUM_PARAMS(N, A)>, N> type;
|
||||
typedef proto::basic_expr<Tag, BOOST_PP_CAT(list, N)<BOOST_PP_ENUM_PARAMS(N, A)>, N> proto_grammar;
|
||||
|
||||
template<typename Expr, typename State, typename Data>
|
||||
struct impl
|
||||
: detail::pass_through_impl<nary_expr, deduce_domain, Expr, State, Data>
|
||||
{};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
typedef Tag proto_tag;
|
||||
BOOST_PP_REPEAT(N, BOOST_PROTO_CHILD, A)
|
||||
BOOST_PP_REPEAT_FROM_TO(
|
||||
N
|
||||
, BOOST_PROTO_MAX_ARITY
|
||||
, BOOST_PROTO_CHILD
|
||||
, detail::if_vararg<BOOST_PP_CAT(A, BOOST_PP_DEC(N))> BOOST_PP_INTERCEPT
|
||||
)
|
||||
};
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template<
|
||||
template<BOOST_PP_ENUM_PARAMS(N, typename BOOST_PP_INTERCEPT)> class T
|
||||
, BOOST_PP_ENUM_PARAMS(N, typename A)
|
||||
>
|
||||
struct is_callable_<T<BOOST_PP_ENUM_PARAMS(N, A)> BOOST_PROTO_TEMPLATE_ARITY_PARAM(N)>
|
||||
: is_same<BOOST_PP_CAT(A, BOOST_PP_DEC(N)), callable>
|
||||
{};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
/// \brief A metafunction that returns the type of the Nth child
|
||||
/// of a Proto expression.
|
||||
///
|
||||
/// A metafunction that returns the type of the Nth child
|
||||
/// of a Proto expression. \c N must be less than
|
||||
/// \c Expr::proto_arity::value.
|
||||
template<typename Expr>
|
||||
struct child_c<Expr, N>
|
||||
{
|
||||
/// Verify that we are not operating on a terminal
|
||||
BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
|
||||
|
||||
/// The raw type of the Nth child as it is stored within
|
||||
/// \c Expr. This may be a value or a reference
|
||||
typedef typename Expr::BOOST_PP_CAT(proto_child, N) value_type;
|
||||
|
||||
/// The "value" type of the child, suitable for return by value,
|
||||
/// computed as follows:
|
||||
/// \li <tt>T const &</tt> becomes <tt>T</tt>
|
||||
/// \li <tt>T &</tt> becomes <tt>T</tt>
|
||||
/// \li <tt>T</tt> becomes <tt>T</tt>
|
||||
typedef typename detail::expr_traits<typename Expr::BOOST_PP_CAT(proto_child, N)>::value_type type;
|
||||
};
|
||||
|
||||
template<typename Expr>
|
||||
struct child_c<Expr &, N>
|
||||
{
|
||||
/// Verify that we are not operating on a terminal
|
||||
BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
|
||||
|
||||
/// The raw type of the Nth child as it is stored within
|
||||
/// \c Expr. This may be a value or a reference
|
||||
typedef typename Expr::BOOST_PP_CAT(proto_child, N) value_type;
|
||||
|
||||
/// The "reference" type of the child, suitable for return by
|
||||
/// reference, computed as follows:
|
||||
/// \li <tt>T const &</tt> becomes <tt>T const &</tt>
|
||||
/// \li <tt>T &</tt> becomes <tt>T &</tt>
|
||||
/// \li <tt>T</tt> becomes <tt>T &</tt>
|
||||
typedef typename detail::expr_traits<typename Expr::BOOST_PP_CAT(proto_child, N)>::reference type;
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
BOOST_FORCEINLINE
|
||||
static type call(Expr &e)
|
||||
{
|
||||
return e.proto_base().BOOST_PP_CAT(child, N);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Expr>
|
||||
struct child_c<Expr const &, N>
|
||||
{
|
||||
/// Verify that we are not operating on a terminal
|
||||
BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
|
||||
|
||||
/// The raw type of the Nth child as it is stored within
|
||||
/// \c Expr. This may be a value or a reference
|
||||
typedef typename Expr::BOOST_PP_CAT(proto_child, N) value_type;
|
||||
|
||||
/// The "const reference" type of the child, suitable for return by
|
||||
/// const reference, computed as follows:
|
||||
/// \li <tt>T const &</tt> becomes <tt>T const &</tt>
|
||||
/// \li <tt>T &</tt> becomes <tt>T &</tt>
|
||||
/// \li <tt>T</tt> becomes <tt>T const &</tt>
|
||||
typedef typename detail::expr_traits<typename Expr::BOOST_PP_CAT(proto_child, N)>::const_reference type;
|
||||
|
||||
/// INTERNAL ONLY
|
||||
///
|
||||
BOOST_FORCEINLINE
|
||||
static type call(Expr const &e)
|
||||
{
|
||||
return e.proto_base().BOOST_PP_CAT(child, N);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#undef N
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,77 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Thorsten Ottosen 2003-2004. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
|
||||
#ifndef BOOST_RANGE_DETAIL_SFINAE_HPP
|
||||
#define BOOST_RANGE_DETAIL_SFINAE_HPP
|
||||
|
||||
#include <boost/range/config.hpp>
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
#include <boost/type_traits/detail/yes_no_type.hpp>
|
||||
#include <utility>
|
||||
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range_detail
|
||||
{
|
||||
using type_traits::yes_type;
|
||||
using type_traits::no_type;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// string
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
yes_type is_string_impl( const char* const );
|
||||
yes_type is_string_impl( const wchar_t* const );
|
||||
no_type is_string_impl( ... );
|
||||
|
||||
template< std::size_t sz >
|
||||
yes_type is_char_array_impl( char BOOST_RANGE_ARRAY_REF()[sz] );
|
||||
template< std::size_t sz >
|
||||
yes_type is_char_array_impl( const char BOOST_RANGE_ARRAY_REF()[sz] );
|
||||
no_type is_char_array_impl( ... );
|
||||
|
||||
template< std::size_t sz >
|
||||
yes_type is_wchar_t_array_impl( wchar_t BOOST_RANGE_ARRAY_REF()[sz] );
|
||||
template< std::size_t sz >
|
||||
yes_type is_wchar_t_array_impl( const wchar_t BOOST_RANGE_ARRAY_REF()[sz] );
|
||||
no_type is_wchar_t_array_impl( ... );
|
||||
|
||||
yes_type is_char_ptr_impl( char* const );
|
||||
no_type is_char_ptr_impl( ... );
|
||||
|
||||
yes_type is_const_char_ptr_impl( const char* const );
|
||||
no_type is_const_char_ptr_impl( ... );
|
||||
|
||||
yes_type is_wchar_t_ptr_impl( wchar_t* const );
|
||||
no_type is_wchar_t_ptr_impl( ... );
|
||||
|
||||
yes_type is_const_wchar_t_ptr_impl( const wchar_t* const );
|
||||
no_type is_const_wchar_t_ptr_impl( ... );
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// pair
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
template< typename Iterator >
|
||||
yes_type is_pair_impl( const std::pair<Iterator,Iterator>* );
|
||||
no_type is_pair_impl( ... );
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// tags
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct char_or_wchar_t_array_tag {};
|
||||
|
||||
} // namespace 'range_detail'
|
||||
|
||||
} // namespace 'boost'
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user