Initial Commit
This commit is contained in:
@@ -0,0 +1,124 @@
|
||||
////
|
||||
Link file to hold all links
|
||||
File Location: ./doc/common/links.adoc
|
||||
Usage example: include::../common/links.adoc[]
|
||||
Syntax: [link-id] [link] [displayed text]
|
||||
|
||||
Example:
|
||||
:pskreporter: http://pskreporter.info/pskmap.html[PSK Reporter]
|
||||
|
||||
[link-id] = :pskreporter:
|
||||
[link] http://pskreporter.info/pskmap.html
|
||||
[displayed text] PSK Reporter
|
||||
|
||||
Perform searches from the doc root directory: doc
|
||||
Search: grep -rl --exclude-dir="*\.svn" {pskreporter} .
|
||||
grep -rl --exclude-dir="*\.svn" PSK Reporter .
|
||||
grep -rl --exclude-dir="*\.svn" {devsvn} .
|
||||
grep -rl --exclude-dir="*\.svn" {kvasd} .
|
||||
grep -rl --exclude-dir="*\.svn" {ntpsetup} .
|
||||
|
||||
Include links.adoc: grep -rl --exclude-dir="*\.svn" pskreporter .
|
||||
Exclude links.adoc: grep -rl --exclude-dir="*\.svn" {pskreporter} .
|
||||
|
||||
Note(s):
|
||||
a). Don't forget a space then "." at the end.
|
||||
|
||||
b). To include links.adoc file itself, remove the brackets {} from
|
||||
the pattern search:
|
||||
|
||||
c). Look at each of the files listed to ensure the [displayed text]
|
||||
still makes sense in the caption. If not, just add another link. Be
|
||||
aware of the translators requirements by trying to keep the displayed
|
||||
text language agnostic or neutral e.g. use a proper noun like a
|
||||
persons name or a document title in the language of the linked
|
||||
document. Do not use plain English generic words for link text link
|
||||
"here".
|
||||
|
||||
d). Edit lines as needed. Keeping them in alphabetic order help see dupes.
|
||||
|
||||
////
|
||||
|
||||
// General URL's
|
||||
//:launchpadac6sl: https://launchpad.net/~jnogatch/+archive/wsjtx[WSJT-X Linux Packages]
|
||||
:alarmejt: http://f5jmh.free.fr/index.php?page=english[AlarmeJT]
|
||||
:asciidoc_cheatsheet: http://powerman.name/doc/asciidoc[AsciiDoc Cheatsheet]
|
||||
:asciidoc_help: http://www.methods.co.nz/asciidoc/userguide.html[AsciiDoc User Guide]
|
||||
:asciidoc_questions: http://www.methods.co.nz/asciidoc/faq.html[AsciiDoc FAQ]
|
||||
:asciidoc_syntax: http://xpt.sourceforge.net/techdocs/nix/tool/asciidoc-syn/ascs01-AsciiDocMarkupSyntaxQuickSummary/single/[AsciiDoc Syntax]
|
||||
:asciidoctor_style: http://asciidoctor.org/docs/asciidoc-writers-guide/#delimited-blocks[AsciiDoctor Styles Guide]
|
||||
:asciidoctor_syntax: http://asciidoctor.org/docs/asciidoc-writers-guide/#delimited-blocks[AsciiDoctor Syntax Guide]
|
||||
:cc_by_sa: http://creativecommons.org/licenses/by-sa/3.0/[Commons Attribution-ShareAlike 3.0 Unported License]
|
||||
:debian32: http://physics.princeton.edu/pulsar/K1JT/wsjtx_{VERSION}_i386.deb[wsjtx_{VERSION}_i386.deb]
|
||||
:debian64: http://physics.princeton.edu/pulsar/K1JT/wsjtx_{VERSION}_amd64.deb[wsjtx_{VERSION}_amd64.deb]
|
||||
:raspbian: http://physics.princeton.edu/pulsar/K1JT/wsjtx_{VERSION}_armhf.deb[wsjtx_{VERSION}_armhf.deb]
|
||||
:debian: http://www.debian.org/[Debian]
|
||||
:dev_guide: http://www.physics.princeton.edu/pulsar/K1JT/wsjtx-doc/wsjt-dev-guide.html[Dev-Guide]
|
||||
:devsvn1: http://sourceforge.net/p/wsjt/wsjt/HEAD/tree/[Devel-SVN]
|
||||
:devsvn: http://sourceforge.net/p/wsjt/wsjt/HEAD/tree/[SourceForge]
|
||||
:dimension4: http://www.thinkman.com/dimension4/[Thinking Man Software]
|
||||
:download: http://physics.princeton.edu/pulsar/K1JT/wsjtx.html[Download Page]
|
||||
:dxatlas: http://www.dxatlas.com/[Afreet Software, Inc.]
|
||||
:dxlcommander: http://www.dxlabsuite.com/commander/[Commander]
|
||||
:dxlsuite: http://www.dxlabsuite.com/[DX Lab Suite]
|
||||
:fedora32: http://physics.princeton.edu/pulsar/K1JT/wsjtx-{VERSION}-i686.rpm[wsjtx-{VERSION}-i686.rpm]
|
||||
:fedora64: http://physics.princeton.edu/pulsar/K1JT/wsjtx-{VERSION}-x86_64.rpm[wsjtx-{VERSION}-x86_64.rpm]
|
||||
:fmt_arrl: http://www.arrl.org/frequency-measuring-test[ARRL FMT Info]
|
||||
:fmt_group: https://groups.yahoo.com/neo/groups/FMT-nuts/info[FMT Group]
|
||||
:fmt_k5cm: http://www.k5cm.com/[FMT Event Info]
|
||||
:fmt_wspr: http://www.physics.princeton.edu/pulsar/K1JT/FMT_User.pdf[Accurate Frequency Measurements with your WSPR Setup]
|
||||
:gnu_gpl: http://www.gnu.org/licenses/gpl-3.0.txt[GNU General Public License]
|
||||
:homepage: http://physics.princeton.edu/pulsar/K1JT/[WSJT Home Page]
|
||||
:hrd: http://www.hrdsoftwarellc.com/[Ham Radio Deluxe]
|
||||
:jt4eme: http://physics.princeton.edu/pulsar/K1JT/WSJT-X_1.6.0_for_JT4_v7.pdf[Using WSJT-X for JT4 EME Operation]
|
||||
:jt65protocol: http://physics.princeton.edu/pulsar/K1JT/JT65.pdf[QEX]
|
||||
:jtalert: http://hamapps.com/[JT-Alert]
|
||||
:launchpadki7mt: https://launchpad.net/~ki7mt[KI7MT PPA's]
|
||||
:log4om: http://www.log4om.com[Log4OM]
|
||||
:lunarEchoes: http://physics.princeton.edu/pulsar/K1JT/LunarEchoes_QEX.pdf[QEX]
|
||||
:msys_url: http://sourceforge.net/projects/mingwbuilds/files/external-binary-packages/[MSYS Download]
|
||||
:ntpsetup: http://www.satsignal.eu/ntp/setup.html[Network Time Protocol Setup]
|
||||
:osx_instructions: http://physics.princeton.edu/pulsar/K1JT/OSX_Readme[Mac OS X Install Instructions]
|
||||
:ppa: http://en.wikipedia.org/wiki/Personal_Package_Archive[PPA]
|
||||
:projsummary: http://sourceforge.net/projects/wsjt/[Project Summary]
|
||||
:pskreporter: http://pskreporter.info/pskmap.html[PSK Reporter]
|
||||
:sourceforge: https://sourceforge.net/user/registration[SourceForge]
|
||||
:sourceforge-jtsdk: https://sourceforge.net/projects/jtsdk[SourceForge JTSDK]
|
||||
:ubuntu_sdk: https://launchpad.net/~ubuntu-sdk-team/+archive/ppa[Ubuntu SDK Notice]
|
||||
:wsjt_yahoo_group: https://groups.yahoo.com/neo/groups/wsjtgroup/info[WSJT Group]
|
||||
:wsjtx: http://physics.princeton.edu/pulsar/K1JT/wsjtx.html[WSJT-X]
|
||||
:wspr0_guide: http://www.physics.princeton.edu/pulsar/K1JT/WSPR0_Instructions.TXT[WSPR0 Guide]
|
||||
:wspr: http://physics.princeton.edu/pulsar/K1JT/wspr.html[WSPR Home Page]
|
||||
:wsprnet: http://wsprnet.org/drupal/[WSPRnet]
|
||||
:wsprnet_activity: http://wsprnet.org/drupal/wsprnet/activity[WSPRnet Activity page]
|
||||
|
||||
// Download Links
|
||||
:cty_dat: http://www.country-files.com/cty/[Amateur Radio Country Files]
|
||||
:jtbridge: http://jt-bridge.eller.nu/[JT-Bridge]
|
||||
:jtsdk_doc: http://physics.princeton.edu/pulsar/K1JT/JTSDK-DOC.exe[Download]
|
||||
:jtsdk_installer: http://sourceforge.net/projects/jtsdk/files/win32/2.0.0/JTSDK-2.0.0-B2-Win32.exe/download[Download]
|
||||
:jtsdk_omnirig: http://sourceforge.net/projects/jtsdk/files/win32/2.0.0/base/contrib/OmniRig.zip/download[Download]
|
||||
:jtsdk_py: http://physics.princeton.edu/pulsar/K1JT/JTSDK-PY.exe[Download]
|
||||
:jtsdk_qt: http://physics.princeton.edu/pulsar/K1JT/JTSDK-QT.exe[Download]
|
||||
:jtsdk_vcredist: http://sourceforge.net/projects/jtsdk/files/win32/2.0.0/base/contrib/vcredist_x86.exe/download[Download]
|
||||
:nh6z: http://www.nh6z.net/Amatuer_Radio_Station_NH6Z/Other_Peoples_Software.html[here]
|
||||
:omnirig: http://www.dxatlas.com/OmniRig/Files/OmniRig.zip[Download]
|
||||
:osx: http://physics.princeton.edu/pulsar/K1JT/wsjtx-{VERSION}-Darwin.dmg[wsjtx-{VERSION}-Darwin.dmg]
|
||||
:QRA64_EME: http://physics.princeton.edu/pulsar/K1JT/QRA64_EME.pdf[QRA64 for microwave EME]
|
||||
:svn: http://subversion.apache.org/packages.html#windows[Subversion]
|
||||
:win32: http://physics.princeton.edu/pulsar/K1JT/wsjtx-{VERSION}-win32.exe[wsjtx-{VERSION}-win32.exe]
|
||||
:wsjt_svn: http://sourceforge.net/p/wsjt/wsjt/HEAD/tree/[WSJT Source Repository]
|
||||
:wspr_code: http://physics.princeton.edu/pulsar/K1JT/WSPRcode.exe[WSPRcode.exe]
|
||||
:wspr_svn: http://sourceforge.net/p/wsjt/wsjt/HEAD/tree/branches/wspr/[WSPR Source Repository]
|
||||
|
||||
// MAIL-TO links
|
||||
:alex_efros: mailto:powerman@powerman.name[Alex Efros]
|
||||
:bill_somerville: mailto:g4wjs -at- c l a s s d e s i g n -dot- com [G4WJS]
|
||||
:dev_mail_list: http://sourceforge.net/mailarchive/forum.php?forum_name=wsjt-devel[WSJT Developers Email List]
|
||||
:dev_mail_svn: https://sourceforge.net/auth/subscriptions/[WSJT SVN Archives]
|
||||
:devmail: mailto:wsjt-devel@lists.sourceforge.net[wsjt-devel@lists.sourceforge.net]
|
||||
:devmail1: mailto:wsjt-devel@lists.sourceforge.net[Post Message]
|
||||
:wsjtgroup_mail: mailto:wsjtgroup@yahoogroups.com[Post Message]
|
||||
:greg_beam: mailto:ki7mt@yahoo.com[KI7MT]
|
||||
:joe_taylor: mailto:joe@princeton.edu[K1JT]
|
||||
:stuart_rackman: mailto:srackham@gmail.com[Stuart Rackham]
|
||||
@@ -0,0 +1,315 @@
|
||||
|
||||
#if !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
///// header body
|
||||
|
||||
// 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_MPL_PREPROCESSING_MODE)
|
||||
# include <boost/mpl/numeric_cast.hpp>
|
||||
# include <boost/mpl/apply_wrap.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/mpl/tag.hpp>
|
||||
# include <boost/mpl/aux_/numeric_cast_utils.hpp>
|
||||
# include <boost/mpl/aux_/na.hpp>
|
||||
# include <boost/mpl/aux_/na_spec.hpp>
|
||||
# include <boost/mpl/aux_/lambda_support.hpp>
|
||||
# include <boost/mpl/aux_/msvc_eti_base.hpp>
|
||||
# include <boost/mpl/aux_/value_wknd.hpp>
|
||||
# include <boost/mpl/aux_/config/eti.hpp>
|
||||
# include <boost/mpl/aux_/nttp_decl.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/mpl/aux_/config/static_constant.hpp>
|
||||
|
||||
#if defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
|
||||
|| defined(BOOST_MPL_PREPROCESSING_MODE)
|
||||
|
||||
# include <boost/mpl/limits/arity.hpp>
|
||||
# include <boost/mpl/aux_/preprocessor/partial_spec_params.hpp>
|
||||
# include <boost/mpl/aux_/preprocessor/def_params_tail.hpp>
|
||||
# include <boost/mpl/aux_/preprocessor/repeat.hpp>
|
||||
# include <boost/mpl/aux_/preprocessor/ext_params.hpp>
|
||||
# include <boost/mpl/aux_/preprocessor/params.hpp>
|
||||
# include <boost/mpl/aux_/preprocessor/enum.hpp>
|
||||
# include <boost/mpl/aux_/preprocessor/add.hpp>
|
||||
# include <boost/mpl/aux_/preprocessor/sub.hpp>
|
||||
# include <boost/mpl/aux_/config/ctps.hpp>
|
||||
# include <boost/mpl/aux_/config/eti.hpp>
|
||||
# include <boost/mpl/aux_/config/msvc.hpp>
|
||||
# include <boost/mpl/aux_/config/workaround.hpp>
|
||||
|
||||
# include <boost/preprocessor/dec.hpp>
|
||||
# include <boost/preprocessor/inc.hpp>
|
||||
# include <boost/preprocessor/iterate.hpp>
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
|
||||
|
||||
#if !defined(AUX778076_OP_ARITY)
|
||||
# define AUX778076_OP_ARITY BOOST_MPL_LIMIT_METAFUNCTION_ARITY
|
||||
#endif
|
||||
|
||||
#if !defined(AUX778076_OP_IMPL_NAME)
|
||||
# define AUX778076_OP_IMPL_NAME BOOST_PP_CAT(AUX778076_OP_PREFIX,_impl)
|
||||
#endif
|
||||
|
||||
#if !defined(AUX778076_OP_TAG_NAME)
|
||||
# define AUX778076_OP_TAG_NAME BOOST_PP_CAT(AUX778076_OP_PREFIX,_tag)
|
||||
#endif
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<
|
||||
typename Tag1
|
||||
, typename Tag2
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
, 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 AUX778076_OP_IMPL_NAME
|
||||
: if_c<
|
||||
( tag1_ > tag2_ )
|
||||
#else
|
||||
>
|
||||
struct AUX778076_OP_IMPL_NAME
|
||||
: if_c<
|
||||
( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1)
|
||||
> BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2)
|
||||
)
|
||||
#endif
|
||||
, aux::cast2nd_impl< AUX778076_OP_IMPL_NAME<Tag1,Tag1>,Tag1,Tag2 >
|
||||
, aux::cast1st_impl< AUX778076_OP_IMPL_NAME<Tag2,Tag2>,Tag1,Tag2 >
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
/// for Digital Mars C++/compilers with no CTPS/TTP support
|
||||
template<> struct AUX778076_OP_IMPL_NAME<na,na>
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
template< typename Tag > struct AUX778076_OP_IMPL_NAME<na,Tag>
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template< typename Tag > struct AUX778076_OP_IMPL_NAME<Tag,na>
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
#else
|
||||
template<> struct AUX778076_OP_IMPL_NAME<na,integral_c_tag>
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template<> struct AUX778076_OP_IMPL_NAME<integral_c_tag,na>
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
|
||||
&& BOOST_WORKAROUND(BOOST_MSVC, >= 1300)
|
||||
template< typename T > struct AUX778076_OP_TAG_NAME
|
||||
: tag<T,na>
|
||||
{
|
||||
};
|
||||
#else
|
||||
template< typename T > struct AUX778076_OP_TAG_NAME
|
||||
{
|
||||
typedef typename T::tag type;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#if AUX778076_OP_ARITY != 2
|
||||
|
||||
# if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
|
||||
# define AUX778076_OP_RIGHT_OPERAND(unused, i, N) , BOOST_PP_CAT(N, BOOST_MPL_PP_ADD(i, 2))>
|
||||
# define AUX778076_OP_N_CALLS(i, N) \
|
||||
BOOST_MPL_PP_REPEAT( BOOST_PP_DEC(i), BOOST_MPL_PP_REPEAT_IDENTITY_FUNC, AUX778076_OP_NAME< ) \
|
||||
N1 BOOST_MPL_PP_REPEAT( BOOST_MPL_PP_SUB(i, 1), AUX778076_OP_RIGHT_OPERAND, N ) \
|
||||
/**/
|
||||
|
||||
template<
|
||||
typename BOOST_MPL_AUX_NA_PARAM(N1)
|
||||
, typename BOOST_MPL_AUX_NA_PARAM(N2)
|
||||
BOOST_MPL_PP_DEF_PARAMS_TAIL(2, typename N, na)
|
||||
>
|
||||
struct AUX778076_OP_NAME
|
||||
: AUX778076_OP_N_CALLS(AUX778076_OP_ARITY, N)
|
||||
{
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(
|
||||
AUX778076_OP_ARITY
|
||||
, AUX778076_OP_NAME
|
||||
, ( BOOST_MPL_PP_PARAMS(AUX778076_OP_ARITY, N) )
|
||||
)
|
||||
};
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3,( BOOST_PP_DEC(AUX778076_OP_ARITY), 2, <boost/mpl/aux_/numeric_op.hpp> ))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
# undef AUX778076_OP_N_CALLS
|
||||
# undef AUX778076_OP_RIGHT_OPERAND
|
||||
|
||||
# else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
/// forward declaration
|
||||
template<
|
||||
typename BOOST_MPL_AUX_NA_PARAM(N1)
|
||||
, typename BOOST_MPL_AUX_NA_PARAM(N2)
|
||||
>
|
||||
struct BOOST_PP_CAT(AUX778076_OP_NAME,2);
|
||||
|
||||
template<
|
||||
typename BOOST_MPL_AUX_NA_PARAM(N1)
|
||||
, typename BOOST_MPL_AUX_NA_PARAM(N2)
|
||||
BOOST_MPL_PP_DEF_PARAMS_TAIL(2, typename N, na)
|
||||
>
|
||||
struct AUX778076_OP_NAME
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
|
||||
: aux::msvc_eti_base< typename if_<
|
||||
#else
|
||||
: if_<
|
||||
#endif
|
||||
is_na<N3>
|
||||
, BOOST_PP_CAT(AUX778076_OP_NAME,2)<N1,N2>
|
||||
, AUX778076_OP_NAME<
|
||||
BOOST_PP_CAT(AUX778076_OP_NAME,2)<N1,N2>
|
||||
, BOOST_MPL_PP_EXT_PARAMS(3, BOOST_PP_INC(AUX778076_OP_ARITY), N)
|
||||
>
|
||||
>::type
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
|
||||
>
|
||||
#endif
|
||||
{
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(
|
||||
AUX778076_OP_ARITY
|
||||
, AUX778076_OP_NAME
|
||||
, ( BOOST_MPL_PP_PARAMS(AUX778076_OP_ARITY, N) )
|
||||
)
|
||||
};
|
||||
|
||||
template<
|
||||
typename N1
|
||||
, typename N2
|
||||
>
|
||||
struct BOOST_PP_CAT(AUX778076_OP_NAME,2)
|
||||
|
||||
#endif
|
||||
|
||||
#else // AUX778076_OP_ARITY == 2
|
||||
|
||||
template<
|
||||
typename BOOST_MPL_AUX_NA_PARAM(N1)
|
||||
, typename BOOST_MPL_AUX_NA_PARAM(N2)
|
||||
>
|
||||
struct AUX778076_OP_NAME
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_MPL_CFG_MSVC_ETI_BUG)
|
||||
: AUX778076_OP_IMPL_NAME<
|
||||
typename AUX778076_OP_TAG_NAME<N1>::type
|
||||
, typename AUX778076_OP_TAG_NAME<N2>::type
|
||||
>::template apply<N1,N2>::type
|
||||
#else
|
||||
: aux::msvc_eti_base< typename apply_wrap2<
|
||||
AUX778076_OP_IMPL_NAME<
|
||||
typename AUX778076_OP_TAG_NAME<N1>::type
|
||||
, typename AUX778076_OP_TAG_NAME<N2>::type
|
||||
>
|
||||
, N1
|
||||
, N2
|
||||
>::type >::type
|
||||
#endif
|
||||
{
|
||||
#if AUX778076_OP_ARITY != 2
|
||||
|
||||
# if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(
|
||||
AUX778076_OP_ARITY
|
||||
, AUX778076_OP_NAME
|
||||
, ( BOOST_MPL_PP_PARTIAL_SPEC_PARAMS(2, N, na) )
|
||||
)
|
||||
# else
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(2, BOOST_PP_CAT(AUX778076_OP_NAME,2), (N1, N2))
|
||||
# endif
|
||||
|
||||
#else
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(2, AUX778076_OP_NAME, (N1, N2))
|
||||
#endif
|
||||
};
|
||||
|
||||
BOOST_MPL_AUX_NA_SPEC2(2, AUX778076_OP_ARITY, AUX778076_OP_NAME)
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
|
||||
|
||||
///// iteration, depth == 1
|
||||
|
||||
// For gcc 4.4 compatability, we must include the
|
||||
// BOOST_PP_ITERATION_DEPTH test inside an #else clause.
|
||||
#else // BOOST_PP_IS_ITERATING
|
||||
#if BOOST_PP_ITERATION_DEPTH() == 1
|
||||
|
||||
# define i_ BOOST_PP_FRAME_ITERATION(1)
|
||||
|
||||
template<
|
||||
BOOST_MPL_PP_PARAMS(i_, typename N)
|
||||
>
|
||||
struct AUX778076_OP_NAME<BOOST_MPL_PP_PARTIAL_SPEC_PARAMS(i_, N, na)>
|
||||
#if i_ != 2
|
||||
: AUX778076_OP_N_CALLS(i_, N)
|
||||
{
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(
|
||||
AUX778076_OP_ARITY
|
||||
, AUX778076_OP_NAME
|
||||
, ( BOOST_MPL_PP_PARTIAL_SPEC_PARAMS(i_, N, na) )
|
||||
)
|
||||
};
|
||||
#endif
|
||||
|
||||
# undef i_
|
||||
|
||||
#endif // BOOST_PP_ITERATION_DEPTH()
|
||||
#endif // BOOST_PP_IS_ITERATING
|
||||
@@ -0,0 +1,20 @@
|
||||
// boost cast.hpp header file
|
||||
//
|
||||
// (C) Copyright Antony Polukhin 2014.
|
||||
//
|
||||
// Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/conversion for Documentation.
|
||||
|
||||
// This is a DEPRECATED header file!
|
||||
// Use <boost/polymorphic_cast.hpp> or <boost/numeric/conversion/cast.hpp> instead
|
||||
|
||||
#ifndef BOOST_CAST_HPP
|
||||
#define BOOST_CAST_HPP
|
||||
|
||||
# include <boost/polymorphic_cast.hpp>
|
||||
# include <boost/numeric/conversion/cast.hpp>
|
||||
|
||||
#endif // BOOST_CAST_HPP
|
||||
@@ -0,0 +1,746 @@
|
||||
#include "plotter.h"
|
||||
#include <math.h>
|
||||
#include <QDebug>
|
||||
#include "commons.h"
|
||||
#include "moc_plotter.cpp"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
#define MAX_SCREENSIZE 2048
|
||||
|
||||
CPlotter::CPlotter(QWidget *parent) : //CPlotter Constructor
|
||||
QFrame {parent},
|
||||
m_bScaleOK {false},
|
||||
m_bReference {false},
|
||||
m_bReference0 {false},
|
||||
m_fSpan {2000.0},
|
||||
m_plotZero {0},
|
||||
m_plotGain {0},
|
||||
m_plot2dGain {0},
|
||||
m_plot2dZero {0},
|
||||
m_nSubMode {0},
|
||||
m_Running {false},
|
||||
m_paintEventBusy {false},
|
||||
m_fftBinWidth {1500.0/2048.0},
|
||||
m_dialFreq {0.},
|
||||
m_sum {},
|
||||
m_dBStepSize {10},
|
||||
m_FreqUnits {1},
|
||||
m_hdivs {HORZ_DIVS},
|
||||
m_line {0},
|
||||
m_fSample {12000},
|
||||
m_nsps {6912},
|
||||
m_Percent2DScreen {30}, //percent of screen used for 2D display
|
||||
m_Percent2DScreen0 {0},
|
||||
m_rxFreq {1020},
|
||||
m_txFreq {0},
|
||||
m_startFreq {0}
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
setAttribute(Qt::WA_PaintOnScreen,false);
|
||||
setAutoFillBackground(false);
|
||||
setAttribute(Qt::WA_OpaquePaintEvent, false);
|
||||
setAttribute(Qt::WA_NoSystemBackground, true);
|
||||
}
|
||||
|
||||
CPlotter::~CPlotter() { } // Destructor
|
||||
|
||||
QSize CPlotter::minimumSizeHint() const
|
||||
{
|
||||
return QSize(50, 50);
|
||||
}
|
||||
|
||||
QSize CPlotter::sizeHint() const
|
||||
{
|
||||
return QSize(180, 180);
|
||||
}
|
||||
|
||||
void CPlotter::resizeEvent(QResizeEvent* ) //resizeEvent()
|
||||
{
|
||||
if(!size().isValid()) return;
|
||||
if( m_Size != size() or (m_bReference != m_bReference0) or
|
||||
m_Percent2DScreen != m_Percent2DScreen0) {
|
||||
m_Size = size();
|
||||
m_w = m_Size.width();
|
||||
m_h = m_Size.height();
|
||||
m_h2 = m_Percent2DScreen*m_h/100.0;
|
||||
if(m_h2>m_h-30) m_h2=m_h-30;
|
||||
if(m_bReference) m_h2=m_h-30;
|
||||
if(m_h2<1) m_h2=1;
|
||||
m_h1=m_h-m_h2;
|
||||
m_2DPixmap = QPixmap(m_Size.width(), m_h2);
|
||||
m_2DPixmap.fill(Qt::black);
|
||||
m_WaterfallPixmap = QPixmap(m_Size.width(), m_h1);
|
||||
m_OverlayPixmap = QPixmap(m_Size.width(), m_h2);
|
||||
m_OverlayPixmap.fill(Qt::black);
|
||||
m_WaterfallPixmap.fill(Qt::black);
|
||||
m_2DPixmap.fill(Qt::black);
|
||||
m_ScalePixmap = QPixmap(m_w,30);
|
||||
m_ScalePixmap.fill(Qt::white);
|
||||
m_Percent2DScreen0 = m_Percent2DScreen;
|
||||
}
|
||||
DrawOverlay();
|
||||
}
|
||||
|
||||
void CPlotter::paintEvent(QPaintEvent *) // paintEvent()
|
||||
{
|
||||
if(m_paintEventBusy) return;
|
||||
m_paintEventBusy=true;
|
||||
QPainter painter(this);
|
||||
painter.drawPixmap(0,0,m_ScalePixmap);
|
||||
painter.drawPixmap(0,30,m_WaterfallPixmap);
|
||||
painter.drawPixmap(0,m_h1,m_2DPixmap);
|
||||
m_paintEventBusy=false;
|
||||
}
|
||||
|
||||
void CPlotter::draw(float swide[], bool bScroll, bool bRed)
|
||||
{
|
||||
int j,j0;
|
||||
static int ktop=0;
|
||||
float y,y2,ymin;
|
||||
double fac = sqrt(m_binsPerPixel*m_waterfallAvg/15.0);
|
||||
double gain = fac*pow(10.0,0.02*m_plotGain);
|
||||
double gain2d = pow(10.0,0.02*(m_plot2dGain));
|
||||
|
||||
if(m_bReference != m_bReference0) resizeEvent(NULL);
|
||||
m_bReference0=m_bReference;
|
||||
|
||||
//move current data down one line (must do this before attaching a QPainter object)
|
||||
if(bScroll) m_WaterfallPixmap.scroll(0,1,0,0,m_w,m_h1);
|
||||
QPainter painter1(&m_WaterfallPixmap);
|
||||
m_2DPixmap = m_OverlayPixmap.copy(0,0,m_w,m_h2);
|
||||
QPainter painter2D(&m_2DPixmap);
|
||||
if(!painter2D.isActive()) return;
|
||||
QFont Font("Arial");
|
||||
Font.setPointSize(12);
|
||||
Font.setWeight(QFont::Normal);
|
||||
painter2D.setFont(Font);
|
||||
|
||||
if(m_bLinearAvg) {
|
||||
painter2D.setPen(Qt::yellow);
|
||||
} else if(m_bReference) {
|
||||
painter2D.setPen(Qt::blue);
|
||||
} else {
|
||||
painter2D.setPen(Qt::green);
|
||||
}
|
||||
static QPoint LineBuf[MAX_SCREENSIZE];
|
||||
static QPoint LineBuf2[MAX_SCREENSIZE];
|
||||
j=0;
|
||||
j0=int(m_startFreq/m_fftBinWidth + 0.5);
|
||||
int iz=XfromFreq(5000.0);
|
||||
int jz=iz*m_binsPerPixel;
|
||||
m_fMax=FreqfromX(iz);
|
||||
|
||||
m_line++;
|
||||
if(bScroll) {
|
||||
flat4_(swide,&iz,&m_Flatten);
|
||||
flat4_(&dec_data.savg[j0],&jz,&m_Flatten);
|
||||
}
|
||||
|
||||
ymin=1.e30;
|
||||
if(swide[0]>1.e29 and swide[0]< 1.5e30) painter1.setPen(Qt::green);
|
||||
if(swide[0]>1.4e30) painter1.setPen(Qt::yellow);
|
||||
for(int i=0; i<iz; i++) {
|
||||
y=swide[i];
|
||||
if(y<ymin) ymin=y;
|
||||
int y1 = 10.0*gain*y + 10*m_plotZero +40;
|
||||
if (y1<0) y1=0;
|
||||
if (y1>254) y1=254;
|
||||
if (swide[i]<1.e29) painter1.setPen(g_ColorTbl[y1]);
|
||||
painter1.drawPoint(i,0);
|
||||
}
|
||||
|
||||
float y2min=1.e30;
|
||||
float y2max=-1.e30;
|
||||
for(int i=0; i<iz; i++) {
|
||||
y=swide[i] - ymin;
|
||||
y2=0;
|
||||
if(m_bCurrent) y2 = gain2d*y + m_plot2dZero; //Current
|
||||
|
||||
if(bScroll) {
|
||||
float sum=0.0;
|
||||
int j=j0+m_binsPerPixel*i;
|
||||
for(int k=0; k<m_binsPerPixel; k++) {
|
||||
sum+=dec_data.savg[j++];
|
||||
}
|
||||
m_sum[i]=sum;
|
||||
}
|
||||
if(m_bCumulative) y2=gain2d*(m_sum[i]/m_binsPerPixel + m_plot2dZero);
|
||||
if(m_Flatten==0) y2 += 15; //### could do better! ###
|
||||
|
||||
if(m_bLinearAvg) { //Linear Avg (yellow)
|
||||
float sum=0.0;
|
||||
int j=j0+m_binsPerPixel*i;
|
||||
for(int k=0; k<m_binsPerPixel; k++) {
|
||||
sum+=spectra_.syellow[j++];
|
||||
}
|
||||
y2=gain2d*sum/m_binsPerPixel + m_plot2dZero;
|
||||
}
|
||||
|
||||
if(m_bReference) { //Reference (red)
|
||||
float df_ref=12000.0/6912.0;
|
||||
int j=FreqfromX(i)/df_ref + 0.5;
|
||||
y2=spectra_.ref[j] + m_plot2dZero;
|
||||
// if(gain2d>1.5) y2=spectra_.filter[j] + m_plot2dZero;
|
||||
|
||||
}
|
||||
|
||||
if(i==iz-1) {
|
||||
painter2D.drawPolyline(LineBuf,j);
|
||||
if(m_mode=="QRA64") {
|
||||
painter2D.setPen(Qt::red);
|
||||
painter2D.drawPolyline(LineBuf2,ktop);
|
||||
}
|
||||
}
|
||||
LineBuf[j].setX(i);
|
||||
LineBuf[j].setY(int(0.9*m_h2-y2*m_h2/70.0));
|
||||
if(y2<y2min) y2min=y2;
|
||||
if(y2>y2max) y2max=y2;
|
||||
j++;
|
||||
}
|
||||
|
||||
if(swide[0]>1.0e29) m_line=0;
|
||||
if(m_line == painter1.fontMetrics ().height ()) {
|
||||
painter1.setPen(Qt::white);
|
||||
QString t;
|
||||
qint64 ms = QDateTime::currentMSecsSinceEpoch() % 86400000;
|
||||
int n=(ms/1000) % m_TRperiod;
|
||||
QDateTime t1=QDateTime::currentDateTimeUtc().addSecs(-n);
|
||||
if(m_TRperiod < 60) {
|
||||
t=t1.toString("hh:mm:ss") + " " + m_rxBand;
|
||||
} else {
|
||||
t=t1.toString("hh:mm") + " " + m_rxBand;
|
||||
}
|
||||
painter1.drawText (5, painter1.fontMetrics ().ascent (), t);
|
||||
}
|
||||
|
||||
if(m_mode=="JT4") {
|
||||
QPen pen3(Qt::yellow); //Mark freqs of JT4 single-tone msgs
|
||||
painter2D.setPen(pen3);
|
||||
Font.setWeight(QFont::Bold);
|
||||
painter2D.setFont(Font);
|
||||
int x1=XfromFreq(m_rxFreq);
|
||||
y=0.2*m_h2;
|
||||
painter2D.drawText(x1-4,y,"T");
|
||||
x1=XfromFreq(m_rxFreq+250);
|
||||
painter2D.drawText(x1-4,y,"M");
|
||||
x1=XfromFreq(m_rxFreq+500);
|
||||
painter2D.drawText(x1-4,y,"R");
|
||||
x1=XfromFreq(m_rxFreq+750);
|
||||
painter2D.drawText(x1-4,y,"73");
|
||||
}
|
||||
|
||||
if(bRed) {
|
||||
std::ifstream f;
|
||||
f.open(m_redFile.toLatin1());
|
||||
if(f) {
|
||||
int x,y;
|
||||
float freq,sync;
|
||||
float slimit=6.0;
|
||||
QPen pen0(Qt::red,1);
|
||||
painter1.setPen(pen0);
|
||||
for(int i=0; i<99999; i++) {
|
||||
f >> freq >> sync;
|
||||
if(f.eof()) break;
|
||||
x=XfromFreq(freq);
|
||||
y=(sync-slimit)*3.0;
|
||||
if(y>0) {
|
||||
if(y>15.0) y=15.0;
|
||||
if(x>=0 and x<=m_w) {
|
||||
painter1.setPen(pen0);
|
||||
painter1.drawLine(x,0,x,y);
|
||||
}
|
||||
}
|
||||
}
|
||||
f.close();
|
||||
}
|
||||
// m_bDecodeFinished=false;
|
||||
}
|
||||
|
||||
update(); //trigger a new paintEvent
|
||||
m_bScaleOK=true;
|
||||
}
|
||||
|
||||
void CPlotter::drawRed(int ia, int ib, float swide[])
|
||||
{
|
||||
m_ia=ia;
|
||||
m_ib=ib;
|
||||
draw(swide,false,true);
|
||||
}
|
||||
|
||||
void CPlotter::DrawOverlay() //DrawOverlay()
|
||||
{
|
||||
if(m_OverlayPixmap.isNull()) return;
|
||||
if(m_WaterfallPixmap.isNull()) return;
|
||||
int w = m_WaterfallPixmap.width();
|
||||
int x,y,x1,x2,x3,x4,x5,x6;
|
||||
float pixperdiv;
|
||||
|
||||
double df = m_binsPerPixel*m_fftBinWidth;
|
||||
QRect rect;
|
||||
QPen penOrange(QColor(255,165,0),3);
|
||||
QPen penGreen(Qt::green, 3); //Mark Tol range with green line
|
||||
QPen penRed(Qt::red, 3); //Mark Tx freq with red
|
||||
QPainter painter(&m_OverlayPixmap);
|
||||
painter.initFrom(this);
|
||||
QLinearGradient gradient(0, 0, 0 ,m_h2); //fill background with gradient
|
||||
gradient.setColorAt(1, Qt::black);
|
||||
gradient.setColorAt(0, Qt::darkBlue);
|
||||
painter.setBrush(gradient);
|
||||
painter.drawRect(0, 0, m_w, m_h2);
|
||||
painter.setBrush(Qt::SolidPattern);
|
||||
|
||||
m_fSpan = w*df;
|
||||
// int n=m_fSpan/10;
|
||||
m_freqPerDiv=10;
|
||||
if(m_fSpan>100) m_freqPerDiv=20;
|
||||
if(m_fSpan>250) m_freqPerDiv=50;
|
||||
if(m_fSpan>500) m_freqPerDiv=100;
|
||||
if(m_fSpan>1000) m_freqPerDiv=200;
|
||||
if(m_fSpan>2500) m_freqPerDiv=500;
|
||||
|
||||
pixperdiv = m_freqPerDiv/df;
|
||||
m_hdivs = w*df/m_freqPerDiv + 1.9999;
|
||||
|
||||
float xx0=float(m_startFreq)/float(m_freqPerDiv);
|
||||
xx0=xx0-int(xx0);
|
||||
int x0=xx0*pixperdiv+0.5;
|
||||
for( int i=1; i<m_hdivs; i++) { //draw vertical grids
|
||||
x = (int)((float)i*pixperdiv ) - x0;
|
||||
if(x >= 0 and x<=m_w) {
|
||||
painter.setPen(QPen(Qt::white, 1,Qt::DotLine));
|
||||
painter.drawLine(x, 0, x , m_h2);
|
||||
}
|
||||
}
|
||||
|
||||
pixperdiv = (float)m_h2 / (float)VERT_DIVS;
|
||||
painter.setPen(QPen(Qt::white, 1,Qt::DotLine));
|
||||
for( int i=1; i<VERT_DIVS; i++) { //draw horizontal grids
|
||||
y = (int)( (float)i*pixperdiv );
|
||||
painter.drawLine(0, y, w, y);
|
||||
}
|
||||
|
||||
QRect rect0;
|
||||
QPainter painter0(&m_ScalePixmap);
|
||||
painter0.initFrom(this);
|
||||
|
||||
//create Font to use for scales
|
||||
QFont Font("Arial");
|
||||
Font.setPointSize(12);
|
||||
Font.setWeight(QFont::Normal);
|
||||
painter0.setFont(Font);
|
||||
painter0.setPen(Qt::black);
|
||||
|
||||
if(m_binsPerPixel < 1) m_binsPerPixel=1;
|
||||
m_hdivs = w*df/m_freqPerDiv + 0.9999;
|
||||
|
||||
m_ScalePixmap.fill(Qt::white);
|
||||
painter0.drawRect(0, 0, w, 30);
|
||||
MakeFrequencyStrs();
|
||||
|
||||
//draw tick marks on upper scale
|
||||
pixperdiv = m_freqPerDiv/df;
|
||||
for( int i=0; i<m_hdivs; i++) { //major ticks
|
||||
x = (int)((m_xOffset+i)*pixperdiv );
|
||||
painter0.drawLine(x,18,x,30);
|
||||
}
|
||||
int minor=5;
|
||||
if(m_freqPerDiv==200) minor=4;
|
||||
for( int i=1; i<minor*m_hdivs; i++) { //minor ticks
|
||||
x = i*pixperdiv/minor;
|
||||
painter0.drawLine(x,24,x,30);
|
||||
}
|
||||
|
||||
//draw frequency values
|
||||
for( int i=0; i<=m_hdivs; i++) {
|
||||
x = (int)((m_xOffset+i)*pixperdiv - pixperdiv/2);
|
||||
rect0.setRect(x,0, (int)pixperdiv, 20);
|
||||
painter0.drawText(rect0, Qt::AlignHCenter|Qt::AlignVCenter,m_HDivText[i]);
|
||||
}
|
||||
|
||||
float bw=9.0*12000.0/m_nsps; //JT9
|
||||
|
||||
if(m_mode=="JT4") { //JT4
|
||||
bw=3*11025.0/2520.0; //Max tone spacing (3/4 of actual BW)
|
||||
if(m_nSubMode==1) bw=2*bw;
|
||||
if(m_nSubMode==2) bw=4*bw;
|
||||
if(m_nSubMode==3) bw=9*bw;
|
||||
if(m_nSubMode==4) bw=18*bw;
|
||||
if(m_nSubMode==5) bw=36*bw;
|
||||
if(m_nSubMode==6) bw=72*bw;
|
||||
|
||||
painter0.setPen(penGreen);
|
||||
x1=XfromFreq(m_rxFreq-m_tol);
|
||||
x2=XfromFreq(m_rxFreq+m_tol);
|
||||
painter0.drawLine(x1,29,x2,29);
|
||||
for(int i=0; i<4; i++) {
|
||||
x1=XfromFreq(m_rxFreq+bw*i/3.0);
|
||||
int j=24;
|
||||
if(i==0) j=18;
|
||||
painter0.drawLine(x1,j,x1,30);
|
||||
}
|
||||
painter0.setPen(penRed);
|
||||
for(int i=0; i<4; i++) {
|
||||
x1=XfromFreq(m_txFreq+bw*i/3.0);
|
||||
painter0.drawLine(x1,12,x1,18);
|
||||
}
|
||||
}
|
||||
|
||||
if(m_modeTx=="JT9" and m_nSubMode>0) { //JT9
|
||||
bw=8.0*12000.0/m_nsps;
|
||||
if(m_nSubMode==1) bw=2*bw; //B
|
||||
if(m_nSubMode==2) bw=4*bw; //C
|
||||
if(m_nSubMode==3) bw=8*bw; //D
|
||||
if(m_nSubMode==4) bw=16*bw; //E
|
||||
if(m_nSubMode==5) bw=32*bw; //F
|
||||
if(m_nSubMode==6) bw=64*bw; //G
|
||||
if(m_nSubMode==7) bw=128*bw; //H
|
||||
}
|
||||
|
||||
if(m_mode=="QRA64") { //QRA64
|
||||
bw=63.0*12000.0/m_nsps;
|
||||
if(m_nSubMode==1) bw=2*bw; //B
|
||||
if(m_nSubMode==2) bw=4*bw; //C
|
||||
if(m_nSubMode==3) bw=8*bw; //D
|
||||
if(m_nSubMode==4) bw=16*bw; //E
|
||||
}
|
||||
|
||||
if(m_modeTx=="JT65") { //JT65
|
||||
bw=65.0*11025.0/4096.0;
|
||||
if(m_nSubMode==1) bw=2*bw; //B
|
||||
if(m_nSubMode==2) bw=4*bw; //C
|
||||
}
|
||||
|
||||
painter0.setPen(penGreen);
|
||||
if(m_mode=="WSPR") {
|
||||
x1=XfromFreq(1400);
|
||||
x2=XfromFreq(1600);
|
||||
painter0.drawLine(x1,29,x2,29);
|
||||
}
|
||||
|
||||
if(m_mode=="WSPR-LF") {
|
||||
x1=XfromFreq(1600);
|
||||
x2=XfromFreq(1700);
|
||||
painter0.drawLine(x1,29,x2,29);
|
||||
}
|
||||
|
||||
if(m_mode=="FreqCal") { //FreqCal
|
||||
x1=XfromFreq(m_rxFreq-m_tol);
|
||||
x2=XfromFreq(m_rxFreq+m_tol);
|
||||
painter0.drawLine(x1,29,x2,29);
|
||||
x1=XfromFreq(m_rxFreq);
|
||||
painter0.drawLine(x1,24,x1,30);
|
||||
}
|
||||
|
||||
if(m_mode=="JT9" or m_mode=="JT65" or m_mode=="JT9+JT65" or m_mode=="QRA64") {
|
||||
|
||||
if(m_mode=="QRA64" or (m_mode=="JT65" and m_bVHF)) {
|
||||
painter0.setPen(penGreen);
|
||||
x1=XfromFreq(m_rxFreq-m_tol);
|
||||
x2=XfromFreq(m_rxFreq+m_tol);
|
||||
painter0.drawLine(x1,28,x2,28);
|
||||
x1=XfromFreq(m_rxFreq);
|
||||
painter0.drawLine(x1,24,x1,30);
|
||||
|
||||
if(m_mode=="JT65") {
|
||||
painter0.setPen(penOrange);
|
||||
x3=XfromFreq(m_rxFreq+20.0*bw/65.0); //RO
|
||||
painter0.drawLine(x3,24,x3,30);
|
||||
x4=XfromFreq(m_rxFreq+30.0*bw/65.0); //RRR
|
||||
painter0.drawLine(x4,24,x4,30);
|
||||
x5=XfromFreq(m_rxFreq+40.0*bw/65.0); //73
|
||||
painter0.drawLine(x5,24,x5,30);
|
||||
}
|
||||
painter0.setPen(penGreen);
|
||||
x6=XfromFreq(m_rxFreq+bw); //Highest tone
|
||||
painter0.drawLine(x6,24,x6,30);
|
||||
|
||||
} else {
|
||||
painter0.setPen(penGreen);
|
||||
x1=XfromFreq(m_rxFreq);
|
||||
x2=XfromFreq(m_rxFreq+bw);
|
||||
painter0.drawLine(x1,24,x1,30);
|
||||
painter0.drawLine(x1,28,x2,28);
|
||||
painter0.drawLine(x2,24,x2,30);
|
||||
}
|
||||
}
|
||||
|
||||
if(m_mode=="JT9" or m_mode=="JT65" or m_mode=="JT9+JT65" or
|
||||
m_mode.mid(0,4)=="WSPR" or m_mode=="QRA64") {
|
||||
painter0.setPen(penRed);
|
||||
x1=XfromFreq(m_txFreq);
|
||||
x2=XfromFreq(m_txFreq+bw);
|
||||
if(m_mode=="WSPR") {
|
||||
bw=4*12000.0/8192.0; //WSPR
|
||||
x1=XfromFreq(m_txFreq-0.5*bw);
|
||||
x2=XfromFreq(m_txFreq+0.5*bw);
|
||||
}
|
||||
if(m_mode=="WSPR-LF") {
|
||||
bw=3*12000.0/8640.0; //WSPR-LF
|
||||
x1=XfromFreq(m_txFreq-0.5*bw);
|
||||
x2=XfromFreq(m_txFreq+0.5*bw);
|
||||
}
|
||||
painter0.drawLine(x1,17,x1,21);
|
||||
painter0.drawLine(x1,17,x2,17);
|
||||
painter0.drawLine(x2,17,x2,21);
|
||||
}
|
||||
|
||||
if(m_mode=="JT9+JT65") {
|
||||
QPen pen2(Qt::blue, 3); //Mark the JT65 | JT9 divider
|
||||
painter0.setPen(pen2);
|
||||
x1=XfromFreq(m_fMin);
|
||||
if(x1<2) x1=2;
|
||||
x2=x1+30;
|
||||
painter0.drawLine(x1,8,x1,28);
|
||||
}
|
||||
|
||||
if(m_dialFreq>10.13 and m_dialFreq< 10.15 and m_mode.mid(0,4)!="WSPR") {
|
||||
float f1=1.0e6*(10.1401 - m_dialFreq);
|
||||
float f2=f1+200.0;
|
||||
x1=XfromFreq(f1);
|
||||
x2=XfromFreq(f2);
|
||||
if(x1<=m_w and x2>=0) {
|
||||
painter0.setPen(penOrange); //Mark WSPR sub-band orange
|
||||
painter0.drawLine(x1,9,x2,9);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CPlotter::MakeFrequencyStrs() //MakeFrequencyStrs
|
||||
{
|
||||
int f=(m_startFreq+m_freqPerDiv-1)/m_freqPerDiv;
|
||||
f*=m_freqPerDiv;
|
||||
m_xOffset=float(f-m_startFreq)/m_freqPerDiv;
|
||||
for(int i=0; i<=m_hdivs; i++) {
|
||||
m_HDivText[i].setNum(f);
|
||||
f+=m_freqPerDiv;
|
||||
}
|
||||
}
|
||||
|
||||
int CPlotter::XfromFreq(float f) //XfromFreq()
|
||||
{
|
||||
// float w = m_WaterfallPixmap.width();
|
||||
int x = int(m_w * (f - m_startFreq)/m_fSpan + 0.5);
|
||||
if(x<0 ) return 0;
|
||||
if(x>m_w) return m_w;
|
||||
return x;
|
||||
}
|
||||
|
||||
float CPlotter::FreqfromX(int x) //FreqfromX()
|
||||
{
|
||||
return float(m_startFreq + x*m_binsPerPixel*m_fftBinWidth);
|
||||
}
|
||||
|
||||
void CPlotter::SetRunningState(bool running) //SetRunningState()
|
||||
{
|
||||
m_Running = running;
|
||||
}
|
||||
|
||||
void CPlotter::setPlotZero(int plotZero) //setPlotZero()
|
||||
{
|
||||
m_plotZero=plotZero;
|
||||
}
|
||||
|
||||
int CPlotter::plotZero() //PlotZero()
|
||||
{
|
||||
return m_plotZero;
|
||||
}
|
||||
|
||||
void CPlotter::setPlotGain(int plotGain) //setPlotGain()
|
||||
{
|
||||
m_plotGain=plotGain;
|
||||
}
|
||||
|
||||
int CPlotter::plotGain() //plotGain()
|
||||
{
|
||||
return m_plotGain;
|
||||
}
|
||||
|
||||
int CPlotter::plot2dGain() //plot2dGain
|
||||
{
|
||||
return m_plot2dGain;
|
||||
}
|
||||
|
||||
void CPlotter::setPlot2dGain(int n) //setPlot2dGain
|
||||
{
|
||||
m_plot2dGain=n;
|
||||
update();
|
||||
}
|
||||
|
||||
int CPlotter::plot2dZero() //plot2dZero
|
||||
{
|
||||
return m_plot2dZero;
|
||||
}
|
||||
|
||||
void CPlotter::setPlot2dZero(int plot2dZero) //setPlot2dZero
|
||||
{
|
||||
m_plot2dZero=plot2dZero;
|
||||
}
|
||||
|
||||
void CPlotter::setStartFreq(int f) //SetStartFreq()
|
||||
{
|
||||
m_startFreq=f;
|
||||
resizeEvent(NULL);
|
||||
update();
|
||||
}
|
||||
|
||||
int CPlotter::startFreq() //startFreq()
|
||||
{
|
||||
return m_startFreq;
|
||||
}
|
||||
|
||||
int CPlotter::plotWidth(){return m_WaterfallPixmap.width();} //plotWidth
|
||||
void CPlotter::UpdateOverlay() {DrawOverlay();} //UpdateOverlay
|
||||
void CPlotter::setDataFromDisk(bool b) {m_dataFromDisk=b;} //setDataFromDisk
|
||||
|
||||
void CPlotter::setRxRange(int fMin) //setRxRange
|
||||
{
|
||||
m_fMin=fMin;
|
||||
}
|
||||
|
||||
void CPlotter::setBinsPerPixel(int n) //setBinsPerPixel
|
||||
{
|
||||
m_binsPerPixel = n;
|
||||
DrawOverlay(); //Redraw scales and ticks
|
||||
update(); //trigger a new paintEvent}
|
||||
}
|
||||
|
||||
int CPlotter::binsPerPixel() //binsPerPixel
|
||||
{
|
||||
return m_binsPerPixel;
|
||||
}
|
||||
|
||||
void CPlotter::setWaterfallAvg(int n) //setBinsPerPixel
|
||||
{
|
||||
m_waterfallAvg = n;
|
||||
}
|
||||
|
||||
void CPlotter::setRxFreq (int x) //setRxFreq
|
||||
{
|
||||
m_rxFreq = x; // x is freq in Hz
|
||||
DrawOverlay();
|
||||
update();
|
||||
}
|
||||
|
||||
int CPlotter::rxFreq() {return m_rxFreq;} //rxFreq
|
||||
|
||||
void CPlotter::mousePressEvent(QMouseEvent *event) //mousePressEvent
|
||||
{
|
||||
int x=event->x();
|
||||
if(x<0) x=0;
|
||||
if(x>m_Size.width()) x=m_Size.width();
|
||||
bool ctrl = (event->modifiers() & Qt::ControlModifier);
|
||||
bool shift = (event->modifiers() & Qt::ShiftModifier);
|
||||
int newFreq = int(FreqfromX(x)+0.5);
|
||||
int oldTxFreq = m_txFreq;
|
||||
int oldRxFreq = m_rxFreq;
|
||||
|
||||
if (ctrl or m_lockTxFreq) {
|
||||
emit setFreq1 (newFreq, newFreq);
|
||||
}
|
||||
else if (shift) {
|
||||
emit setFreq1 (oldRxFreq, newFreq);
|
||||
}
|
||||
else {
|
||||
emit setFreq1(newFreq,oldTxFreq);
|
||||
}
|
||||
|
||||
int n=1;
|
||||
if(ctrl) n+=100;
|
||||
emit freezeDecode1(n);
|
||||
}
|
||||
|
||||
void CPlotter::mouseDoubleClickEvent(QMouseEvent *event) //mouse2click
|
||||
{
|
||||
bool ctrl = (event->modifiers() & Qt::ControlModifier);
|
||||
int n=2;
|
||||
if(ctrl) n+=100;
|
||||
emit freezeDecode1(n);
|
||||
}
|
||||
|
||||
void CPlotter::setNsps(int ntrperiod, int nsps) //setNsps
|
||||
{
|
||||
m_TRperiod=ntrperiod;
|
||||
m_nsps=nsps;
|
||||
m_fftBinWidth=1500.0/2048.0;
|
||||
if(m_nsps==15360) m_fftBinWidth=1500.0/2048.0;
|
||||
if(m_nsps==40960) m_fftBinWidth=1500.0/6144.0;
|
||||
if(m_nsps==82944) m_fftBinWidth=1500.0/12288.0;
|
||||
if(m_nsps==252000) m_fftBinWidth=1500.0/32768.0;
|
||||
DrawOverlay(); //Redraw scales and ticks
|
||||
update(); //trigger a new paintEvent}
|
||||
}
|
||||
|
||||
void CPlotter::setTxFreq(int n) //setTxFreq
|
||||
{
|
||||
m_txFreq=n;
|
||||
DrawOverlay();
|
||||
update();
|
||||
}
|
||||
|
||||
void CPlotter::setMode(QString mode) //setMode
|
||||
{
|
||||
m_mode=mode;
|
||||
}
|
||||
|
||||
void CPlotter::setSubMode(int n) //setSubMode
|
||||
{
|
||||
m_nSubMode=n;
|
||||
}
|
||||
|
||||
void CPlotter::setModeTx(QString modeTx) //setModeTx
|
||||
{
|
||||
m_modeTx=modeTx;
|
||||
}
|
||||
|
||||
int CPlotter::Fmax()
|
||||
{
|
||||
return m_fMax;
|
||||
}
|
||||
|
||||
void CPlotter::setDialFreq(double d)
|
||||
{
|
||||
m_dialFreq=d;
|
||||
DrawOverlay();
|
||||
update();
|
||||
}
|
||||
|
||||
void CPlotter::setRxBand(QString band)
|
||||
{
|
||||
m_rxBand=band;
|
||||
}
|
||||
|
||||
void CPlotter::setFlatten(bool b1, bool b2)
|
||||
{
|
||||
m_Flatten=0;
|
||||
if(b1) m_Flatten=1;
|
||||
if(b2) m_Flatten=2;
|
||||
}
|
||||
|
||||
void CPlotter::setTol(int n) //setTol()
|
||||
{
|
||||
m_tol=n;
|
||||
DrawOverlay();
|
||||
}
|
||||
|
||||
void CPlotter::setColours(QVector<QColor> const& cl)
|
||||
{
|
||||
g_ColorTbl = cl;
|
||||
}
|
||||
|
||||
void CPlotter::SetPercent2DScreen(int percent)
|
||||
{
|
||||
m_Percent2DScreen=percent;
|
||||
resizeEvent(NULL);
|
||||
update();
|
||||
}
|
||||
void CPlotter::setVHF(bool bVHF)
|
||||
{
|
||||
m_bVHF=bVHF;
|
||||
}
|
||||
|
||||
void CPlotter::setRedFile(QString fRed)
|
||||
{
|
||||
m_redFile=fRed;
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
|
||||
// NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION
|
||||
|
||||
#if defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id$
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
#include <boost/preprocessor/enum_params.hpp>
|
||||
#include <boost/preprocessor/enum_shifted_params.hpp>
|
||||
#include <boost/preprocessor/comma_if.hpp>
|
||||
#include <boost/preprocessor/repeat.hpp>
|
||||
#include <boost/preprocessor/dec.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
|
||||
#define i_ BOOST_PP_FRAME_ITERATION(1)
|
||||
|
||||
#if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES)
|
||||
|
||||
# define AUX778076_VECTOR_TAIL(vector, i_, C) \
|
||||
BOOST_PP_CAT(BOOST_PP_CAT(vector,i_),_c)<T \
|
||||
BOOST_PP_COMMA_IF(i_) BOOST_PP_ENUM_PARAMS(i_, C) \
|
||||
> \
|
||||
/**/
|
||||
|
||||
#if i_ > 0
|
||||
template<
|
||||
typename T
|
||||
, BOOST_PP_ENUM_PARAMS(i_, T C)
|
||||
>
|
||||
struct BOOST_PP_CAT(BOOST_PP_CAT(vector,i_),_c)
|
||||
: v_item<
|
||||
integral_c<T,BOOST_PP_CAT(C,BOOST_PP_DEC(i_))>
|
||||
, AUX778076_VECTOR_TAIL(vector,BOOST_PP_DEC(i_),C)
|
||||
>
|
||||
{
|
||||
typedef BOOST_PP_CAT(BOOST_PP_CAT(vector,i_),_c) type;
|
||||
typedef T value_type;
|
||||
};
|
||||
#endif
|
||||
|
||||
# undef AUX778076_VECTOR_TAIL
|
||||
|
||||
#else // "brute force" implementation
|
||||
|
||||
# define AUX778076_VECTOR_C_PARAM_FUNC(unused, i_, param) \
|
||||
BOOST_PP_COMMA_IF(i_) \
|
||||
integral_c<T,BOOST_PP_CAT(param,i_)> \
|
||||
/**/
|
||||
|
||||
template<
|
||||
typename T
|
||||
, BOOST_PP_ENUM_PARAMS(i_, T C)
|
||||
>
|
||||
struct BOOST_PP_CAT(BOOST_PP_CAT(vector,i_),_c)
|
||||
: BOOST_PP_CAT(vector,i_)< BOOST_PP_REPEAT(i_,AUX778076_VECTOR_C_PARAM_FUNC,C) >
|
||||
{
|
||||
typedef BOOST_PP_CAT(BOOST_PP_CAT(vector,i_),_c) type;
|
||||
typedef T value_type;
|
||||
};
|
||||
|
||||
# undef AUX778076_VECTOR_C_PARAM_FUNC
|
||||
|
||||
#endif // BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES
|
||||
|
||||
#undef i_
|
||||
|
||||
#endif // BOOST_PP_IS_ITERATING
|
||||
@@ -0,0 +1,980 @@
|
||||
// (C) Copyright David Abrahams 2002.
|
||||
// (C) Copyright Jeremy Siek 2002.
|
||||
// (C) Copyright Thomas Witt 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 BOOST_ITERATOR_FACADE_23022003THW_HPP
|
||||
#define BOOST_ITERATOR_FACADE_23022003THW_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/iterator.hpp>
|
||||
#include <boost/iterator/interoperable.hpp>
|
||||
#include <boost/iterator/iterator_traits.hpp>
|
||||
#include <boost/iterator/iterator_categories.hpp>
|
||||
|
||||
#include <boost/iterator/detail/facade_iterator_category.hpp>
|
||||
#include <boost/iterator/detail/enable_if.hpp>
|
||||
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/utility/addressof.hpp>
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/type_traits/add_pointer.hpp>
|
||||
#include <boost/type_traits/add_lvalue_reference.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/type_traits/is_pod.hpp>
|
||||
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/mpl/always.hpp>
|
||||
#include <boost/mpl/apply.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
|
||||
#include <boost/iterator/detail/config_def.hpp> // this goes last
|
||||
|
||||
namespace boost {
|
||||
namespace iterators {
|
||||
|
||||
// This forward declaration is required for the friend declaration
|
||||
// in iterator_core_access
|
||||
template <class I, class V, class TC, class R, class D> class iterator_facade;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
// A binary metafunction class that always returns bool. VC6
|
||||
// ICEs on mpl::always<bool>, probably because of the default
|
||||
// parameters.
|
||||
struct always_bool2
|
||||
{
|
||||
template <class T, class U>
|
||||
struct apply
|
||||
{
|
||||
typedef bool type;
|
||||
};
|
||||
};
|
||||
|
||||
// The type trait checks if the category or traversal is at least as advanced as the specified required traversal
|
||||
template< typename CategoryOrTraversal, typename Required >
|
||||
struct is_traversal_at_least :
|
||||
public boost::is_convertible< typename iterator_category_to_traversal< CategoryOrTraversal >::type, Required >
|
||||
{};
|
||||
|
||||
//
|
||||
// enable if for use in operator implementation.
|
||||
//
|
||||
template <
|
||||
class Facade1
|
||||
, class Facade2
|
||||
, class Return
|
||||
>
|
||||
struct enable_if_interoperable :
|
||||
public boost::iterators::enable_if<
|
||||
is_interoperable< Facade1, Facade2 >
|
||||
, Return
|
||||
>
|
||||
{};
|
||||
|
||||
//
|
||||
// enable if for use in implementation of operators specific for random access traversal.
|
||||
//
|
||||
template <
|
||||
class Facade1
|
||||
, class Facade2
|
||||
, class Return
|
||||
>
|
||||
struct enable_if_interoperable_and_random_access_traversal :
|
||||
public boost::iterators::enable_if<
|
||||
mpl::and_<
|
||||
is_interoperable< Facade1, Facade2 >
|
||||
, is_traversal_at_least< typename iterator_category< Facade1 >::type, random_access_traversal_tag >
|
||||
, is_traversal_at_least< typename iterator_category< Facade2 >::type, random_access_traversal_tag >
|
||||
>
|
||||
, Return
|
||||
>
|
||||
{};
|
||||
|
||||
//
|
||||
// Generates associated types for an iterator_facade with the
|
||||
// given parameters.
|
||||
//
|
||||
template <
|
||||
class ValueParam
|
||||
, class CategoryOrTraversal
|
||||
, class Reference
|
||||
, class Difference
|
||||
>
|
||||
struct iterator_facade_types
|
||||
{
|
||||
typedef typename facade_iterator_category<
|
||||
CategoryOrTraversal, ValueParam, Reference
|
||||
>::type iterator_category;
|
||||
|
||||
typedef typename remove_const<ValueParam>::type value_type;
|
||||
|
||||
// Not the real associated pointer type
|
||||
typedef typename mpl::eval_if<
|
||||
boost::iterators::detail::iterator_writability_disabled<ValueParam,Reference>
|
||||
, add_pointer<const value_type>
|
||||
, add_pointer<value_type>
|
||||
>::type pointer;
|
||||
|
||||
# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
|
||||
&& (BOOST_WORKAROUND(_STLPORT_VERSION, BOOST_TESTED_AT(0x452)) \
|
||||
|| BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, BOOST_TESTED_AT(310))) \
|
||||
|| BOOST_WORKAROUND(BOOST_RWSTD_VER, BOOST_TESTED_AT(0x20101)) \
|
||||
|| BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, <= 310)
|
||||
|
||||
// To interoperate with some broken library/compiler
|
||||
// combinations, user-defined iterators must be derived from
|
||||
// std::iterator. It is possible to implement a standard
|
||||
// library for broken compilers without this limitation.
|
||||
# define BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE 1
|
||||
|
||||
typedef
|
||||
iterator<iterator_category, value_type, Difference, pointer, Reference>
|
||||
base;
|
||||
# endif
|
||||
};
|
||||
|
||||
// iterators whose dereference operators reference the same value
|
||||
// for all iterators into the same sequence (like many input
|
||||
// iterators) need help with their postfix ++: the referenced
|
||||
// value must be read and stored away before the increment occurs
|
||||
// so that *a++ yields the originally referenced element and not
|
||||
// the next one.
|
||||
template <class Iterator>
|
||||
class postfix_increment_proxy
|
||||
{
|
||||
typedef typename iterator_value<Iterator>::type value_type;
|
||||
public:
|
||||
explicit postfix_increment_proxy(Iterator const& x)
|
||||
: stored_value(*x)
|
||||
{}
|
||||
|
||||
// Returning a mutable reference allows nonsense like
|
||||
// (*r++).mutate(), but it imposes fewer assumptions about the
|
||||
// behavior of the value_type. In particular, recall that
|
||||
// (*r).mutate() is legal if operator* returns by value.
|
||||
value_type&
|
||||
operator*() const
|
||||
{
|
||||
return this->stored_value;
|
||||
}
|
||||
private:
|
||||
mutable value_type stored_value;
|
||||
};
|
||||
|
||||
//
|
||||
// In general, we can't determine that such an iterator isn't
|
||||
// writable -- we also need to store a copy of the old iterator so
|
||||
// that it can be written into.
|
||||
template <class Iterator>
|
||||
class writable_postfix_increment_proxy
|
||||
{
|
||||
typedef typename iterator_value<Iterator>::type value_type;
|
||||
public:
|
||||
explicit writable_postfix_increment_proxy(Iterator const& x)
|
||||
: stored_value(*x)
|
||||
, stored_iterator(x)
|
||||
{}
|
||||
|
||||
// Dereferencing must return a proxy so that both *r++ = o and
|
||||
// value_type(*r++) can work. In this case, *r is the same as
|
||||
// *r++, and the conversion operator below is used to ensure
|
||||
// readability.
|
||||
writable_postfix_increment_proxy const&
|
||||
operator*() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Provides readability of *r++
|
||||
operator value_type&() const
|
||||
{
|
||||
return stored_value;
|
||||
}
|
||||
|
||||
// Provides writability of *r++
|
||||
template <class T>
|
||||
T const& operator=(T const& x) const
|
||||
{
|
||||
*this->stored_iterator = x;
|
||||
return x;
|
||||
}
|
||||
|
||||
// This overload just in case only non-const objects are writable
|
||||
template <class T>
|
||||
T& operator=(T& x) const
|
||||
{
|
||||
*this->stored_iterator = x;
|
||||
return x;
|
||||
}
|
||||
|
||||
// Provides X(r++)
|
||||
operator Iterator const&() const
|
||||
{
|
||||
return stored_iterator;
|
||||
}
|
||||
|
||||
private:
|
||||
mutable value_type stored_value;
|
||||
Iterator stored_iterator;
|
||||
};
|
||||
|
||||
# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
template <class Reference, class Value>
|
||||
struct is_non_proxy_reference_impl
|
||||
{
|
||||
static Reference r;
|
||||
|
||||
template <class R>
|
||||
static typename mpl::if_<
|
||||
is_convertible<
|
||||
R const volatile*
|
||||
, Value const volatile*
|
||||
>
|
||||
, char[1]
|
||||
, char[2]
|
||||
>::type& helper(R const&);
|
||||
|
||||
BOOST_STATIC_CONSTANT(bool, value = sizeof(helper(r)) == 1);
|
||||
};
|
||||
|
||||
template <class Reference, class Value>
|
||||
struct is_non_proxy_reference
|
||||
: mpl::bool_<
|
||||
is_non_proxy_reference_impl<Reference, Value>::value
|
||||
>
|
||||
{};
|
||||
# else
|
||||
template <class Reference, class Value>
|
||||
struct is_non_proxy_reference
|
||||
: is_convertible<
|
||||
typename remove_reference<Reference>::type
|
||||
const volatile*
|
||||
, Value const volatile*
|
||||
>
|
||||
{};
|
||||
# endif
|
||||
|
||||
// A metafunction to choose the result type of postfix ++
|
||||
//
|
||||
// Because the C++98 input iterator requirements say that *r++ has
|
||||
// type T (value_type), implementations of some standard
|
||||
// algorithms like lexicographical_compare may use constructions
|
||||
// like:
|
||||
//
|
||||
// *r++ < *s++
|
||||
//
|
||||
// If *r++ returns a proxy (as required if r is writable but not
|
||||
// multipass), this sort of expression will fail unless the proxy
|
||||
// supports the operator<. Since there are any number of such
|
||||
// operations, we're not going to try to support them. Therefore,
|
||||
// even if r++ returns a proxy, *r++ will only return a proxy if
|
||||
// *r also returns a proxy.
|
||||
template <class Iterator, class Value, class Reference, class CategoryOrTraversal>
|
||||
struct postfix_increment_result
|
||||
: mpl::eval_if<
|
||||
mpl::and_<
|
||||
// A proxy is only needed for readable iterators
|
||||
is_convertible<
|
||||
Reference
|
||||
// Use add_lvalue_reference to form `reference to Value` due to
|
||||
// some (strict) C++03 compilers (e.g. `gcc -std=c++03`) reject
|
||||
// 'reference-to-reference' in the template which described in CWG
|
||||
// DR106.
|
||||
// http://www.open-std.org/Jtc1/sc22/wg21/docs/cwg_defects.html#106
|
||||
, typename add_lvalue_reference<Value const>::type
|
||||
>
|
||||
|
||||
// No multipass iterator can have values that disappear
|
||||
// before positions can be re-visited
|
||||
, mpl::not_<
|
||||
is_convertible<
|
||||
typename iterator_category_to_traversal<CategoryOrTraversal>::type
|
||||
, forward_traversal_tag
|
||||
>
|
||||
>
|
||||
>
|
||||
, mpl::if_<
|
||||
is_non_proxy_reference<Reference,Value>
|
||||
, postfix_increment_proxy<Iterator>
|
||||
, writable_postfix_increment_proxy<Iterator>
|
||||
>
|
||||
, mpl::identity<Iterator>
|
||||
>
|
||||
{};
|
||||
|
||||
// operator->() needs special support for input iterators to strictly meet the
|
||||
// standard's requirements. If *i is not a reference type, we must still
|
||||
// produce an lvalue to which a pointer can be formed. We do that by
|
||||
// returning a proxy object containing an instance of the reference object.
|
||||
template <class Reference, class Pointer>
|
||||
struct operator_arrow_dispatch // proxy references
|
||||
{
|
||||
struct proxy
|
||||
{
|
||||
explicit proxy(Reference const & x) : m_ref(x) {}
|
||||
Reference* operator->() { return boost::addressof(m_ref); }
|
||||
// This function is needed for MWCW and BCC, which won't call
|
||||
// operator-> again automatically per 13.3.1.2 para 8
|
||||
operator Reference*() { return boost::addressof(m_ref); }
|
||||
Reference m_ref;
|
||||
};
|
||||
typedef proxy result_type;
|
||||
static result_type apply(Reference const & x)
|
||||
{
|
||||
return result_type(x);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T, class Pointer>
|
||||
struct operator_arrow_dispatch<T&, Pointer> // "real" references
|
||||
{
|
||||
typedef Pointer result_type;
|
||||
static result_type apply(T& x)
|
||||
{
|
||||
return boost::addressof(x);
|
||||
}
|
||||
};
|
||||
|
||||
// A proxy return type for operator[], needed to deal with
|
||||
// iterators that may invalidate referents upon destruction.
|
||||
// Consider the temporary iterator in *(a + n)
|
||||
template <class Iterator>
|
||||
class operator_brackets_proxy
|
||||
{
|
||||
// Iterator is actually an iterator_facade, so we do not have to
|
||||
// go through iterator_traits to access the traits.
|
||||
typedef typename Iterator::reference reference;
|
||||
typedef typename Iterator::value_type value_type;
|
||||
|
||||
public:
|
||||
operator_brackets_proxy(Iterator const& iter)
|
||||
: m_iter(iter)
|
||||
{}
|
||||
|
||||
operator reference() const
|
||||
{
|
||||
return *m_iter;
|
||||
}
|
||||
|
||||
operator_brackets_proxy& operator=(value_type const& val)
|
||||
{
|
||||
*m_iter = val;
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
Iterator m_iter;
|
||||
};
|
||||
|
||||
// A metafunction that determines whether operator[] must return a
|
||||
// proxy, or whether it can simply return a copy of the value_type.
|
||||
template <class ValueType, class Reference>
|
||||
struct use_operator_brackets_proxy
|
||||
: mpl::not_<
|
||||
mpl::and_<
|
||||
// Really we want an is_copy_constructible trait here,
|
||||
// but is_POD will have to suffice in the meantime.
|
||||
boost::is_POD<ValueType>
|
||||
, iterator_writability_disabled<ValueType,Reference>
|
||||
>
|
||||
>
|
||||
{};
|
||||
|
||||
template <class Iterator, class Value, class Reference>
|
||||
struct operator_brackets_result
|
||||
{
|
||||
typedef typename mpl::if_<
|
||||
use_operator_brackets_proxy<Value,Reference>
|
||||
, operator_brackets_proxy<Iterator>
|
||||
, Value
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template <class Iterator>
|
||||
operator_brackets_proxy<Iterator> make_operator_brackets_result(Iterator const& iter, mpl::true_)
|
||||
{
|
||||
return operator_brackets_proxy<Iterator>(iter);
|
||||
}
|
||||
|
||||
template <class Iterator>
|
||||
typename Iterator::value_type make_operator_brackets_result(Iterator const& iter, mpl::false_)
|
||||
{
|
||||
return *iter;
|
||||
}
|
||||
|
||||
struct choose_difference_type
|
||||
{
|
||||
template <class I1, class I2>
|
||||
struct apply
|
||||
:
|
||||
# ifdef BOOST_NO_ONE_WAY_ITERATOR_INTEROP
|
||||
iterator_difference<I1>
|
||||
# else
|
||||
mpl::eval_if<
|
||||
is_convertible<I2,I1>
|
||||
, iterator_difference<I1>
|
||||
, iterator_difference<I2>
|
||||
>
|
||||
# endif
|
||||
{};
|
||||
|
||||
};
|
||||
|
||||
template <
|
||||
class Derived
|
||||
, class Value
|
||||
, class CategoryOrTraversal
|
||||
, class Reference
|
||||
, class Difference
|
||||
, bool IsBidirectionalTraversal
|
||||
, bool IsRandomAccessTraversal
|
||||
>
|
||||
class iterator_facade_base;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
|
||||
// Macros which describe the declarations of binary operators
|
||||
# ifdef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY
|
||||
# define BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, enabler) \
|
||||
template < \
|
||||
class Derived1, class V1, class TC1, class Reference1, class Difference1 \
|
||||
, class Derived2, class V2, class TC2, class Reference2, class Difference2 \
|
||||
> \
|
||||
prefix typename mpl::apply2<result_type,Derived1,Derived2>::type \
|
||||
operator op( \
|
||||
iterator_facade<Derived1, V1, TC1, Reference1, Difference1> const& lhs \
|
||||
, iterator_facade<Derived2, V2, TC2, Reference2, Difference2> const& rhs)
|
||||
# else
|
||||
# define BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, enabler) \
|
||||
template < \
|
||||
class Derived1, class V1, class TC1, class Reference1, class Difference1 \
|
||||
, class Derived2, class V2, class TC2, class Reference2, class Difference2 \
|
||||
> \
|
||||
prefix typename enabler< \
|
||||
Derived1, Derived2 \
|
||||
, typename mpl::apply2<result_type,Derived1,Derived2>::type \
|
||||
>::type \
|
||||
operator op( \
|
||||
iterator_facade<Derived1, V1, TC1, Reference1, Difference1> const& lhs \
|
||||
, iterator_facade<Derived2, V2, TC2, Reference2, Difference2> const& rhs)
|
||||
# endif
|
||||
|
||||
# define BOOST_ITERATOR_FACADE_INTEROP_HEAD(prefix, op, result_type) \
|
||||
BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, boost::iterators::detail::enable_if_interoperable)
|
||||
|
||||
# define BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(prefix, op, result_type) \
|
||||
BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, boost::iterators::detail::enable_if_interoperable_and_random_access_traversal)
|
||||
|
||||
# define BOOST_ITERATOR_FACADE_PLUS_HEAD(prefix,args) \
|
||||
template <class Derived, class V, class TC, class R, class D> \
|
||||
prefix typename boost::iterators::enable_if< \
|
||||
boost::iterators::detail::is_traversal_at_least< TC, boost::iterators::random_access_traversal_tag >, \
|
||||
Derived \
|
||||
>::type operator+ args
|
||||
|
||||
//
|
||||
// Helper class for granting access to the iterator core interface.
|
||||
//
|
||||
// The simple core interface is used by iterator_facade. The core
|
||||
// interface of a user/library defined iterator type should not be made public
|
||||
// so that it does not clutter the public interface. Instead iterator_core_access
|
||||
// should be made friend so that iterator_facade can access the core
|
||||
// interface through iterator_core_access.
|
||||
//
|
||||
class iterator_core_access
|
||||
{
|
||||
# if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
|
||||
// Tasteless as this may seem, making all members public allows member templates
|
||||
// to work in the absence of member template friends.
|
||||
public:
|
||||
# else
|
||||
|
||||
template <class I, class V, class TC, class R, class D> friend class iterator_facade;
|
||||
template <class I, class V, class TC, class R, class D, bool IsBidirectionalTraversal, bool IsRandomAccessTraversal>
|
||||
friend class detail::iterator_facade_base;
|
||||
|
||||
# define BOOST_ITERATOR_FACADE_RELATION(op) \
|
||||
BOOST_ITERATOR_FACADE_INTEROP_HEAD(friend,op, boost::iterators::detail::always_bool2);
|
||||
|
||||
BOOST_ITERATOR_FACADE_RELATION(==)
|
||||
BOOST_ITERATOR_FACADE_RELATION(!=)
|
||||
|
||||
# undef BOOST_ITERATOR_FACADE_RELATION
|
||||
|
||||
# define BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(op) \
|
||||
BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(friend,op, boost::iterators::detail::always_bool2);
|
||||
|
||||
BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(<)
|
||||
BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(>)
|
||||
BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(<=)
|
||||
BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(>=)
|
||||
|
||||
# undef BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION
|
||||
|
||||
BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(
|
||||
friend, -, boost::iterators::detail::choose_difference_type)
|
||||
;
|
||||
|
||||
BOOST_ITERATOR_FACADE_PLUS_HEAD(
|
||||
friend inline
|
||||
, (iterator_facade<Derived, V, TC, R, D> const&
|
||||
, typename Derived::difference_type)
|
||||
)
|
||||
;
|
||||
|
||||
BOOST_ITERATOR_FACADE_PLUS_HEAD(
|
||||
friend inline
|
||||
, (typename Derived::difference_type
|
||||
, iterator_facade<Derived, V, TC, R, D> const&)
|
||||
)
|
||||
;
|
||||
|
||||
# endif
|
||||
|
||||
template <class Facade>
|
||||
static typename Facade::reference dereference(Facade const& f)
|
||||
{
|
||||
return f.dereference();
|
||||
}
|
||||
|
||||
template <class Facade>
|
||||
static void increment(Facade& f)
|
||||
{
|
||||
f.increment();
|
||||
}
|
||||
|
||||
template <class Facade>
|
||||
static void decrement(Facade& f)
|
||||
{
|
||||
f.decrement();
|
||||
}
|
||||
|
||||
template <class Facade1, class Facade2>
|
||||
static bool equal(Facade1 const& f1, Facade2 const& f2, mpl::true_)
|
||||
{
|
||||
return f1.equal(f2);
|
||||
}
|
||||
|
||||
template <class Facade1, class Facade2>
|
||||
static bool equal(Facade1 const& f1, Facade2 const& f2, mpl::false_)
|
||||
{
|
||||
return f2.equal(f1);
|
||||
}
|
||||
|
||||
template <class Facade>
|
||||
static void advance(Facade& f, typename Facade::difference_type n)
|
||||
{
|
||||
f.advance(n);
|
||||
}
|
||||
|
||||
template <class Facade1, class Facade2>
|
||||
static typename Facade1::difference_type distance_from(
|
||||
Facade1 const& f1, Facade2 const& f2, mpl::true_)
|
||||
{
|
||||
return -f1.distance_to(f2);
|
||||
}
|
||||
|
||||
template <class Facade1, class Facade2>
|
||||
static typename Facade2::difference_type distance_from(
|
||||
Facade1 const& f1, Facade2 const& f2, mpl::false_)
|
||||
{
|
||||
return f2.distance_to(f1);
|
||||
}
|
||||
|
||||
//
|
||||
// Curiously Recurring Template interface.
|
||||
//
|
||||
template <class I, class V, class TC, class R, class D>
|
||||
static I& derived(iterator_facade<I,V,TC,R,D>& facade)
|
||||
{
|
||||
return *static_cast<I*>(&facade);
|
||||
}
|
||||
|
||||
template <class I, class V, class TC, class R, class D>
|
||||
static I const& derived(iterator_facade<I,V,TC,R,D> const& facade)
|
||||
{
|
||||
return *static_cast<I const*>(&facade);
|
||||
}
|
||||
|
||||
// objects of this class are useless
|
||||
BOOST_DELETED_FUNCTION(iterator_core_access())
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
// Implementation for forward traversal iterators
|
||||
template <
|
||||
class Derived
|
||||
, class Value
|
||||
, class CategoryOrTraversal
|
||||
, class Reference
|
||||
, class Difference
|
||||
>
|
||||
class iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, false, false >
|
||||
# ifdef BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE
|
||||
: public boost::iterators::detail::iterator_facade_types<
|
||||
Value, CategoryOrTraversal, Reference, Difference
|
||||
>::base
|
||||
# undef BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE
|
||||
# endif
|
||||
{
|
||||
private:
|
||||
typedef boost::iterators::detail::iterator_facade_types<
|
||||
Value, CategoryOrTraversal, Reference, Difference
|
||||
> associated_types;
|
||||
|
||||
typedef boost::iterators::detail::operator_arrow_dispatch<
|
||||
Reference
|
||||
, typename associated_types::pointer
|
||||
> operator_arrow_dispatch_;
|
||||
|
||||
public:
|
||||
typedef typename associated_types::value_type value_type;
|
||||
typedef Reference reference;
|
||||
typedef Difference difference_type;
|
||||
|
||||
typedef typename operator_arrow_dispatch_::result_type pointer;
|
||||
|
||||
typedef typename associated_types::iterator_category iterator_category;
|
||||
|
||||
public:
|
||||
reference operator*() const
|
||||
{
|
||||
return iterator_core_access::dereference(this->derived());
|
||||
}
|
||||
|
||||
pointer operator->() const
|
||||
{
|
||||
return operator_arrow_dispatch_::apply(*this->derived());
|
||||
}
|
||||
|
||||
Derived& operator++()
|
||||
{
|
||||
iterator_core_access::increment(this->derived());
|
||||
return this->derived();
|
||||
}
|
||||
|
||||
protected:
|
||||
//
|
||||
// Curiously Recurring Template interface.
|
||||
//
|
||||
Derived& derived()
|
||||
{
|
||||
return *static_cast<Derived*>(this);
|
||||
}
|
||||
|
||||
Derived const& derived() const
|
||||
{
|
||||
return *static_cast<Derived const*>(this);
|
||||
}
|
||||
};
|
||||
|
||||
// Implementation for bidirectional traversal iterators
|
||||
template <
|
||||
class Derived
|
||||
, class Value
|
||||
, class CategoryOrTraversal
|
||||
, class Reference
|
||||
, class Difference
|
||||
>
|
||||
class iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, false > :
|
||||
public iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, false, false >
|
||||
{
|
||||
public:
|
||||
Derived& operator--()
|
||||
{
|
||||
iterator_core_access::decrement(this->derived());
|
||||
return this->derived();
|
||||
}
|
||||
|
||||
Derived operator--(int)
|
||||
{
|
||||
Derived tmp(this->derived());
|
||||
--*this;
|
||||
return tmp;
|
||||
}
|
||||
};
|
||||
|
||||
// Implementation for random access traversal iterators
|
||||
template <
|
||||
class Derived
|
||||
, class Value
|
||||
, class CategoryOrTraversal
|
||||
, class Reference
|
||||
, class Difference
|
||||
>
|
||||
class iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, true > :
|
||||
public iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, false >
|
||||
{
|
||||
private:
|
||||
typedef iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, false > base_type;
|
||||
|
||||
public:
|
||||
typedef typename base_type::reference reference;
|
||||
typedef typename base_type::difference_type difference_type;
|
||||
|
||||
public:
|
||||
typename boost::iterators::detail::operator_brackets_result<Derived, Value, reference>::type
|
||||
operator[](difference_type n) const
|
||||
{
|
||||
typedef boost::iterators::detail::use_operator_brackets_proxy<Value, Reference> use_proxy;
|
||||
|
||||
return boost::iterators::detail::make_operator_brackets_result<Derived>(
|
||||
this->derived() + n
|
||||
, use_proxy()
|
||||
);
|
||||
}
|
||||
|
||||
Derived& operator+=(difference_type n)
|
||||
{
|
||||
iterator_core_access::advance(this->derived(), n);
|
||||
return this->derived();
|
||||
}
|
||||
|
||||
Derived& operator-=(difference_type n)
|
||||
{
|
||||
iterator_core_access::advance(this->derived(), -n);
|
||||
return this->derived();
|
||||
}
|
||||
|
||||
Derived operator-(difference_type x) const
|
||||
{
|
||||
Derived result(this->derived());
|
||||
return result -= x;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// iterator_facade - use as a public base class for defining new
|
||||
// standard-conforming iterators.
|
||||
//
|
||||
template <
|
||||
class Derived // The derived iterator type being constructed
|
||||
, class Value
|
||||
, class CategoryOrTraversal
|
||||
, class Reference = Value&
|
||||
, class Difference = std::ptrdiff_t
|
||||
>
|
||||
class iterator_facade :
|
||||
public detail::iterator_facade_base<
|
||||
Derived,
|
||||
Value,
|
||||
CategoryOrTraversal,
|
||||
Reference,
|
||||
Difference,
|
||||
detail::is_traversal_at_least< CategoryOrTraversal, bidirectional_traversal_tag >::value,
|
||||
detail::is_traversal_at_least< CategoryOrTraversal, random_access_traversal_tag >::value
|
||||
>
|
||||
{
|
||||
protected:
|
||||
// For use by derived classes
|
||||
typedef iterator_facade<Derived,Value,CategoryOrTraversal,Reference,Difference> iterator_facade_;
|
||||
};
|
||||
|
||||
template <class I, class V, class TC, class R, class D>
|
||||
inline typename boost::iterators::detail::postfix_increment_result<I,V,R,TC>::type
|
||||
operator++(
|
||||
iterator_facade<I,V,TC,R,D>& i
|
||||
, int
|
||||
)
|
||||
{
|
||||
typename boost::iterators::detail::postfix_increment_result<I,V,R,TC>::type
|
||||
tmp(*static_cast<I*>(&i));
|
||||
|
||||
++i;
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Comparison operator implementation. The library supplied operators
|
||||
// enables the user to provide fully interoperable constant/mutable
|
||||
// iterator types. I.e. the library provides all operators
|
||||
// for all mutable/constant iterator combinations.
|
||||
//
|
||||
// Note though that this kind of interoperability for constant/mutable
|
||||
// iterators is not required by the standard for container iterators.
|
||||
// All the standard asks for is a conversion mutable -> constant.
|
||||
// Most standard library implementations nowadays provide fully interoperable
|
||||
// iterator implementations, but there are still heavily used implementations
|
||||
// that do not provide them. (Actually it's even worse, they do not provide
|
||||
// them for only a few iterators.)
|
||||
//
|
||||
// ?? Maybe a BOOST_ITERATOR_NO_FULL_INTEROPERABILITY macro should
|
||||
// enable the user to turn off mixed type operators
|
||||
//
|
||||
// The library takes care to provide only the right operator overloads.
|
||||
// I.e.
|
||||
//
|
||||
// bool operator==(Iterator, Iterator);
|
||||
// bool operator==(ConstIterator, Iterator);
|
||||
// bool operator==(Iterator, ConstIterator);
|
||||
// bool operator==(ConstIterator, ConstIterator);
|
||||
//
|
||||
// ...
|
||||
//
|
||||
// In order to do so it uses c++ idioms that are not yet widely supported
|
||||
// by current compiler releases. The library is designed to degrade gracefully
|
||||
// in the face of compiler deficiencies. In general compiler
|
||||
// deficiencies result in less strict error checking and more obscure
|
||||
// error messages, functionality is not affected.
|
||||
//
|
||||
// For full operation compiler support for "Substitution Failure Is Not An Error"
|
||||
// (aka. enable_if) and boost::is_convertible is required.
|
||||
//
|
||||
// The following problems occur if support is lacking.
|
||||
//
|
||||
// Pseudo code
|
||||
//
|
||||
// ---------------
|
||||
// AdaptorA<Iterator1> a1;
|
||||
// AdaptorA<Iterator2> a2;
|
||||
//
|
||||
// // This will result in a no such overload error in full operation
|
||||
// // If enable_if or is_convertible is not supported
|
||||
// // The instantiation will fail with an error hopefully indicating that
|
||||
// // there is no operator== for Iterator1, Iterator2
|
||||
// // The same will happen if no enable_if is used to remove
|
||||
// // false overloads from the templated conversion constructor
|
||||
// // of AdaptorA.
|
||||
//
|
||||
// a1 == a2;
|
||||
// ----------------
|
||||
//
|
||||
// AdaptorA<Iterator> a;
|
||||
// AdaptorB<Iterator> b;
|
||||
//
|
||||
// // This will result in a no such overload error in full operation
|
||||
// // If enable_if is not supported the static assert used
|
||||
// // in the operator implementation will fail.
|
||||
// // This will accidently work if is_convertible is not supported.
|
||||
//
|
||||
// a == b;
|
||||
// ----------------
|
||||
//
|
||||
|
||||
# ifdef BOOST_NO_ONE_WAY_ITERATOR_INTEROP
|
||||
# define BOOST_ITERATOR_CONVERTIBLE(a,b) mpl::true_()
|
||||
# else
|
||||
# define BOOST_ITERATOR_CONVERTIBLE(a,b) is_convertible<a,b>()
|
||||
# endif
|
||||
|
||||
# define BOOST_ITERATOR_FACADE_INTEROP(op, result_type, return_prefix, base_op) \
|
||||
BOOST_ITERATOR_FACADE_INTEROP_HEAD(inline, op, result_type) \
|
||||
{ \
|
||||
/* For those compilers that do not support enable_if */ \
|
||||
BOOST_STATIC_ASSERT(( \
|
||||
is_interoperable< Derived1, Derived2 >::value \
|
||||
)); \
|
||||
return_prefix iterator_core_access::base_op( \
|
||||
*static_cast<Derived1 const*>(&lhs) \
|
||||
, *static_cast<Derived2 const*>(&rhs) \
|
||||
, BOOST_ITERATOR_CONVERTIBLE(Derived2,Derived1) \
|
||||
); \
|
||||
}
|
||||
|
||||
# define BOOST_ITERATOR_FACADE_RELATION(op, return_prefix, base_op) \
|
||||
BOOST_ITERATOR_FACADE_INTEROP( \
|
||||
op \
|
||||
, boost::iterators::detail::always_bool2 \
|
||||
, return_prefix \
|
||||
, base_op \
|
||||
)
|
||||
|
||||
BOOST_ITERATOR_FACADE_RELATION(==, return, equal)
|
||||
BOOST_ITERATOR_FACADE_RELATION(!=, return !, equal)
|
||||
|
||||
# undef BOOST_ITERATOR_FACADE_RELATION
|
||||
|
||||
|
||||
# define BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS(op, result_type, return_prefix, base_op) \
|
||||
BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(inline, op, result_type) \
|
||||
{ \
|
||||
/* For those compilers that do not support enable_if */ \
|
||||
BOOST_STATIC_ASSERT(( \
|
||||
is_interoperable< Derived1, Derived2 >::value && \
|
||||
boost::iterators::detail::is_traversal_at_least< typename iterator_category< Derived1 >::type, random_access_traversal_tag >::value && \
|
||||
boost::iterators::detail::is_traversal_at_least< typename iterator_category< Derived2 >::type, random_access_traversal_tag >::value \
|
||||
)); \
|
||||
return_prefix iterator_core_access::base_op( \
|
||||
*static_cast<Derived1 const*>(&lhs) \
|
||||
, *static_cast<Derived2 const*>(&rhs) \
|
||||
, BOOST_ITERATOR_CONVERTIBLE(Derived2,Derived1) \
|
||||
); \
|
||||
}
|
||||
|
||||
# define BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(op, return_prefix, base_op) \
|
||||
BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS( \
|
||||
op \
|
||||
, boost::iterators::detail::always_bool2 \
|
||||
, return_prefix \
|
||||
, base_op \
|
||||
)
|
||||
|
||||
BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(<, return 0 >, distance_from)
|
||||
BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(>, return 0 <, distance_from)
|
||||
BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(<=, return 0 >=, distance_from)
|
||||
BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(>=, return 0 <=, distance_from)
|
||||
|
||||
# undef BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION
|
||||
|
||||
// operator- requires an additional part in the static assertion
|
||||
BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS(
|
||||
-
|
||||
, boost::iterators::detail::choose_difference_type
|
||||
, return
|
||||
, distance_from
|
||||
)
|
||||
|
||||
# undef BOOST_ITERATOR_FACADE_INTEROP
|
||||
# undef BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS
|
||||
|
||||
# define BOOST_ITERATOR_FACADE_PLUS(args) \
|
||||
BOOST_ITERATOR_FACADE_PLUS_HEAD(inline, args) \
|
||||
{ \
|
||||
Derived tmp(static_cast<Derived const&>(i)); \
|
||||
return tmp += n; \
|
||||
}
|
||||
|
||||
BOOST_ITERATOR_FACADE_PLUS((
|
||||
iterator_facade<Derived, V, TC, R, D> const& i
|
||||
, typename Derived::difference_type n
|
||||
))
|
||||
|
||||
BOOST_ITERATOR_FACADE_PLUS((
|
||||
typename Derived::difference_type n
|
||||
, iterator_facade<Derived, V, TC, R, D> const& i
|
||||
))
|
||||
|
||||
# undef BOOST_ITERATOR_FACADE_PLUS
|
||||
# undef BOOST_ITERATOR_FACADE_PLUS_HEAD
|
||||
|
||||
# undef BOOST_ITERATOR_FACADE_INTEROP_HEAD
|
||||
# undef BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD
|
||||
# undef BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL
|
||||
|
||||
} // namespace iterators
|
||||
|
||||
using iterators::iterator_core_access;
|
||||
using iterators::iterator_facade;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/iterator/detail/config_undef.hpp>
|
||||
|
||||
#endif // BOOST_ITERATOR_FACADE_23022003THW_HPP
|
||||
@@ -0,0 +1,222 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <
|
||||
typename F
|
||||
, typename A0
|
||||
>
|
||||
inline
|
||||
typename detail::expression::function_eval<
|
||||
F
|
||||
, A0
|
||||
>::type const
|
||||
bind(F f, A0 const& a0)
|
||||
{
|
||||
return
|
||||
detail::expression::function_eval<F, A0>::make(
|
||||
f
|
||||
, a0
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <
|
||||
typename F
|
||||
, typename A0 , typename A1
|
||||
>
|
||||
inline
|
||||
typename detail::expression::function_eval<
|
||||
F
|
||||
, A0 , A1
|
||||
>::type const
|
||||
bind(F f, A0 const& a0 , A1 const& a1)
|
||||
{
|
||||
return
|
||||
detail::expression::function_eval<F, A0 , A1>::make(
|
||||
f
|
||||
, a0 , a1
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <
|
||||
typename F
|
||||
, typename A0 , typename A1 , typename A2
|
||||
>
|
||||
inline
|
||||
typename detail::expression::function_eval<
|
||||
F
|
||||
, A0 , A1 , A2
|
||||
>::type const
|
||||
bind(F f, A0 const& a0 , A1 const& a1 , A2 const& a2)
|
||||
{
|
||||
return
|
||||
detail::expression::function_eval<F, A0 , A1 , A2>::make(
|
||||
f
|
||||
, a0 , a1 , a2
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <
|
||||
typename F
|
||||
, typename A0 , typename A1 , typename A2 , typename A3
|
||||
>
|
||||
inline
|
||||
typename detail::expression::function_eval<
|
||||
F
|
||||
, A0 , A1 , A2 , A3
|
||||
>::type const
|
||||
bind(F f, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3)
|
||||
{
|
||||
return
|
||||
detail::expression::function_eval<F, A0 , A1 , A2 , A3>::make(
|
||||
f
|
||||
, a0 , a1 , a2 , a3
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <
|
||||
typename F
|
||||
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4
|
||||
>
|
||||
inline
|
||||
typename detail::expression::function_eval<
|
||||
F
|
||||
, A0 , A1 , A2 , A3 , A4
|
||||
>::type const
|
||||
bind(F f, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4)
|
||||
{
|
||||
return
|
||||
detail::expression::function_eval<F, A0 , A1 , A2 , A3 , A4>::make(
|
||||
f
|
||||
, a0 , a1 , a2 , a3 , a4
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <
|
||||
typename F
|
||||
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5
|
||||
>
|
||||
inline
|
||||
typename detail::expression::function_eval<
|
||||
F
|
||||
, A0 , A1 , A2 , A3 , A4 , A5
|
||||
>::type const
|
||||
bind(F f, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5)
|
||||
{
|
||||
return
|
||||
detail::expression::function_eval<F, A0 , A1 , A2 , A3 , A4 , A5>::make(
|
||||
f
|
||||
, a0 , a1 , a2 , a3 , a4 , a5
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <
|
||||
typename F
|
||||
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6
|
||||
>
|
||||
inline
|
||||
typename detail::expression::function_eval<
|
||||
F
|
||||
, A0 , A1 , A2 , A3 , A4 , A5 , A6
|
||||
>::type const
|
||||
bind(F f, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6)
|
||||
{
|
||||
return
|
||||
detail::expression::function_eval<F, A0 , A1 , A2 , A3 , A4 , A5 , A6>::make(
|
||||
f
|
||||
, a0 , a1 , a2 , a3 , a4 , a5 , a6
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <
|
||||
typename F
|
||||
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7
|
||||
>
|
||||
inline
|
||||
typename detail::expression::function_eval<
|
||||
F
|
||||
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7
|
||||
>::type const
|
||||
bind(F f, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7)
|
||||
{
|
||||
return
|
||||
detail::expression::function_eval<F, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7>::make(
|
||||
f
|
||||
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <
|
||||
typename F
|
||||
, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8
|
||||
>
|
||||
inline
|
||||
typename detail::expression::function_eval<
|
||||
F
|
||||
, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8
|
||||
>::type const
|
||||
bind(F f, A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8)
|
||||
{
|
||||
return
|
||||
detail::expression::function_eval<F, A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8>::make(
|
||||
f
|
||||
, a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8
|
||||
);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,145 @@
|
||||
// Copyright (C) 2005, 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)
|
||||
|
||||
// Message Passing Interface 1.1 -- Section 4.4. Broadcast
|
||||
#ifndef BOOST_MPI_BROADCAST_HPP
|
||||
#define BOOST_MPI_BROADCAST_HPP
|
||||
|
||||
#include <boost/mpi/collectives_fwd.hpp>
|
||||
#include <boost/mpi/exception.hpp>
|
||||
#include <boost/mpi/datatype.hpp>
|
||||
#include <boost/mpi/communicator.hpp>
|
||||
|
||||
namespace boost { namespace mpi {
|
||||
|
||||
/************************************************************************
|
||||
* Specializations *
|
||||
************************************************************************/
|
||||
|
||||
/**
|
||||
* INTERNAL ONLY
|
||||
*/
|
||||
template<>
|
||||
BOOST_MPI_DECL void
|
||||
broadcast<const packed_oarchive>(const communicator& comm,
|
||||
const packed_oarchive& oa,
|
||||
int root);
|
||||
|
||||
/**
|
||||
* INTERNAL ONLY
|
||||
*/
|
||||
template<>
|
||||
BOOST_MPI_DECL void
|
||||
broadcast<packed_oarchive>(const communicator& comm, packed_oarchive& oa,
|
||||
int root);
|
||||
|
||||
/**
|
||||
* INTERNAL ONLY
|
||||
*/
|
||||
template<>
|
||||
BOOST_MPI_DECL void
|
||||
broadcast<packed_iarchive>(const communicator& comm, packed_iarchive& ia,
|
||||
int root);
|
||||
|
||||
/**
|
||||
* INTERNAL ONLY
|
||||
*/
|
||||
template<>
|
||||
BOOST_MPI_DECL void
|
||||
broadcast<const packed_skeleton_oarchive>(const communicator& comm,
|
||||
const packed_skeleton_oarchive& oa,
|
||||
int root);
|
||||
|
||||
/**
|
||||
* INTERNAL ONLY
|
||||
*/
|
||||
template<>
|
||||
void
|
||||
broadcast<packed_skeleton_oarchive>(const communicator& comm,
|
||||
packed_skeleton_oarchive& oa, int root);
|
||||
|
||||
/**
|
||||
* INTERNAL ONLY
|
||||
*/
|
||||
template<>
|
||||
void
|
||||
broadcast<packed_skeleton_iarchive>(const communicator& comm,
|
||||
packed_skeleton_iarchive& ia, int root);
|
||||
|
||||
/**
|
||||
* INTERNAL ONLY
|
||||
*/
|
||||
template<>
|
||||
void broadcast<content>(const communicator& comm, content& c, int root);
|
||||
|
||||
/**
|
||||
* INTERNAL ONLY
|
||||
*/
|
||||
template<>
|
||||
void broadcast<const content>(const communicator& comm, const content& c,
|
||||
int root);
|
||||
|
||||
/************************************************************************
|
||||
* broadcast() implementation *
|
||||
************************************************************************/
|
||||
namespace detail {
|
||||
// We're sending a type that has an associated MPI datatype, so
|
||||
// we'll use MPI_Bcast to do all of the work.
|
||||
template<typename T>
|
||||
void
|
||||
broadcast_impl(const communicator& comm, T* values, int n, int root,
|
||||
mpl::true_)
|
||||
{
|
||||
BOOST_MPI_CHECK_RESULT(MPI_Bcast,
|
||||
(values, n,
|
||||
boost::mpi::get_mpi_datatype<T>(*values),
|
||||
root, MPI_Comm(comm)));
|
||||
}
|
||||
|
||||
// We're sending a type that does not have an associated MPI
|
||||
// datatype, so we'll need to serialize it. Unfortunately, this
|
||||
// means that we cannot use MPI_Bcast, so we'll just send from the
|
||||
// root to everyone else.
|
||||
template<typename T>
|
||||
void
|
||||
broadcast_impl(const communicator& comm, T* values, int n, int root,
|
||||
mpl::false_)
|
||||
{
|
||||
if (comm.rank() == root) {
|
||||
packed_oarchive oa(comm);
|
||||
for (int i = 0; i < n; ++i)
|
||||
oa << values[i];
|
||||
broadcast(comm, oa, root);
|
||||
} else {
|
||||
packed_iarchive ia(comm);
|
||||
broadcast(comm, ia, root);
|
||||
for (int i = 0; i < n; ++i)
|
||||
ia >> values[i];
|
||||
}
|
||||
}
|
||||
} // end namespace detail
|
||||
|
||||
template<typename T>
|
||||
void broadcast(const communicator& comm, T& value, int root)
|
||||
{
|
||||
detail::broadcast_impl(comm, &value, 1, root, is_mpi_datatype<T>());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void broadcast(const communicator& comm, T* values, int n, int root)
|
||||
{
|
||||
detail::broadcast_impl(comm, values, n, root, is_mpi_datatype<T>());
|
||||
}
|
||||
|
||||
} } // end namespace boost::mpi
|
||||
|
||||
// If the user has already included skeleton_and_content.hpp, include
|
||||
// the code to broadcast skeletons and content.
|
||||
#ifdef BOOST_MPI_SKELETON_AND_CONTENT_HPP
|
||||
# include <boost/mpi/detail/broadcast_sc.hpp>
|
||||
#endif
|
||||
|
||||
#endif // BOOST_MPI_BROADCAST_HPP
|
||||
@@ -0,0 +1,175 @@
|
||||
/* boost random/laplace_distribution.hpp header file
|
||||
*
|
||||
* Copyright Steven Watanabe 2014
|
||||
* Distributed under the Boost Software License, Version 1.0. (See
|
||||
* accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* See http://www.boost.org for most recent version including documentation.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef BOOST_RANDOM_LAPLACE_DISTRIBUTION_HPP
|
||||
#define BOOST_RANDOM_LAPLACE_DISTRIBUTION_HPP
|
||||
|
||||
#include <cassert>
|
||||
#include <istream>
|
||||
#include <iosfwd>
|
||||
#include <boost/random/detail/operators.hpp>
|
||||
#include <boost/random/exponential_distribution.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace random {
|
||||
|
||||
/**
|
||||
* The laplace distribution is a real-valued distribution with
|
||||
* two parameters, mean and beta.
|
||||
*
|
||||
* It has \f$\displaystyle p(x) = \frac{e^-{\frac{|x-\mu|}{\beta}}}{2\beta}\f$.
|
||||
*/
|
||||
template<class RealType = double>
|
||||
class laplace_distribution {
|
||||
public:
|
||||
typedef RealType result_type;
|
||||
typedef RealType input_type;
|
||||
|
||||
class param_type {
|
||||
public:
|
||||
typedef laplace_distribution distribution_type;
|
||||
|
||||
/**
|
||||
* Constructs a @c param_type from the "mean" and "beta" parameters
|
||||
* of the distribution.
|
||||
*/
|
||||
explicit param_type(RealType mean_arg = RealType(0.0),
|
||||
RealType beta_arg = RealType(1.0))
|
||||
: _mean(mean_arg), _beta(beta_arg)
|
||||
{}
|
||||
|
||||
/** Returns the "mean" parameter of the distribtuion. */
|
||||
RealType mean() const { return _mean; }
|
||||
/** Returns the "beta" parameter of the distribution. */
|
||||
RealType beta() const { return _beta; }
|
||||
|
||||
/** Writes a @c param_type to a @c std::ostream. */
|
||||
BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, param_type, parm)
|
||||
{ os << parm._mean << ' ' << parm._beta; return os; }
|
||||
|
||||
/** Reads a @c param_type from a @c std::istream. */
|
||||
BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR(is, param_type, parm)
|
||||
{ is >> parm._mean >> std::ws >> parm._beta; return is; }
|
||||
|
||||
/** Returns true if the two sets of parameters are the same. */
|
||||
BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(param_type, lhs, rhs)
|
||||
{ return lhs._mean == rhs._mean && lhs._beta == rhs._beta; }
|
||||
|
||||
/** Returns true if the two sets of parameters are the different. */
|
||||
BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR(param_type)
|
||||
|
||||
private:
|
||||
RealType _mean;
|
||||
RealType _beta;
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs an @c laplace_distribution from its "mean" and "beta" parameters.
|
||||
*/
|
||||
explicit laplace_distribution(RealType mean_arg = RealType(0.0),
|
||||
RealType beta_arg = RealType(1.0))
|
||||
: _mean(mean_arg), _beta(beta_arg)
|
||||
{}
|
||||
/** Constructs an @c laplace_distribution from its parameters. */
|
||||
explicit laplace_distribution(const param_type& parm)
|
||||
: _mean(parm.mean()), _beta(parm.beta())
|
||||
{}
|
||||
|
||||
/**
|
||||
* Returns a random variate distributed according to the
|
||||
* laplace distribution.
|
||||
*/
|
||||
template<class URNG>
|
||||
RealType operator()(URNG& urng) const
|
||||
{
|
||||
RealType exponential = exponential_distribution<RealType>()(urng);
|
||||
if(uniform_01<RealType>()(urng) < 0.5)
|
||||
exponential = -exponential;
|
||||
return _mean + _beta * exponential;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a random variate distributed accordint to the laplace
|
||||
* distribution with parameters specified by @c param.
|
||||
*/
|
||||
template<class URNG>
|
||||
RealType operator()(URNG& urng, const param_type& parm) const
|
||||
{
|
||||
return laplace_distribution(parm)(urng);
|
||||
}
|
||||
|
||||
/** Returns the "mean" parameter of the distribution. */
|
||||
RealType mean() const { return _mean; }
|
||||
/** Returns the "beta" parameter of the distribution. */
|
||||
RealType beta() const { return _beta; }
|
||||
|
||||
/** Returns the smallest value that the distribution can produce. */
|
||||
RealType min BOOST_PREVENT_MACRO_SUBSTITUTION () const
|
||||
{ return RealType(-std::numeric_limits<RealType>::infinity()); }
|
||||
/** Returns the largest value that the distribution can produce. */
|
||||
RealType max BOOST_PREVENT_MACRO_SUBSTITUTION () const
|
||||
{ return RealType(std::numeric_limits<RealType>::infinity()); }
|
||||
|
||||
/** Returns the parameters of the distribution. */
|
||||
param_type param() const { return param_type(_mean, _beta); }
|
||||
/** Sets the parameters of the distribution. */
|
||||
void param(const param_type& parm)
|
||||
{
|
||||
_mean = parm.mean();
|
||||
_beta = parm.beta();
|
||||
}
|
||||
|
||||
/**
|
||||
* Effects: Subsequent uses of the distribution do not depend
|
||||
* on values produced by any engine prior to invoking reset.
|
||||
*/
|
||||
void reset() { }
|
||||
|
||||
/** Writes an @c laplace_distribution to a @c std::ostream. */
|
||||
BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, laplace_distribution, wd)
|
||||
{
|
||||
os << wd.param();
|
||||
return os;
|
||||
}
|
||||
|
||||
/** Reads an @c laplace_distribution from a @c std::istream. */
|
||||
BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR(is, laplace_distribution, wd)
|
||||
{
|
||||
param_type parm;
|
||||
if(is >> parm) {
|
||||
wd.param(parm);
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the two instances of @c laplace_distribution will
|
||||
* return identical sequences of values given equal generators.
|
||||
*/
|
||||
BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(laplace_distribution, lhs, rhs)
|
||||
{ return lhs._mean == rhs._mean && lhs._beta == rhs._beta; }
|
||||
|
||||
/**
|
||||
* Returns true if the two instances of @c laplace_distribution will
|
||||
* return different sequences of values given equal generators.
|
||||
*/
|
||||
BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR(laplace_distribution)
|
||||
|
||||
private:
|
||||
RealType _mean;
|
||||
RealType _beta;
|
||||
};
|
||||
|
||||
} // namespace random
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_RANDOM_LAPLACE_DISTRIBUTION_HPP
|
||||
@@ -0,0 +1,42 @@
|
||||
#ifndef FOREIGN_KEY_DELEGATE_HPP_
|
||||
#define FOREIGN_KEY_DELEGATE_HPP_
|
||||
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QScopedPointer>
|
||||
|
||||
class CandidateKeyFilter;
|
||||
|
||||
//
|
||||
// Class ForeignKeyDelegate
|
||||
//
|
||||
// Item delegate for editing a foreign key item in a one or many
|
||||
// to one relationship. A QComboBox is used as an item delegate
|
||||
// for the edit role.
|
||||
//
|
||||
class ForeignKeyDelegate final
|
||||
: public QStyledItemDelegate
|
||||
{
|
||||
public:
|
||||
// many to many relationship
|
||||
explicit ForeignKeyDelegate (QAbstractItemModel * referenced_model
|
||||
, int referenced_key_column
|
||||
, QObject * parent = nullptr
|
||||
, int referenced_key_role = Qt::EditRole);
|
||||
|
||||
// one to many (referenced to referencing) relationship
|
||||
explicit ForeignKeyDelegate (QAbstractItemModel * referenced_model
|
||||
, QAbstractItemModel const * referencing_model
|
||||
, int referenced_key_column
|
||||
, int referencing_key_column
|
||||
, QObject * parent = nullptr
|
||||
, int referenced_key_role = Qt::EditRole
|
||||
, int referencing_key_role = Qt::EditRole);
|
||||
~ForeignKeyDelegate ();
|
||||
|
||||
QWidget * createEditor (QWidget * parent, QStyleOptionViewItem const&, QModelIndex const&) const override;
|
||||
|
||||
private:
|
||||
QScopedPointer<CandidateKeyFilter> candidate_key_filter_;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_CONFIG_GCC_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_CONFIG_GCC_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 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(__GNUC__) && !defined(__EDG_VERSION__)
|
||||
# define BOOST_MPL_CFG_GCC ((__GNUC__ << 8) | __GNUC_MINOR__)
|
||||
#else
|
||||
# define BOOST_MPL_CFG_GCC 0
|
||||
#endif
|
||||
|
||||
#endif // BOOST_MPL_AUX_CONFIG_GCC_HPP_INCLUDED
|
||||
@@ -0,0 +1,89 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
=============================================================================*/
|
||||
#ifndef BOOST_SPIRIT_ACTOR_ERASE_ACTOR_HPP
|
||||
#define BOOST_SPIRIT_ACTOR_ERASE_ACTOR_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
#include <boost/spirit/home/classic/actor/ref_value_actor.hpp>
|
||||
#include <boost/spirit/home/classic/actor/ref_const_ref_actor.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Summary:
|
||||
// A semantic action policy that calss the erase method.
|
||||
// (This doc uses convention available in actors.hpp)
|
||||
//
|
||||
// Actions (what it does):
|
||||
// ref.erase( value );
|
||||
// ref.erase( T::key_type(first,last) );
|
||||
// ref.erase( key_ref );
|
||||
//
|
||||
// Policy name:
|
||||
// erase_action
|
||||
//
|
||||
// Policy holder, corresponding helper method:
|
||||
// ref_value_actor, erase_a( ref );
|
||||
// ref_const_ref_actor, erase_a( ref, key_ref );
|
||||
//
|
||||
// () operators: both
|
||||
//
|
||||
// See also ref_value_actor and ref_const_ref_actor for more details.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
struct erase_action
|
||||
{
|
||||
template<
|
||||
typename T,
|
||||
typename KeyT
|
||||
>
|
||||
void act(T& ref_, KeyT const& key_) const
|
||||
{
|
||||
ref_.erase(key_);
|
||||
}
|
||||
template<
|
||||
typename T,
|
||||
typename IteratorT
|
||||
>
|
||||
void act(
|
||||
T& ref_,
|
||||
IteratorT const& first_,
|
||||
IteratorT const& last_
|
||||
) const
|
||||
{
|
||||
typedef typename T::key_type key_type;
|
||||
key_type key(first_,last_);
|
||||
|
||||
ref_.erase(key);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline ref_value_actor<T,erase_action> erase_a(T& ref_)
|
||||
{
|
||||
return ref_value_actor<T,erase_action>(ref_);
|
||||
}
|
||||
|
||||
template<
|
||||
typename T,
|
||||
typename KeyT
|
||||
>
|
||||
inline ref_const_ref_actor<T,KeyT,erase_action> erase_a(
|
||||
T& ref_,
|
||||
KeyT const& key_
|
||||
)
|
||||
{
|
||||
return ref_const_ref_actor<T,KeyT,erase_action>(ref_,key_);
|
||||
}
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,25 @@
|
||||
subroutine twkfreq65(c4aa,n5,a)
|
||||
|
||||
complex c4aa(n5)
|
||||
real a(5)
|
||||
complex w,wstep
|
||||
data twopi/6.283185307/
|
||||
|
||||
! Apply AFC corrections to the c4aa data
|
||||
w=1.0
|
||||
wstep=1.0
|
||||
x0=0.5*(n5+1)
|
||||
s=2.0/n5
|
||||
do i=1,n5
|
||||
x=s*(i-x0)
|
||||
if(mod(i,100).eq.1) then
|
||||
p2=1.5*x*x - 0.5
|
||||
dphi=(a(1) + x*a(2) + p2*a(3)) * (twopi/1378.125)
|
||||
wstep=cmplx(cos(dphi),sin(dphi))
|
||||
endif
|
||||
w=w*wstep
|
||||
c4aa(i)=w*c4aa(i)
|
||||
enddo
|
||||
|
||||
return
|
||||
end subroutine twkfreq65
|
||||
@@ -0,0 +1,57 @@
|
||||
#ifndef BOOST_PP_IS_ITERATING
|
||||
// Copyright David Abrahams 2002.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
# ifndef TYPE_LIST_IMPL_DWA2002913_HPP
|
||||
# define TYPE_LIST_IMPL_DWA2002913_HPP
|
||||
|
||||
# include <boost/python/detail/type_list.hpp>
|
||||
|
||||
# include <boost/preprocessor/enum_params.hpp>
|
||||
# include <boost/preprocessor/enum_params_with_a_default.hpp>
|
||||
# include <boost/preprocessor/repetition/enum.hpp>
|
||||
# include <boost/preprocessor/comma_if.hpp>
|
||||
# include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
# include <boost/preprocessor/iterate.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_trailing.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PYTHON_LIST_SIZE, class T, mpl::void_)>
|
||||
struct type_list
|
||||
: BOOST_PP_CAT(mpl::vector,BOOST_PYTHON_LIST_SIZE)<BOOST_PP_ENUM_PARAMS_Z(1, BOOST_PYTHON_LIST_SIZE, T)>
|
||||
{
|
||||
};
|
||||
|
||||
# define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (0, BOOST_PP_DEC(BOOST_PYTHON_LIST_SIZE), <boost/python/detail/type_list_impl.hpp>))
|
||||
# include BOOST_PP_ITERATE()
|
||||
|
||||
|
||||
}}} // namespace boost::python::detail
|
||||
|
||||
# endif // TYPE_LIST_IMPL_DWA2002913_HPP
|
||||
|
||||
#else // BOOST_PP_IS_ITERATING
|
||||
|
||||
# define N BOOST_PP_ITERATION()
|
||||
# define BOOST_PYTHON_VOID_ARGS BOOST_PP_SUB_D(1,BOOST_PYTHON_LIST_SIZE,N)
|
||||
|
||||
template <
|
||||
BOOST_PP_ENUM_PARAMS_Z(1, N, class T)
|
||||
>
|
||||
struct type_list<
|
||||
BOOST_PP_ENUM_PARAMS_Z(1, N, T)
|
||||
BOOST_PP_COMMA_IF(N)
|
||||
BOOST_PP_ENUM(
|
||||
BOOST_PYTHON_VOID_ARGS, BOOST_PYTHON_FIXED, mpl::void_)
|
||||
>
|
||||
: BOOST_PP_CAT(mpl::vector,N)<BOOST_PP_ENUM_PARAMS_Z(1, N, T)>
|
||||
{
|
||||
};
|
||||
|
||||
# undef BOOST_PYTHON_VOID_ARGS
|
||||
# undef N
|
||||
|
||||
#endif // BOOST_PP_IS_ITERATING
|
||||
Binary file not shown.
@@ -0,0 +1,392 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file default_function_impl.hpp
|
||||
/// Contains definition of the default_function_impl, the implementation of the
|
||||
/// _default transform for function-like nodes.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
template<typename Grammar, typename Expr, typename State, typename Data>
|
||||
struct default_function_impl<Grammar, Expr, State, Data, 3>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename result_of::child_c< Expr, 0>::type e0; typedef typename Grammar::template impl<e0, State, Data>::result_type r0; typedef typename result_of::child_c< Expr, 1>::type e1; typedef typename Grammar::template impl<e1, State, Data>::result_type r1; typedef typename result_of::child_c< Expr, 2>::type e2; typedef typename Grammar::template impl<e2, State, Data>::result_type r2;
|
||||
typedef
|
||||
typename proto::detail::result_of_fixup<r0>::type
|
||||
function_type;
|
||||
typedef
|
||||
typename BOOST_PROTO_RESULT_OF<
|
||||
function_type(r1 , r2)
|
||||
>::type
|
||||
result_type;
|
||||
result_type operator ()(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return this->invoke(e, s, d, is_member_function_pointer<function_type>());
|
||||
}
|
||||
private:
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::false_
|
||||
) const
|
||||
{
|
||||
return typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )(
|
||||
typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ) , typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d )
|
||||
);
|
||||
}
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::true_
|
||||
) const
|
||||
{
|
||||
BOOST_PROTO_USE_GET_POINTER();
|
||||
typedef typename detail::class_member_traits<function_type>::class_type class_type;
|
||||
return (
|
||||
BOOST_PROTO_GET_POINTER(class_type, (typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ))) ->*
|
||||
typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )
|
||||
)(typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ));
|
||||
}
|
||||
};
|
||||
template<typename Grammar, typename Expr, typename State, typename Data>
|
||||
struct default_function_impl<Grammar, Expr, State, Data, 4>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename result_of::child_c< Expr, 0>::type e0; typedef typename Grammar::template impl<e0, State, Data>::result_type r0; typedef typename result_of::child_c< Expr, 1>::type e1; typedef typename Grammar::template impl<e1, State, Data>::result_type r1; typedef typename result_of::child_c< Expr, 2>::type e2; typedef typename Grammar::template impl<e2, State, Data>::result_type r2; typedef typename result_of::child_c< Expr, 3>::type e3; typedef typename Grammar::template impl<e3, State, Data>::result_type r3;
|
||||
typedef
|
||||
typename proto::detail::result_of_fixup<r0>::type
|
||||
function_type;
|
||||
typedef
|
||||
typename BOOST_PROTO_RESULT_OF<
|
||||
function_type(r1 , r2 , r3)
|
||||
>::type
|
||||
result_type;
|
||||
result_type operator ()(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return this->invoke(e, s, d, is_member_function_pointer<function_type>());
|
||||
}
|
||||
private:
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::false_
|
||||
) const
|
||||
{
|
||||
return typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )(
|
||||
typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ) , typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d )
|
||||
);
|
||||
}
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::true_
|
||||
) const
|
||||
{
|
||||
BOOST_PROTO_USE_GET_POINTER();
|
||||
typedef typename detail::class_member_traits<function_type>::class_type class_type;
|
||||
return (
|
||||
BOOST_PROTO_GET_POINTER(class_type, (typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ))) ->*
|
||||
typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )
|
||||
)(typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ));
|
||||
}
|
||||
};
|
||||
template<typename Grammar, typename Expr, typename State, typename Data>
|
||||
struct default_function_impl<Grammar, Expr, State, Data, 5>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename result_of::child_c< Expr, 0>::type e0; typedef typename Grammar::template impl<e0, State, Data>::result_type r0; typedef typename result_of::child_c< Expr, 1>::type e1; typedef typename Grammar::template impl<e1, State, Data>::result_type r1; typedef typename result_of::child_c< Expr, 2>::type e2; typedef typename Grammar::template impl<e2, State, Data>::result_type r2; typedef typename result_of::child_c< Expr, 3>::type e3; typedef typename Grammar::template impl<e3, State, Data>::result_type r3; typedef typename result_of::child_c< Expr, 4>::type e4; typedef typename Grammar::template impl<e4, State, Data>::result_type r4;
|
||||
typedef
|
||||
typename proto::detail::result_of_fixup<r0>::type
|
||||
function_type;
|
||||
typedef
|
||||
typename BOOST_PROTO_RESULT_OF<
|
||||
function_type(r1 , r2 , r3 , r4)
|
||||
>::type
|
||||
result_type;
|
||||
result_type operator ()(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return this->invoke(e, s, d, is_member_function_pointer<function_type>());
|
||||
}
|
||||
private:
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::false_
|
||||
) const
|
||||
{
|
||||
return typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )(
|
||||
typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ) , typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d )
|
||||
);
|
||||
}
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::true_
|
||||
) const
|
||||
{
|
||||
BOOST_PROTO_USE_GET_POINTER();
|
||||
typedef typename detail::class_member_traits<function_type>::class_type class_type;
|
||||
return (
|
||||
BOOST_PROTO_GET_POINTER(class_type, (typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ))) ->*
|
||||
typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )
|
||||
)(typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d ));
|
||||
}
|
||||
};
|
||||
template<typename Grammar, typename Expr, typename State, typename Data>
|
||||
struct default_function_impl<Grammar, Expr, State, Data, 6>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename result_of::child_c< Expr, 0>::type e0; typedef typename Grammar::template impl<e0, State, Data>::result_type r0; typedef typename result_of::child_c< Expr, 1>::type e1; typedef typename Grammar::template impl<e1, State, Data>::result_type r1; typedef typename result_of::child_c< Expr, 2>::type e2; typedef typename Grammar::template impl<e2, State, Data>::result_type r2; typedef typename result_of::child_c< Expr, 3>::type e3; typedef typename Grammar::template impl<e3, State, Data>::result_type r3; typedef typename result_of::child_c< Expr, 4>::type e4; typedef typename Grammar::template impl<e4, State, Data>::result_type r4; typedef typename result_of::child_c< Expr, 5>::type e5; typedef typename Grammar::template impl<e5, State, Data>::result_type r5;
|
||||
typedef
|
||||
typename proto::detail::result_of_fixup<r0>::type
|
||||
function_type;
|
||||
typedef
|
||||
typename BOOST_PROTO_RESULT_OF<
|
||||
function_type(r1 , r2 , r3 , r4 , r5)
|
||||
>::type
|
||||
result_type;
|
||||
result_type operator ()(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return this->invoke(e, s, d, is_member_function_pointer<function_type>());
|
||||
}
|
||||
private:
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::false_
|
||||
) const
|
||||
{
|
||||
return typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )(
|
||||
typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ) , typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d ) , typename Grammar::template impl<e5, State, Data>()( proto::child_c< 5>( e), s, d )
|
||||
);
|
||||
}
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::true_
|
||||
) const
|
||||
{
|
||||
BOOST_PROTO_USE_GET_POINTER();
|
||||
typedef typename detail::class_member_traits<function_type>::class_type class_type;
|
||||
return (
|
||||
BOOST_PROTO_GET_POINTER(class_type, (typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ))) ->*
|
||||
typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )
|
||||
)(typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d ) , typename Grammar::template impl<e5, State, Data>()( proto::child_c< 5>( e), s, d ));
|
||||
}
|
||||
};
|
||||
template<typename Grammar, typename Expr, typename State, typename Data>
|
||||
struct default_function_impl<Grammar, Expr, State, Data, 7>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename result_of::child_c< Expr, 0>::type e0; typedef typename Grammar::template impl<e0, State, Data>::result_type r0; typedef typename result_of::child_c< Expr, 1>::type e1; typedef typename Grammar::template impl<e1, State, Data>::result_type r1; typedef typename result_of::child_c< Expr, 2>::type e2; typedef typename Grammar::template impl<e2, State, Data>::result_type r2; typedef typename result_of::child_c< Expr, 3>::type e3; typedef typename Grammar::template impl<e3, State, Data>::result_type r3; typedef typename result_of::child_c< Expr, 4>::type e4; typedef typename Grammar::template impl<e4, State, Data>::result_type r4; typedef typename result_of::child_c< Expr, 5>::type e5; typedef typename Grammar::template impl<e5, State, Data>::result_type r5; typedef typename result_of::child_c< Expr, 6>::type e6; typedef typename Grammar::template impl<e6, State, Data>::result_type r6;
|
||||
typedef
|
||||
typename proto::detail::result_of_fixup<r0>::type
|
||||
function_type;
|
||||
typedef
|
||||
typename BOOST_PROTO_RESULT_OF<
|
||||
function_type(r1 , r2 , r3 , r4 , r5 , r6)
|
||||
>::type
|
||||
result_type;
|
||||
result_type operator ()(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return this->invoke(e, s, d, is_member_function_pointer<function_type>());
|
||||
}
|
||||
private:
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::false_
|
||||
) const
|
||||
{
|
||||
return typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )(
|
||||
typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ) , typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d ) , typename Grammar::template impl<e5, State, Data>()( proto::child_c< 5>( e), s, d ) , typename Grammar::template impl<e6, State, Data>()( proto::child_c< 6>( e), s, d )
|
||||
);
|
||||
}
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::true_
|
||||
) const
|
||||
{
|
||||
BOOST_PROTO_USE_GET_POINTER();
|
||||
typedef typename detail::class_member_traits<function_type>::class_type class_type;
|
||||
return (
|
||||
BOOST_PROTO_GET_POINTER(class_type, (typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ))) ->*
|
||||
typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )
|
||||
)(typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d ) , typename Grammar::template impl<e5, State, Data>()( proto::child_c< 5>( e), s, d ) , typename Grammar::template impl<e6, State, Data>()( proto::child_c< 6>( e), s, d ));
|
||||
}
|
||||
};
|
||||
template<typename Grammar, typename Expr, typename State, typename Data>
|
||||
struct default_function_impl<Grammar, Expr, State, Data, 8>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename result_of::child_c< Expr, 0>::type e0; typedef typename Grammar::template impl<e0, State, Data>::result_type r0; typedef typename result_of::child_c< Expr, 1>::type e1; typedef typename Grammar::template impl<e1, State, Data>::result_type r1; typedef typename result_of::child_c< Expr, 2>::type e2; typedef typename Grammar::template impl<e2, State, Data>::result_type r2; typedef typename result_of::child_c< Expr, 3>::type e3; typedef typename Grammar::template impl<e3, State, Data>::result_type r3; typedef typename result_of::child_c< Expr, 4>::type e4; typedef typename Grammar::template impl<e4, State, Data>::result_type r4; typedef typename result_of::child_c< Expr, 5>::type e5; typedef typename Grammar::template impl<e5, State, Data>::result_type r5; typedef typename result_of::child_c< Expr, 6>::type e6; typedef typename Grammar::template impl<e6, State, Data>::result_type r6; typedef typename result_of::child_c< Expr, 7>::type e7; typedef typename Grammar::template impl<e7, State, Data>::result_type r7;
|
||||
typedef
|
||||
typename proto::detail::result_of_fixup<r0>::type
|
||||
function_type;
|
||||
typedef
|
||||
typename BOOST_PROTO_RESULT_OF<
|
||||
function_type(r1 , r2 , r3 , r4 , r5 , r6 , r7)
|
||||
>::type
|
||||
result_type;
|
||||
result_type operator ()(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return this->invoke(e, s, d, is_member_function_pointer<function_type>());
|
||||
}
|
||||
private:
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::false_
|
||||
) const
|
||||
{
|
||||
return typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )(
|
||||
typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ) , typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d ) , typename Grammar::template impl<e5, State, Data>()( proto::child_c< 5>( e), s, d ) , typename Grammar::template impl<e6, State, Data>()( proto::child_c< 6>( e), s, d ) , typename Grammar::template impl<e7, State, Data>()( proto::child_c< 7>( e), s, d )
|
||||
);
|
||||
}
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::true_
|
||||
) const
|
||||
{
|
||||
BOOST_PROTO_USE_GET_POINTER();
|
||||
typedef typename detail::class_member_traits<function_type>::class_type class_type;
|
||||
return (
|
||||
BOOST_PROTO_GET_POINTER(class_type, (typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ))) ->*
|
||||
typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )
|
||||
)(typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d ) , typename Grammar::template impl<e5, State, Data>()( proto::child_c< 5>( e), s, d ) , typename Grammar::template impl<e6, State, Data>()( proto::child_c< 6>( e), s, d ) , typename Grammar::template impl<e7, State, Data>()( proto::child_c< 7>( e), s, d ));
|
||||
}
|
||||
};
|
||||
template<typename Grammar, typename Expr, typename State, typename Data>
|
||||
struct default_function_impl<Grammar, Expr, State, Data, 9>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename result_of::child_c< Expr, 0>::type e0; typedef typename Grammar::template impl<e0, State, Data>::result_type r0; typedef typename result_of::child_c< Expr, 1>::type e1; typedef typename Grammar::template impl<e1, State, Data>::result_type r1; typedef typename result_of::child_c< Expr, 2>::type e2; typedef typename Grammar::template impl<e2, State, Data>::result_type r2; typedef typename result_of::child_c< Expr, 3>::type e3; typedef typename Grammar::template impl<e3, State, Data>::result_type r3; typedef typename result_of::child_c< Expr, 4>::type e4; typedef typename Grammar::template impl<e4, State, Data>::result_type r4; typedef typename result_of::child_c< Expr, 5>::type e5; typedef typename Grammar::template impl<e5, State, Data>::result_type r5; typedef typename result_of::child_c< Expr, 6>::type e6; typedef typename Grammar::template impl<e6, State, Data>::result_type r6; typedef typename result_of::child_c< Expr, 7>::type e7; typedef typename Grammar::template impl<e7, State, Data>::result_type r7; typedef typename result_of::child_c< Expr, 8>::type e8; typedef typename Grammar::template impl<e8, State, Data>::result_type r8;
|
||||
typedef
|
||||
typename proto::detail::result_of_fixup<r0>::type
|
||||
function_type;
|
||||
typedef
|
||||
typename BOOST_PROTO_RESULT_OF<
|
||||
function_type(r1 , r2 , r3 , r4 , r5 , r6 , r7 , r8)
|
||||
>::type
|
||||
result_type;
|
||||
result_type operator ()(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return this->invoke(e, s, d, is_member_function_pointer<function_type>());
|
||||
}
|
||||
private:
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::false_
|
||||
) const
|
||||
{
|
||||
return typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )(
|
||||
typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ) , typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d ) , typename Grammar::template impl<e5, State, Data>()( proto::child_c< 5>( e), s, d ) , typename Grammar::template impl<e6, State, Data>()( proto::child_c< 6>( e), s, d ) , typename Grammar::template impl<e7, State, Data>()( proto::child_c< 7>( e), s, d ) , typename Grammar::template impl<e8, State, Data>()( proto::child_c< 8>( e), s, d )
|
||||
);
|
||||
}
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::true_
|
||||
) const
|
||||
{
|
||||
BOOST_PROTO_USE_GET_POINTER();
|
||||
typedef typename detail::class_member_traits<function_type>::class_type class_type;
|
||||
return (
|
||||
BOOST_PROTO_GET_POINTER(class_type, (typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ))) ->*
|
||||
typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )
|
||||
)(typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d ) , typename Grammar::template impl<e5, State, Data>()( proto::child_c< 5>( e), s, d ) , typename Grammar::template impl<e6, State, Data>()( proto::child_c< 6>( e), s, d ) , typename Grammar::template impl<e7, State, Data>()( proto::child_c< 7>( e), s, d ) , typename Grammar::template impl<e8, State, Data>()( proto::child_c< 8>( e), s, d ));
|
||||
}
|
||||
};
|
||||
template<typename Grammar, typename Expr, typename State, typename Data>
|
||||
struct default_function_impl<Grammar, Expr, State, Data, 10>
|
||||
: transform_impl<Expr, State, Data>
|
||||
{
|
||||
typedef typename result_of::child_c< Expr, 0>::type e0; typedef typename Grammar::template impl<e0, State, Data>::result_type r0; typedef typename result_of::child_c< Expr, 1>::type e1; typedef typename Grammar::template impl<e1, State, Data>::result_type r1; typedef typename result_of::child_c< Expr, 2>::type e2; typedef typename Grammar::template impl<e2, State, Data>::result_type r2; typedef typename result_of::child_c< Expr, 3>::type e3; typedef typename Grammar::template impl<e3, State, Data>::result_type r3; typedef typename result_of::child_c< Expr, 4>::type e4; typedef typename Grammar::template impl<e4, State, Data>::result_type r4; typedef typename result_of::child_c< Expr, 5>::type e5; typedef typename Grammar::template impl<e5, State, Data>::result_type r5; typedef typename result_of::child_c< Expr, 6>::type e6; typedef typename Grammar::template impl<e6, State, Data>::result_type r6; typedef typename result_of::child_c< Expr, 7>::type e7; typedef typename Grammar::template impl<e7, State, Data>::result_type r7; typedef typename result_of::child_c< Expr, 8>::type e8; typedef typename Grammar::template impl<e8, State, Data>::result_type r8; typedef typename result_of::child_c< Expr, 9>::type e9; typedef typename Grammar::template impl<e9, State, Data>::result_type r9;
|
||||
typedef
|
||||
typename proto::detail::result_of_fixup<r0>::type
|
||||
function_type;
|
||||
typedef
|
||||
typename BOOST_PROTO_RESULT_OF<
|
||||
function_type(r1 , r2 , r3 , r4 , r5 , r6 , r7 , r8 , r9)
|
||||
>::type
|
||||
result_type;
|
||||
result_type operator ()(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
) const
|
||||
{
|
||||
return this->invoke(e, s, d, is_member_function_pointer<function_type>());
|
||||
}
|
||||
private:
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::false_
|
||||
) const
|
||||
{
|
||||
return typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )(
|
||||
typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ) , typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d ) , typename Grammar::template impl<e5, State, Data>()( proto::child_c< 5>( e), s, d ) , typename Grammar::template impl<e6, State, Data>()( proto::child_c< 6>( e), s, d ) , typename Grammar::template impl<e7, State, Data>()( proto::child_c< 7>( e), s, d ) , typename Grammar::template impl<e8, State, Data>()( proto::child_c< 8>( e), s, d ) , typename Grammar::template impl<e9, State, Data>()( proto::child_c< 9>( e), s, d )
|
||||
);
|
||||
}
|
||||
result_type invoke(
|
||||
typename default_function_impl::expr_param e
|
||||
, typename default_function_impl::state_param s
|
||||
, typename default_function_impl::data_param d
|
||||
, mpl::true_
|
||||
) const
|
||||
{
|
||||
BOOST_PROTO_USE_GET_POINTER();
|
||||
typedef typename detail::class_member_traits<function_type>::class_type class_type;
|
||||
return (
|
||||
BOOST_PROTO_GET_POINTER(class_type, (typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ))) ->*
|
||||
typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d )
|
||||
)(typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d ) , typename Grammar::template impl<e5, State, Data>()( proto::child_c< 5>( e), s, d ) , typename Grammar::template impl<e6, State, Data>()( proto::child_c< 6>( e), s, d ) , typename Grammar::template impl<e7, State, Data>()( proto::child_c< 7>( e), s, d ) , typename Grammar::template impl<e8, State, Data>()( proto::child_c< 8>( e), s, d ) , typename Grammar::template impl<e9, State, Data>()( proto::child_c< 9>( e), s, d ));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,129 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
// See http://boostorg.github.com/compute for more information.
|
||||
//---------------------------------------------------------------------------//
|
||||
|
||||
#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_COUNT_IF_WITH_THREADS_HPP
|
||||
#define BOOST_COMPUTE_ALGORITHM_DETAIL_COUNT_IF_WITH_THREADS_HPP
|
||||
|
||||
#include <numeric>
|
||||
|
||||
#include <boost/compute/detail/meta_kernel.hpp>
|
||||
#include <boost/compute/container/vector.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
namespace detail {
|
||||
|
||||
template<class InputIterator, class Predicate>
|
||||
class count_if_with_threads_kernel : meta_kernel
|
||||
{
|
||||
public:
|
||||
typedef typename
|
||||
std::iterator_traits<InputIterator>::value_type
|
||||
value_type;
|
||||
|
||||
count_if_with_threads_kernel()
|
||||
: meta_kernel("count_if_with_threads")
|
||||
{
|
||||
}
|
||||
|
||||
void set_args(InputIterator first,
|
||||
InputIterator last,
|
||||
Predicate predicate)
|
||||
|
||||
{
|
||||
typedef typename std::iterator_traits<InputIterator>::value_type T;
|
||||
|
||||
m_size = detail::iterator_range_size(first, last);
|
||||
|
||||
m_size_arg = add_arg<const ulong_>("size");
|
||||
m_counts_arg = add_arg<ulong_ *>(memory_object::global_memory, "counts");
|
||||
|
||||
*this <<
|
||||
// thread parameters
|
||||
"const uint gid = get_global_id(0);\n" <<
|
||||
"const uint block_size = size / get_global_size(0);\n" <<
|
||||
"const uint start = block_size * gid;\n" <<
|
||||
"uint end = 0;\n" <<
|
||||
"if(gid == get_global_size(0) - 1)\n" <<
|
||||
" end = size;\n" <<
|
||||
"else\n" <<
|
||||
" end = block_size * gid + block_size;\n" <<
|
||||
|
||||
// count values
|
||||
"uint count = 0;\n" <<
|
||||
"for(uint i = start; i < end; i++){\n" <<
|
||||
decl<const T>("value") << "="
|
||||
<< first[expr<uint_>("i")] << ";\n" <<
|
||||
if_(predicate(var<const T>("value"))) << "{\n" <<
|
||||
"count++;\n" <<
|
||||
"}\n" <<
|
||||
"}\n" <<
|
||||
|
||||
// write count
|
||||
"counts[gid] = count;\n";
|
||||
}
|
||||
|
||||
size_t exec(command_queue &queue)
|
||||
{
|
||||
const device &device = queue.get_device();
|
||||
const context &context = queue.get_context();
|
||||
|
||||
size_t threads = device.compute_units();
|
||||
|
||||
const size_t minimum_block_size = 2048;
|
||||
if(m_size / threads < minimum_block_size){
|
||||
threads = static_cast<size_t>(
|
||||
(std::max)(
|
||||
std::ceil(float(m_size) / minimum_block_size),
|
||||
1.0f
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// storage for counts
|
||||
::boost::compute::vector<ulong_> counts(threads, context);
|
||||
|
||||
// exec kernel
|
||||
set_arg(m_size_arg, static_cast<ulong_>(m_size));
|
||||
set_arg(m_counts_arg, counts.get_buffer());
|
||||
exec_1d(queue, 0, threads, 1);
|
||||
|
||||
// copy counts to the host
|
||||
std::vector<ulong_> host_counts(threads);
|
||||
::boost::compute::copy(counts.begin(), counts.end(), host_counts.begin(), queue);
|
||||
|
||||
// return sum of counts
|
||||
return std::accumulate(host_counts.begin(), host_counts.end(), size_t(0));
|
||||
}
|
||||
|
||||
private:
|
||||
size_t m_size;
|
||||
size_t m_size_arg;
|
||||
size_t m_counts_arg;
|
||||
};
|
||||
|
||||
// counts values that match the predicate using one thread per block. this is
|
||||
// optimized for cpu-type devices with a small number of compute units.
|
||||
template<class InputIterator, class Predicate>
|
||||
inline size_t count_if_with_threads(InputIterator first,
|
||||
InputIterator last,
|
||||
Predicate predicate,
|
||||
command_queue &queue)
|
||||
{
|
||||
count_if_with_threads_kernel<InputIterator, Predicate> kernel;
|
||||
kernel.set_args(first, last, predicate);
|
||||
return kernel.exec(queue);
|
||||
}
|
||||
|
||||
} // end detail namespace
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_COUNT_IF_WITH_THREADS_HPP
|
||||
@@ -0,0 +1,329 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 1998-2002 Joel de Guzman
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
=============================================================================*/
|
||||
#if !defined(BOOST_SPIRIT_SCANNER_HPP)
|
||||
#define BOOST_SPIRIT_SCANNER_HPP
|
||||
|
||||
#include <iterator>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
#include <boost/spirit/home/classic/core/match.hpp>
|
||||
#include <boost/spirit/home/classic/core/non_terminal/parser_id.hpp>
|
||||
#include <boost/detail/iterator.hpp> // for boost::detail::iterator_traits
|
||||
|
||||
#include <boost/spirit/home/classic/core/scanner/scanner_fwd.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// iteration_policy class
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
struct iteration_policy
|
||||
{
|
||||
template <typename ScannerT>
|
||||
void
|
||||
advance(ScannerT const& scan) const
|
||||
{
|
||||
++scan.first;
|
||||
}
|
||||
|
||||
template <typename ScannerT>
|
||||
bool at_end(ScannerT const& scan) const
|
||||
{
|
||||
return scan.first == scan.last;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T filter(T ch) const
|
||||
{
|
||||
return ch;
|
||||
}
|
||||
|
||||
template <typename ScannerT>
|
||||
typename ScannerT::ref_t
|
||||
get(ScannerT const& scan) const
|
||||
{
|
||||
return *scan.first;
|
||||
}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// match_policy class
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
struct match_policy
|
||||
{
|
||||
template <typename T>
|
||||
struct result { typedef match<T> type; };
|
||||
|
||||
const match<nil_t>
|
||||
no_match() const
|
||||
{
|
||||
return match<nil_t>();
|
||||
}
|
||||
|
||||
const match<nil_t>
|
||||
empty_match() const
|
||||
{
|
||||
return match<nil_t>(0, nil_t());
|
||||
}
|
||||
|
||||
template <typename AttrT, typename IteratorT>
|
||||
match<AttrT>
|
||||
create_match(
|
||||
std::size_t length,
|
||||
AttrT const& val,
|
||||
IteratorT const& /*first*/,
|
||||
IteratorT const& /*last*/) const
|
||||
{
|
||||
return match<AttrT>(length, val);
|
||||
}
|
||||
|
||||
template <typename MatchT, typename IteratorT>
|
||||
void group_match(
|
||||
MatchT& /*m*/,
|
||||
parser_id const& /*id*/,
|
||||
IteratorT const& /*first*/,
|
||||
IteratorT const& /*last*/) const {}
|
||||
|
||||
template <typename Match1T, typename Match2T>
|
||||
void concat_match(Match1T& l, Match2T const& r) const
|
||||
{
|
||||
l.concat(r);
|
||||
}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// match_result class
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename MatchPolicyT, typename T>
|
||||
struct match_result
|
||||
{
|
||||
typedef typename MatchPolicyT::template result<T>::type type;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// action_policy class
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename AttrT>
|
||||
struct attributed_action_policy
|
||||
{
|
||||
template <typename ActorT, typename IteratorT>
|
||||
static void
|
||||
call(
|
||||
ActorT const& actor,
|
||||
AttrT& val,
|
||||
IteratorT const&,
|
||||
IteratorT const&)
|
||||
{
|
||||
actor(val);
|
||||
}
|
||||
};
|
||||
|
||||
//////////////////////////////////
|
||||
template <>
|
||||
struct attributed_action_policy<nil_t>
|
||||
{
|
||||
template <typename ActorT, typename IteratorT>
|
||||
static void
|
||||
call(
|
||||
ActorT const& actor,
|
||||
nil_t,
|
||||
IteratorT const& first,
|
||||
IteratorT const& last)
|
||||
{
|
||||
actor(first, last);
|
||||
}
|
||||
};
|
||||
|
||||
//////////////////////////////////
|
||||
struct action_policy
|
||||
{
|
||||
template <typename ActorT, typename AttrT, typename IteratorT>
|
||||
void
|
||||
do_action(
|
||||
ActorT const& actor,
|
||||
AttrT& val,
|
||||
IteratorT const& first,
|
||||
IteratorT const& last) const
|
||||
{
|
||||
attributed_action_policy<AttrT>::call(actor, val, first, last);
|
||||
}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// scanner_policies class
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <
|
||||
typename IterationPolicyT,
|
||||
typename MatchPolicyT,
|
||||
typename ActionPolicyT>
|
||||
struct scanner_policies :
|
||||
public IterationPolicyT,
|
||||
public MatchPolicyT,
|
||||
public ActionPolicyT
|
||||
{
|
||||
typedef IterationPolicyT iteration_policy_t;
|
||||
typedef MatchPolicyT match_policy_t;
|
||||
typedef ActionPolicyT action_policy_t;
|
||||
|
||||
scanner_policies(
|
||||
IterationPolicyT const& i_policy = IterationPolicyT(),
|
||||
MatchPolicyT const& m_policy = MatchPolicyT(),
|
||||
ActionPolicyT const& a_policy = ActionPolicyT())
|
||||
: IterationPolicyT(i_policy)
|
||||
, MatchPolicyT(m_policy)
|
||||
, ActionPolicyT(a_policy) {}
|
||||
|
||||
template <typename ScannerPoliciesT>
|
||||
scanner_policies(ScannerPoliciesT const& policies)
|
||||
: IterationPolicyT(policies)
|
||||
, MatchPolicyT(policies)
|
||||
, ActionPolicyT(policies) {}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// scanner_policies_base class: the base class of all scanners
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
struct scanner_base {};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// scanner class
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <
|
||||
typename IteratorT,
|
||||
typename PoliciesT>
|
||||
class scanner : public PoliciesT, public scanner_base
|
||||
{
|
||||
public:
|
||||
|
||||
typedef IteratorT iterator_t;
|
||||
typedef PoliciesT policies_t;
|
||||
|
||||
typedef typename boost::detail::
|
||||
iterator_traits<IteratorT>::value_type value_t;
|
||||
typedef typename boost::detail::
|
||||
iterator_traits<IteratorT>::reference ref_t;
|
||||
typedef typename boost::
|
||||
call_traits<IteratorT>::param_type iter_param_t;
|
||||
|
||||
scanner(
|
||||
IteratorT& first_,
|
||||
iter_param_t last_,
|
||||
PoliciesT const& policies = PoliciesT())
|
||||
: PoliciesT(policies), first(first_), last(last_)
|
||||
{
|
||||
at_end();
|
||||
}
|
||||
|
||||
scanner(scanner const& other)
|
||||
: PoliciesT(other), first(other.first), last(other.last) {}
|
||||
|
||||
scanner(scanner const& other, IteratorT& first_)
|
||||
: PoliciesT(other), first(first_), last(other.last) {}
|
||||
|
||||
template <typename PoliciesT1>
|
||||
scanner(scanner<IteratorT, PoliciesT1> const& other)
|
||||
: PoliciesT(other), first(other.first), last(other.last) {}
|
||||
|
||||
bool
|
||||
at_end() const
|
||||
{
|
||||
typedef typename PoliciesT::iteration_policy_t iteration_policy_type;
|
||||
return iteration_policy_type::at_end(*this);
|
||||
}
|
||||
|
||||
value_t
|
||||
operator*() const
|
||||
{
|
||||
typedef typename PoliciesT::iteration_policy_t iteration_policy_type;
|
||||
return iteration_policy_type::filter(iteration_policy_type::get(*this));
|
||||
}
|
||||
|
||||
scanner const&
|
||||
operator++() const
|
||||
{
|
||||
typedef typename PoliciesT::iteration_policy_t iteration_policy_type;
|
||||
iteration_policy_type::advance(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename PoliciesT2>
|
||||
struct rebind_policies
|
||||
{
|
||||
typedef scanner<IteratorT, PoliciesT2> type;
|
||||
};
|
||||
|
||||
template <typename PoliciesT2>
|
||||
scanner<IteratorT, PoliciesT2>
|
||||
change_policies(PoliciesT2 const& policies) const
|
||||
{
|
||||
return scanner<IteratorT, PoliciesT2>(first, last, policies);
|
||||
}
|
||||
|
||||
template <typename IteratorT2>
|
||||
struct rebind_iterator
|
||||
{
|
||||
typedef scanner<IteratorT2, PoliciesT> type;
|
||||
};
|
||||
|
||||
template <typename IteratorT2>
|
||||
scanner<IteratorT2, PoliciesT>
|
||||
change_iterator(IteratorT2 const& first_, IteratorT2 const &last_) const
|
||||
{
|
||||
return scanner<IteratorT2, PoliciesT>(first_, last_, *this);
|
||||
}
|
||||
|
||||
IteratorT& first;
|
||||
IteratorT const last;
|
||||
|
||||
private:
|
||||
|
||||
scanner&
|
||||
operator=(scanner const& other);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// rebind_scanner_policies class
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename ScannerT, typename PoliciesT>
|
||||
struct rebind_scanner_policies
|
||||
{
|
||||
typedef typename ScannerT::template
|
||||
rebind_policies<PoliciesT>::type type;
|
||||
};
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename ScannerT, typename IteratorT>
|
||||
struct rebind_scanner_iterator
|
||||
{
|
||||
typedef typename ScannerT::template
|
||||
rebind_iterator<IteratorT>::type type;
|
||||
};
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,323 @@
|
||||
|
||||
// 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 the main "set.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<
|
||||
typename T0 = na, typename T1 = na, typename T2 = na, typename T3 = na
|
||||
, typename T4 = na, typename T5 = na, typename T6 = na, typename T7 = na
|
||||
, typename T8 = na, typename T9 = na, typename T10 = na, typename T11 = na
|
||||
, typename T12 = na, typename T13 = na, typename T14 = na
|
||||
, typename T15 = na, typename T16 = na, typename T17 = na
|
||||
, typename T18 = na, typename T19 = na
|
||||
>
|
||||
struct set;
|
||||
|
||||
template<
|
||||
|
||||
>
|
||||
struct set<
|
||||
na, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na
|
||||
, na, na, na
|
||||
>
|
||||
: set0< >
|
||||
{
|
||||
typedef set0< >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0
|
||||
>
|
||||
struct set<
|
||||
T0, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na
|
||||
, na, na, na
|
||||
>
|
||||
: set1<T0>
|
||||
{
|
||||
typedef typename set1<T0>::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1
|
||||
>
|
||||
struct set<
|
||||
T0, T1, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na
|
||||
, na, na, na
|
||||
>
|
||||
: set2< T0,T1 >
|
||||
{
|
||||
typedef typename set2< T0,T1 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2
|
||||
>
|
||||
struct set<
|
||||
T0, T1, T2, na, na, na, na, na, na, na, na, na, na, na, na, na, na
|
||||
, na, na, na
|
||||
>
|
||||
: set3< T0,T1,T2 >
|
||||
{
|
||||
typedef typename set3< T0,T1,T2 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3
|
||||
>
|
||||
struct set<
|
||||
T0, T1, T2, T3, na, na, na, na, na, na, na, na, na, na, na, na, na
|
||||
, na, na, na
|
||||
>
|
||||
: set4< T0,T1,T2,T3 >
|
||||
{
|
||||
typedef typename set4< T0,T1,T2,T3 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
>
|
||||
struct set<
|
||||
T0, T1, T2, T3, T4, na, na, na, na, na, na, na, na, na, na, na, na
|
||||
, na, na, na
|
||||
>
|
||||
: set5< T0,T1,T2,T3,T4 >
|
||||
{
|
||||
typedef typename set5< T0,T1,T2,T3,T4 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5
|
||||
>
|
||||
struct set<
|
||||
T0, T1, T2, T3, T4, T5, na, na, na, na, na, na, na, na, na, na, na
|
||||
, na, na, na
|
||||
>
|
||||
: set6< T0,T1,T2,T3,T4,T5 >
|
||||
{
|
||||
typedef typename set6< T0,T1,T2,T3,T4,T5 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename T6
|
||||
>
|
||||
struct set<
|
||||
T0, T1, T2, T3, T4, T5, T6, na, na, na, na, na, na, na, na, na, na
|
||||
, na, na, na
|
||||
>
|
||||
: set7< T0,T1,T2,T3,T4,T5,T6 >
|
||||
{
|
||||
typedef typename set7< T0,T1,T2,T3,T4,T5,T6 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename T6, typename T7
|
||||
>
|
||||
struct set<
|
||||
T0, T1, T2, T3, T4, T5, T6, T7, na, na, na, na, na, na, na, na, na
|
||||
, na, na, na
|
||||
>
|
||||
: set8< T0,T1,T2,T3,T4,T5,T6,T7 >
|
||||
{
|
||||
typedef typename set8< T0,T1,T2,T3,T4,T5,T6,T7 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename T6, typename T7, typename T8
|
||||
>
|
||||
struct set<
|
||||
T0, T1, T2, T3, T4, T5, T6, T7, T8, na, na, na, na, na, na, na, na
|
||||
, na, na, na
|
||||
>
|
||||
: set9< T0,T1,T2,T3,T4,T5,T6,T7,T8 >
|
||||
{
|
||||
typedef typename set9< T0,T1,T2,T3,T4,T5,T6,T7,T8 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename T6, typename T7, typename T8, typename T9
|
||||
>
|
||||
struct set<
|
||||
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, na, na, na, na, na, na, na
|
||||
, na, na, na
|
||||
>
|
||||
: set10< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9 >
|
||||
{
|
||||
typedef typename set10< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename T6, typename T7, typename T8, typename T9
|
||||
, typename T10
|
||||
>
|
||||
struct set<
|
||||
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, na, na, na, na, na, na
|
||||
, na, na, na
|
||||
>
|
||||
: set11< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10 >
|
||||
{
|
||||
typedef typename set11< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename T6, typename T7, typename T8, typename T9
|
||||
, typename T10, typename T11
|
||||
>
|
||||
struct set<
|
||||
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, na, na, na, na
|
||||
, na, na, na, na
|
||||
>
|
||||
: set12< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11 >
|
||||
{
|
||||
typedef typename set12< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename T6, typename T7, typename T8, typename T9
|
||||
, typename T10, typename T11, typename T12
|
||||
>
|
||||
struct set<
|
||||
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, na, na, na
|
||||
, na, na, na, na
|
||||
>
|
||||
: set13< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12 >
|
||||
{
|
||||
typedef typename set13< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename T6, typename T7, typename T8, typename T9
|
||||
, typename T10, typename T11, typename T12, typename T13
|
||||
>
|
||||
struct set<
|
||||
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, na, na
|
||||
, na, na, na, na
|
||||
>
|
||||
: set14< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13 >
|
||||
{
|
||||
typedef typename set14< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename T6, typename T7, typename T8, typename T9
|
||||
, typename T10, typename T11, typename T12, typename T13, typename T14
|
||||
>
|
||||
struct set<
|
||||
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, na
|
||||
, na, na, na, na
|
||||
>
|
||||
: set15<
|
||||
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
|
||||
>
|
||||
{
|
||||
typedef typename set15< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename T6, typename T7, typename T8, typename T9
|
||||
, typename T10, typename T11, typename T12, typename T13, typename T14
|
||||
, typename T15
|
||||
>
|
||||
struct set<
|
||||
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
|
||||
, T15, na, na, na, na
|
||||
>
|
||||
: set16<
|
||||
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
|
||||
, T15
|
||||
>
|
||||
{
|
||||
typedef typename set16< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename T6, typename T7, typename T8, typename T9
|
||||
, typename T10, typename T11, typename T12, typename T13, typename T14
|
||||
, typename T15, typename T16
|
||||
>
|
||||
struct set<
|
||||
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
|
||||
, T15, T16, na, na, na
|
||||
>
|
||||
: set17<
|
||||
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
|
||||
, T15, T16
|
||||
>
|
||||
{
|
||||
typedef typename set17< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename T6, typename T7, typename T8, typename T9
|
||||
, typename T10, typename T11, typename T12, typename T13, typename T14
|
||||
, typename T15, typename T16, typename T17
|
||||
>
|
||||
struct set<
|
||||
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
|
||||
, T15, T16, T17, na, na
|
||||
>
|
||||
: set18<
|
||||
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
|
||||
, T15, T16, T17
|
||||
>
|
||||
{
|
||||
typedef typename set18< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17 >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename T6, typename T7, typename T8, typename T9
|
||||
, typename T10, typename T11, typename T12, typename T13, typename T14
|
||||
, typename T15, typename T16, typename T17, typename T18
|
||||
>
|
||||
struct set<
|
||||
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
|
||||
, T15, T16, T17, T18, na
|
||||
>
|
||||
: set19<
|
||||
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
|
||||
, T15, T16, T17, T18
|
||||
>
|
||||
{
|
||||
typedef typename set19< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18 >::type type;
|
||||
};
|
||||
|
||||
/// primary template (not a specialization!)
|
||||
|
||||
template<
|
||||
typename T0, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename T6, typename T7, typename T8, typename T9
|
||||
, typename T10, typename T11, typename T12, typename T13, typename T14
|
||||
, typename T15, typename T16, typename T17, typename T18, typename T19
|
||||
>
|
||||
struct set
|
||||
: set20<
|
||||
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
|
||||
, T15, T16, T17, T18, T19
|
||||
>
|
||||
{
|
||||
typedef typename set20< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19 >::type type;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
This is an auto-generated file. Do not edit!
|
||||
==============================================================================*/
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
template<typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 , typename T46 , typename T47 , typename T48 , typename T49>
|
||||
struct deque_initial_size
|
||||
{
|
||||
typedef mpl::vector<T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 , T46 , T47 , T48 , T49> args;
|
||||
typedef typename mpl::find<args, void_>::type first_void;
|
||||
typedef typename mpl::distance<typename mpl::begin<args>::type, first_void>::type type;
|
||||
};
|
||||
}}}
|
||||
@@ -0,0 +1,80 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_INSERT_RANGE_IMPL_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_INSERT_RANGE_IMPL_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id$
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
#include <boost/mpl/placeholders.hpp>
|
||||
#include <boost/mpl/fold.hpp>
|
||||
#include <boost/mpl/insert.hpp>
|
||||
#include <boost/mpl/clear.hpp>
|
||||
#include <boost/mpl/joint_view.hpp>
|
||||
#include <boost/mpl/iterator_range.hpp>
|
||||
#include <boost/mpl/aux_/na_spec.hpp>
|
||||
#include <boost/mpl/aux_/iter_push_front.hpp>
|
||||
#include <boost/mpl/aux_/traits_lambda_spec.hpp>
|
||||
#include <boost/mpl/aux_/config/forwarding.hpp>
|
||||
|
||||
#include <boost/type_traits/same_traits.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
// default implementation; conrete sequences might override it by
|
||||
// specializing either the 'insert_range_impl' or the primary
|
||||
// 'insert_range' template
|
||||
|
||||
|
||||
template< typename Tag >
|
||||
struct insert_range_impl
|
||||
{
|
||||
template<
|
||||
typename Sequence
|
||||
, typename Pos
|
||||
, typename Range
|
||||
>
|
||||
struct apply
|
||||
#if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)
|
||||
: reverse_fold<
|
||||
joint_view<
|
||||
iterator_range<typename begin<Sequence>::type,Pos>
|
||||
, joint_view<
|
||||
Range
|
||||
, iterator_range<Pos,typename end<Sequence>::type>
|
||||
>
|
||||
>
|
||||
, typename clear<Sequence>::type
|
||||
, insert<_1, begin<_1>, _2>
|
||||
>
|
||||
{
|
||||
#else
|
||||
{
|
||||
typedef typename reverse_fold<
|
||||
joint_view<
|
||||
iterator_range<typename begin<Sequence>::type,Pos>
|
||||
, joint_view<
|
||||
Range
|
||||
, iterator_range<Pos,typename end<Sequence>::type>
|
||||
>
|
||||
>
|
||||
, typename clear<Sequence>::type
|
||||
, insert<_1, begin<_1>, _2>
|
||||
>::type type;
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(3,insert_range_impl)
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_AUX_INSERT_RANGE_IMPL_HPP_INCLUDED
|
||||
Reference in New Issue
Block a user