Initial Commit
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
program msk144sim
|
||||
|
||||
use wavhdr
|
||||
parameter (NMAX=15*12000)
|
||||
real pings(0:NMAX-1)
|
||||
real waveform(0:NMAX-1)
|
||||
character*6 mygrid
|
||||
character arg*8,msg*22,msgsent*22,fname*40
|
||||
real wave(0:NMAX-1) !Simulated received waveform
|
||||
real*8 twopi,freq,phi,dphi0,dphi1,dphi
|
||||
type(hdr) h !Header for .wav file
|
||||
integer*2 iwave(0:NMAX-1)
|
||||
integer itone(144) !Message bits
|
||||
logical*1 bcontest
|
||||
data mygrid/"EN50wc"/
|
||||
|
||||
nargs=iargc()
|
||||
if(nargs.ne.6) then
|
||||
print*,'Usage: msk144sim message freq width nslow snr nfiles'
|
||||
print*,'Example: msk144sim "K1ABC W9XYZ EN37" 1500 0.12 1 2 1'
|
||||
print*,' msk144sim "K1ABC W9XYZ EN37" 1500 2.5 32 15 1'
|
||||
go to 999
|
||||
endif
|
||||
call getarg(1,msg)
|
||||
call getarg(2,arg)
|
||||
read(arg,*) freq
|
||||
call getarg(3,arg)
|
||||
read(arg,*) width
|
||||
call getarg(4,arg)
|
||||
read(arg,*) nslow
|
||||
call getarg(5,arg)
|
||||
read(arg,*) snrdb
|
||||
call getarg(6,arg)
|
||||
read(arg,*) nfiles
|
||||
|
||||
!sig is the peak amplitude of the ping.
|
||||
sig=sqrt(2.0)*10.0**(0.05*snrdb)
|
||||
h=default_header(12000,NMAX)
|
||||
i1=len(trim(msg))-5
|
||||
bcontest=.false.
|
||||
if(msg(i1:i1+1).eq.'R ') bcontest=.true.
|
||||
ichk=0
|
||||
call genmsk144(msg,mygrid,ichk,bcontest,msgsent,itone,itype)
|
||||
twopi=8.d0*atan(1.d0)
|
||||
|
||||
nsym=144
|
||||
nsps=6*nslow
|
||||
if( itone(41) .lt. 0 ) nsym=40
|
||||
baud=2000.d0/nslow
|
||||
dphi0=twopi*(freq-0.25d0*baud)/12000.d0
|
||||
dphi1=twopi*(freq+0.25d0*baud)/12000.d0
|
||||
phi=0.0
|
||||
k=0
|
||||
nreps=NMAX/(nsym*nsps)
|
||||
print*,nsym,nslow,nsps,baud,freq
|
||||
do jrep=1,nreps
|
||||
do i=1,nsym
|
||||
if( itone(i) .eq. 0 ) then
|
||||
dphi=dphi0
|
||||
else
|
||||
dphi=dphi1
|
||||
endif
|
||||
do j=1,nsps
|
||||
waveform(k)=cos(phi)
|
||||
k=k+1
|
||||
phi=mod(phi+dphi,twopi)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
if(itype.lt.1 .or. itype.gt.7) then
|
||||
print*,'Illegal message'
|
||||
go to 999
|
||||
endif
|
||||
|
||||
if(nslow.eq.1) call makepings(pings,NMAX,width,sig)
|
||||
|
||||
! call sgran()
|
||||
do ifile=1,nfiles !Loop over requested number of files
|
||||
write(fname,1002) ifile !Output filename
|
||||
1002 format('000000_',i6.6)
|
||||
open(10,file=fname(1:13)//'.wav',access='stream',status='unknown')
|
||||
|
||||
wave=0.0
|
||||
iwave=0
|
||||
fac=sqrt(6000.0/2500.0)
|
||||
do i=0,NMAX-1
|
||||
xx=gran()
|
||||
if(nslow.eq.1) wave(i)=pings(i)*waveform(i) + fac*xx
|
||||
if(nslow.gt.1) wave(i)=sig*waveform(i) + fac*xx
|
||||
iwave(i)=30.0*wave(i)
|
||||
enddo
|
||||
|
||||
write(10) h,iwave !Save the .wav file
|
||||
close(10)
|
||||
|
||||
enddo
|
||||
|
||||
999 end program msk144sim
|
||||
@@ -0,0 +1,13 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_INCLUDE_AT)
|
||||
#define FUSION_INCLUDE_AT
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/at.hpp>
|
||||
|
||||
#endif
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.5 KiB |
@@ -0,0 +1,13 @@
|
||||
/*==============================================================================
|
||||
Copyright (c) 2005-2010 Joel de Guzman
|
||||
Copyright (c) 2010 Thomas Heller
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#ifndef BOOST_PHOENIX_FUSION_HPP
|
||||
#define BOOST_PHOENIX_FUSION_HPP
|
||||
|
||||
#include <boost/phoenix/fusion/at.hpp>
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,177 @@
|
||||
/* boost random/extreme_value_distribution.hpp header file
|
||||
*
|
||||
* Copyright Steven Watanabe 2010
|
||||
* 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_EXTREME_VALUE_DISTRIBUTION_HPP
|
||||
#define BOOST_RANDOM_EXTREME_VALUE_DISTRIBUTION_HPP
|
||||
|
||||
#include <boost/config/no_tr1/cmath.hpp>
|
||||
#include <iosfwd>
|
||||
#include <istream>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/random/detail/operators.hpp>
|
||||
#include <boost/random/uniform_01.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace random {
|
||||
|
||||
/**
|
||||
* The extreme value distribution is a real valued distribution with two
|
||||
* parameters a and b.
|
||||
*
|
||||
* It has \f$\displaystyle p(x) = \frac{1}{b}e^{\frac{a-x}{b} - e^\frac{a-x}{b}}\f$.
|
||||
*/
|
||||
template<class RealType = double>
|
||||
class extreme_value_distribution {
|
||||
public:
|
||||
typedef RealType result_type;
|
||||
typedef RealType input_type;
|
||||
|
||||
class param_type {
|
||||
public:
|
||||
typedef extreme_value_distribution distribution_type;
|
||||
|
||||
/**
|
||||
* Constructs a @c param_type from the "a" and "b" parameters
|
||||
* of the distribution.
|
||||
*
|
||||
* Requires: b > 0
|
||||
*/
|
||||
explicit param_type(RealType a_arg = 1.0, RealType b_arg = 1.0)
|
||||
: _a(a_arg), _b(b_arg)
|
||||
{}
|
||||
|
||||
/** Returns the "a" parameter of the distribtuion. */
|
||||
RealType a() const { return _a; }
|
||||
/** Returns the "b" parameter of the distribution. */
|
||||
RealType b() const { return _b; }
|
||||
|
||||
/** Writes a @c param_type to a @c std::ostream. */
|
||||
BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, param_type, parm)
|
||||
{ os << parm._a << ' ' << parm._b; return os; }
|
||||
|
||||
/** Reads a @c param_type from a @c std::istream. */
|
||||
BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR(is, param_type, parm)
|
||||
{ is >> parm._a >> std::ws >> parm._b; return is; }
|
||||
|
||||
/** Returns true if the two sets of parameters are the same. */
|
||||
BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(param_type, lhs, rhs)
|
||||
{ return lhs._a == rhs._a && lhs._b == rhs._b; }
|
||||
|
||||
/** Returns true if the two sets of parameters are the different. */
|
||||
BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR(param_type)
|
||||
|
||||
private:
|
||||
RealType _a;
|
||||
RealType _b;
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs an @c extreme_value_distribution from its "a" and "b" parameters.
|
||||
*
|
||||
* Requires: b > 0
|
||||
*/
|
||||
explicit extreme_value_distribution(RealType a_arg = 1.0, RealType b_arg = 1.0)
|
||||
: _a(a_arg), _b(b_arg)
|
||||
{}
|
||||
/** Constructs an @c extreme_value_distribution from its parameters. */
|
||||
explicit extreme_value_distribution(const param_type& parm)
|
||||
: _a(parm.a()), _b(parm.b())
|
||||
{}
|
||||
|
||||
/**
|
||||
* Returns a random variate distributed according to the
|
||||
* @c extreme_value_distribution.
|
||||
*/
|
||||
template<class URNG>
|
||||
RealType operator()(URNG& urng) const
|
||||
{
|
||||
using std::log;
|
||||
return _a - log(-log(uniform_01<RealType>()(urng))) * _b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a random variate distributed accordint to the extreme
|
||||
* value distribution with parameters specified by @c param.
|
||||
*/
|
||||
template<class URNG>
|
||||
RealType operator()(URNG& urng, const param_type& parm) const
|
||||
{
|
||||
return extreme_value_distribution(parm)(urng);
|
||||
}
|
||||
|
||||
/** Returns the "a" parameter of the distribution. */
|
||||
RealType a() const { return _a; }
|
||||
/** Returns the "b" parameter of the distribution. */
|
||||
RealType b() const { return _b; }
|
||||
|
||||
/** Returns the smallest value that the distribution can produce. */
|
||||
RealType min BOOST_PREVENT_MACRO_SUBSTITUTION () const
|
||||
{ return -std::numeric_limits<RealType>::infinity(); }
|
||||
/** Returns the largest value that the distribution can produce. */
|
||||
RealType max BOOST_PREVENT_MACRO_SUBSTITUTION () const
|
||||
{ return std::numeric_limits<RealType>::infinity(); }
|
||||
|
||||
/** Returns the parameters of the distribution. */
|
||||
param_type param() const { return param_type(_a, _b); }
|
||||
/** Sets the parameters of the distribution. */
|
||||
void param(const param_type& parm)
|
||||
{
|
||||
_a = parm.a();
|
||||
_b = parm.b();
|
||||
}
|
||||
|
||||
/**
|
||||
* Effects: Subsequent uses of the distribution do not depend
|
||||
* on values produced by any engine prior to invoking reset.
|
||||
*/
|
||||
void reset() { }
|
||||
|
||||
/** Writes an @c extreme_value_distribution to a @c std::ostream. */
|
||||
BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, extreme_value_distribution, wd)
|
||||
{
|
||||
os << wd.param();
|
||||
return os;
|
||||
}
|
||||
|
||||
/** Reads an @c extreme_value_distribution from a @c std::istream. */
|
||||
BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR(is, extreme_value_distribution, wd)
|
||||
{
|
||||
param_type parm;
|
||||
if(is >> parm) {
|
||||
wd.param(parm);
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the two instances of @c extreme_value_distribution will
|
||||
* return identical sequences of values given equal generators.
|
||||
*/
|
||||
BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(extreme_value_distribution, lhs, rhs)
|
||||
{ return lhs._a == rhs._a && lhs._b == rhs._b; }
|
||||
|
||||
/**
|
||||
* Returns true if the two instances of @c extreme_value_distribution will
|
||||
* return different sequences of values given equal generators.
|
||||
*/
|
||||
BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR(extreme_value_distribution)
|
||||
|
||||
private:
|
||||
RealType _a;
|
||||
RealType _b;
|
||||
};
|
||||
|
||||
} // namespace random
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_RANDOM_EXTREME_VALUE_DISTRIBUTION_HPP
|
||||
@@ -0,0 +1,309 @@
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
// Preprocessed version of "boost/mpl/vector_c.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<
|
||||
typename T, long C0 = LONG_MAX, long C1 = LONG_MAX, long C2 = LONG_MAX
|
||||
, long C3 = LONG_MAX, long C4 = LONG_MAX, long C5 = LONG_MAX
|
||||
, long C6 = LONG_MAX, long C7 = LONG_MAX, long C8 = LONG_MAX
|
||||
, long C9 = LONG_MAX, long C10 = LONG_MAX, long C11 = LONG_MAX
|
||||
, long C12 = LONG_MAX, long C13 = LONG_MAX, long C14 = LONG_MAX
|
||||
, long C15 = LONG_MAX, long C16 = LONG_MAX, long C17 = LONG_MAX
|
||||
, long C18 = LONG_MAX, long C19 = LONG_MAX
|
||||
>
|
||||
struct vector_c;
|
||||
|
||||
template<
|
||||
typename T
|
||||
>
|
||||
struct vector_c<
|
||||
T, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: vector0_c<T>
|
||||
{
|
||||
typedef typename vector0_c<T>::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0
|
||||
>
|
||||
struct vector_c<
|
||||
T, C0, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: vector1_c< T, T(C0) >
|
||||
{
|
||||
typedef typename vector1_c< T, T(C0) >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1
|
||||
>
|
||||
struct vector_c<
|
||||
T, C0, C1, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: vector2_c< T, T(C0), T(C1) >
|
||||
{
|
||||
typedef typename vector2_c< T, T(C0), T(C1) >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2
|
||||
>
|
||||
struct vector_c<
|
||||
T, C0, C1, C2, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: vector3_c< T, T(C0), T(C1), T(C2) >
|
||||
{
|
||||
typedef typename vector3_c< T, T(C0), T(C1), T(C2) >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3
|
||||
>
|
||||
struct vector_c<
|
||||
T, C0, C1, C2, C3, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: vector4_c< T, T(C0), T(C1), T(C2), T(C3) >
|
||||
{
|
||||
typedef typename vector4_c< T, T(C0), T(C1), T(C2), T(C3) >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4
|
||||
>
|
||||
struct vector_c<
|
||||
T, C0, C1, C2, C3, C4, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: vector5_c< T, T(C0), T(C1), T(C2), T(C3), T(C4) >
|
||||
{
|
||||
typedef typename vector5_c< T, T(C0), T(C1), T(C2), T(C3), T(C4) >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
>
|
||||
struct vector_c<
|
||||
T, C0, C1, C2, C3, C4, C5, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: vector6_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5) >
|
||||
{
|
||||
typedef typename vector6_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5) >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
, long C6
|
||||
>
|
||||
struct vector_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: vector7_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6) >
|
||||
{
|
||||
typedef typename vector7_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6) >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
, long C6, long C7
|
||||
>
|
||||
struct vector_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: vector8_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7) >
|
||||
{
|
||||
typedef typename vector8_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7) >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
, long C6, long C7, long C8
|
||||
>
|
||||
struct vector_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX
|
||||
>
|
||||
: vector9_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8) >
|
||||
{
|
||||
typedef typename vector9_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8) >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
, long C6, long C7, long C8, long C9
|
||||
>
|
||||
struct vector_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX
|
||||
>
|
||||
: vector10_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9) >
|
||||
{
|
||||
typedef typename vector10_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9) >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
, long C6, long C7, long C8, long C9, long C10
|
||||
>
|
||||
struct vector_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, LONG_MAX, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: vector11_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10) >
|
||||
{
|
||||
typedef typename vector11_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10) >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
, long C6, long C7, long C8, long C9, long C10, long C11
|
||||
>
|
||||
struct vector_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: vector12_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11) >
|
||||
{
|
||||
typedef typename vector12_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11) >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
, long C6, long C7, long C8, long C9, long C10, long C11, long C12
|
||||
>
|
||||
struct vector_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, LONG_MAX
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: vector13_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12) >
|
||||
{
|
||||
typedef typename vector13_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12) >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
, long C6, long C7, long C8, long C9, long C10, long C11, long C12
|
||||
, long C13
|
||||
>
|
||||
struct vector_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: vector14_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13) >
|
||||
{
|
||||
typedef typename vector14_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13) >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
, long C6, long C7, long C8, long C9, long C10, long C11, long C12
|
||||
, long C13, long C14
|
||||
>
|
||||
struct vector_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14
|
||||
, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: vector15_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14) >
|
||||
{
|
||||
typedef typename vector15_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14) >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
, long C6, long C7, long C8, long C9, long C10, long C11, long C12
|
||||
, long C13, long C14, long C15
|
||||
>
|
||||
struct vector_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14
|
||||
, C15, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: vector16_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15) >
|
||||
{
|
||||
typedef typename vector16_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15) >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
, long C6, long C7, long C8, long C9, long C10, long C11, long C12
|
||||
, long C13, long C14, long C15, long C16
|
||||
>
|
||||
struct vector_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14
|
||||
, C15, C16, LONG_MAX, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: vector17_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16) >
|
||||
{
|
||||
typedef typename vector17_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16) >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
, long C6, long C7, long C8, long C9, long C10, long C11, long C12
|
||||
, long C13, long C14, long C15, long C16, long C17
|
||||
>
|
||||
struct vector_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14
|
||||
, C15, C16, C17, LONG_MAX, LONG_MAX
|
||||
>
|
||||
: vector18_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17) >
|
||||
{
|
||||
typedef typename vector18_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17) >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
, long C6, long C7, long C8, long C9, long C10, long C11, long C12
|
||||
, long C13, long C14, long C15, long C16, long C17, long C18
|
||||
>
|
||||
struct vector_c<
|
||||
T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14
|
||||
, C15, C16, C17, C18, LONG_MAX
|
||||
>
|
||||
: vector19_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18) >
|
||||
{
|
||||
typedef typename vector19_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18) >::type type;
|
||||
};
|
||||
|
||||
/// primary template (not a specialization!)
|
||||
|
||||
template<
|
||||
typename T, long C0, long C1, long C2, long C3, long C4, long C5
|
||||
, long C6, long C7, long C8, long C9, long C10, long C11, long C12
|
||||
, long C13, long C14, long C15, long C16, long C17, long C18, long C19
|
||||
>
|
||||
struct vector_c
|
||||
: vector20_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18), T(C19) >
|
||||
{
|
||||
typedef typename vector20_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18), T(C19) >::type type;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
// boost thread_clock.cpp -----------------------------------------------------------//
|
||||
|
||||
// Copyright 2010 Vicente J. Botet Escriba
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
// See http://www.boost.org/libs/chrono for documentation.
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
#ifndef BOOST_CHRONO_DETAIL_INLINED_THREAD_CLOCK_HPP
|
||||
#define BOOST_CHRONO_DETAIL_INLINED_THREAD_CLOCK_HPP
|
||||
|
||||
#include <boost/chrono/config.hpp>
|
||||
#include <boost/version.hpp>
|
||||
#if defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
|
||||
#include <boost/chrono/thread_clock.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#if defined BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING
|
||||
#include <boost/system/system_error.hpp>
|
||||
#endif
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/chrono/detail/system.hpp>
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
// Windows //
|
||||
//----------------------------------------------------------------------------//
|
||||
#if defined(BOOST_CHRONO_WINDOWS_API)
|
||||
#include <boost/chrono/detail/inlined/win/thread_clock.hpp>
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
// Mac //
|
||||
//----------------------------------------------------------------------------//
|
||||
#elif defined(BOOST_CHRONO_MAC_API)
|
||||
#include <boost/chrono/detail/inlined/mac/thread_clock.hpp>
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
// POSIX //
|
||||
//----------------------------------------------------------------------------//
|
||||
#elif defined(BOOST_CHRONO_POSIX_API)
|
||||
#include <boost/chrono/detail/inlined/posix/thread_clock.hpp>
|
||||
|
||||
#endif // POSIX
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard
|
||||
// Hinnant & John Maddock 2000.
|
||||
// Use, modification and distribution are subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt).
|
||||
//
|
||||
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
|
||||
|
||||
|
||||
#ifndef BOOST_TT_IS_UNION_HPP_INCLUDED
|
||||
#define BOOST_TT_IS_UNION_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/intrinsics.hpp>
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
#ifdef BOOST_IS_UNION
|
||||
template <class T> struct is_union : public integral_constant<bool, BOOST_IS_UNION(T)> {};
|
||||
#else
|
||||
template <class T> struct is_union : public integral_constant<bool, false> {};
|
||||
#endif
|
||||
|
||||
template <class T> struct is_union<T const> : public is_union<T>{};
|
||||
template <class T> struct is_union<T volatile const> : public is_union<T>{};
|
||||
template <class T> struct is_union<T volatile> : public is_union<T>{};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_TT_IS_UNION_HPP_INCLUDED
|
||||
@@ -0,0 +1,64 @@
|
||||
// -*- Mode: C++ -*-
|
||||
#ifndef LogQSO_H
|
||||
#define LogQSO_H
|
||||
|
||||
#ifdef QT5
|
||||
#include <QtWidgets>
|
||||
#else
|
||||
#include <QtGui>
|
||||
#endif
|
||||
|
||||
#include <QScopedPointer>
|
||||
|
||||
#include "Radio.hpp"
|
||||
|
||||
namespace Ui {
|
||||
class LogQSO;
|
||||
}
|
||||
|
||||
class QSettings;
|
||||
class Configuration;
|
||||
|
||||
class LogQSO : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit LogQSO(QString const& programTitle, QSettings *, Configuration const *, QWidget *parent = 0);
|
||||
~LogQSO();
|
||||
void initLogQSO(QString const& hisCall, QString const& hisGrid, QString mode,
|
||||
QString const& rptSent, QString const& rptRcvd, QDateTime const& dateTimeOn,
|
||||
QDateTime const& dateTimeOff,
|
||||
Radio::Frequency dialFreq, QString const& myCall, QString const& myGrid,
|
||||
bool noSuffix, bool toRTTY, bool dBtoComments);
|
||||
|
||||
public slots:
|
||||
void accept();
|
||||
|
||||
signals:
|
||||
void acceptQSO (QDateTime const& QSO_date_off, QString const& call, QString const& grid
|
||||
, Radio::Frequency dial_freq, QString const& mode
|
||||
, QString const& rpt_sent, QString const& rpt_received
|
||||
, QString const& tx_power, QString const& comments
|
||||
, QString const& name, QDateTime const& QSO_date_on);
|
||||
|
||||
protected:
|
||||
void hideEvent (QHideEvent *);
|
||||
|
||||
private:
|
||||
void loadSettings ();
|
||||
void storeSettings () const;
|
||||
|
||||
QScopedPointer<Ui::LogQSO> ui;
|
||||
QSettings * m_settings;
|
||||
Configuration const * m_config;
|
||||
QString m_txPower;
|
||||
QString m_comments;
|
||||
Radio::Frequency m_dialFreq;
|
||||
QString m_myCall;
|
||||
QString m_myGrid;
|
||||
QDateTime m_dateTimeOn;
|
||||
QDateTime m_dateTimeOff;
|
||||
};
|
||||
|
||||
#endif // LogQSO_H
|
||||
@@ -0,0 +1,66 @@
|
||||
/* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_MULTI_INDEX_DETAIL_NODE_TYPE_HPP
|
||||
#define BOOST_MULTI_INDEX_DETAIL_NODE_TYPE_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/mpl/bind.hpp>
|
||||
#include <boost/mpl/reverse_iter_fold.hpp>
|
||||
#include <boost/mpl/deref.hpp>
|
||||
#include <boost/multi_index_container_fwd.hpp>
|
||||
#include <boost/multi_index/detail/header_holder.hpp>
|
||||
#include <boost/multi_index/detail/index_node_base.hpp>
|
||||
#include <boost/multi_index/detail/is_index_list.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace multi_index{
|
||||
|
||||
namespace detail{
|
||||
|
||||
/* MPL machinery to construct the internal node type associated to an
|
||||
* index list.
|
||||
*/
|
||||
|
||||
struct index_node_applier
|
||||
{
|
||||
template<typename IndexSpecifierIterator,typename Super>
|
||||
struct apply
|
||||
{
|
||||
typedef typename mpl::deref<IndexSpecifierIterator>::type index_specifier;
|
||||
typedef typename index_specifier::
|
||||
BOOST_NESTED_TEMPLATE node_class<Super>::type type;
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Value,typename IndexSpecifierList,typename Allocator>
|
||||
struct multi_index_node_type
|
||||
{
|
||||
BOOST_STATIC_ASSERT(detail::is_index_list<IndexSpecifierList>::value);
|
||||
|
||||
typedef typename mpl::reverse_iter_fold<
|
||||
IndexSpecifierList,
|
||||
index_node_base<Value,Allocator>,
|
||||
mpl::bind2<index_node_applier,mpl::_2,mpl::_1>
|
||||
>::type type;
|
||||
};
|
||||
|
||||
} /* namespace multi_index::detail */
|
||||
|
||||
} /* namespace multi_index */
|
||||
|
||||
} /* namespace boost */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,261 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
// See http://boostorg.github.com/compute for more information.
|
||||
//---------------------------------------------------------------------------//
|
||||
|
||||
#ifndef BOOST_COMPUTE_FUNCTIONAL_BIND_HPP
|
||||
#define BOOST_COMPUTE_FUNCTIONAL_BIND_HPP
|
||||
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/type_traits/conditional.hpp>
|
||||
|
||||
#include <boost/compute/config.hpp>
|
||||
#include <boost/compute/detail/meta_kernel.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
namespace placeholders {
|
||||
|
||||
/// \internal_
|
||||
template<int I>
|
||||
struct placeholder : boost::integral_constant<int, I>
|
||||
{
|
||||
placeholder() { }
|
||||
};
|
||||
|
||||
placeholder<0> const _1;
|
||||
placeholder<1> const _2;
|
||||
|
||||
} // end placeholders namespace
|
||||
|
||||
/// Meta-function returning \c true if \c T is a placeholder type.
|
||||
template<class T>
|
||||
struct is_placeholder : boost::false_type
|
||||
{
|
||||
};
|
||||
|
||||
/// \internal_
|
||||
template<int I>
|
||||
struct is_placeholder<placeholders::placeholder<I> > : boost::true_type
|
||||
{
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<class Function, class BoundArgs, class Args>
|
||||
struct invoked_bound_function
|
||||
{
|
||||
invoked_bound_function(Function f, BoundArgs bound_args, Args args)
|
||||
: m_function(f),
|
||||
m_bound_args(bound_args),
|
||||
m_args(args)
|
||||
{
|
||||
}
|
||||
|
||||
// meta-function returning true if the N'th argument is a placeholder
|
||||
template<int N>
|
||||
struct is_placeholder_arg
|
||||
{
|
||||
typedef typename boost::tuples::element<N, BoundArgs>::type nth_bound_arg;
|
||||
|
||||
typedef typename is_placeholder<nth_bound_arg>::type type;
|
||||
static const bool value = is_placeholder<nth_bound_arg>::value;
|
||||
};
|
||||
|
||||
template<class Arg>
|
||||
struct get_arg_type
|
||||
{
|
||||
typedef Arg type;
|
||||
};
|
||||
|
||||
template<int I>
|
||||
struct get_arg_type<placeholders::placeholder<I> >
|
||||
{
|
||||
typedef typename boost::tuples::element<I, Args>::type type;
|
||||
};
|
||||
|
||||
// meta-function returning the type of the N'th argument when invoked
|
||||
template<int N>
|
||||
struct get_nth_arg_type
|
||||
{
|
||||
typedef typename boost::tuples::element<N, BoundArgs>::type nth_bound_arg;
|
||||
|
||||
typedef typename get_arg_type<nth_bound_arg>::type type;
|
||||
};
|
||||
|
||||
template<int N>
|
||||
typename get_nth_arg_type<N>::type get_nth_arg(
|
||||
typename boost::enable_if_c<is_placeholder_arg<N>::value>::type* = 0
|
||||
) const
|
||||
{
|
||||
typedef typename boost::tuples::element<N, BoundArgs>::type nth_bound_arg;
|
||||
|
||||
return boost::get<nth_bound_arg::value>(m_args);
|
||||
}
|
||||
|
||||
template<int N>
|
||||
typename get_nth_arg_type<N>::type get_nth_arg(
|
||||
typename boost::disable_if_c<is_placeholder_arg<N>::value>::type* = 0
|
||||
) const
|
||||
{
|
||||
return boost::get<N>(m_bound_args);
|
||||
}
|
||||
|
||||
Function m_function;
|
||||
BoundArgs m_bound_args;
|
||||
Args m_args;
|
||||
};
|
||||
|
||||
template<class Function, class BoundArgs, class Args>
|
||||
inline meta_kernel& apply_invoked_bound_function(
|
||||
meta_kernel &k,
|
||||
const invoked_bound_function<Function, BoundArgs, Args> &expr,
|
||||
typename boost::enable_if_c<
|
||||
boost::tuples::length<BoundArgs>::value == 1
|
||||
>::type* = 0
|
||||
)
|
||||
{
|
||||
return k << expr.m_function(expr.template get_nth_arg<0>());
|
||||
}
|
||||
|
||||
template<class Function, class BoundArgs, class Args>
|
||||
inline meta_kernel& apply_invoked_bound_function(
|
||||
meta_kernel &k,
|
||||
const invoked_bound_function<Function, BoundArgs, Args> &expr,
|
||||
typename boost::enable_if_c<
|
||||
boost::tuples::length<BoundArgs>::value == 2
|
||||
>::type* = 0
|
||||
)
|
||||
{
|
||||
return k << expr.m_function(expr.template get_nth_arg<0>(),
|
||||
expr.template get_nth_arg<1>());
|
||||
}
|
||||
|
||||
template<class Function, class BoundArgs, class Args>
|
||||
inline meta_kernel& apply_invoked_bound_function(
|
||||
meta_kernel &k,
|
||||
const invoked_bound_function<Function, BoundArgs, Args> &expr,
|
||||
typename boost::enable_if_c<
|
||||
boost::tuples::length<BoundArgs>::value == 3
|
||||
>::type* = 0
|
||||
)
|
||||
{
|
||||
return k << expr.m_function(expr.template get_nth_arg<0>(),
|
||||
expr.template get_nth_arg<1>(),
|
||||
expr.template get_nth_arg<2>());
|
||||
}
|
||||
|
||||
template<class Function, class BoundArgs, class Args>
|
||||
inline meta_kernel& operator<<(
|
||||
meta_kernel &k,
|
||||
const invoked_bound_function<Function, BoundArgs, Args> &expr
|
||||
)
|
||||
{
|
||||
return apply_invoked_bound_function(k, expr);
|
||||
}
|
||||
|
||||
template<class Function, class BoundArgs>
|
||||
struct bound_function
|
||||
{
|
||||
typedef int result_type;
|
||||
|
||||
bound_function(Function f, BoundArgs args)
|
||||
: m_function(f),
|
||||
m_args(args)
|
||||
{
|
||||
}
|
||||
|
||||
template<class Arg1>
|
||||
detail::invoked_bound_function<
|
||||
Function,
|
||||
BoundArgs,
|
||||
boost::tuple<Arg1>
|
||||
>
|
||||
operator()(const Arg1 &arg1) const
|
||||
{
|
||||
return detail::invoked_bound_function<
|
||||
Function,
|
||||
BoundArgs,
|
||||
boost::tuple<Arg1>
|
||||
>(m_function, m_args, boost::make_tuple(arg1));
|
||||
}
|
||||
|
||||
template<class Arg1, class Arg2>
|
||||
detail::invoked_bound_function<
|
||||
Function,
|
||||
BoundArgs,
|
||||
boost::tuple<Arg1, Arg2>
|
||||
>
|
||||
operator()(const Arg1 &arg1, const Arg2 &arg2) const
|
||||
{
|
||||
return detail::invoked_bound_function<
|
||||
Function,
|
||||
BoundArgs,
|
||||
boost::tuple<Arg1, Arg2>
|
||||
>(m_function, m_args, boost::make_tuple(arg1, arg2));
|
||||
}
|
||||
|
||||
Function m_function;
|
||||
BoundArgs m_args;
|
||||
};
|
||||
|
||||
} // end detail namespace
|
||||
|
||||
#if !defined(BOOST_COMPUTE_NO_VARIADIC_TEMPLATES) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED)
|
||||
/// Returns a function wrapper which invokes \p f with \p args when called.
|
||||
///
|
||||
/// For example, to generate a unary function object which returns \c true
|
||||
/// when its argument is less than \c 7:
|
||||
/// \code
|
||||
/// using boost::compute::less;
|
||||
/// using boost::compute::placeholders::_1;
|
||||
///
|
||||
/// auto less_than_seven = boost::compute::bind(less<int>(), _1, 7);
|
||||
/// \endcode
|
||||
template<class F, class... Args>
|
||||
inline detail::bound_function<F, boost::tuple<Args...> >
|
||||
bind(F f, Args... args)
|
||||
{
|
||||
typedef typename boost::tuple<Args...> ArgsTuple;
|
||||
|
||||
return detail::bound_function<F, ArgsTuple>(f, boost::make_tuple(args...));
|
||||
}
|
||||
#else
|
||||
template<class F, class A1>
|
||||
inline detail::bound_function<F, boost::tuple<A1> >
|
||||
bind(F f, A1 a1)
|
||||
{
|
||||
typedef typename boost::tuple<A1> Args;
|
||||
|
||||
return detail::bound_function<F, Args>(f, boost::make_tuple(a1));
|
||||
}
|
||||
|
||||
template<class F, class A1, class A2>
|
||||
inline detail::bound_function<F, boost::tuple<A1, A2> >
|
||||
bind(F f, A1 a1, A2 a2)
|
||||
{
|
||||
typedef typename boost::tuple<A1, A2> Args;
|
||||
|
||||
return detail::bound_function<F, Args>(f, boost::make_tuple(a1, a2));
|
||||
}
|
||||
|
||||
template<class F, class A1, class A2, class A3>
|
||||
inline detail::bound_function<F, boost::tuple<A1, A2, A3> >
|
||||
bind(F f, A1 a1, A2 a2, A3 a3)
|
||||
{
|
||||
typedef typename boost::tuple<A1, A2, A3> Args;
|
||||
|
||||
return detail::bound_function<F, Args>(f, boost::make_tuple(a1, a2, a3));
|
||||
}
|
||||
#endif // BOOST_COMPUTE_NO_VARIADIC_TEMPLATES
|
||||
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_FUNCTIONAL_BIND_HPP
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,231 @@
|
||||
// boost/uuid/sha1.hpp header file ----------------------------------------------//
|
||||
|
||||
// Copyright 2007 Andy Tompkins.
|
||||
// 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)
|
||||
|
||||
// Revision History
|
||||
// 29 May 2007 - Initial Revision
|
||||
// 25 Feb 2008 - moved to namespace boost::uuids::detail
|
||||
// 10 Jan 2012 - can now handle the full size of messages (2^64 - 1 bits)
|
||||
|
||||
// This is a byte oriented implementation
|
||||
|
||||
#ifndef BOOST_UUID_SHA1_H
|
||||
#define BOOST_UUID_SHA1_H
|
||||
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <stdexcept>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
|
||||
#ifdef BOOST_NO_STDC_NAMESPACE
|
||||
namespace std {
|
||||
using ::size_t;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace uuids {
|
||||
namespace detail {
|
||||
|
||||
BOOST_STATIC_ASSERT(sizeof(unsigned char)*8 == 8);
|
||||
BOOST_STATIC_ASSERT(sizeof(unsigned int)*8 == 32);
|
||||
|
||||
inline unsigned int left_rotate(unsigned int x, std::size_t n)
|
||||
{
|
||||
return (x<<n) ^ (x>> (32-n));
|
||||
}
|
||||
|
||||
class sha1
|
||||
{
|
||||
public:
|
||||
typedef unsigned int(&digest_type)[5];
|
||||
public:
|
||||
sha1();
|
||||
|
||||
void reset();
|
||||
|
||||
void process_byte(unsigned char byte);
|
||||
void process_block(void const* bytes_begin, void const* bytes_end);
|
||||
void process_bytes(void const* buffer, std::size_t byte_count);
|
||||
|
||||
void get_digest(digest_type digest);
|
||||
|
||||
private:
|
||||
void process_block();
|
||||
void process_byte_impl(unsigned char byte);
|
||||
|
||||
private:
|
||||
unsigned int h_[5];
|
||||
|
||||
unsigned char block_[64];
|
||||
|
||||
std::size_t block_byte_index_;
|
||||
std::size_t bit_count_low;
|
||||
std::size_t bit_count_high;
|
||||
};
|
||||
|
||||
inline sha1::sha1()
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
inline void sha1::reset()
|
||||
{
|
||||
h_[0] = 0x67452301;
|
||||
h_[1] = 0xEFCDAB89;
|
||||
h_[2] = 0x98BADCFE;
|
||||
h_[3] = 0x10325476;
|
||||
h_[4] = 0xC3D2E1F0;
|
||||
|
||||
block_byte_index_ = 0;
|
||||
bit_count_low = 0;
|
||||
bit_count_high = 0;
|
||||
}
|
||||
|
||||
inline void sha1::process_byte(unsigned char byte)
|
||||
{
|
||||
process_byte_impl(byte);
|
||||
|
||||
// size_t max value = 0xFFFFFFFF
|
||||
//if (bit_count_low + 8 >= 0x100000000) { // would overflow
|
||||
//if (bit_count_low >= 0x100000000-8) {
|
||||
if (bit_count_low < 0xFFFFFFF8) {
|
||||
bit_count_low += 8;
|
||||
} else {
|
||||
bit_count_low = 0;
|
||||
|
||||
if (bit_count_high <= 0xFFFFFFFE) {
|
||||
++bit_count_high;
|
||||
} else {
|
||||
BOOST_THROW_EXCEPTION(std::runtime_error("sha1 too many bytes"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline void sha1::process_byte_impl(unsigned char byte)
|
||||
{
|
||||
block_[block_byte_index_++] = byte;
|
||||
|
||||
if (block_byte_index_ == 64) {
|
||||
block_byte_index_ = 0;
|
||||
process_block();
|
||||
}
|
||||
}
|
||||
|
||||
inline void sha1::process_block(void const* bytes_begin, void const* bytes_end)
|
||||
{
|
||||
unsigned char const* begin = static_cast<unsigned char const*>(bytes_begin);
|
||||
unsigned char const* end = static_cast<unsigned char const*>(bytes_end);
|
||||
for(; begin != end; ++begin) {
|
||||
process_byte(*begin);
|
||||
}
|
||||
}
|
||||
|
||||
inline void sha1::process_bytes(void const* buffer, std::size_t byte_count)
|
||||
{
|
||||
unsigned char const* b = static_cast<unsigned char const*>(buffer);
|
||||
process_block(b, b+byte_count);
|
||||
}
|
||||
|
||||
inline void sha1::process_block()
|
||||
{
|
||||
unsigned int w[80];
|
||||
for (std::size_t i=0; i<16; ++i) {
|
||||
w[i] = (block_[i*4 + 0] << 24);
|
||||
w[i] |= (block_[i*4 + 1] << 16);
|
||||
w[i] |= (block_[i*4 + 2] << 8);
|
||||
w[i] |= (block_[i*4 + 3]);
|
||||
}
|
||||
for (std::size_t i=16; i<80; ++i) {
|
||||
w[i] = left_rotate((w[i-3] ^ w[i-8] ^ w[i-14] ^ w[i-16]), 1);
|
||||
}
|
||||
|
||||
unsigned int a = h_[0];
|
||||
unsigned int b = h_[1];
|
||||
unsigned int c = h_[2];
|
||||
unsigned int d = h_[3];
|
||||
unsigned int e = h_[4];
|
||||
|
||||
for (std::size_t i=0; i<80; ++i) {
|
||||
unsigned int f;
|
||||
unsigned int k;
|
||||
|
||||
if (i<20) {
|
||||
f = (b & c) | (~b & d);
|
||||
k = 0x5A827999;
|
||||
} else if (i<40) {
|
||||
f = b ^ c ^ d;
|
||||
k = 0x6ED9EBA1;
|
||||
} else if (i<60) {
|
||||
f = (b & c) | (b & d) | (c & d);
|
||||
k = 0x8F1BBCDC;
|
||||
} else {
|
||||
f = b ^ c ^ d;
|
||||
k = 0xCA62C1D6;
|
||||
}
|
||||
|
||||
unsigned temp = left_rotate(a, 5) + f + e + k + w[i];
|
||||
e = d;
|
||||
d = c;
|
||||
c = left_rotate(b, 30);
|
||||
b = a;
|
||||
a = temp;
|
||||
}
|
||||
|
||||
h_[0] += a;
|
||||
h_[1] += b;
|
||||
h_[2] += c;
|
||||
h_[3] += d;
|
||||
h_[4] += e;
|
||||
}
|
||||
|
||||
inline void sha1::get_digest(digest_type digest)
|
||||
{
|
||||
// append the bit '1' to the message
|
||||
process_byte_impl(0x80);
|
||||
|
||||
// append k bits '0', where k is the minimum number >= 0
|
||||
// such that the resulting message length is congruent to 56 (mod 64)
|
||||
// check if there is enough space for padding and bit_count
|
||||
if (block_byte_index_ > 56) {
|
||||
// finish this block
|
||||
while (block_byte_index_ != 0) {
|
||||
process_byte_impl(0);
|
||||
}
|
||||
|
||||
// one more block
|
||||
while (block_byte_index_ < 56) {
|
||||
process_byte_impl(0);
|
||||
}
|
||||
} else {
|
||||
while (block_byte_index_ < 56) {
|
||||
process_byte_impl(0);
|
||||
}
|
||||
}
|
||||
|
||||
// append length of message (before pre-processing)
|
||||
// as a 64-bit big-endian integer
|
||||
process_byte_impl( static_cast<unsigned char>((bit_count_high>>24) & 0xFF) );
|
||||
process_byte_impl( static_cast<unsigned char>((bit_count_high>>16) & 0xFF) );
|
||||
process_byte_impl( static_cast<unsigned char>((bit_count_high>>8 ) & 0xFF) );
|
||||
process_byte_impl( static_cast<unsigned char>((bit_count_high) & 0xFF) );
|
||||
process_byte_impl( static_cast<unsigned char>((bit_count_low>>24) & 0xFF) );
|
||||
process_byte_impl( static_cast<unsigned char>((bit_count_low>>16) & 0xFF) );
|
||||
process_byte_impl( static_cast<unsigned char>((bit_count_low>>8 ) & 0xFF) );
|
||||
process_byte_impl( static_cast<unsigned char>((bit_count_low) & 0xFF) );
|
||||
|
||||
// get final digest
|
||||
digest[0] = h_[0];
|
||||
digest[1] = h_[1];
|
||||
digest[2] = h_[2];
|
||||
digest[3] = h_[3];
|
||||
digest[4] = h_[4];
|
||||
}
|
||||
|
||||
}}} // namespace boost::uuids::detail
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,309 @@
|
||||
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
|
||||
// unit/quantity manipulation and conversion
|
||||
//
|
||||
// Copyright (C) 2003-2008 Matthias Christian Schabel
|
||||
// Copyright (C) 2008 Steven Watanabe
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_UNITS_DETAIL_HETEROGENEOUS_CONVERSION_HPP
|
||||
#define BOOST_UNITS_DETAIL_HETEROGENEOUS_CONVERSION_HPP
|
||||
|
||||
#include <boost/mpl/minus.hpp>
|
||||
#include <boost/mpl/times.hpp>
|
||||
|
||||
#include <boost/units/static_rational.hpp>
|
||||
#include <boost/units/homogeneous_system.hpp>
|
||||
#include <boost/units/detail/linear_algebra.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace units {
|
||||
|
||||
namespace detail {
|
||||
|
||||
struct solve_end {
|
||||
template<class Begin, class Y>
|
||||
struct apply {
|
||||
typedef dimensionless_type type;
|
||||
};
|
||||
};
|
||||
|
||||
struct no_solution {};
|
||||
|
||||
template<class X1, class X2, class Next>
|
||||
struct solve_normal {
|
||||
template<class Begin, class Y>
|
||||
struct apply {
|
||||
typedef typename Begin::next next;
|
||||
typedef list<
|
||||
typename mpl::minus<
|
||||
typename mpl::times<X1, Y>::type,
|
||||
typename mpl::times<X2, typename Begin::item>::type
|
||||
>::type,
|
||||
typename Next::template apply<next, Y>::type
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
template<class Next>
|
||||
struct solve_leading_zeroes {
|
||||
template<class Begin>
|
||||
struct apply {
|
||||
typedef list<
|
||||
typename Begin::item,
|
||||
typename Next::template apply<typename Begin::next>::type
|
||||
> type;
|
||||
};
|
||||
typedef solve_leading_zeroes type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct solve_leading_zeroes<no_solution> {
|
||||
typedef no_solution type;
|
||||
};
|
||||
|
||||
template<class Next>
|
||||
struct solve_first_non_zero {
|
||||
template<class Begin>
|
||||
struct apply {
|
||||
typedef typename Next::template apply<
|
||||
typename Begin::next,
|
||||
typename Begin::item
|
||||
>::type type;
|
||||
};
|
||||
};
|
||||
|
||||
template<class Next>
|
||||
struct solve_internal_zero {
|
||||
template<class Begin, class Y>
|
||||
struct apply {
|
||||
typedef list<
|
||||
typename Begin::item,
|
||||
typename Next::template apply<typename Begin::next, Y>::type
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct make_solve_list_internal_zero {
|
||||
template<class Next, class X>
|
||||
struct apply {
|
||||
typedef solve_normal<T, X, Next> type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct make_solve_list_internal_zero<static_rational<0> > {
|
||||
template<class Next, class X>
|
||||
struct apply {
|
||||
typedef solve_internal_zero<Next> type;
|
||||
};
|
||||
};
|
||||
|
||||
template<int N>
|
||||
struct make_solve_list_normal {
|
||||
template<class Begin, class X>
|
||||
struct apply {
|
||||
typedef typename make_solve_list_internal_zero<
|
||||
typename Begin::item
|
||||
>::template apply<
|
||||
typename make_solve_list_normal<N-1>::template apply<typename Begin::next, X>::type,
|
||||
X
|
||||
>::type type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct make_solve_list_normal<0> {
|
||||
template<class Begin, class X>
|
||||
struct apply {
|
||||
typedef solve_end type;
|
||||
};
|
||||
};
|
||||
|
||||
template<int N>
|
||||
struct make_solve_list_leading_zeroes;
|
||||
|
||||
template<class T>
|
||||
struct make_solve_list_first_non_zero {
|
||||
template<class Begin, int N>
|
||||
struct apply {
|
||||
typedef solve_first_non_zero<
|
||||
typename make_solve_list_normal<N-1>::template apply<
|
||||
typename Begin::next,
|
||||
typename Begin::item
|
||||
>::type
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct make_solve_list_first_non_zero<static_rational<0> > {
|
||||
template<class Begin, int N>
|
||||
struct apply {
|
||||
typedef typename solve_leading_zeroes<
|
||||
typename make_solve_list_leading_zeroes<N-1>::template apply<
|
||||
typename Begin::next
|
||||
>::type
|
||||
>::type type;
|
||||
};
|
||||
};
|
||||
|
||||
template<int N>
|
||||
struct make_solve_list_leading_zeroes {
|
||||
template<class Begin>
|
||||
struct apply {
|
||||
typedef typename make_solve_list_first_non_zero<typename Begin::item>::template apply<Begin, N>::type type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct make_solve_list_leading_zeroes<0> {
|
||||
template<class Begin>
|
||||
struct apply {
|
||||
typedef no_solution type;
|
||||
};
|
||||
};
|
||||
|
||||
template<int N>
|
||||
struct try_add_unit_impl {
|
||||
template<class Begin, class L>
|
||||
struct apply {
|
||||
typedef typename try_add_unit_impl<N-1>::template apply<typename Begin::next, L>::type next;
|
||||
typedef typename Begin::item::template apply<next>::type type;
|
||||
BOOST_STATIC_ASSERT((next::size::value - 1 == type::size::value));
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct try_add_unit_impl<0> {
|
||||
template<class Begin, class L>
|
||||
struct apply {
|
||||
typedef L type;
|
||||
};
|
||||
};
|
||||
|
||||
template<int N>
|
||||
struct make_homogeneous_system_impl;
|
||||
|
||||
template<class T, bool is_done>
|
||||
struct make_homogeneous_system_func;
|
||||
|
||||
template<class T>
|
||||
struct make_homogeneous_system_func<T, false> {
|
||||
template<class Begin, class Current, class Units, class Dimensions, int N>
|
||||
struct apply {
|
||||
typedef typename make_homogeneous_system_impl<N-1>::template apply<
|
||||
typename Begin::next,
|
||||
list<T, Current>,
|
||||
list<typename Begin::item, Units>,
|
||||
Dimensions
|
||||
>::type type;
|
||||
};
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct make_homogeneous_system_func<T, true> {
|
||||
template<class Begin, class Current, class Units, class Dimensions, int N>
|
||||
struct apply {
|
||||
typedef list<typename Begin::item, Units> type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct make_homogeneous_system_func<no_solution, false> {
|
||||
template<class Begin, class Current, class Units, class Dimensions, int N>
|
||||
struct apply {
|
||||
typedef typename make_homogeneous_system_impl<N-1>::template apply<
|
||||
typename Begin::next,
|
||||
Current,
|
||||
Units,
|
||||
Dimensions
|
||||
>::type type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct make_homogeneous_system_func<no_solution, true> {
|
||||
template<class Begin, class Current, class Units, class Dimensions, int N>
|
||||
struct apply {
|
||||
typedef typename make_homogeneous_system_impl<N-1>::template apply<
|
||||
typename Begin::next,
|
||||
Current,
|
||||
Units,
|
||||
Dimensions
|
||||
>::type type;
|
||||
};
|
||||
};
|
||||
|
||||
template<int N>
|
||||
struct make_homogeneous_system_impl {
|
||||
template<class Begin, class Current, class Units, class Dimensions>
|
||||
struct apply {
|
||||
typedef typename expand_dimensions<Dimensions::size::value>::template apply<
|
||||
Dimensions,
|
||||
typename Begin::item::dimension_type
|
||||
>::type dimensions;
|
||||
typedef typename try_add_unit_impl<Current::size::value>::template apply<Current, dimensions>::type new_element;
|
||||
typedef typename make_solve_list_leading_zeroes<new_element::size::value>::template apply<new_element>::type new_func;
|
||||
typedef typename make_homogeneous_system_func<
|
||||
new_func,
|
||||
((Current::size::value)+1) == (Dimensions::size::value)
|
||||
>::template apply<Begin, Current, Units, Dimensions, N>::type type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct make_homogeneous_system_impl<0> {
|
||||
template<class Begin, class Current, class Units, class Dimensions>
|
||||
struct apply {
|
||||
typedef Units type;
|
||||
};
|
||||
};
|
||||
|
||||
template<class Units>
|
||||
struct make_homogeneous_system {
|
||||
typedef typename find_base_dimensions<Units>::type base_dimensions;
|
||||
typedef homogeneous_system<
|
||||
typename insertion_sort<
|
||||
typename make_homogeneous_system_impl<
|
||||
Units::size::value
|
||||
>::template apply<
|
||||
Units,
|
||||
dimensionless_type,
|
||||
dimensionless_type,
|
||||
base_dimensions
|
||||
>::type
|
||||
>::type
|
||||
> type;
|
||||
};
|
||||
|
||||
template<int N>
|
||||
struct extract_base_units {
|
||||
template<class Begin, class T>
|
||||
struct apply {
|
||||
typedef list<
|
||||
typename Begin::item::tag_type,
|
||||
typename extract_base_units<N-1>::template apply<typename Begin::next, T>::type
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct extract_base_units<0> {
|
||||
template<class Begin, class T>
|
||||
struct apply {
|
||||
typedef T type;
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,51 @@
|
||||
// Copyright David Abrahams 2001.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef CLASS_WRAPPER_DWA20011221_HPP
|
||||
# define CLASS_WRAPPER_DWA20011221_HPP
|
||||
|
||||
# include <boost/python/to_python_converter.hpp>
|
||||
#ifndef BOOST_PYTHON_NO_PY_SIGNATURES
|
||||
# include <boost/python/converter/pytype_function.hpp>
|
||||
#endif
|
||||
# include <boost/ref.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace objects {
|
||||
|
||||
//
|
||||
// These two classes adapt the static execute function of a class
|
||||
// MakeInstance execute() function returning a new PyObject*
|
||||
// reference. The first one is used for class copy constructors, and
|
||||
// the second one is used to handle smart pointers.
|
||||
//
|
||||
|
||||
template <class Src, class MakeInstance>
|
||||
struct class_cref_wrapper
|
||||
: to_python_converter<Src,class_cref_wrapper<Src,MakeInstance> ,true>
|
||||
{
|
||||
static PyObject* convert(Src const& x)
|
||||
{
|
||||
return MakeInstance::execute(boost::ref(x));
|
||||
}
|
||||
#ifndef BOOST_PYTHON_NO_PY_SIGNATURES
|
||||
static PyTypeObject const *get_pytype() { return converter::registered_pytype_direct<Src>::get_pytype(); }
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class Src, class MakeInstance>
|
||||
struct class_value_wrapper
|
||||
: to_python_converter<Src,class_value_wrapper<Src,MakeInstance> ,true>
|
||||
{
|
||||
static PyObject* convert(Src x)
|
||||
{
|
||||
return MakeInstance::execute(x);
|
||||
}
|
||||
#ifndef BOOST_PYTHON_NO_PY_SIGNATURES
|
||||
static PyTypeObject const *get_pytype() { return MakeInstance::get_pytype(); }
|
||||
#endif
|
||||
};
|
||||
|
||||
}}} // namespace boost::python::objects
|
||||
|
||||
#endif // CLASS_WRAPPER_DWA20011221_HPP
|
||||
@@ -0,0 +1,123 @@
|
||||
#ifndef BOOST_SERIALIZATION_NVP_HPP
|
||||
#define BOOST_SERIALIZATION_NVP_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// nvp.hpp: interface for serialization system.
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <boost/serialization/level.hpp>
|
||||
#include <boost/serialization/tracking.hpp>
|
||||
#include <boost/serialization/split_member.hpp>
|
||||
#include <boost/serialization/base_object.hpp>
|
||||
#include <boost/serialization/traits.hpp>
|
||||
#include <boost/serialization/wrapper.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
|
||||
template<class T>
|
||||
struct nvp :
|
||||
public std::pair<const char *, T *>,
|
||||
public wrapper_traits<const nvp< T > >
|
||||
{
|
||||
//private:
|
||||
nvp(const nvp & rhs) :
|
||||
std::pair<const char *, T *>(rhs.first, rhs.second)
|
||||
{}
|
||||
public:
|
||||
explicit nvp(const char * name_, T & t) :
|
||||
// note: added _ to suppress useless gcc warning
|
||||
std::pair<const char *, T *>(name_, & t)
|
||||
{}
|
||||
|
||||
const char * name() const {
|
||||
return this->first;
|
||||
}
|
||||
T & value() const {
|
||||
return *(this->second);
|
||||
}
|
||||
|
||||
const T & const_value() const {
|
||||
return *(this->second);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
void save(
|
||||
Archive & ar,
|
||||
const unsigned int /* file_version */
|
||||
) const {
|
||||
ar.operator<<(const_value());
|
||||
}
|
||||
template<class Archive>
|
||||
void load(
|
||||
Archive & ar,
|
||||
const unsigned int /* file_version */
|
||||
){
|
||||
ar.operator>>(value());
|
||||
}
|
||||
BOOST_SERIALIZATION_SPLIT_MEMBER()
|
||||
};
|
||||
|
||||
template<class T>
|
||||
inline
|
||||
const nvp< T > make_nvp(const char * name, T & t){
|
||||
return nvp< T >(name, t);
|
||||
}
|
||||
|
||||
// to maintain efficiency and portability, we want to assign
|
||||
// specific serialization traits to all instances of this wrappers.
|
||||
// we can't strait forward method below as it depends upon
|
||||
// Partial Template Specialization and doing so would mean that wrappers
|
||||
// wouldn't be treated the same on different platforms. This would
|
||||
// break archive portability. Leave this here as reminder not to use it !!!
|
||||
|
||||
template <class T>
|
||||
struct implementation_level<nvp< T > >
|
||||
{
|
||||
typedef mpl::integral_c_tag tag;
|
||||
typedef mpl::int_<object_serializable> type;
|
||||
BOOST_STATIC_CONSTANT(int, value = implementation_level::type::value);
|
||||
};
|
||||
|
||||
// nvp objects are generally created on the stack and are never tracked
|
||||
template<class T>
|
||||
struct tracking_level<nvp< T > >
|
||||
{
|
||||
typedef mpl::integral_c_tag tag;
|
||||
typedef mpl::int_<track_never> type;
|
||||
BOOST_STATIC_CONSTANT(int, value = tracking_level::type::value);
|
||||
};
|
||||
|
||||
} // seralization
|
||||
} // boost
|
||||
|
||||
#include <boost/preprocessor/stringize.hpp>
|
||||
|
||||
#define BOOST_SERIALIZATION_NVP(name) \
|
||||
boost::serialization::make_nvp(BOOST_PP_STRINGIZE(name), name)
|
||||
/**/
|
||||
|
||||
#define BOOST_SERIALIZATION_BASE_OBJECT_NVP(name) \
|
||||
boost::serialization::make_nvp( \
|
||||
BOOST_PP_STRINGIZE(name), \
|
||||
boost::serialization::base_object<name >(*this) \
|
||||
)
|
||||
/**/
|
||||
|
||||
#endif // BOOST_SERIALIZATION_NVP_HPP
|
||||
@@ -0,0 +1,16 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2011 Eric Niebler
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_SEGMENTED_ITERATOR_HPP_INCLUDED)
|
||||
#define BOOST_FUSION_SEGMENTED_ITERATOR_HPP_INCLUDED
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/iterator/detail/segmented_iterator.hpp>
|
||||
#include <boost/fusion/iterator/detail/segmented_next_impl.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/container/list/cons.hpp>
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,44 @@
|
||||
// Boost.Assign library
|
||||
//
|
||||
// Copyright Thorsten Ottosen 2003-2004. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/assign/
|
||||
//
|
||||
|
||||
|
||||
#ifndef BOOST_ASSIGN_STD_SET_HPP
|
||||
#define BOOST_ASSIGN_STD_SET_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/assign/list_inserter.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <set>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace assign
|
||||
{
|
||||
template< class K, class C, class A, class K2 >
|
||||
inline list_inserter< assign_detail::call_insert< std::set<K,C,A> >, K >
|
||||
operator+=( std::set<K,C,A>& c, K2 k )
|
||||
{
|
||||
return insert( c )( k );
|
||||
}
|
||||
|
||||
template< class K, class C, class A, class K2 >
|
||||
inline list_inserter< assign_detail::call_insert< std::multiset<K,C,A> >, K >
|
||||
operator+=( std::multiset<K,C,A>& c, K2 k )
|
||||
{
|
||||
return insert( c )( k );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,200 @@
|
||||
// Boost string_algo library sequence.hpp header file ---------------------------//
|
||||
|
||||
// Copyright Pavol Droba 2002-2003.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/ for updates, documentation, and revision history.
|
||||
|
||||
#ifndef BOOST_STRING_DETAIL_SEQUENCE_HPP
|
||||
#define BOOST_STRING_DETAIL_SEQUENCE_HPP
|
||||
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/logical.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
#include <boost/algorithm/string/sequence_traits.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
namespace detail {
|
||||
|
||||
// insert helpers -------------------------------------------------//
|
||||
|
||||
template< typename InputT, typename ForwardIteratorT >
|
||||
inline void insert(
|
||||
InputT& Input,
|
||||
BOOST_STRING_TYPENAME InputT::iterator At,
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End )
|
||||
{
|
||||
Input.insert( At, Begin, End );
|
||||
}
|
||||
|
||||
template< typename InputT, typename InsertT >
|
||||
inline void insert(
|
||||
InputT& Input,
|
||||
BOOST_STRING_TYPENAME InputT::iterator At,
|
||||
const InsertT& Insert )
|
||||
{
|
||||
::boost::algorithm::detail::insert( Input, At, ::boost::begin(Insert), ::boost::end(Insert) );
|
||||
}
|
||||
|
||||
// erase helper ---------------------------------------------------//
|
||||
|
||||
// Erase a range in the sequence
|
||||
/*
|
||||
Returns the iterator pointing just after the erase subrange
|
||||
*/
|
||||
template< typename InputT >
|
||||
inline typename InputT::iterator erase(
|
||||
InputT& Input,
|
||||
BOOST_STRING_TYPENAME InputT::iterator From,
|
||||
BOOST_STRING_TYPENAME InputT::iterator To )
|
||||
{
|
||||
return Input.erase( From, To );
|
||||
}
|
||||
|
||||
// replace helper implementation ----------------------------------//
|
||||
|
||||
// Optimized version of replace for generic sequence containers
|
||||
// Assumption: insert and erase are expensive
|
||||
template< bool HasConstTimeOperations >
|
||||
struct replace_const_time_helper
|
||||
{
|
||||
template< typename InputT, typename ForwardIteratorT >
|
||||
void operator()(
|
||||
InputT& Input,
|
||||
BOOST_STRING_TYPENAME InputT::iterator From,
|
||||
BOOST_STRING_TYPENAME InputT::iterator To,
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End )
|
||||
{
|
||||
// Copy data to the container ( as much as possible )
|
||||
ForwardIteratorT InsertIt=Begin;
|
||||
BOOST_STRING_TYPENAME InputT::iterator InputIt=From;
|
||||
for(; InsertIt!=End && InputIt!=To; InsertIt++, InputIt++ )
|
||||
{
|
||||
*InputIt=*InsertIt;
|
||||
}
|
||||
|
||||
if ( InsertIt!=End )
|
||||
{
|
||||
// Replace sequence is longer, insert it
|
||||
Input.insert( InputIt, InsertIt, End );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( InputIt!=To )
|
||||
{
|
||||
// Replace sequence is shorter, erase the rest
|
||||
Input.erase( InputIt, To );
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct replace_const_time_helper< true >
|
||||
{
|
||||
// Const-time erase and insert methods -> use them
|
||||
template< typename InputT, typename ForwardIteratorT >
|
||||
void operator()(
|
||||
InputT& Input,
|
||||
BOOST_STRING_TYPENAME InputT::iterator From,
|
||||
BOOST_STRING_TYPENAME InputT::iterator To,
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End )
|
||||
{
|
||||
BOOST_STRING_TYPENAME InputT::iterator At=Input.erase( From, To );
|
||||
if ( Begin!=End )
|
||||
{
|
||||
if(!Input.empty())
|
||||
{
|
||||
Input.insert( At, Begin, End );
|
||||
}
|
||||
else
|
||||
{
|
||||
Input.insert( Input.begin(), Begin, End );
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// No native replace method
|
||||
template< bool HasNative >
|
||||
struct replace_native_helper
|
||||
{
|
||||
template< typename InputT, typename ForwardIteratorT >
|
||||
void operator()(
|
||||
InputT& Input,
|
||||
BOOST_STRING_TYPENAME InputT::iterator From,
|
||||
BOOST_STRING_TYPENAME InputT::iterator To,
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End )
|
||||
{
|
||||
replace_const_time_helper<
|
||||
boost::mpl::and_<
|
||||
has_const_time_insert<InputT>,
|
||||
has_const_time_erase<InputT> >::value >()(
|
||||
Input, From, To, Begin, End );
|
||||
}
|
||||
};
|
||||
|
||||
// Container has native replace method
|
||||
template<>
|
||||
struct replace_native_helper< true >
|
||||
{
|
||||
template< typename InputT, typename ForwardIteratorT >
|
||||
void operator()(
|
||||
InputT& Input,
|
||||
BOOST_STRING_TYPENAME InputT::iterator From,
|
||||
BOOST_STRING_TYPENAME InputT::iterator To,
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End )
|
||||
{
|
||||
Input.replace( From, To, Begin, End );
|
||||
}
|
||||
};
|
||||
|
||||
// replace helper -------------------------------------------------//
|
||||
|
||||
template< typename InputT, typename ForwardIteratorT >
|
||||
inline void replace(
|
||||
InputT& Input,
|
||||
BOOST_STRING_TYPENAME InputT::iterator From,
|
||||
BOOST_STRING_TYPENAME InputT::iterator To,
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End )
|
||||
{
|
||||
replace_native_helper< has_native_replace<InputT>::value >()(
|
||||
Input, From, To, Begin, End );
|
||||
}
|
||||
|
||||
template< typename InputT, typename InsertT >
|
||||
inline void replace(
|
||||
InputT& Input,
|
||||
BOOST_STRING_TYPENAME InputT::iterator From,
|
||||
BOOST_STRING_TYPENAME InputT::iterator To,
|
||||
const InsertT& Insert )
|
||||
{
|
||||
if(From!=To)
|
||||
{
|
||||
::boost::algorithm::detail::replace( Input, From, To, ::boost::begin(Insert), ::boost::end(Insert) );
|
||||
}
|
||||
else
|
||||
{
|
||||
::boost::algorithm::detail::insert( Input, From, ::boost::begin(Insert), ::boost::end(Insert) );
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace algorithm
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // BOOST_STRING_DETAIL_SEQUENCE_HPP
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef BOOST_SHARED_PTR_HPP_INCLUDED
|
||||
#define BOOST_SHARED_PTR_HPP_INCLUDED
|
||||
|
||||
//
|
||||
// shared_ptr.hpp
|
||||
//
|
||||
// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
|
||||
// Copyright (c) 2001-2008 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/smart_ptr/shared_ptr.htm for documentation.
|
||||
//
|
||||
|
||||
#include <boost/smart_ptr/shared_ptr.hpp>
|
||||
|
||||
#endif // #ifndef BOOST_SHARED_PTR_HPP_INCLUDED
|
||||
@@ -0,0 +1,173 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
// See http://boostorg.github.com/compute for more information.
|
||||
//---------------------------------------------------------------------------//
|
||||
|
||||
#ifndef BOOST_COMPUTE_TYPES_STRUCT_HPP
|
||||
#define BOOST_COMPUTE_TYPES_STRUCT_HPP
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#include <boost/preprocessor/expr_if.hpp>
|
||||
#include <boost/preprocessor/stringize.hpp>
|
||||
#include <boost/preprocessor/seq/fold_left.hpp>
|
||||
#include <boost/preprocessor/seq/for_each.hpp>
|
||||
#include <boost/preprocessor/seq/transform.hpp>
|
||||
|
||||
#include <boost/compute/type_traits/type_definition.hpp>
|
||||
#include <boost/compute/type_traits/type_name.hpp>
|
||||
#include <boost/compute/detail/meta_kernel.hpp>
|
||||
#include <boost/compute/detail/variadic_macros.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
namespace detail {
|
||||
|
||||
template<class Struct, class T>
|
||||
inline std::string adapt_struct_insert_member(T Struct::*, const char *name)
|
||||
{
|
||||
std::stringstream s;
|
||||
s << " " << type_name<T>() << " " << name << ";\n";
|
||||
return s.str();
|
||||
}
|
||||
|
||||
|
||||
template<class Struct, class T, int N>
|
||||
inline std::string adapt_struct_insert_member(T (Struct::*)[N], const char *name)
|
||||
{
|
||||
std::stringstream s;
|
||||
s << " " << type_name<T>() << " " << name << "[" << N << "]" << ";\n";
|
||||
return s.str();
|
||||
}
|
||||
|
||||
} // end detail namespace
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
/// \internal_
|
||||
#define BOOST_COMPUTE_DETAIL_ADAPT_STRUCT_INSERT_MEMBER(r, type, member) \
|
||||
<< ::boost::compute::detail::adapt_struct_insert_member( \
|
||||
&type::member, BOOST_PP_STRINGIZE(member) \
|
||||
)
|
||||
|
||||
/// \internal_
|
||||
#define BOOST_COMPUTE_DETAIL_ADAPT_STRUCT_STREAM_MEMBER(r, data, i, elem) \
|
||||
BOOST_PP_EXPR_IF(i, << ", ") << data.elem
|
||||
|
||||
/// \internal_
|
||||
#define BOOST_COMPUTE_DETAIL_STRUCT_MEMBER_SIZE(s, struct_, member_) \
|
||||
sizeof(((struct_ *)0)->member_)
|
||||
|
||||
/// \internal_
|
||||
#define BOOST_COMPUTE_DETAIL_STRUCT_MEMBER_SIZE_ADD(s, x, y) (x+y)
|
||||
|
||||
/// \internal_
|
||||
#define BOOST_COMPUTE_DETAIL_STRUCT_MEMBER_SIZE_SUM(struct_, members_) \
|
||||
BOOST_PP_SEQ_FOLD_LEFT( \
|
||||
BOOST_COMPUTE_DETAIL_STRUCT_MEMBER_SIZE_ADD, \
|
||||
0, \
|
||||
BOOST_PP_SEQ_TRANSFORM( \
|
||||
BOOST_COMPUTE_DETAIL_STRUCT_MEMBER_SIZE, struct_, members_ \
|
||||
) \
|
||||
)
|
||||
|
||||
/// \internal_
|
||||
///
|
||||
/// Returns true if struct_ contains no internal padding bytes (i.e. it is
|
||||
/// packed). members_ is a sequence of the names of the struct members.
|
||||
#define BOOST_COMPUTE_DETAIL_STRUCT_IS_PACKED(struct_, members_) \
|
||||
(sizeof(struct_) == BOOST_COMPUTE_DETAIL_STRUCT_MEMBER_SIZE_SUM(struct_, members_))
|
||||
|
||||
/// The BOOST_COMPUTE_ADAPT_STRUCT() macro makes a C++ struct/class available
|
||||
/// to OpenCL kernels.
|
||||
///
|
||||
/// \param type The C++ type.
|
||||
/// \param name The OpenCL name.
|
||||
/// \param members A tuple of the struct's members.
|
||||
///
|
||||
/// For example, to adapt a 2D particle struct with position (x, y) and
|
||||
/// velocity (dx, dy):
|
||||
/// \code
|
||||
/// // c++ struct definition
|
||||
/// struct Particle
|
||||
/// {
|
||||
/// float x, y;
|
||||
/// float dx, dy;
|
||||
/// };
|
||||
///
|
||||
/// // adapt struct for OpenCL
|
||||
/// BOOST_COMPUTE_ADAPT_STRUCT(Particle, Particle, (x, y, dx, dy))
|
||||
/// \endcode
|
||||
///
|
||||
/// After adapting the struct it can be used in Boost.Compute containers
|
||||
/// and with Boost.Compute algorithms:
|
||||
/// \code
|
||||
/// // create vector of particles
|
||||
/// boost::compute::vector<Particle> particles = ...
|
||||
///
|
||||
/// // function to compare particles by their x-coordinate
|
||||
/// BOOST_COMPUTE_FUNCTION(bool, sort_by_x, (Particle a, Particle b),
|
||||
/// {
|
||||
/// return a.x < b.x;
|
||||
/// });
|
||||
///
|
||||
/// // sort particles by their x-coordinate
|
||||
/// boost::compute::sort(
|
||||
/// particles.begin(), particles.end(), sort_by_x, queue
|
||||
/// );
|
||||
/// \endcode
|
||||
///
|
||||
/// Due to differences in struct padding between the host compiler and the
|
||||
/// device compiler, the \c BOOST_COMPUTE_ADAPT_STRUCT() macro requires that
|
||||
/// the adapted struct is packed (i.e. no padding bytes between members).
|
||||
///
|
||||
/// \see type_name()
|
||||
#define BOOST_COMPUTE_ADAPT_STRUCT(type, name, members) \
|
||||
BOOST_STATIC_ASSERT_MSG( \
|
||||
BOOST_COMPUTE_DETAIL_STRUCT_IS_PACKED(type, BOOST_COMPUTE_PP_TUPLE_TO_SEQ(members)), \
|
||||
"BOOST_COMPUTE_ADAPT_STRUCT() does not support structs with internal padding." \
|
||||
); \
|
||||
BOOST_COMPUTE_TYPE_NAME(type, name) \
|
||||
namespace boost { namespace compute { \
|
||||
template<> \
|
||||
inline std::string type_definition<type>() \
|
||||
{ \
|
||||
std::stringstream declaration; \
|
||||
declaration << "typedef struct __attribute__((packed)) {\n" \
|
||||
BOOST_PP_SEQ_FOR_EACH( \
|
||||
BOOST_COMPUTE_DETAIL_ADAPT_STRUCT_INSERT_MEMBER, \
|
||||
type, \
|
||||
BOOST_COMPUTE_PP_TUPLE_TO_SEQ(members) \
|
||||
) \
|
||||
<< "} " << type_name<type>() << ";\n"; \
|
||||
return declaration.str(); \
|
||||
} \
|
||||
namespace detail { \
|
||||
template<> \
|
||||
struct inject_type_impl<type> \
|
||||
{ \
|
||||
void operator()(meta_kernel &kernel) \
|
||||
{ \
|
||||
kernel.add_type_declaration<type>(type_definition<type>()); \
|
||||
} \
|
||||
}; \
|
||||
inline meta_kernel& operator<<(meta_kernel &k, type s) \
|
||||
{ \
|
||||
return k << "(" << #name << "){" \
|
||||
BOOST_PP_SEQ_FOR_EACH_I( \
|
||||
BOOST_COMPUTE_DETAIL_ADAPT_STRUCT_STREAM_MEMBER, \
|
||||
s, \
|
||||
BOOST_COMPUTE_PP_TUPLE_TO_SEQ(members) \
|
||||
) \
|
||||
<< "}"; \
|
||||
} \
|
||||
}}}
|
||||
|
||||
#endif // BOOST_COMPUTE_TYPES_STRUCT_HPP
|
||||
@@ -0,0 +1,29 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2009 Christopher Schmidt
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUSION_VIEW_REVERSE_VIEW_DETAIL_KEY_OF_IMPL_HPP
|
||||
#define BOOST_FUSION_VIEW_REVERSE_VIEW_DETAIL_KEY_OF_IMPL_HPP
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/iterator/key_of.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
template <typename>
|
||||
struct key_of_impl;
|
||||
|
||||
template <>
|
||||
struct key_of_impl<reverse_view_iterator_tag>
|
||||
{
|
||||
template <typename It>
|
||||
struct apply
|
||||
: result_of::key_of<typename It::it_type>
|
||||
{};
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,55 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// 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_TYPE_TRAITS_COMMON_TYPE_HPP
|
||||
#define BOOST_COMPUTE_TYPE_TRAITS_COMMON_TYPE_HPP
|
||||
|
||||
#include <boost/type_traits/common_type.hpp>
|
||||
|
||||
#include <boost/compute/types/fundamental.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
/// \internal_
|
||||
#define BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPE(scalar, size) \
|
||||
template<> \
|
||||
struct common_type<BOOST_COMPUTE_MAKE_VECTOR_TYPE(scalar, size), \
|
||||
BOOST_COMPUTE_MAKE_SCALAR_TYPE(scalar)> \
|
||||
{ \
|
||||
typedef BOOST_COMPUTE_MAKE_VECTOR_TYPE(scalar, size) type; \
|
||||
}; \
|
||||
template<> \
|
||||
struct common_type<BOOST_COMPUTE_MAKE_SCALAR_TYPE(scalar), \
|
||||
BOOST_COMPUTE_MAKE_VECTOR_TYPE(scalar, size)> \
|
||||
{ \
|
||||
typedef BOOST_COMPUTE_MAKE_VECTOR_TYPE(scalar, size) type; \
|
||||
};
|
||||
|
||||
/// \internal_
|
||||
#define BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPES(scalar) \
|
||||
BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPE(scalar, 2) \
|
||||
BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPE(scalar, 4) \
|
||||
BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPE(scalar, 8) \
|
||||
BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPE(scalar, 16) \
|
||||
|
||||
BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPES(char)
|
||||
BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPES(uchar)
|
||||
BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPES(short)
|
||||
BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPES(ushort)
|
||||
BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPES(int)
|
||||
BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPES(uint)
|
||||
BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPES(long)
|
||||
BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPES(ulong)
|
||||
BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPES(float)
|
||||
BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPES(double)
|
||||
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_TYPE_TRAITS_COMMON_TYPE_HPP
|
||||
@@ -0,0 +1,303 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2002-2003 Joel de Guzman
|
||||
Copyright (c) 2002-2003 Hartmut Kaiser
|
||||
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_SUBRULE_HPP)
|
||||
#define BOOST_SPIRIT_SUBRULE_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
#include <boost/spirit/home/classic/core/parser.hpp>
|
||||
#include <boost/spirit/home/classic/core/non_terminal/parser_context.hpp>
|
||||
|
||||
#include <boost/spirit/home/classic/core/non_terminal/subrule_fwd.hpp>
|
||||
#include <boost/spirit/home/classic/core/non_terminal/impl/subrule.ipp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// subrules_scanner class
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename ScannerT, typename ListT>
|
||||
struct subrules_scanner : public ScannerT
|
||||
{
|
||||
typedef ScannerT scanner_t;
|
||||
typedef ListT list_t;
|
||||
typedef subrules_scanner<ScannerT, ListT> self_t;
|
||||
|
||||
subrules_scanner(ScannerT const& scan, ListT const& list_)
|
||||
: ScannerT(scan), list(list_) {}
|
||||
|
||||
template <typename PoliciesT>
|
||||
struct rebind_policies
|
||||
{
|
||||
typedef typename rebind_scanner_policies<ScannerT, PoliciesT>::type
|
||||
rebind_scanner;
|
||||
typedef subrules_scanner<rebind_scanner, ListT> type;
|
||||
};
|
||||
|
||||
template <typename PoliciesT>
|
||||
subrules_scanner<
|
||||
typename rebind_scanner_policies<ScannerT, PoliciesT>::type,
|
||||
ListT>
|
||||
change_policies(PoliciesT const& policies) const
|
||||
{
|
||||
typedef subrules_scanner<
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
rebind_scanner_policies<ScannerT, PoliciesT>::type,
|
||||
ListT>
|
||||
subrules_scanner_t;
|
||||
|
||||
return subrules_scanner_t(
|
||||
ScannerT::change_policies(policies),
|
||||
list);
|
||||
}
|
||||
|
||||
template <typename IteratorT>
|
||||
struct rebind_iterator
|
||||
{
|
||||
typedef typename rebind_scanner_iterator<ScannerT, IteratorT>::type
|
||||
rebind_scanner;
|
||||
typedef subrules_scanner<rebind_scanner, ListT> type;
|
||||
};
|
||||
|
||||
template <typename IteratorT>
|
||||
subrules_scanner<
|
||||
typename rebind_scanner_iterator<ScannerT, IteratorT>::type,
|
||||
ListT>
|
||||
change_iterator(IteratorT const& first, IteratorT const &last) const
|
||||
{
|
||||
typedef subrules_scanner<
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
rebind_scanner_iterator<ScannerT, IteratorT>::type,
|
||||
ListT>
|
||||
subrules_scanner_t;
|
||||
|
||||
return subrules_scanner_t(
|
||||
ScannerT::change_iterator(first, last),
|
||||
list);
|
||||
}
|
||||
|
||||
ListT const& list;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// subrule_scanner type computer class
|
||||
//
|
||||
// This computer ensures that the scanner will not be recursively
|
||||
// instantiated if it's not needed.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename ScannerT, typename ListT>
|
||||
struct subrules_scanner_finder
|
||||
{
|
||||
typedef subrules_scanner<ScannerT, ListT> type;
|
||||
};
|
||||
|
||||
template <typename ScannerT, typename ListT>
|
||||
struct subrules_scanner_finder<subrules_scanner<ScannerT, ListT>, ListT>
|
||||
{
|
||||
typedef subrules_scanner<ScannerT, ListT> type;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// subrule_list class
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename FirstT, typename RestT>
|
||||
struct subrule_list : public parser<subrule_list<FirstT, RestT> >
|
||||
{
|
||||
typedef subrule_list<FirstT, RestT> self_t;
|
||||
typedef FirstT first_t;
|
||||
typedef RestT rest_t;
|
||||
|
||||
subrule_list(FirstT const& first_, RestT const& rest_)
|
||||
: first(first_), rest(rest_) {}
|
||||
|
||||
template <typename ScannerT>
|
||||
struct result
|
||||
{
|
||||
typedef typename parser_result<FirstT, ScannerT>::type type;
|
||||
};
|
||||
|
||||
template <typename ScannerT>
|
||||
typename parser_result<self_t, ScannerT>::type
|
||||
parse(ScannerT const& scan) const
|
||||
{
|
||||
typedef typename subrules_scanner_finder<ScannerT, self_t>::type
|
||||
subrules_scanner_t;
|
||||
subrules_scanner_t g_arg(scan, *this);
|
||||
return first.start.parse(g_arg);
|
||||
}
|
||||
|
||||
template <int ID, typename DefT, typename ContextT>
|
||||
subrule_list<
|
||||
FirstT,
|
||||
subrule_list<
|
||||
subrule_parser<ID, DefT, ContextT>,
|
||||
RestT> >
|
||||
operator,(subrule_parser<ID, DefT, ContextT> const& rhs_)
|
||||
{
|
||||
return subrule_list<
|
||||
FirstT,
|
||||
subrule_list<
|
||||
subrule_parser<ID, DefT, ContextT>,
|
||||
RestT> >(
|
||||
first,
|
||||
subrule_list<
|
||||
subrule_parser<ID, DefT, ContextT>,
|
||||
RestT>(rhs_, rest));
|
||||
}
|
||||
|
||||
FirstT first;
|
||||
RestT rest;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// subrule_parser class
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <int ID, typename DefT, typename ContextT>
|
||||
struct subrule_parser
|
||||
: public parser<subrule_parser<ID, DefT, ContextT> >
|
||||
{
|
||||
typedef subrule_parser<ID, DefT, ContextT> self_t;
|
||||
typedef subrule<ID, ContextT> subrule_t;
|
||||
typedef DefT def_t;
|
||||
|
||||
BOOST_STATIC_CONSTANT(int, id = ID);
|
||||
|
||||
template <typename ScannerT>
|
||||
struct result
|
||||
{
|
||||
typedef typename
|
||||
impl::get_subrule_parser_result<
|
||||
DefT, ScannerT, typename subrule_t::attr_t>::type type;
|
||||
};
|
||||
|
||||
subrule_parser(subrule_t const& start_, DefT const& rhs_)
|
||||
: rhs(rhs_), start(start_) {}
|
||||
|
||||
template <typename ScannerT>
|
||||
typename parser_result<self_t, ScannerT>::type
|
||||
parse(ScannerT const& scan) const
|
||||
{
|
||||
// This will only be called when parsing single subrules.
|
||||
typedef subrule_list<self_t, nil_t> list_t;
|
||||
typedef subrules_scanner<ScannerT, list_t> scanner_t;
|
||||
|
||||
list_t list(*this, nil_t());
|
||||
scanner_t g_arg(scan, list);
|
||||
return start.parse(g_arg);
|
||||
}
|
||||
|
||||
template <int ID2, typename DefT2, typename ContextT2>
|
||||
inline subrule_list<
|
||||
self_t,
|
||||
subrule_list<
|
||||
subrule_parser<ID2, DefT2, ContextT2>,
|
||||
nil_t> >
|
||||
operator,(subrule_parser<ID2, DefT2, ContextT2> const& rhs) const
|
||||
{
|
||||
return subrule_list<
|
||||
self_t,
|
||||
subrule_list<
|
||||
subrule_parser<ID2, DefT2, ContextT2>,
|
||||
nil_t> >(
|
||||
*this,
|
||||
subrule_list<
|
||||
subrule_parser<ID2, DefT2, ContextT2>, nil_t>(
|
||||
rhs, nil_t()));
|
||||
}
|
||||
|
||||
typename DefT::embed_t rhs;
|
||||
subrule_t const& start;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// subrule class
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <int ID, typename ContextT>
|
||||
struct subrule
|
||||
: public parser<subrule<ID, ContextT> >
|
||||
, public ContextT::base_t
|
||||
, public context_aux<ContextT, subrule<ID, ContextT> >
|
||||
{
|
||||
typedef subrule<ID, ContextT> self_t;
|
||||
typedef subrule<ID, ContextT> const& embed_t;
|
||||
|
||||
typedef typename ContextT::context_linker_t context_t;
|
||||
typedef typename context_t::attr_t attr_t;
|
||||
|
||||
BOOST_STATIC_CONSTANT(int, id = ID);
|
||||
|
||||
template <typename ScannerT>
|
||||
struct result
|
||||
{
|
||||
typedef typename
|
||||
impl::get_subrule_result<ID, ScannerT, attr_t>::type type;
|
||||
};
|
||||
|
||||
template <typename ScannerT>
|
||||
typename parser_result<self_t, ScannerT>::type
|
||||
parse_main(ScannerT const& scan) const
|
||||
{
|
||||
typedef typename parser_result<self_t, ScannerT>::type result_t;
|
||||
result_t result_;
|
||||
impl::parse_subrule<result_t, ScannerT, ID>::
|
||||
do_(result_, scan);
|
||||
return result_;
|
||||
}
|
||||
|
||||
template <typename ScannerT>
|
||||
typename parser_result<self_t, ScannerT>::type
|
||||
parse(ScannerT const& scan) const
|
||||
{
|
||||
typedef typename parser_result<self_t, ScannerT>::type result_t;
|
||||
typedef parser_scanner_linker<ScannerT> scanner_t;
|
||||
BOOST_SPIRIT_CONTEXT_PARSE(
|
||||
scan, *this, scanner_t, context_t, result_t);
|
||||
}
|
||||
|
||||
template <typename DefT>
|
||||
subrule_parser<ID, DefT, ContextT>
|
||||
operator=(parser<DefT> const& rhs) const
|
||||
{
|
||||
return subrule_parser<ID, DefT, ContextT>(*this, rhs.derived());
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
// assignment of subrules is not allowed. Use subrules
|
||||
// with identical IDs if you want to have aliases.
|
||||
|
||||
subrule& operator=(subrule const&);
|
||||
|
||||
template <int ID2, typename ContextT2>
|
||||
subrule& operator=(subrule<ID2, ContextT2> const&);
|
||||
};
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}} // namespace BOOST_SPIRIT_CLASSIC_NS
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user