Initial Commit

This commit is contained in:
Jordan Sherer
2018-02-08 21:28:33 -05:00
commit 678c1d3966
14352 changed files with 3176737 additions and 0 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,168 @@
#include "logqso.h"
#include <QString>
#include <QSettings>
#include <QStandardPaths>
#include <QDir>
#include <QDebug>
#include "logbook/adif.h"
#include "MessageBox.hpp"
#include "ui_logqso.h"
#include "moc_logqso.cpp"
LogQSO::LogQSO(QString const& programTitle, QSettings * settings, QWidget *parent)
: QDialog(parent)
, ui(new Ui::LogQSO)
, m_settings (settings)
{
ui->setupUi(this);
setWindowTitle(programTitle + " - Log QSO");
loadSettings ();
}
LogQSO::~LogQSO ()
{
}
void LogQSO::loadSettings ()
{
m_settings->beginGroup ("LogQSO");
restoreGeometry (m_settings->value ("geometry", saveGeometry ()).toByteArray ());
ui->cbTxPower->setChecked (m_settings->value ("SaveTxPower", false).toBool ());
ui->cbComments->setChecked (m_settings->value ("SaveComments", false).toBool ());
m_txPower = m_settings->value ("TxPower", "").toString ();
m_comments = m_settings->value ("LogComments", "").toString();
m_settings->endGroup ();
}
void LogQSO::storeSettings () const
{
m_settings->beginGroup ("LogQSO");
m_settings->setValue ("geometry", saveGeometry ());
m_settings->setValue ("SaveTxPower", ui->cbTxPower->isChecked ());
m_settings->setValue ("SaveComments", ui->cbComments->isChecked ());
m_settings->setValue ("TxPower", m_txPower);
m_settings->setValue ("LogComments", m_comments);
m_settings->endGroup ();
}
void LogQSO::initLogQSO(QString hisCall, QString hisGrid, QString mode,
QString rptSent, QString rptRcvd, QDateTime dateTimeOn, QDateTime dateTimeOff,
Radio::Frequency dialFreq, QString myCall, QString myGrid,
bool noSuffix, bool toRTTY, bool dBtoComments)
{
if(!isHidden()) return;
ui->call->setText(hisCall);
ui->grid->setText(hisGrid);
ui->name->setText("");
ui->txPower->setText("");
ui->comments->setText("");
if (ui->cbTxPower->isChecked ()) ui->txPower->setText(m_txPower);
if (ui->cbComments->isChecked ()) ui->comments->setText(m_comments);
if(dBtoComments) {
QString t=mode;
if(rptSent!="") t+=" Sent: " + rptSent;
if(rptRcvd!="") t+=" Rcvd: " + rptRcvd;
ui->comments->setText(t);
}
if(noSuffix and mode.mid(0,3)=="JT9") mode="JT9";
if(toRTTY and mode.mid(0,3)=="JT9") mode="RTTY";
ui->mode->setText(mode);
ui->sent->setText(rptSent);
ui->rcvd->setText(rptRcvd);
m_dateTimeOn=dateTimeOn;
m_dateTimeOff=dateTimeOff;
QString dateOn=dateTimeOn.toString("yyyy-MM-dd");
ui->dateOn->setText(dateOn);
QString timeOn=dateTimeOn.toString("hhmm");
ui->timeOn->setText(timeOn);
QString dateOff=dateTimeOff.toString("yyyy-MM-dd");
ui->dateOff->setText(dateOff);
QString timeOff=dateTimeOff.toString("hhmm");
ui->timeOff->setText(timeOff);
m_dialFreq=dialFreq;
m_myCall=myCall;
m_myGrid=myGrid;
QString band= ADIF::bandFromFrequency(dialFreq / 1.e6);
ui->band->setText(band);
show ();
}
void LogQSO::accept()
{
QString hisCall,hisGrid,mode,rptSent,rptRcvd,dateOn,dateOff,timeOn,timeOff,band;
QString comments,name;
hisCall=ui->call->text();
hisGrid=ui->grid->text();
mode=ui->mode->text();
rptSent=ui->sent->text();
rptRcvd=ui->rcvd->text();
m_dateTimeOn = m_dateTimeOn.fromString(ui->dateOn->text()+" "+ui->timeOn->text(),"yyyy-MM-dd hhmm");
m_dateTimeOff = m_dateTimeOff.fromString(ui->dateOff->text()+" "+ui->timeOff->text(),"yyyy-MM-dd hhmm");
// set time off and on back to UTC as the above QDateTime::fromString()
// creates a local time value -- this would be al so much simpler if
// QDateTimeEdit widgets had been used
m_dateTimeOff.setTimeSpec (Qt::UTC);
m_dateTimeOn.setTimeSpec (Qt::UTC);
dateOn=ui->dateOn->text();
dateOn=dateOn.mid(0,4) + dateOn.mid(5,2) + dateOn.mid(8,2);
timeOn=ui->timeOn->text();
dateOff=ui->dateOff->text();
dateOff=dateOff.mid(0,4) + dateOff.mid(5,2) + dateOff.mid(8,2);
timeOff=ui->timeOff->text();
band=ui->band->text();
name=ui->name->text();
m_txPower=ui->txPower->text();
comments=ui->comments->text();
m_comments=comments;
QString strDialFreq(QString::number(m_dialFreq / 1.e6,'f',6));
//Log this QSO to ADIF file "wsjtx_log.adi"
QString filename = "wsjtx_log.adi"; // TODO allow user to set
ADIF adifile;
auto adifilePath = QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("wsjtx_log.adi");
adifile.init(adifilePath);
if (!adifile.addQSOToFile(hisCall,hisGrid,mode,rptSent,rptRcvd,dateOn,timeOn,dateOff,timeOff,band,comments,name,strDialFreq,m_myCall,m_myGrid,m_txPower))
{
MessageBox::warning_message (this, tr ("Log file error"),
tr ("Cannot open \"%1\"").arg (adifilePath));
}
//Log this QSO to file "wsjtx.log"
static QFile f {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("wsjtx.log")};
if(!f.open(QIODevice::Text | QIODevice::Append)) {
MessageBox::warning_message (this, tr ("Log file error"),
tr ("Cannot open \"%1\" for append").arg (f.fileName ()),
tr ("Error: %1").arg (f.errorString ()));
} else {
QString logEntry=m_dateTimeOn.date().toString("yyyy-MM-dd,") +
m_dateTimeOn.time().toString("hh:mm,") +
m_dateTimeOff.date().toString("yyyy-MM-dd,") +
m_dateTimeOff.time().toString("hh:mm,") + hisCall + "," +
hisGrid + "," + strDialFreq + "," + mode +
"," + rptSent + "," + rptRcvd + "," + m_txPower +
"," + comments + "," + name;
QTextStream out(&f);
out << logEntry << endl;
f.close();
}
//Clean up and finish logging
Q_EMIT acceptQSO (m_dateTimeOff, hisCall, hisGrid, m_dialFreq, mode, rptSent, rptRcvd, m_txPower, comments, name,m_dateTimeOn);
QDialog::accept();
}
// closeEvent is only called from the system menu close widget for a
// modeless dialog so we use the hideEvent override to store the
// window settings
void LogQSO::hideEvent (QHideEvent * e)
{
storeSettings ();
QDialog::hideEvent (e);
}
@@ -0,0 +1,171 @@
/*
[auto_generated]
boost/numeric/odeint/external/openmp/openmp_state.hpp
[begin_description]
Wrappers for OpenMP.
[end_description]
Copyright 2013 Karsten Ahnert
Copyright 2013 Mario Mulansky
Copyright 2013 Pascal Germroth
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or
copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_OPENMP_OPENMP_STATE_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_EXTERNAL_OPENMP_OPENMP_STATE_HPP_INCLUDED
#include <omp.h>
#include <vector>
#include <algorithm>
#include <boost/range/adaptor/sliced.hpp>
#include <boost/numeric/odeint/util/copy.hpp>
#include <boost/numeric/odeint/util/split.hpp>
#include <boost/numeric/odeint/util/resize.hpp>
#include <boost/numeric/odeint/external/openmp/openmp_nested_algebra.hpp>
namespace boost {
namespace numeric {
namespace odeint {
/** \brief A container that is split into distinct parts, for threading.
* Just a wrapper for vector<vector<T>>, use `copy` for splitting/joining.
*/
template< class T >
struct openmp_state : public std::vector< std::vector< T > >
{
openmp_state() {}
openmp_state(size_t n, const std::vector<T>& val = std::vector<T>())
: std::vector< std::vector< T > >(n, val) {}
template<class InputIterator>
openmp_state(InputIterator first, InputIterator last)
: std::vector< std::vector< T > >(first, last) {}
openmp_state(const std::vector< std::vector< T > > &orig)
: std::vector< std::vector< T > >(orig) {}
};
template< class T >
struct is_resizeable< openmp_state< T > > : boost::true_type { };
template< class T >
struct same_size_impl< openmp_state< T > , openmp_state< T > >
{
static bool same_size( const openmp_state< T > &x , const openmp_state< T > &y )
{
if( x.size() != y.size() ) return false;
for( size_t i = 0 ; i != x.size() ; i++ )
if( x[i].size() != y[i].size() ) return false;
return true;
}
};
template< class T >
struct resize_impl< openmp_state< T > , openmp_state< T > >
{
static void resize( openmp_state< T > &x , const openmp_state< T > &y )
{
x.resize( y.size() );
# pragma omp parallel for schedule(dynamic)
for(size_t i = 0 ; i < x.size() ; i++)
x[i].resize( y[i].size() );
}
};
/** \brief Copy data between openmp_states of same size. */
template< class T >
struct copy_impl< openmp_state< T >, openmp_state< T > >
{
static void copy( const openmp_state< T > &from, openmp_state< T > &to )
{
# pragma omp parallel for schedule(dynamic)
for(size_t i = 0 ; i < from.size() ; i++)
std::copy( from[i].begin() , from[i].end() , to.begin() );
}
};
/** \brief Copy data from some container to an openmp_state and resize it.
* Target container size will determine number of blocks to split into.
* If it is empty, it will be resized to the maximum number of OpenMP threads.
* SourceContainer must support `s::value_type`, `s::const_iterator`, `s.begin()`, `s.end()` and `s.size()`,
* with Random Access Iterators; i.e. it must be a Random Access Container. */
template< class SourceContainer >
struct split_impl< SourceContainer, openmp_state< typename SourceContainer::value_type > >
{
static void split( const SourceContainer &from, openmp_state< typename SourceContainer::value_type > &to )
{
if(to.size() == 0) to.resize( omp_get_max_threads() );
const size_t part = from.size() / to.size();
# pragma omp parallel for schedule(dynamic)
for(size_t i = 0 ; i < to.size() ; i++) {
typedef typename SourceContainer::const_iterator it_t;
const it_t begin = from.begin() + i * part;
it_t end = begin + part;
// for cases where from.size() % to.size() > 0
if(i + 1 == to.size() || end > from.end()) end = from.end();
to[i].resize(end - begin);
std::copy(begin, end, to[i].begin());
}
}
};
/** \brief Copy data from an openmp_state to some container and resize it.
* TargetContainer must support `s::value_type`, `s::iterator`, `s.begin()` and `s.resize(n)`,
* i.e. it must be a `std::vector`. */
template< class TargetContainer >
struct unsplit_impl< openmp_state< typename TargetContainer::value_type >, TargetContainer >
{
static void unsplit( const openmp_state< typename TargetContainer::value_type > &from , TargetContainer &to )
{
// resize target
size_t total_size = 0;
for(size_t i = 0 ; i < from.size() ; i++)
total_size += from[i].size();
to.resize( total_size );
// copy parts
typename TargetContainer::iterator out = to.begin();
for(size_t i = 0 ; i < from.size() ; i++)
out = std::copy(from[i].begin(), from[i].end(), out);
}
};
/** \brief OpenMP-parallelized algebra.
* For use with openmp_state.
*/
typedef openmp_nested_algebra< range_algebra > openmp_algebra;
/** \brief Use `openmp_algebra` for `openmp_state`. */
template< class T >
struct algebra_dispatcher< openmp_state< T > >
{
typedef openmp_algebra algebra_type;
};
}
}
}
#endif
@@ -0,0 +1,145 @@
/*
* Copyright (c) 2002
* John Maddock
*
* 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)
*
*/
/*
* LOCATION: see http://www.boost.org for most recent version.
* FILE mem_block_cache.hpp
* VERSION see <boost/version.hpp>
* DESCRIPTION: memory block cache used by the non-recursive matcher.
*/
#ifndef BOOST_REGEX_V4_MEM_BLOCK_CACHE_HPP
#define BOOST_REGEX_V4_MEM_BLOCK_CACHE_HPP
#include <new>
#ifdef BOOST_HAS_THREADS
#include <boost/regex/pending/static_mutex.hpp>
#endif
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_PREFIX
#endif
#ifndef BOOST_NO_CXX11_HDR_ATOMIC
#include <atomic>
#if ATOMIC_POINTER_LOCK_FREE == 2
#define BOOST_REGEX_MEM_BLOCK_CACHE_LOCK_FREE
#define BOOST_REGEX_ATOMIC_POINTER std::atomic
#endif
#endif
namespace boost{
namespace BOOST_REGEX_DETAIL_NS{
#ifdef BOOST_REGEX_MEM_BLOCK_CACHE_LOCK_FREE /* lock free implementation */
struct mem_block_cache
{
std::atomic<void*> cache[BOOST_REGEX_MAX_CACHE_BLOCKS];
~mem_block_cache()
{
for (size_t i = 0;i < BOOST_REGEX_MAX_CACHE_BLOCKS; ++i) {
if (cache[i].load()) ::operator delete(cache[i].load());
}
}
void* get()
{
for (size_t i = 0;i < BOOST_REGEX_MAX_CACHE_BLOCKS; ++i) {
void* p = cache[i].load();
if (p != NULL) {
if (cache[i].compare_exchange_strong(p, NULL)) return p;
}
}
return ::operator new(BOOST_REGEX_BLOCKSIZE);
}
void put(void* ptr)
{
for (size_t i = 0;i < BOOST_REGEX_MAX_CACHE_BLOCKS; ++i) {
void* p = cache[i].load();
if (p == NULL) {
if (cache[i].compare_exchange_strong(p, ptr)) return;
}
}
::operator delete(ptr);
}
};
#else /* lock-based implementation */
struct mem_block_node
{
mem_block_node* next;
};
struct mem_block_cache
{
// this member has to be statically initialsed:
mem_block_node* next;
unsigned cached_blocks;
#ifdef BOOST_HAS_THREADS
boost::static_mutex mut;
#endif
~mem_block_cache()
{
while(next)
{
mem_block_node* old = next;
next = next->next;
::operator delete(old);
}
}
void* get()
{
#ifdef BOOST_HAS_THREADS
boost::static_mutex::scoped_lock g(mut);
#endif
if(next)
{
mem_block_node* result = next;
next = next->next;
--cached_blocks;
return result;
}
return ::operator new(BOOST_REGEX_BLOCKSIZE);
}
void put(void* p)
{
#ifdef BOOST_HAS_THREADS
boost::static_mutex::scoped_lock g(mut);
#endif
if(cached_blocks >= BOOST_REGEX_MAX_CACHE_BLOCKS)
{
::operator delete(p);
}
else
{
mem_block_node* old = static_cast<mem_block_node*>(p);
old->next = next;
next = old;
++cached_blocks;
}
}
};
#endif
extern mem_block_cache block_cache;
}
} // namespace boost
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_SUFFIX
#endif
#endif
@@ -0,0 +1,58 @@
subroutine afc65b(cx,npts,fsample,nflip,a,ccfbest,dtbest)
! Find delta f, f1, f2 ==> a(1:3)
complex cx(npts)
real a(5),deltaa(5)
a(1)=0.
a(2)=0.
a(3)=0.
a(4)=0.
deltaa(1)=2.0
deltaa(2)=2.0
deltaa(3)=1.0
nterms=2 !Maybe 2 is enough?
! Start the iteration
chisqr=0.
chisqr0=1.e6
do iter=1,3 !One iteration is enough?
do j=1,nterms
chisq1=fchisq65(cx,npts,fsample,nflip,a,ccfmax,dtmax)
fn=0.
delta=deltaa(j)
10 a(j)=a(j)+delta
chisq2=fchisq65(cx,npts,fsample,nflip,a,ccfmax,dtmax)
if(chisq2.eq.chisq1) go to 10
if(chisq2.gt.chisq1) then
delta=-delta !Reverse direction
a(j)=a(j)+delta
tmp=chisq1
chisq1=chisq2
chisq2=tmp
endif
20 fn=fn+1.0
a(j)=a(j)+delta
chisq3=fchisq65(cx,npts,fsample,nflip,a,ccfmax,dtmax)
if(chisq3.lt.chisq2) then
chisq1=chisq2
chisq2=chisq3
go to 20
endif
! Find minimum of parabola defined by last three points
delta=delta*(1./(1.+(chisq1-chisq2)/(chisq3-chisq2))+0.5)
a(j)=a(j)-delta
deltaa(j)=deltaa(j)*fn/3.
enddo
chisqr=fchisq65(cx,npts,fsample,nflip,a,ccfmax,dtmax)
if(chisqr/chisqr0.gt.0.9999) go to 30
chisqr0=chisqr
enddo
30 ccfbest=ccfmax * (1378.125/fsample)**2
dtbest=dtmax
return
end subroutine afc65b
@@ -0,0 +1,39 @@
# Compilers
CC = gcc
CXX = g++
FC = gfortran
AR = ar cr
RANLIB = ranlib
MKDIR = mkdir -p
CP = cp
RM = rm -f
FFLAGS = -O2 -fbounds-check -Wall -Wno-conversion
CFLAGS = -O2 -I.
# Default rules
%.o: %.c
${CC} ${CFLAGS} -c $<
%.o: %.f
${FC} ${FFLAGS} -c $<
%.o: %.F
${FC} ${FFLAGS} -c $<
%.o: %.f90
${FC} ${FFLAGS} -c $<
%.o: %.F90
${FC} ${FFLAGS} -c $<
all: ldpcsim
OBJS = ldpcsim.o alloc.o rcode.o dec.o enc.o \
intio.o blockio.o check.o open.o mod2dense.o \
mod2sparse.o mod2convert.o distrib.o rand.o gran.o
ldpcsim:$(OBJS)
$(FC) -o ldpcsim $(OBJS)
rand.o:
$(CC) $(CFLAGS) -DRAND_FILE=\"./randfile\" -c rand.c
clean:
$(RM) *.o msksim
@@ -0,0 +1,398 @@
// Boost string_algo library trim.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_TRIM_HPP
#define BOOST_STRING_TRIM_HPP
#include <boost/algorithm/string/config.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/const_iterator.hpp>
#include <boost/range/as_literal.hpp>
#include <boost/range/iterator_range_core.hpp>
#include <boost/algorithm/string/detail/trim.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <locale>
/*! \file
Defines trim algorithms.
Trim algorithms are used to remove trailing and leading spaces from a
sequence (string). Space is recognized using given locales.
Parametric (\c _if) variants use a predicate (functor) to select which characters
are to be trimmed..
Functions take a selection predicate as a parameter, which is used to determine
whether a character is a space. Common predicates are provided in classification.hpp header.
*/
namespace boost {
namespace algorithm {
// left trim -----------------------------------------------//
//! Left trim - parametric
/*!
Remove all leading spaces from the input.
The supplied predicate is used to determine which characters are considered spaces.
The result is a trimmed copy of the input. It is returned as a sequence
or copied to the output iterator
\param Output An output iterator to which the result will be copied
\param Input An input range
\param IsSpace A unary predicate identifying spaces
\return
An output iterator pointing just after the last inserted character or
a copy of the input
\note The second variant of this function provides the strong exception-safety guarantee
*/
template<typename OutputIteratorT, typename RangeT, typename PredicateT>
inline OutputIteratorT trim_left_copy_if(
OutputIteratorT Output,
const RangeT& Input,
PredicateT IsSpace)
{
iterator_range<BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> lit_range(::boost::as_literal(Input));
std::copy(
::boost::algorithm::detail::trim_begin(
::boost::begin(lit_range),
::boost::end(lit_range),
IsSpace ),
::boost::end(lit_range),
Output);
return Output;
}
//! Left trim - parametric
/*!
\overload
*/
template<typename SequenceT, typename PredicateT>
inline SequenceT trim_left_copy_if(const SequenceT& Input, PredicateT IsSpace)
{
return SequenceT(
::boost::algorithm::detail::trim_begin(
::boost::begin(Input),
::boost::end(Input),
IsSpace ),
::boost::end(Input));
}
//! Left trim - parametric
/*!
Remove all leading spaces from the input.
The result is a trimmed copy of the input.
\param Input An input sequence
\param Loc a locale used for 'space' classification
\return A trimmed copy of the input
\note This function provides the strong exception-safety guarantee
*/
template<typename SequenceT>
inline SequenceT trim_left_copy(const SequenceT& Input, const std::locale& Loc=std::locale())
{
return
::boost::algorithm::trim_left_copy_if(
Input,
is_space(Loc));
}
//! Left trim
/*!
Remove all leading spaces from the input. The supplied predicate is
used to determine which characters are considered spaces.
The input sequence is modified in-place.
\param Input An input sequence
\param IsSpace A unary predicate identifying spaces
*/
template<typename SequenceT, typename PredicateT>
inline void trim_left_if(SequenceT& Input, PredicateT IsSpace)
{
Input.erase(
::boost::begin(Input),
::boost::algorithm::detail::trim_begin(
::boost::begin(Input),
::boost::end(Input),
IsSpace));
}
//! Left trim
/*!
Remove all leading spaces from the input.
The Input sequence is modified in-place.
\param Input An input sequence
\param Loc A locale used for 'space' classification
*/
template<typename SequenceT>
inline void trim_left(SequenceT& Input, const std::locale& Loc=std::locale())
{
::boost::algorithm::trim_left_if(
Input,
is_space(Loc));
}
// right trim -----------------------------------------------//
//! Right trim - parametric
/*!
Remove all trailing spaces from the input.
The supplied predicate is used to determine which characters are considered spaces.
The result is a trimmed copy of the input. It is returned as a sequence
or copied to the output iterator
\param Output An output iterator to which the result will be copied
\param Input An input range
\param IsSpace A unary predicate identifying spaces
\return
An output iterator pointing just after the last inserted character or
a copy of the input
\note The second variant of this function provides the strong exception-safety guarantee
*/
template<typename OutputIteratorT, typename RangeT, typename PredicateT>
inline OutputIteratorT trim_right_copy_if(
OutputIteratorT Output,
const RangeT& Input,
PredicateT IsSpace )
{
iterator_range<BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> lit_range(::boost::as_literal(Input));
std::copy(
::boost::begin(lit_range),
::boost::algorithm::detail::trim_end(
::boost::begin(lit_range),
::boost::end(lit_range),
IsSpace ),
Output );
return Output;
}
//! Right trim - parametric
/*!
\overload
*/
template<typename SequenceT, typename PredicateT>
inline SequenceT trim_right_copy_if(const SequenceT& Input, PredicateT IsSpace)
{
return SequenceT(
::boost::begin(Input),
::boost::algorithm::detail::trim_end(
::boost::begin(Input),
::boost::end(Input),
IsSpace)
);
}
//! Right trim
/*!
Remove all trailing spaces from the input.
The result is a trimmed copy of the input
\param Input An input sequence
\param Loc A locale used for 'space' classification
\return A trimmed copy of the input
\note This function provides the strong exception-safety guarantee
*/
template<typename SequenceT>
inline SequenceT trim_right_copy(const SequenceT& Input, const std::locale& Loc=std::locale())
{
return
::boost::algorithm::trim_right_copy_if(
Input,
is_space(Loc));
}
//! Right trim - parametric
/*!
Remove all trailing spaces from the input.
The supplied predicate is used to determine which characters are considered spaces.
The input sequence is modified in-place.
\param Input An input sequence
\param IsSpace A unary predicate identifying spaces
*/
template<typename SequenceT, typename PredicateT>
inline void trim_right_if(SequenceT& Input, PredicateT IsSpace)
{
Input.erase(
::boost::algorithm::detail::trim_end(
::boost::begin(Input),
::boost::end(Input),
IsSpace ),
::boost::end(Input)
);
}
//! Right trim
/*!
Remove all trailing spaces from the input.
The input sequence is modified in-place.
\param Input An input sequence
\param Loc A locale used for 'space' classification
*/
template<typename SequenceT>
inline void trim_right(SequenceT& Input, const std::locale& Loc=std::locale())
{
::boost::algorithm::trim_right_if(
Input,
is_space(Loc) );
}
// both side trim -----------------------------------------------//
//! Trim - parametric
/*!
Remove all trailing and leading spaces from the input.
The supplied predicate is used to determine which characters are considered spaces.
The result is a trimmed copy of the input. It is returned as a sequence
or copied to the output iterator
\param Output An output iterator to which the result will be copied
\param Input An input range
\param IsSpace A unary predicate identifying spaces
\return
An output iterator pointing just after the last inserted character or
a copy of the input
\note The second variant of this function provides the strong exception-safety guarantee
*/
template<typename OutputIteratorT, typename RangeT, typename PredicateT>
inline OutputIteratorT trim_copy_if(
OutputIteratorT Output,
const RangeT& Input,
PredicateT IsSpace)
{
iterator_range<BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> lit_range(::boost::as_literal(Input));
BOOST_STRING_TYPENAME
range_const_iterator<RangeT>::type TrimEnd=
::boost::algorithm::detail::trim_end(
::boost::begin(lit_range),
::boost::end(lit_range),
IsSpace);
std::copy(
detail::trim_begin(
::boost::begin(lit_range), TrimEnd, IsSpace),
TrimEnd,
Output
);
return Output;
}
//! Trim - parametric
/*!
\overload
*/
template<typename SequenceT, typename PredicateT>
inline SequenceT trim_copy_if(const SequenceT& Input, PredicateT IsSpace)
{
BOOST_STRING_TYPENAME
range_const_iterator<SequenceT>::type TrimEnd=
::boost::algorithm::detail::trim_end(
::boost::begin(Input),
::boost::end(Input),
IsSpace);
return SequenceT(
detail::trim_begin(
::boost::begin(Input),
TrimEnd,
IsSpace),
TrimEnd
);
}
//! Trim
/*!
Remove all leading and trailing spaces from the input.
The result is a trimmed copy of the input
\param Input An input sequence
\param Loc A locale used for 'space' classification
\return A trimmed copy of the input
\note This function provides the strong exception-safety guarantee
*/
template<typename SequenceT>
inline SequenceT trim_copy( const SequenceT& Input, const std::locale& Loc=std::locale() )
{
return
::boost::algorithm::trim_copy_if(
Input,
is_space(Loc) );
}
//! Trim
/*!
Remove all leading and trailing spaces from the input.
The supplied predicate is used to determine which characters are considered spaces.
The input sequence is modified in-place.
\param Input An input sequence
\param IsSpace A unary predicate identifying spaces
*/
template<typename SequenceT, typename PredicateT>
inline void trim_if(SequenceT& Input, PredicateT IsSpace)
{
::boost::algorithm::trim_right_if( Input, IsSpace );
::boost::algorithm::trim_left_if( Input, IsSpace );
}
//! Trim
/*!
Remove all leading and trailing spaces from the input.
The input sequence is modified in-place.
\param Input An input sequence
\param Loc A locale used for 'space' classification
*/
template<typename SequenceT>
inline void trim(SequenceT& Input, const std::locale& Loc=std::locale())
{
::boost::algorithm::trim_if(
Input,
is_space( Loc ) );
}
} // namespace algorithm
// pull names to the boost namespace
using algorithm::trim_left;
using algorithm::trim_left_if;
using algorithm::trim_left_copy;
using algorithm::trim_left_copy_if;
using algorithm::trim_right;
using algorithm::trim_right_if;
using algorithm::trim_right_copy;
using algorithm::trim_right_copy_if;
using algorithm::trim;
using algorithm::trim_if;
using algorithm::trim_copy;
using algorithm::trim_copy_if;
} // namespace boost
#endif // BOOST_STRING_TRIM_HPP
@@ -0,0 +1,719 @@
// Copyright Benjamin Sobotta 2012
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_STATS_SKEW_NORMAL_HPP
#define BOOST_STATS_SKEW_NORMAL_HPP
// http://en.wikipedia.org/wiki/Skew_normal_distribution
// http://azzalini.stat.unipd.it/SN/
// Also:
// Azzalini, A. (1985). "A class of distributions which includes the normal ones".
// Scand. J. Statist. 12: 171-178.
#include <boost/math/distributions/fwd.hpp> // TODO add skew_normal distribution to fwd.hpp!
#include <boost/math/special_functions/owens_t.hpp> // Owen's T function
#include <boost/math/distributions/complement.hpp>
#include <boost/math/distributions/normal.hpp>
#include <boost/math/distributions/detail/common_error_handling.hpp>
#include <boost/math/constants/constants.hpp>
#include <boost/math/tools/tuple.hpp>
#include <boost/math/tools/roots.hpp> // Newton-Raphson
#include <boost/assert.hpp>
#include <boost/math/distributions/detail/generic_mode.hpp> // pdf max finder.
#include <utility>
#include <algorithm> // std::lower_bound, std::distance
namespace boost{ namespace math{
namespace detail
{
template <class RealType, class Policy>
inline bool check_skew_normal_shape(
const char* function,
RealType shape,
RealType* result,
const Policy& pol)
{
if(!(boost::math::isfinite)(shape))
{
*result =
policies::raise_domain_error<RealType>(function,
"Shape parameter is %1%, but must be finite!",
shape, pol);
return false;
}
return true;
}
} // namespace detail
template <class RealType = double, class Policy = policies::policy<> >
class skew_normal_distribution
{
public:
typedef RealType value_type;
typedef Policy policy_type;
skew_normal_distribution(RealType l_location = 0, RealType l_scale = 1, RealType l_shape = 0)
: location_(l_location), scale_(l_scale), shape_(l_shape)
{ // Default is a 'standard' normal distribution N01. (shape=0 results in the normal distribution with no skew)
static const char* function = "boost::math::skew_normal_distribution<%1%>::skew_normal_distribution";
RealType result;
detail::check_scale(function, l_scale, &result, Policy());
detail::check_location(function, l_location, &result, Policy());
detail::check_skew_normal_shape(function, l_shape, &result, Policy());
}
RealType location()const
{
return location_;
}
RealType scale()const
{
return scale_;
}
RealType shape()const
{
return shape_;
}
private:
//
// Data members:
//
RealType location_; // distribution location.
RealType scale_; // distribution scale.
RealType shape_; // distribution shape.
}; // class skew_normal_distribution
typedef skew_normal_distribution<double> skew_normal;
template <class RealType, class Policy>
inline const std::pair<RealType, RealType> range(const skew_normal_distribution<RealType, Policy>& /*dist*/)
{ // Range of permissible values for random variable x.
using boost::math::tools::max_value;
return std::pair<RealType, RealType>(
std::numeric_limits<RealType>::has_infinity ? -std::numeric_limits<RealType>::infinity() : -max_value<RealType>(),
std::numeric_limits<RealType>::has_infinity ? std::numeric_limits<RealType>::infinity() : max_value<RealType>()); // - to + max value.
}
template <class RealType, class Policy>
inline const std::pair<RealType, RealType> support(const skew_normal_distribution<RealType, Policy>& /*dist*/)
{ // Range of supported values for random variable x.
// This is range where cdf rises from 0 to 1, and outside it, the pdf is zero.
using boost::math::tools::max_value;
return std::pair<RealType, RealType>(-max_value<RealType>(), max_value<RealType>()); // - to + max value.
}
template <class RealType, class Policy>
inline RealType pdf(const skew_normal_distribution<RealType, Policy>& dist, const RealType& x)
{
const RealType scale = dist.scale();
const RealType location = dist.location();
const RealType shape = dist.shape();
static const char* function = "boost::math::pdf(const skew_normal_distribution<%1%>&, %1%)";
RealType result = 0;
if(false == detail::check_scale(function, scale, &result, Policy()))
{
return result;
}
if(false == detail::check_location(function, location, &result, Policy()))
{
return result;
}
if(false == detail::check_skew_normal_shape(function, shape, &result, Policy()))
{
return result;
}
if((boost::math::isinf)(x))
{
return 0; // pdf + and - infinity is zero.
}
// Below produces MSVC 4127 warnings, so the above used instead.
//if(std::numeric_limits<RealType>::has_infinity && abs(x) == std::numeric_limits<RealType>::infinity())
//{ // pdf + and - infinity is zero.
// return 0;
//}
if(false == detail::check_x(function, x, &result, Policy()))
{
return result;
}
const RealType transformed_x = (x-location)/scale;
normal_distribution<RealType, Policy> std_normal;
result = pdf(std_normal, transformed_x) * cdf(std_normal, shape*transformed_x) * 2 / scale;
return result;
} // pdf
template <class RealType, class Policy>
inline RealType cdf(const skew_normal_distribution<RealType, Policy>& dist, const RealType& x)
{
const RealType scale = dist.scale();
const RealType location = dist.location();
const RealType shape = dist.shape();
static const char* function = "boost::math::cdf(const skew_normal_distribution<%1%>&, %1%)";
RealType result = 0;
if(false == detail::check_scale(function, scale, &result, Policy()))
{
return result;
}
if(false == detail::check_location(function, location, &result, Policy()))
{
return result;
}
if(false == detail::check_skew_normal_shape(function, shape, &result, Policy()))
{
return result;
}
if((boost::math::isinf)(x))
{
if(x < 0) return 0; // -infinity
return 1; // + infinity
}
// These produce MSVC 4127 warnings, so the above used instead.
//if(std::numeric_limits<RealType>::has_infinity && x == std::numeric_limits<RealType>::infinity())
//{ // cdf +infinity is unity.
// return 1;
//}
//if(std::numeric_limits<RealType>::has_infinity && x == -std::numeric_limits<RealType>::infinity())
//{ // cdf -infinity is zero.
// return 0;
//}
if(false == detail::check_x(function, x, &result, Policy()))
{
return result;
}
const RealType transformed_x = (x-location)/scale;
normal_distribution<RealType, Policy> std_normal;
result = cdf(std_normal, transformed_x) - owens_t(transformed_x, shape)*static_cast<RealType>(2);
return result;
} // cdf
template <class RealType, class Policy>
inline RealType cdf(const complemented2_type<skew_normal_distribution<RealType, Policy>, RealType>& c)
{
const RealType scale = c.dist.scale();
const RealType location = c.dist.location();
const RealType shape = c.dist.shape();
const RealType x = c.param;
static const char* function = "boost::math::cdf(const complement(skew_normal_distribution<%1%>&), %1%)";
if((boost::math::isinf)(x))
{
if(x < 0) return 1; // cdf complement -infinity is unity.
return 0; // cdf complement +infinity is zero
}
// These produce MSVC 4127 warnings, so the above used instead.
//if(std::numeric_limits<RealType>::has_infinity && x == std::numeric_limits<RealType>::infinity())
//{ // cdf complement +infinity is zero.
// return 0;
//}
//if(std::numeric_limits<RealType>::has_infinity && x == -std::numeric_limits<RealType>::infinity())
//{ // cdf complement -infinity is unity.
// return 1;
//}
RealType result = 0;
if(false == detail::check_scale(function, scale, &result, Policy()))
return result;
if(false == detail::check_location(function, location, &result, Policy()))
return result;
if(false == detail::check_skew_normal_shape(function, shape, &result, Policy()))
return result;
if(false == detail::check_x(function, x, &result, Policy()))
return result;
const RealType transformed_x = (x-location)/scale;
normal_distribution<RealType, Policy> std_normal;
result = cdf(complement(std_normal, transformed_x)) + owens_t(transformed_x, shape)*static_cast<RealType>(2);
return result;
} // cdf complement
template <class RealType, class Policy>
inline RealType location(const skew_normal_distribution<RealType, Policy>& dist)
{
return dist.location();
}
template <class RealType, class Policy>
inline RealType scale(const skew_normal_distribution<RealType, Policy>& dist)
{
return dist.scale();
}
template <class RealType, class Policy>
inline RealType shape(const skew_normal_distribution<RealType, Policy>& dist)
{
return dist.shape();
}
template <class RealType, class Policy>
inline RealType mean(const skew_normal_distribution<RealType, Policy>& dist)
{
BOOST_MATH_STD_USING // for ADL of std functions
using namespace boost::math::constants;
//const RealType delta = dist.shape() / sqrt(static_cast<RealType>(1)+dist.shape()*dist.shape());
//return dist.location() + dist.scale() * delta * root_two_div_pi<RealType>();
return dist.location() + dist.scale() * dist.shape() / sqrt(pi<RealType>()+pi<RealType>()*dist.shape()*dist.shape()) * root_two<RealType>();
}
template <class RealType, class Policy>
inline RealType variance(const skew_normal_distribution<RealType, Policy>& dist)
{
using namespace boost::math::constants;
const RealType delta2 = static_cast<RealType>(1) / (static_cast<RealType>(1)+static_cast<RealType>(1)/(dist.shape()*dist.shape()));
//const RealType inv_delta2 = static_cast<RealType>(1)+static_cast<RealType>(1)/(dist.shape()*dist.shape());
RealType variance = dist.scale()*dist.scale()*(static_cast<RealType>(1)-two_div_pi<RealType>()*delta2);
//RealType variance = dist.scale()*dist.scale()*(static_cast<RealType>(1)-two_div_pi<RealType>()/inv_delta2);
return variance;
}
namespace detail
{
/*
TODO No closed expression for mode, so use max of pdf.
*/
template <class RealType, class Policy>
inline RealType mode_fallback(const skew_normal_distribution<RealType, Policy>& dist)
{ // mode.
static const char* function = "mode(skew_normal_distribution<%1%> const&)";
const RealType scale = dist.scale();
const RealType location = dist.location();
const RealType shape = dist.shape();
RealType result;
if(!detail::check_scale(
function,
scale, &result, Policy())
||
!detail::check_skew_normal_shape(
function,
shape,
&result,
Policy()))
return result;
if( shape == 0 )
{
return location;
}
if( shape < 0 )
{
skew_normal_distribution<RealType, Policy> D(0, 1, -shape);
result = mode_fallback(D);
result = location-scale*result;
return result;
}
BOOST_MATH_STD_USING
// 21 elements
static const RealType shapes[] = {
0.0,
1.000000000000000e-004,
2.069138081114790e-004,
4.281332398719396e-004,
8.858667904100824e-004,
1.832980710832436e-003,
3.792690190732250e-003,
7.847599703514606e-003,
1.623776739188722e-002,
3.359818286283781e-002,
6.951927961775606e-002,
1.438449888287663e-001,
2.976351441631319e-001,
6.158482110660261e-001,
1.274274985703135e+000,
2.636650898730361e+000,
5.455594781168514e+000,
1.128837891684688e+001,
2.335721469090121e+001,
4.832930238571753e+001,
1.000000000000000e+002};
// 21 elements
static const RealType guess[] = {
0.0,
5.000050000525391e-005,
1.500015000148736e-004,
3.500035000350010e-004,
7.500075000752560e-004,
1.450014500145258e-003,
3.050030500305390e-003,
6.250062500624765e-003,
1.295012950129504e-002,
2.675026750267495e-002,
5.525055250552491e-002,
1.132511325113255e-001,
2.249522495224952e-001,
3.992539925399257e-001,
5.353553535535358e-001,
4.954549545495457e-001,
3.524535245352451e-001,
2.182521825218249e-001,
1.256512565125654e-001,
6.945069450694508e-002,
3.735037350373460e-002
};
const RealType* result_ptr = std::lower_bound(shapes, shapes+21, shape);
typedef typename std::iterator_traits<RealType*>::difference_type diff_type;
const diff_type d = std::distance(shapes, result_ptr);
BOOST_ASSERT(d > static_cast<diff_type>(0));
// refine
if(d < static_cast<diff_type>(21)) // shape smaller 100
{
result = guess[d-static_cast<diff_type>(1)]
+ (guess[d]-guess[d-static_cast<diff_type>(1)])/(shapes[d]-shapes[d-static_cast<diff_type>(1)])
* (shape-shapes[d-static_cast<diff_type>(1)]);
}
else // shape greater 100
{
result = 1e-4;
}
skew_normal_distribution<RealType, Policy> helper(0, 1, shape);
result = detail::generic_find_mode_01(helper, result, function);
result = result*scale + location;
return result;
} // mode_fallback
/*
* TODO No closed expression for mode, so use f'(x) = 0
*/
template <class RealType, class Policy>
struct skew_normal_mode_functor
{
skew_normal_mode_functor(const boost::math::skew_normal_distribution<RealType, Policy> dist)
: distribution(dist)
{
}
boost::math::tuple<RealType, RealType> operator()(RealType const& x)
{
normal_distribution<RealType, Policy> std_normal;
const RealType shape = distribution.shape();
const RealType pdf_x = pdf(distribution, x);
const RealType normpdf_x = pdf(std_normal, x);
const RealType normpdf_ax = pdf(std_normal, x*shape);
RealType fx = static_cast<RealType>(2)*shape*normpdf_ax*normpdf_x - x*pdf_x;
RealType dx = static_cast<RealType>(2)*shape*x*normpdf_x*normpdf_ax*(static_cast<RealType>(1) + shape*shape) + pdf_x + x*fx;
// return both function evaluation difference f(x) and 1st derivative f'(x).
return boost::math::make_tuple(fx, -dx);
}
private:
const boost::math::skew_normal_distribution<RealType, Policy> distribution;
};
} // namespace detail
template <class RealType, class Policy>
inline RealType mode(const skew_normal_distribution<RealType, Policy>& dist)
{
const RealType scale = dist.scale();
const RealType location = dist.location();
const RealType shape = dist.shape();
static const char* function = "boost::math::mode(const skew_normal_distribution<%1%>&, %1%)";
RealType result = 0;
if(false == detail::check_scale(function, scale, &result, Policy()))
return result;
if(false == detail::check_location(function, location, &result, Policy()))
return result;
if(false == detail::check_skew_normal_shape(function, shape, &result, Policy()))
return result;
if( shape == 0 )
{
return location;
}
if( shape < 0 )
{
skew_normal_distribution<RealType, Policy> D(0, 1, -shape);
result = mode(D);
result = location-scale*result;
return result;
}
// 21 elements
static const RealType shapes[] = {
0.0,
static_cast<RealType>(1.000000000000000e-004),
static_cast<RealType>(2.069138081114790e-004),
static_cast<RealType>(4.281332398719396e-004),
static_cast<RealType>(8.858667904100824e-004),
static_cast<RealType>(1.832980710832436e-003),
static_cast<RealType>(3.792690190732250e-003),
static_cast<RealType>(7.847599703514606e-003),
static_cast<RealType>(1.623776739188722e-002),
static_cast<RealType>(3.359818286283781e-002),
static_cast<RealType>(6.951927961775606e-002),
static_cast<RealType>(1.438449888287663e-001),
static_cast<RealType>(2.976351441631319e-001),
static_cast<RealType>(6.158482110660261e-001),
static_cast<RealType>(1.274274985703135e+000),
static_cast<RealType>(2.636650898730361e+000),
static_cast<RealType>(5.455594781168514e+000),
static_cast<RealType>(1.128837891684688e+001),
static_cast<RealType>(2.335721469090121e+001),
static_cast<RealType>(4.832930238571753e+001),
static_cast<RealType>(1.000000000000000e+002)
};
// 21 elements
static const RealType guess[] = {
0.0,
static_cast<RealType>(5.000050000525391e-005),
static_cast<RealType>(1.500015000148736e-004),
static_cast<RealType>(3.500035000350010e-004),
static_cast<RealType>(7.500075000752560e-004),
static_cast<RealType>(1.450014500145258e-003),
static_cast<RealType>(3.050030500305390e-003),
static_cast<RealType>(6.250062500624765e-003),
static_cast<RealType>(1.295012950129504e-002),
static_cast<RealType>(2.675026750267495e-002),
static_cast<RealType>(5.525055250552491e-002),
static_cast<RealType>(1.132511325113255e-001),
static_cast<RealType>(2.249522495224952e-001),
static_cast<RealType>(3.992539925399257e-001),
static_cast<RealType>(5.353553535535358e-001),
static_cast<RealType>(4.954549545495457e-001),
static_cast<RealType>(3.524535245352451e-001),
static_cast<RealType>(2.182521825218249e-001),
static_cast<RealType>(1.256512565125654e-001),
static_cast<RealType>(6.945069450694508e-002),
static_cast<RealType>(3.735037350373460e-002)
};
const RealType* result_ptr = std::lower_bound(shapes, shapes+21, shape);
typedef typename std::iterator_traits<RealType*>::difference_type diff_type;
const diff_type d = std::distance(shapes, result_ptr);
BOOST_ASSERT(d > static_cast<diff_type>(0));
// TODO: make the search bounds smarter, depending on the shape parameter
RealType search_min = 0; // below zero was caught above
RealType search_max = 0.55f; // will never go above 0.55
// refine
if(d < static_cast<diff_type>(21)) // shape smaller 100
{
// it is safe to assume that d > 0, because shape==0.0 is caught earlier
result = guess[d-static_cast<diff_type>(1)]
+ (guess[d]-guess[d-static_cast<diff_type>(1)])/(shapes[d]-shapes[d-static_cast<diff_type>(1)])
* (shape-shapes[d-static_cast<diff_type>(1)]);
}
else // shape greater 100
{
result = 1e-4f;
search_max = guess[19]; // set 19 instead of 20 to have a safety margin because the table may not be exact @ shape=100
}
const int get_digits = policies::digits<RealType, Policy>();// get digits from policy,
boost::uintmax_t m = policies::get_max_root_iterations<Policy>(); // and max iterations.
skew_normal_distribution<RealType, Policy> helper(0, 1, shape);
result = tools::newton_raphson_iterate(detail::skew_normal_mode_functor<RealType, Policy>(helper), result,
search_min, search_max, get_digits, m);
result = result*scale + location;
return result;
}
template <class RealType, class Policy>
inline RealType skewness(const skew_normal_distribution<RealType, Policy>& dist)
{
BOOST_MATH_STD_USING // for ADL of std functions
using namespace boost::math::constants;
static const RealType factor = four_minus_pi<RealType>()/static_cast<RealType>(2);
const RealType delta = dist.shape() / sqrt(static_cast<RealType>(1)+dist.shape()*dist.shape());
return factor * pow(root_two_div_pi<RealType>() * delta, 3) /
pow(static_cast<RealType>(1)-two_div_pi<RealType>()*delta*delta, static_cast<RealType>(1.5));
}
template <class RealType, class Policy>
inline RealType kurtosis(const skew_normal_distribution<RealType, Policy>& dist)
{
return kurtosis_excess(dist)+static_cast<RealType>(3);
}
template <class RealType, class Policy>
inline RealType kurtosis_excess(const skew_normal_distribution<RealType, Policy>& dist)
{
using namespace boost::math::constants;
static const RealType factor = pi_minus_three<RealType>()*static_cast<RealType>(2);
const RealType delta2 = static_cast<RealType>(1) / (static_cast<RealType>(1)+static_cast<RealType>(1)/(dist.shape()*dist.shape()));
const RealType x = static_cast<RealType>(1)-two_div_pi<RealType>()*delta2;
const RealType y = two_div_pi<RealType>() * delta2;
return factor * y*y / (x*x);
}
namespace detail
{
template <class RealType, class Policy>
struct skew_normal_quantile_functor
{
skew_normal_quantile_functor(const boost::math::skew_normal_distribution<RealType, Policy> dist, RealType const& p)
: distribution(dist), prob(p)
{
}
boost::math::tuple<RealType, RealType> operator()(RealType const& x)
{
RealType c = cdf(distribution, x);
RealType fx = c - prob; // Difference cdf - value - to minimize.
RealType dx = pdf(distribution, x); // pdf is 1st derivative.
// return both function evaluation difference f(x) and 1st derivative f'(x).
return boost::math::make_tuple(fx, dx);
}
private:
const boost::math::skew_normal_distribution<RealType, Policy> distribution;
RealType prob;
};
} // namespace detail
template <class RealType, class Policy>
inline RealType quantile(const skew_normal_distribution<RealType, Policy>& dist, const RealType& p)
{
const RealType scale = dist.scale();
const RealType location = dist.location();
const RealType shape = dist.shape();
static const char* function = "boost::math::quantile(const skew_normal_distribution<%1%>&, %1%)";
RealType result = 0;
if(false == detail::check_scale(function, scale, &result, Policy()))
return result;
if(false == detail::check_location(function, location, &result, Policy()))
return result;
if(false == detail::check_skew_normal_shape(function, shape, &result, Policy()))
return result;
if(false == detail::check_probability(function, p, &result, Policy()))
return result;
// Compute initial guess via Cornish-Fisher expansion.
RealType x = -boost::math::erfc_inv(2 * p, Policy()) * constants::root_two<RealType>();
// Avoid unnecessary computations if there is no skew.
if(shape != 0)
{
const RealType skew = skewness(dist);
const RealType exk = kurtosis_excess(dist);
x = x + (x*x-static_cast<RealType>(1))*skew/static_cast<RealType>(6)
+ x*(x*x-static_cast<RealType>(3))*exk/static_cast<RealType>(24)
- x*(static_cast<RealType>(2)*x*x-static_cast<RealType>(5))*skew*skew/static_cast<RealType>(36);
} // if(shape != 0)
result = standard_deviation(dist)*x+mean(dist);
// handle special case of non-skew normal distribution.
if(shape == 0)
return result;
// refine the result by numerically searching the root of (p-cdf)
const RealType search_min = range(dist).first;
const RealType search_max = range(dist).second;
const int get_digits = policies::digits<RealType, Policy>();// get digits from policy,
boost::uintmax_t m = policies::get_max_root_iterations<Policy>(); // and max iterations.
result = tools::newton_raphson_iterate(detail::skew_normal_quantile_functor<RealType, Policy>(dist, p), result,
search_min, search_max, get_digits, m);
return result;
} // quantile
template <class RealType, class Policy>
inline RealType quantile(const complemented2_type<skew_normal_distribution<RealType, Policy>, RealType>& c)
{
const RealType scale = c.dist.scale();
const RealType location = c.dist.location();
const RealType shape = c.dist.shape();
static const char* function = "boost::math::quantile(const complement(skew_normal_distribution<%1%>&), %1%)";
RealType result = 0;
if(false == detail::check_scale(function, scale, &result, Policy()))
return result;
if(false == detail::check_location(function, location, &result, Policy()))
return result;
if(false == detail::check_skew_normal_shape(function, shape, &result, Policy()))
return result;
RealType q = c.param;
if(false == detail::check_probability(function, q, &result, Policy()))
return result;
skew_normal_distribution<RealType, Policy> D(-location, scale, -shape);
result = -quantile(D, q);
return result;
} // quantile
} // namespace math
} // namespace boost
// This include must be at the end, *after* the accessors
// for this distribution have been defined, in order to
// keep compilers that support two-phase lookup happy.
#include <boost/math/distributions/detail/derived_accessors.hpp>
#endif // BOOST_STATS_SKEW_NORMAL_HPP
@@ -0,0 +1,68 @@
/*
Copyright Rene Rivera 2008-2015
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_PREDEF_COMPILER_GCC_H
#define BOOST_PREDEF_COMPILER_GCC_H
/* Other compilers that emulate this one need to be detected first. */
#include <boost/predef/compiler/clang.h>
#include <boost/predef/version_number.h>
#include <boost/predef/make.h>
/*`
[heading `BOOST_COMP_GNUC`]
[@http://en.wikipedia.org/wiki/GNU_Compiler_Collection Gnu GCC C/C++] compiler.
Version number available as major, minor, and patch (if available).
[table
[[__predef_symbol__] [__predef_version__]]
[[`__GNUC__`] [__predef_detection__]]
[[`__GNUC__`, `__GNUC_MINOR__`, `__GNUC_PATCHLEVEL__`] [V.R.P]]
[[`__GNUC__`, `__GNUC_MINOR__`] [V.R.0]]
]
*/
#define BOOST_COMP_GNUC BOOST_VERSION_NUMBER_NOT_AVAILABLE
#if defined(__GNUC__)
# if !defined(BOOST_COMP_GNUC_DETECTION) && defined(__GNUC_PATCHLEVEL__)
# define BOOST_COMP_GNUC_DETECTION \
BOOST_VERSION_NUMBER(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__)
# endif
# if !defined(BOOST_COMP_GNUC_DETECTION)
# define BOOST_COMP_GNUC_DETECTION \
BOOST_VERSION_NUMBER(__GNUC__,__GNUC_MINOR__,0)
# endif
#endif
#ifdef BOOST_COMP_GNUC_DETECTION
# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED)
# define BOOST_COMP_GNUC_EMULATED BOOST_COMP_GNUC_DETECTION
# else
# undef BOOST_COMP_GNUC
# define BOOST_COMP_GNUC BOOST_COMP_GNUC_DETECTION
# endif
# define BOOST_COMP_GNUC_AVAILABLE
# include <boost/predef/detail/comp_detected.h>
#endif
#define BOOST_COMP_GNUC_NAME "Gnu GCC C/C++"
#endif
#include <boost/predef/detail/test.h>
BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_GNUC,BOOST_COMP_GNUC_NAME)
#ifdef BOOST_COMP_GNUC_EMULATED
#include <boost/predef/detail/test.h>
BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_GNUC_EMULATED,BOOST_COMP_GNUC_NAME)
#endif
@@ -0,0 +1,217 @@
/* RCODE.C - Procedures to read parity check and generator matrices. */
/* Copyright (c) 1995-2012 by Radford M. Neal.
*
* Permission is granted for anyone to copy, use, modify, and distribute
* these programs and accompanying documents for any purpose, provided
* this copyright notice is retained and prominently displayed, and note
* is made of any changes made to these programs. These programs and
* documents are distributed without any warranty, express or implied.
* As the programs were written for research purposes only, they have not
* been tested to the degree that would be advisable in any important
* application. All use of these programs is entirely at the user's own
* risk.
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "alloc.h"
#include "intio.h"
#include "open.h"
#include "mod2sparse.h"
#include "mod2dense.h"
#include "mod2convert.h"
#include "rcode.h"
/* VARIABLES DECLARED IN RCODE.H. These global variables are set to
representations of the parity check and generator matrices by read_pchk
and read_gen. */
mod2sparse *H; /* Parity check matrix */
int M; /* Number of rows in parity check matrix */
int N; /* Number of columns in parity check matrix */
char type; /* Type of generator matrix representation (s/d/m) */
int *cols; /* Ordering of columns in generator matrix */
mod2sparse *L, *U; /* Sparse LU decomposition, if type=='s' */
int *rows; /* Ordering of rows in generator matrix (type 's') */
mod2dense *G; /* Dense or mixed representation of generator matrix,
if type=='d' or type=='m' */
/* READ PARITY CHECK MATRIX. Sets the H, M, and N global variables. If an
error is encountered, a message is displayed on standard error, and the
program is terminated. */
void read_pchk
( char *pchk_file
)
{
FILE *f;
f = open_file_std(pchk_file,"rb");
if (f==NULL)
{ fprintf(stderr,"Can't open parity check file: %s\n",pchk_file);
exit(1);
}
if (intio_read(f)!=('P'<<8)+0x80)
{ fprintf(stderr,"File %s doesn't contain a parity check matrix\n",pchk_file);
exit(1);
}
H = mod2sparse_read(f);
if (H==0)
{ fprintf(stderr,"Error reading parity check matrix from %s\n",pchk_file);
exit(1);
}
M = mod2sparse_rows(H);
N = mod2sparse_cols(H);
fclose(f);
}
/* READ GENERATOR MATRIX. The parity check matrix must have already been
read, unless the last argument is set to 1. The generator matrix must be
compatible with the parity check matrix, if it has been read. If the
second argument is 1, only the column ordering (the last N-M of which are
the indexes of the message bits) is read, into the 'cols' global variable.
Otherwise, everything is read, into the global variables appropriate
to the representation. The 'type' global variable is set to a letter
indicating which represention is used.
If an error is encountered, a message is displayed on standard error,
and the program is terminated. */
void read_gen
( char *gen_file, /* Name of generator matrix file */
int cols_only, /* Read only column ordering? */
int no_pchk_file /* No parity check file used? */
)
{
int M2, N2;
FILE *f;
int i;
f = open_file_std(gen_file,"rb");
if (f==NULL)
{ fprintf(stderr,"Can't open generator matrix file: %s\n",gen_file);
exit(1);
}
if (intio_read(f)!=('G'<<8)+0x80)
{ fprintf(stderr,"File %s doesn't contain a generator matrix\n",gen_file);
exit(1);
}
if (fread (&type, 1, 1, f) != 1) goto error;
M2 = intio_read(f);
N2 = intio_read(f);
if (feof(f) || ferror(f)) goto error;
if (no_pchk_file)
{ M = M2;
N = N2;
}
else
{ if (M2!=M || N2!=N)
{ fprintf(stderr,
"Generator matrix and parity-check matrix are incompatible\n");
exit(1);
}
}
cols = chk_alloc (N, sizeof *cols);
rows = chk_alloc (M, sizeof *rows);
for (i = 0; i<N; i++)
{ cols[i] = intio_read(f);
if (feof(f) || ferror(f)) goto error;
}
if (!cols_only)
{
switch (type)
{
case 's':
{
for (i = 0; i<M; i++)
{ rows[i] = intio_read(f);
if (feof(f) || ferror(f)) goto error;
}
if ((L = mod2sparse_read(f)) == 0) goto error;
if ((U = mod2sparse_read(f)) == 0) goto error;
if (mod2sparse_rows(L)!=M || mod2sparse_cols(L)!=M) goto garbled;
if (mod2sparse_rows(U)!=M || mod2sparse_cols(U)<M) goto garbled;
break;
}
case 'd':
{
if ((G = mod2dense_read(f)) == 0) goto error;
if (mod2dense_rows(G)!=M || mod2dense_cols(G)!=N-M) goto garbled;
break;
}
case 'm':
{
if ((G = mod2dense_read(f)) == 0) goto error;
if (mod2dense_rows(G)!=M || mod2dense_cols(G)!=M) goto garbled;
break;
}
default:
{ fprintf(stderr,
"Unknown type of generator matrix in file %s\n",gen_file);
exit(1);
}
}
}
fclose(f);
return;
error:
fprintf(stderr,"Error reading generator matrix from file %s\n",gen_file);
exit(1);
garbled:
fprintf(stderr,"Garbled generator matrix in file %s\n",gen_file);
exit(1);
}
// Fortran interface routines for WSJT-X
void init_ldpc_ (char *pfile, char *gfile )
{
read_pchk( pfile );
read_gen( gfile, 0, 0 );
}
void fini_ldpc_ ()
{
mod2dense_free (G);
mod2sparse_free (U);
mod2sparse_free (L);
free (cols);
free (rows);
mod2sparse_free (H);
}
@@ -0,0 +1,60 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(FUSION_CONVERT_09232005_1215)
#define FUSION_CONVERT_09232005_1215
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/list/cons.hpp>
#include <boost/fusion/container/list/detail/build_cons.hpp>
#include <boost/fusion/container/list/detail/convert_impl.hpp>
#include <boost/fusion/sequence/intrinsic/empty.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
namespace boost { namespace fusion
{
namespace result_of
{
template <typename Sequence>
struct as_list
{
typedef typename
detail::build_cons<
typename result_of::begin<Sequence>::type
, typename result_of::end<Sequence>::type
>
build_cons;
typedef typename build_cons::type type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Sequence& seq)
{
return build_cons::call(fusion::begin(seq), fusion::end(seq));
}
};
}
template <typename Sequence>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::as_list<Sequence>::type
as_list(Sequence& seq)
{
return result_of::as_list<Sequence>::call(seq);
}
template <typename Sequence>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::as_list<Sequence const>::type
as_list(Sequence const& seq)
{
return result_of::as_list<Sequence const>::call(seq);
}
}}
#endif
@@ -0,0 +1,21 @@
#ifndef BOOST_MPL_TIMES_HPP_INCLUDED
#define BOOST_MPL_TIMES_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$
#define AUX778076_OP_NAME times
#define AUX778076_OP_TOKEN *
#include <boost/mpl/aux_/arithmetic_op.hpp>
#endif // BOOST_MPL_TIMES_HPP_INCLUDED
@@ -0,0 +1,55 @@
// (C) Copyright 2009-2011 Frederic Bron.
//
// 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_HAS_BIT_OR_ASSIGN_HPP_INCLUDED
#define BOOST_TT_HAS_BIT_OR_ASSIGN_HPP_INCLUDED
#define BOOST_TT_TRAIT_NAME has_bit_or_assign
#define BOOST_TT_TRAIT_OP |=
#define BOOST_TT_FORBIDDEN_IF\
(\
/* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\
(\
::boost::is_fundamental< Lhs_nocv >::value && \
::boost::is_fundamental< Rhs_nocv >::value && \
( \
(! ::boost::is_integral< Lhs_noref >::value ) || \
(! ::boost::is_integral< Rhs_noref >::value )\
)\
)||\
/* Lhs==fundamental and Rhs==pointer */\
(\
::boost::is_fundamental< Lhs_nocv >::value && \
::boost::is_pointer< Rhs_noref >::value\
)||\
/* Rhs==fundamental and Lhs==pointer */\
(\
::boost::is_fundamental< Rhs_nocv >::value && \
::boost::is_pointer< Lhs_noref >::value\
)||\
/* Lhs==pointer and Rhs==pointer */\
(\
::boost::is_pointer< Lhs_noref >::value && \
::boost::is_pointer< Rhs_noref >::value\
)||\
/* Lhs==fundamental and Rhs==fundamental and Lhs==const */\
(\
::boost::is_fundamental< Lhs_nocv >::value && \
::boost::is_fundamental< Rhs_nocv >::value && \
::boost::is_const< Lhs_noref >::value\
)\
)
#include <boost/type_traits/detail/has_binary_operator.hpp>
#undef BOOST_TT_TRAIT_NAME
#undef BOOST_TT_TRAIT_OP
#undef BOOST_TT_FORBIDDEN_IF
#endif
@@ -0,0 +1,198 @@
#include "soundout.h"
#include <QDateTime>
#include <QAudioDeviceInfo>
#include <QAudioOutput>
#include <QSysInfo>
#include <qmath.h>
#include <QDebug>
#include "moc_soundout.cpp"
#if defined (WIN32)
# define MS_BUFFERED 1000u
#else
# define MS_BUFFERED 2000u
#endif
bool SoundOutput::audioError () const
{
bool result (true);
Q_ASSERT_X (m_stream, "SoundOutput", "programming error");
if (m_stream) {
switch (m_stream->error ())
{
case QAudio::OpenError:
Q_EMIT error (tr ("An error opening the audio output device has occurred."));
break;
case QAudio::IOError:
Q_EMIT error (tr ("An error occurred during write to the audio output device."));
break;
case QAudio::UnderrunError:
Q_EMIT error (tr ("Audio data not being fed to the audio output device fast enough."));
break;
case QAudio::FatalError:
Q_EMIT error (tr ("Non-recoverable error, audio output device not usable at this time."));
break;
case QAudio::NoError:
result = false;
break;
}
}
return result;
}
void SoundOutput::setFormat (QAudioDeviceInfo const& device, unsigned channels, unsigned msBuffered)
{
Q_ASSERT (0 < channels && channels < 3);
m_msBuffered = msBuffered;
QAudioFormat format (device.preferredFormat ());
// qDebug () << "Preferred audio output format:" << format;
format.setChannelCount (channels);
format.setCodec ("audio/pcm");
format.setSampleRate (48000);
format.setSampleType (QAudioFormat::SignedInt);
format.setSampleSize (16);
format.setByteOrder (QAudioFormat::Endian (QSysInfo::ByteOrder));
if (!format.isValid ())
{
Q_EMIT error (tr ("Requested output audio format is not valid."));
}
if (!device.isFormatSupported (format))
{
Q_EMIT error (tr ("Requested output audio format is not supported on device."));
}
// qDebug () << "Selected audio output format:" << format;
m_stream.reset (new QAudioOutput (device, format));
audioError ();
m_stream->setVolume (m_volume);
m_stream->setNotifyInterval(100);
connect (m_stream.data(), &QAudioOutput::stateChanged, this, &SoundOutput::handleStateChanged);
// qDebug() << "A" << m_volume << m_stream->notifyInterval();
}
void SoundOutput::restart (QIODevice * source)
{
Q_ASSERT (m_stream);
//
// This buffer size is critical since for proper sound streaming. If
// it is too short; high activity levels on the machine can starve
// the audio buffer. On the other hand the Windows implementation
// seems to take the length of the buffer in time to stop the audio
// stream even if reset() is used.
//
// 2 seconds seems a reasonable compromise except for Windows
// where things are probably broken.
//
// we have to set this before every start on the stream because the
// Windows implementation seems to forget the buffer size after a
// stop.
m_stream->setBufferSize (m_stream->format().bytesForDuration((m_msBuffered ? m_msBuffered : MS_BUFFERED) * 1000));
// qDebug() << "B" << m_stream->bufferSize() <<
// m_stream->periodSize() << m_stream->notifyInterval();
m_stream->start (source);
}
void SoundOutput::suspend ()
{
if (m_stream && QAudio::ActiveState == m_stream->state ())
{
m_stream->suspend ();
audioError ();
}
}
void SoundOutput::resume ()
{
if (m_stream && QAudio::SuspendedState == m_stream->state ())
{
m_stream->resume ();
audioError ();
}
}
void SoundOutput::reset ()
{
if (m_stream)
{
m_stream->reset ();
audioError ();
}
}
void SoundOutput::stop ()
{
if (m_stream)
{
m_stream->stop ();
audioError ();
}
}
qreal SoundOutput::attenuation () const
{
return -(20. * qLn (m_volume) / qLn (10.));
}
void SoundOutput::setAttenuation (qreal a)
{
Q_ASSERT (0. <= a && a <= 999.);
m_volume = qPow(10.0, -a/20.0);
// qDebug () << "SoundOut: attn = " << a << ", vol = " << m_volume;
if (m_stream)
{
m_stream->setVolume (m_volume);
}
}
void SoundOutput::resetAttenuation ()
{
m_volume = 1.;
if (m_stream)
{
m_stream->setVolume (m_volume);
}
}
void SoundOutput::handleStateChanged (QAudio::State newState)
{
// qDebug () << "SoundOutput::handleStateChanged: newState:" << newState;
switch (newState)
{
case QAudio::IdleState:
Q_EMIT status (tr ("Idle"));
break;
case QAudio::ActiveState:
Q_EMIT status (tr ("Sending"));
break;
case QAudio::SuspendedState:
Q_EMIT status (tr ("Suspended"));
break;
case QAudio::StoppedState:
if (audioError ())
{
Q_EMIT status (tr ("Error"));
}
else
{
Q_EMIT status (tr ("Stopped"));
}
break;
}
}
@@ -0,0 +1,9 @@
0; 0;163
0; 87;191
0;207;219
0;247;139
0;255; 23
95;255; 0
219;255; 0
255;171;155
255;255;255
@@ -0,0 +1,517 @@
#include "widegraph.h"
#include <algorithm>
#include <QApplication>
#include <QSettings>
#include "ui_widegraph.h"
#include "commons.h"
#include "Configuration.hpp"
#include "MessageBox.hpp"
#include "SettingsGroup.hpp"
#include "moc_widegraph.cpp"
namespace
{
auto user_defined = QObject::tr ("User Defined");
float swide[MAX_SCREENSIZE];
}
WideGraph::WideGraph(QSettings * settings, QWidget *parent) :
QDialog(parent),
ui(new Ui::WideGraph),
m_settings (settings),
m_palettes_path {":/Palettes"},
m_ntr0 {0},
m_lockTxFreq {false},
m_bHaveTransmitted {false},
m_n {0}
{
ui->setupUi(this);
setWindowTitle (QApplication::applicationName () + " - " + tr ("Wide Graph"));
setWindowFlags (Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint);
setMaximumWidth (MAX_SCREENSIZE);
setMaximumHeight (880);
ui->widePlot->setCursor(Qt::CrossCursor);
ui->widePlot->setMaximumHeight(800);
ui->widePlot->setCurrent(false);
connect(ui->widePlot, SIGNAL(freezeDecode1(int)),this,
SLOT(wideFreezeDecode(int)));
connect(ui->widePlot, SIGNAL(setFreq1(int,int)),this,
SLOT(setFreq2(int,int)));
{
//Restore user's settings
SettingsGroup g {m_settings, "WideGraph"};
restoreGeometry (m_settings->value ("geometry", saveGeometry ()).toByteArray ());
ui->widePlot->setPlotZero(m_settings->value("PlotZero", 0).toInt());
ui->widePlot->setPlotGain(m_settings->value("PlotGain", 0).toInt());
ui->widePlot->setPlot2dGain(m_settings->value("Plot2dGain", 0).toInt());
ui->widePlot->setPlot2dZero(m_settings->value("Plot2dZero", 0).toInt());
ui->zeroSlider->setValue(ui->widePlot->plotZero());
ui->gainSlider->setValue(ui->widePlot->plotGain());
ui->gain2dSlider->setValue(ui->widePlot->plot2dGain());
ui->zero2dSlider->setValue(ui->widePlot->plot2dZero());
int n = m_settings->value("BinsPerPixel",2).toInt();
m_bFlatten=m_settings->value("Flatten",true).toBool();
m_bRef=m_settings->value("UseRef",false).toBool();
ui->cbFlatten->setChecked(m_bFlatten);
ui->widePlot->setFlatten(m_bFlatten,m_bRef);
ui->cbRef->setChecked(m_bRef);
ui->widePlot->setBreadth(m_settings->value("PlotWidth",1000).toInt());
ui->bppSpinBox->setValue(n);
m_nsmo=m_settings->value("SmoothYellow",1).toInt();
ui->smoSpinBox->setValue(m_nsmo);
m_Percent2DScreen=m_settings->value("Percent2D",30).toInt();
ui->sbPercent2dPlot->setValue(m_Percent2DScreen);
m_waterfallAvg = m_settings->value("WaterfallAvg",5).toInt();
ui->waterfallAvgSpinBox->setValue(m_waterfallAvg);
ui->widePlot->setWaterfallAvg(m_waterfallAvg);
ui->widePlot->setCurrent(m_settings->value("Current",false).toBool());
ui->widePlot->setCumulative(m_settings->value("Cumulative",true).toBool());
ui->widePlot->setLinearAvg(m_settings->value("LinearAvg",false).toBool());
ui->widePlot->setReference(m_settings->value("Reference",false).toBool());
if(ui->widePlot->current()) ui->spec2dComboBox->setCurrentIndex(0);
if(ui->widePlot->cumulative()) ui->spec2dComboBox->setCurrentIndex(1);
if(ui->widePlot->linearAvg()) ui->spec2dComboBox->setCurrentIndex(2);
if(ui->widePlot->Reference()) ui->spec2dComboBox->setCurrentIndex(3);
int nbpp=m_settings->value("BinsPerPixel",2).toInt();
ui->widePlot->setBinsPerPixel(nbpp);
ui->widePlot->setStartFreq(m_settings->value("StartFreq",0).toInt());
ui->fStartSpinBox->setValue(ui->widePlot->startFreq());
m_waterfallPalette=m_settings->value("WaterfallPalette","Default").toString();
m_userPalette = WFPalette {m_settings->value("UserPalette").value<WFPalette::Colours> ()};
int m_fMin = m_settings->value ("Fmin", 2500).toInt ();
ui->fSplitSpinBox->setValue (m_fMin);
setRxRange ();
ui->controls_widget->setVisible(!m_settings->value("HideControls", false).toBool ());
}
saveSettings (); // update config with defaults
int index=0;
for (QString const& file:
m_palettes_path.entryList(QDir::NoDotAndDotDot |
QDir::System | QDir::Hidden |
QDir::AllDirs | QDir::Files,
QDir::DirsFirst)) {
QString t=file.mid(0,file.length()-4);
ui->paletteComboBox->addItem(t);
if(t==m_waterfallPalette) ui->paletteComboBox->setCurrentIndex(index);
index++;
}
ui->paletteComboBox->addItem (user_defined);
if (user_defined == m_waterfallPalette) ui->paletteComboBox->setCurrentIndex(index);
readPalette ();
}
WideGraph::~WideGraph ()
{
}
void WideGraph::closeEvent (QCloseEvent * e)
{
saveSettings ();
QDialog::closeEvent (e);
}
void WideGraph::saveSettings() //saveSettings
{
SettingsGroup g {m_settings, "WideGraph"};
m_settings->setValue ("geometry", saveGeometry ());
m_settings->setValue ("PlotZero", ui->widePlot->plotZero());
m_settings->setValue ("PlotGain", ui->widePlot->plotGain());
m_settings->setValue ("Plot2dGain", ui->widePlot->plot2dGain());
m_settings->setValue ("Plot2dZero", ui->widePlot->plot2dZero());
m_settings->setValue ("PlotWidth", ui->widePlot->plotWidth ());
m_settings->setValue ("BinsPerPixel", ui->bppSpinBox->value ());
m_settings->setValue ("SmoothYellow", ui->smoSpinBox->value ());
m_settings->setValue ("Percent2D",m_Percent2DScreen);
m_settings->setValue ("WaterfallAvg", ui->waterfallAvgSpinBox->value ());
m_settings->setValue ("Current", ui->widePlot->current());
m_settings->setValue ("Cumulative", ui->widePlot->cumulative());
m_settings->setValue ("LinearAvg", ui->widePlot->linearAvg());
m_settings->setValue ("Reference", ui->widePlot->Reference());
m_settings->setValue ("BinsPerPixel", ui->widePlot->binsPerPixel ());
m_settings->setValue ("StartFreq", ui->widePlot->startFreq ());
m_settings->setValue ("WaterfallPalette", m_waterfallPalette);
m_settings->setValue ("UserPalette", QVariant::fromValue (m_userPalette.colours ()));
m_settings->setValue("Flatten",m_bFlatten);
m_settings->setValue("UseRef",m_bRef);
m_settings->setValue ("HideControls", ui->controls_widget->isHidden ());
}
void WideGraph::drawRed(int ia, int ib)
{
ui->widePlot->drawRed(ia,ib,swide);
}
void WideGraph::dataSink2(float s[], float df3, int ihsym, int ndiskdata) //dataSink2
{
static float splot[NSMAX];
int nbpp = ui->widePlot->binsPerPixel();
//Average spectra over specified number, m_waterfallAvg
if (m_n==0) {
for (int i=0; i<NSMAX; i++)
splot[i]=s[i];
} else {
for (int i=0; i<NSMAX; i++)
splot[i] += s[i];
}
m_n++;
if (m_n>=m_waterfallAvg) {
for (int i=0; i<NSMAX; i++)
splot[i] /= m_n; //Normalize the average
m_n=0;
int i=int(ui->widePlot->startFreq()/df3 + 0.5);
int jz=5000.0/(nbpp*df3);
if(jz>MAX_SCREENSIZE) jz=MAX_SCREENSIZE;
for (int j=0; j<jz; j++) {
float ss=0;
for (int k=0; k<nbpp; k++) {
if(splot[i]>ss) ss=splot[i];
i++;
}
swide[j]=nbpp*ss;
}
// Time according to this computer
qint64 ms = QDateTime::currentMSecsSinceEpoch() % 86400000;
int ntr = (ms/1000) % m_TRperiod;
if((ndiskdata && ihsym <= m_waterfallAvg) || (!ndiskdata && ntr<m_ntr0)) {
float flagValue=1.0e30;
if(m_bHaveTransmitted) flagValue=2.0e30;
for (int i=0; i<2048; i++) {
swide[i] = flagValue;
}
m_bHaveTransmitted=false;
}
m_ntr0=ntr;
ui->widePlot->draw(swide,true,false);
}
}
void WideGraph::on_bppSpinBox_valueChanged(int n) //bpp
{
ui->widePlot->setBinsPerPixel(n);
}
void WideGraph::on_waterfallAvgSpinBox_valueChanged(int n) //Navg
{
m_waterfallAvg = n;
ui->widePlot->setWaterfallAvg(n);
}
void WideGraph::keyPressEvent(QKeyEvent *e) //F11, F12
{
switch(e->key())
{
int n;
case Qt::Key_F11:
n=11;
if(e->modifiers() & Qt::ControlModifier) n+=100;
emit f11f12(n);
break;
case Qt::Key_F12:
n=12;
if(e->modifiers() & Qt::ControlModifier) n+=100;
emit f11f12(n);
break;
case Qt::Key_M:
if(e->modifiers() & Qt::ControlModifier) {
ui->controls_widget->setVisible(!ui->controls_widget->isVisible());
}
break;
default:
QDialog::keyPressEvent (e);
}
}
void WideGraph::setRxFreq(int n) //setRxFreq
{
ui->widePlot->setRxFreq(n);
ui->widePlot->draw(swide,false,false);
if(m_lockTxFreq) setTxFreq(n);
}
int WideGraph::rxFreq() //rxFreq
{
return ui->widePlot->rxFreq();
}
int WideGraph::nStartFreq() //nStartFreq
{
return ui->widePlot->startFreq();
}
void WideGraph::wideFreezeDecode(int n) //wideFreezeDecode
{
emit freezeDecode2(n);
}
void WideGraph::setRxRange ()
{
ui->widePlot->setRxRange (Fmin ());
ui->widePlot->DrawOverlay();
ui->widePlot->update();
}
int WideGraph::Fmin() //Fmin
{
return "60m" == m_rxBand ? 0 : m_fMin;
}
int WideGraph::Fmax() //Fmax
{
return std::min(5000,ui->widePlot->Fmax());
}
int WideGraph::fSpan()
{
return ui->widePlot->fSpan ();
}
void WideGraph::setPeriod(int ntrperiod, int nsps) //SetPeriod
{
m_TRperiod=ntrperiod;
m_nsps=nsps;
ui->widePlot->setNsps(ntrperiod, nsps);
}
void WideGraph::setTxFreq(int n) //setTxFreq
{
emit setXIT2(n);
ui->widePlot->setTxFreq(n);
}
void WideGraph::setMode(QString mode) //setMode
{
m_mode=mode;
ui->fSplitSpinBox->setEnabled(m_mode=="JT9+JT65");
ui->widePlot->setMode(mode);
ui->widePlot->DrawOverlay();
ui->widePlot->update();
}
void WideGraph::setSubMode(int n) //setSubMode
{
m_nSubMode=n;
ui->widePlot->setSubMode(n);
ui->widePlot->DrawOverlay();
ui->widePlot->update();
}
void WideGraph::setModeTx(QString modeTx) //setModeTx
{
m_modeTx=modeTx;
ui->widePlot->setModeTx(modeTx);
ui->widePlot->DrawOverlay();
ui->widePlot->update();
}
//Current-Cumulative-Yellow
void WideGraph::on_spec2dComboBox_currentIndexChanged(const QString &arg1)
{
ui->widePlot->setCurrent(false);
ui->widePlot->setCumulative(false);
ui->widePlot->setLinearAvg(false);
ui->widePlot->setReference(false);
ui->smoSpinBox->setEnabled(false);
if(arg1=="Current") ui->widePlot->setCurrent(true);
if(arg1=="Cumulative") ui->widePlot->setCumulative(true);
if(arg1=="Linear Avg") {
ui->widePlot->setLinearAvg(true);
ui->smoSpinBox->setEnabled(true);
}
if(arg1=="Reference") {
ui->widePlot->setReference(true);
}
if(ui->widePlot->m_bScaleOK) ui->widePlot->draw(swide,false,false);
}
void WideGraph::on_fSplitSpinBox_valueChanged(int n) //fSplit
{
if (m_rxBand != "60m") m_fMin=n;
setRxRange ();
}
void WideGraph::setLockTxFreq(bool b) //LockTxFreq
{
m_lockTxFreq=b;
ui->widePlot->setLockTxFreq(b);
}
void WideGraph::setFreq2(int rxFreq, int txFreq) //setFreq2
{
emit setFreq3(rxFreq,txFreq);
}
void WideGraph::setDialFreq(double d) //setDialFreq
{
ui->widePlot->setDialFreq(d);
}
void WideGraph::setRxBand (QString const& band)
{
m_rxBand = band;
if ("60m" == m_rxBand)
{
ui->fSplitSpinBox->setEnabled (false);
ui->fSplitSpinBox->setValue (0);
}
else
{
ui->fSplitSpinBox->setValue (m_fMin);
ui->fSplitSpinBox->setEnabled (true);
}
ui->widePlot->setRxBand(band);
setRxRange ();
}
void WideGraph::on_fStartSpinBox_valueChanged(int n) //fStart
{
ui->widePlot->setStartFreq(n);
}
void WideGraph::readPalette () //readPalette
{
try
{
if (user_defined == m_waterfallPalette)
{
ui->widePlot->setColours (WFPalette {m_userPalette}.interpolate ());
}
else
{
ui->widePlot->setColours (WFPalette {m_palettes_path.absoluteFilePath (m_waterfallPalette + ".pal")}.interpolate());
}
}
catch (std::exception const& e)
{
MessageBox::warning_message (this, tr ("Read Palette"), e.what ());
}
}
void WideGraph::on_paletteComboBox_activated (QString const& palette) //palette selector
{
m_waterfallPalette = palette;
readPalette();
}
void WideGraph::on_cbFlatten_toggled(bool b) //Flatten On/Off
{
m_bFlatten=b;
if(m_bRef and m_bFlatten) {
m_bRef=false;
ui->cbRef->setChecked(false);
}
ui->widePlot->setFlatten(m_bFlatten,m_bRef);
}
void WideGraph::on_cbRef_toggled(bool b)
{
m_bRef=b;
if(m_bRef and m_bFlatten) {
m_bFlatten=false;
ui->cbFlatten->setChecked(false);
}
ui->widePlot->setFlatten(m_bFlatten,m_bRef);
}
void WideGraph::on_adjust_palette_push_button_clicked (bool) //Adjust Palette
{
try
{
if (m_userPalette.design ())
{
m_waterfallPalette = user_defined;
ui->paletteComboBox->setCurrentText (m_waterfallPalette);
readPalette ();
}
}
catch (std::exception const& e)
{
MessageBox::warning_message (this, tr ("Read Palette"), e.what ());
}
}
bool WideGraph::flatten() //Flatten
{
return m_bFlatten;
}
bool WideGraph::useRef() //Flatten
{
return m_bRef;
}
void WideGraph::on_gainSlider_valueChanged(int value) //Gain
{
ui->widePlot->setPlotGain(value);
}
void WideGraph::on_zeroSlider_valueChanged(int value) //Zero
{
ui->widePlot->setPlotZero(value);
}
void WideGraph::on_gain2dSlider_valueChanged(int value) //Gain2
{
ui->widePlot->setPlot2dGain(value);
if(ui->widePlot->m_bScaleOK) {
ui->widePlot->draw(swide,false,false);
if(m_mode=="QRA64") ui->widePlot->draw(swide,false,true);
}
}
void WideGraph::on_zero2dSlider_valueChanged(int value) //Zero2
{
ui->widePlot->setPlot2dZero(value);
if(ui->widePlot->m_bScaleOK) {
ui->widePlot->draw(swide,false,false);
if(m_mode=="QRA64") ui->widePlot->draw(swide,false,true);
}
}
void WideGraph::setTol(int n) //setTol
{
ui->widePlot->setTol(n);
ui->widePlot->DrawOverlay();
ui->widePlot->update();
}
void WideGraph::on_smoSpinBox_valueChanged(int n)
{
m_nsmo=n;
}
int WideGraph::smoothYellow()
{
return m_nsmo;
}
void WideGraph::setWSPRtransmitted()
{
m_bHaveTransmitted=true;
}
void WideGraph::setVHF(bool bVHF)
{
ui->widePlot->setVHF(bVHF);
}
void WideGraph::on_sbPercent2dPlot_valueChanged(int n)
{
m_Percent2DScreen=n;
ui->widePlot->SetPercent2DScreen(n);
}
void WideGraph::setRedFile(QString fRed)
{
ui->widePlot->setRedFile(fRed);
}
@@ -0,0 +1,34 @@
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
// unit/quantity manipulation and conversion
//
// Copyright (C) 2003-2008 Matthias Christian Schabel
// Copyright (C) 2008 Steven Watanabe
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_UNITS_SI_MAGNETIC_FLUX_HPP
#define BOOST_UNITS_SI_MAGNETIC_FLUX_HPP
#include <boost/units/systems/si/base.hpp>
#include <boost/units/physical_dimensions/magnetic_flux.hpp>
namespace boost {
namespace units {
namespace si {
typedef unit<magnetic_flux_dimension,si::system> magnetic_flux;
BOOST_UNITS_STATIC_CONSTANT(weber,magnetic_flux);
BOOST_UNITS_STATIC_CONSTANT(webers,magnetic_flux);
} // namespace si
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_SI_MAGNETIC_FLUX_HPP
@@ -0,0 +1,13 @@
/*=============================================================================
Copyright (c) 2001-2007 Joel de Guzman
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(FUSION_INCLUDE_IS_VIEW)
#define FUSION_INCLUDE_IS_VIEW
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/support/is_view.hpp>
#endif
Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

@@ -0,0 +1,17 @@
# /* **************************************************************************
# * *
# * (C) Copyright Paul Mensonides 2002.
# * Distributed under the Boost Software License, Version 1.0. (See
# * accompanying file LICENSE_1_0.txt or copy at
# * http://www.boost.org/LICENSE_1_0.txt)
# * *
# ************************************************************************** */
#
# /* See http://www.boost.org for most recent version. */
#
# ifndef BOOST_PREPROCESSOR_DEC_HPP
# define BOOST_PREPROCESSOR_DEC_HPP
#
# include <boost/preprocessor/arithmetic/dec.hpp>
#
# endif
@@ -0,0 +1,45 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 1999-2003 Jeremiah Willcock
Copyright (c) 2001-2011 Joel de Guzman
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(BOOST_OUT_05042005_0120)
#define BOOST_OUT_05042005_0120
#include <boost/fusion/support/config.hpp>
#include <ostream>
#include <boost/fusion/sequence/io/detail/out.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/mpl/or.hpp>
namespace boost { namespace fusion
{
template <typename Sequence>
inline std::ostream&
out(std::ostream& os, Sequence& seq)
{
detail::print_sequence(os, seq);
return os;
}
namespace operators
{
template <typename Sequence>
inline typename
boost::enable_if<
fusion::traits::is_sequence<Sequence>
, std::ostream&
>::type
operator<<(std::ostream& os, Sequence const& seq)
{
return fusion::out(os, seq);
}
}
using operators::operator<<;
}}
#endif
@@ -0,0 +1,377 @@
/*
*
* Copyright (c) 2004
* John Maddock
*
* 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)
*
*/
/*
* LOCATION: see http://www.boost.org for most recent version.
* FILE regex_traits_defaults.hpp
* VERSION see <boost/version.hpp>
* DESCRIPTION: Declares API's for access to regex_traits default properties.
*/
#ifndef BOOST_REGEX_TRAITS_DEFAULTS_HPP_INCLUDED
#define BOOST_REGEX_TRAITS_DEFAULTS_HPP_INCLUDED
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable: 4103)
#endif
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_PREFIX
#endif
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
#include <boost/regex/config.hpp>
#ifndef BOOST_REGEX_SYNTAX_TYPE_HPP
#include <boost/regex/v4/syntax_type.hpp>
#endif
#ifndef BOOST_REGEX_ERROR_TYPE_HPP
#include <boost/regex/v4/error_type.hpp>
#endif
#include <boost/type_traits/make_unsigned.hpp>
#ifdef BOOST_NO_STDC_NAMESPACE
namespace std{
using ::strlen;
}
#endif
namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
//
// helpers to suppress warnings:
//
template <class charT>
inline bool is_extended(charT c)
{
typedef typename make_unsigned<charT>::type unsigned_type;
return (sizeof(charT) > 1) && (static_cast<unsigned_type>(c) >= 256u);
}
inline bool is_extended(char)
{ return false; }
BOOST_REGEX_DECL const char* BOOST_REGEX_CALL get_default_syntax(regex_constants::syntax_type n);
BOOST_REGEX_DECL const char* BOOST_REGEX_CALL get_default_error_string(regex_constants::error_type n);
BOOST_REGEX_DECL regex_constants::syntax_type BOOST_REGEX_CALL get_default_syntax_type(char c);
BOOST_REGEX_DECL regex_constants::escape_syntax_type BOOST_REGEX_CALL get_default_escape_syntax_type(char c);
// is charT c a combining character?
BOOST_REGEX_DECL bool BOOST_REGEX_CALL is_combining_implementation(uint_least16_t s);
template <class charT>
inline bool is_combining(charT c)
{
return (c <= static_cast<charT>(0)) ? false : ((c >= static_cast<charT>((std::numeric_limits<uint_least16_t>::max)())) ? false : is_combining_implementation(static_cast<unsigned short>(c)));
}
template <>
inline bool is_combining<char>(char)
{
return false;
}
template <>
inline bool is_combining<signed char>(signed char)
{
return false;
}
template <>
inline bool is_combining<unsigned char>(unsigned char)
{
return false;
}
#if !defined(__hpux) && !defined(__WINSCW__) // can't use WCHAR_MAX/MIN in pp-directives
#ifdef _MSC_VER
template<>
inline bool is_combining<wchar_t>(wchar_t c)
{
return is_combining_implementation(static_cast<unsigned short>(c));
}
#elif !defined(__DECCXX) && !defined(__osf__) && !defined(__OSF__) && defined(WCHAR_MIN) && (WCHAR_MIN == 0) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
#if defined(WCHAR_MAX) && (WCHAR_MAX <= USHRT_MAX)
template<>
inline bool is_combining<wchar_t>(wchar_t c)
{
return is_combining_implementation(static_cast<unsigned short>(c));
}
#else
template<>
inline bool is_combining<wchar_t>(wchar_t c)
{
return (c >= (std::numeric_limits<uint_least16_t>::max)()) ? false : is_combining_implementation(static_cast<unsigned short>(c));
}
#endif
#endif
#endif
//
// is a charT c a line separator?
//
template <class charT>
inline bool is_separator(charT c)
{
return BOOST_REGEX_MAKE_BOOL(
(c == static_cast<charT>('\n'))
|| (c == static_cast<charT>('\r'))
|| (c == static_cast<charT>('\f'))
|| (static_cast<boost::uint16_t>(c) == 0x2028u)
|| (static_cast<boost::uint16_t>(c) == 0x2029u)
|| (static_cast<boost::uint16_t>(c) == 0x85u));
}
template <>
inline bool is_separator<char>(char c)
{
return BOOST_REGEX_MAKE_BOOL((c == '\n') || (c == '\r') || (c == '\f'));
}
//
// get a default collating element:
//
BOOST_REGEX_DECL std::string BOOST_REGEX_CALL lookup_default_collate_name(const std::string& name);
//
// get the state_id of a character clasification, the individual
// traits classes then transform that state_id into a bitmask:
//
template <class charT>
struct character_pointer_range
{
const charT* p1;
const charT* p2;
bool operator < (const character_pointer_range& r)const
{
return std::lexicographical_compare(p1, p2, r.p1, r.p2);
}
bool operator == (const character_pointer_range& r)const
{
// Not only do we check that the ranges are of equal size before
// calling std::equal, but there is no other algorithm available:
// not even a non-standard MS one. So forward to unchecked_equal
// in the MS case.
return ((p2 - p1) == (r.p2 - r.p1)) && BOOST_REGEX_DETAIL_NS::equal(p1, p2, r.p1);
}
};
template <class charT>
int get_default_class_id(const charT* p1, const charT* p2)
{
static const charT data[73] = {
'a', 'l', 'n', 'u', 'm',
'a', 'l', 'p', 'h', 'a',
'b', 'l', 'a', 'n', 'k',
'c', 'n', 't', 'r', 'l',
'd', 'i', 'g', 'i', 't',
'g', 'r', 'a', 'p', 'h',
'l', 'o', 'w', 'e', 'r',
'p', 'r', 'i', 'n', 't',
'p', 'u', 'n', 'c', 't',
's', 'p', 'a', 'c', 'e',
'u', 'n', 'i', 'c', 'o', 'd', 'e',
'u', 'p', 'p', 'e', 'r',
'v',
'w', 'o', 'r', 'd',
'x', 'd', 'i', 'g', 'i', 't',
};
static const character_pointer_range<charT> ranges[21] =
{
{data+0, data+5,}, // alnum
{data+5, data+10,}, // alpha
{data+10, data+15,}, // blank
{data+15, data+20,}, // cntrl
{data+20, data+21,}, // d
{data+20, data+25,}, // digit
{data+25, data+30,}, // graph
{data+29, data+30,}, // h
{data+30, data+31,}, // l
{data+30, data+35,}, // lower
{data+35, data+40,}, // print
{data+40, data+45,}, // punct
{data+45, data+46,}, // s
{data+45, data+50,}, // space
{data+57, data+58,}, // u
{data+50, data+57,}, // unicode
{data+57, data+62,}, // upper
{data+62, data+63,}, // v
{data+63, data+64,}, // w
{data+63, data+67,}, // word
{data+67, data+73,}, // xdigit
};
static const character_pointer_range<charT>* ranges_begin = ranges;
static const character_pointer_range<charT>* ranges_end = ranges + (sizeof(ranges)/sizeof(ranges[0]));
character_pointer_range<charT> t = { p1, p2, };
const character_pointer_range<charT>* p = std::lower_bound(ranges_begin, ranges_end, t);
if((p != ranges_end) && (t == *p))
return static_cast<int>(p - ranges);
return -1;
}
//
// helper functions:
//
template <class charT>
std::ptrdiff_t global_length(const charT* p)
{
std::ptrdiff_t n = 0;
while(*p)
{
++p;
++n;
}
return n;
}
template<>
inline std::ptrdiff_t global_length<char>(const char* p)
{
return (std::strlen)(p);
}
#ifndef BOOST_NO_WREGEX
template<>
inline std::ptrdiff_t global_length<wchar_t>(const wchar_t* p)
{
return (std::wcslen)(p);
}
#endif
template <class charT>
inline charT BOOST_REGEX_CALL global_lower(charT c)
{
return c;
}
template <class charT>
inline charT BOOST_REGEX_CALL global_upper(charT c)
{
return c;
}
BOOST_REGEX_DECL char BOOST_REGEX_CALL do_global_lower(char c);
BOOST_REGEX_DECL char BOOST_REGEX_CALL do_global_upper(char c);
#ifndef BOOST_NO_WREGEX
BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL do_global_lower(wchar_t c);
BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL do_global_upper(wchar_t c);
#endif
#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL do_global_lower(unsigned short c);
BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL do_global_upper(unsigned short c);
#endif
//
// This sucks: declare template specialisations of global_lower/global_upper
// that just forward to the non-template implementation functions. We do
// this because there is one compiler (Compaq Tru64 C++) that doesn't seem
// to differentiate between templates and non-template overloads....
// what's more, the primary template, plus all overloads have to be
// defined in the same translation unit (if one is inline they all must be)
// otherwise the "local template instantiation" compiler option can pick
// the wrong instantiation when linking:
//
template<> inline char BOOST_REGEX_CALL global_lower<char>(char c){ return do_global_lower(c); }
template<> inline char BOOST_REGEX_CALL global_upper<char>(char c){ return do_global_upper(c); }
#ifndef BOOST_NO_WREGEX
template<> inline wchar_t BOOST_REGEX_CALL global_lower<wchar_t>(wchar_t c){ return do_global_lower(c); }
template<> inline wchar_t BOOST_REGEX_CALL global_upper<wchar_t>(wchar_t c){ return do_global_upper(c); }
#endif
#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
template<> inline unsigned short BOOST_REGEX_CALL global_lower<unsigned short>(unsigned short c){ return do_global_lower(c); }
template<> inline unsigned short BOOST_REGEX_CALL global_upper<unsigned short>(unsigned short c){ return do_global_upper(c); }
#endif
template <class charT>
int global_value(charT c)
{
static const charT zero = '0';
static const charT nine = '9';
static const charT a = 'a';
static const charT f = 'f';
static const charT A = 'A';
static const charT F = 'F';
if(c > f) return -1;
if(c >= a) return 10 + (c - a);
if(c > F) return -1;
if(c >= A) return 10 + (c - A);
if(c > nine) return -1;
if(c >= zero) return c - zero;
return -1;
}
template <class charT, class traits>
boost::intmax_t global_toi(const charT*& p1, const charT* p2, int radix, const traits& t)
{
(void)t; // warning suppression
boost::intmax_t next_value = t.value(*p1, radix);
if((p1 == p2) || (next_value < 0) || (next_value >= radix))
return -1;
boost::intmax_t result = 0;
while(p1 != p2)
{
next_value = t.value(*p1, radix);
if((next_value < 0) || (next_value >= radix))
break;
result *= radix;
result += next_value;
++p1;
}
return result;
}
template <class charT>
inline const charT* get_escape_R_string()
{
#ifdef BOOST_MSVC
# pragma warning(push)
# pragma warning(disable:4309 4245)
#endif
static const charT e1[] = { '(', '?', '>', '\x0D', '\x0A', '?',
'|', '[', '\x0A', '\x0B', '\x0C', static_cast<unsigned char>('\x85'), '\\', 'x', '{', '2', '0', '2', '8', '}',
'\\', 'x', '{', '2', '0', '2', '9', '}', ']', ')', '\0' };
static const charT e2[] = { '(', '?', '>', '\x0D', '\x0A', '?',
'|', '[', '\x0A', '\x0B', '\x0C', static_cast<unsigned char>('\x85'), ']', ')', '\0' };
charT c = static_cast<charT>(0x2029u);
bool b = (static_cast<unsigned>(c) == 0x2029u);
return (b ? e1 : e2);
#ifdef BOOST_MSVC
# pragma warning(pop)
#endif
}
template <>
inline const char* get_escape_R_string<char>()
{
#ifdef BOOST_MSVC
# pragma warning(push)
# pragma warning(disable:4309)
#endif
static const char e2[] = { '(', '?', '>', '\x0D', '\x0A', '?',
'|', '[', '\x0A', '\x0B', '\x0C', '\x85', ']', ')', '\0' };
return e2;
#ifdef BOOST_MSVC
# pragma warning(pop)
#endif
}
} // BOOST_REGEX_DETAIL_NS
} // boost
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable: 4103)
#endif
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_SUFFIX
#endif
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
#endif
@@ -0,0 +1,12 @@
// Boost.Function library
// Copyright Douglas Gregor 2002-2003. 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
#define BOOST_FUNCTION_NUM_ARGS 0
#include <boost/function/detail/maybe_include.hpp>
#undef BOOST_FUNCTION_NUM_ARGS
@@ -0,0 +1,19 @@
/* BLOCKIO.H - Interface to block input/output routines. */
/* Copyright (c) 1995-2012 by Radford M. Neal.
*
* Permission is granted for anyone to copy, use, modify, and distribute
* these programs and accompanying documents for any purpose, provided
* this copyright notice is retained and prominently displayed, and note
* is made of any changes made to these programs. These programs and
* documents are distributed without any warranty, express or implied.
* As the programs were written for research purposes only, they have not
* been tested to the degree that would be advisable in any important
* application. All use of these programs is entirely at the user's own
* risk.
*/
extern int blockio_flush; /* Should blocks written be immediately flushed? */
int blockio_read (FILE *, char *, int);
void blockio_write (FILE *, char *, int);
@@ -0,0 +1,98 @@
// (C) Copyright 2008-10 Anthony Williams
// (C) Copyright 2011-2015 Vicente J. Botet Escriba
//
// 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_THREAD_FUTURES_FUTURE_ERROR_HPP
#define BOOST_THREAD_FUTURES_FUTURE_ERROR_HPP
#include <boost/thread/detail/config.hpp>
#include <boost/thread/futures/future_error_code.hpp>
#include <boost/system/error_code.hpp>
#include <stdexcept>
namespace boost
{
class BOOST_SYMBOL_VISIBLE future_error
: public std::logic_error
{
system::error_code ec_;
public:
future_error(system::error_code ec)
: logic_error(ec.message()),
ec_(ec)
{
}
const system::error_code& code() const BOOST_NOEXCEPT
{
return ec_;
}
};
class BOOST_SYMBOL_VISIBLE future_uninitialized:
public future_error
{
public:
future_uninitialized() :
future_error(system::make_error_code(future_errc::no_state))
{}
};
class BOOST_SYMBOL_VISIBLE broken_promise:
public future_error
{
public:
broken_promise():
future_error(system::make_error_code(future_errc::broken_promise))
{}
};
class BOOST_SYMBOL_VISIBLE future_already_retrieved:
public future_error
{
public:
future_already_retrieved():
future_error(system::make_error_code(future_errc::future_already_retrieved))
{}
};
class BOOST_SYMBOL_VISIBLE promise_already_satisfied:
public future_error
{
public:
promise_already_satisfied():
future_error(system::make_error_code(future_errc::promise_already_satisfied))
{}
};
class BOOST_SYMBOL_VISIBLE task_already_started:
public future_error
{
public:
task_already_started():
future_error(system::make_error_code(future_errc::promise_already_satisfied))
{}
};
class BOOST_SYMBOL_VISIBLE task_moved:
public future_error
{
public:
task_moved():
future_error(system::make_error_code(future_errc::no_state))
{}
};
class promise_moved:
public future_error
{
public:
promise_moved():
future_error(system::make_error_code(future_errc::no_state))
{}
};
}
#endif // header
@@ -0,0 +1,55 @@
// Status=review
Two arrangements of controls are provided for generating and selecting
Tx messages. Controls familiar to users of program _WSJT_
appear on *Tab 1*, providing six fields for message entry.
Pre-formatted messages for the standard minimal QSO are generated when
you click *Generate Std Msgs* or double-click on an appropriate line
in one of the decoded text windows.
//.Traditional Message Menu
image::traditional-msg-box.png[align="center",alt="Traditional Message Menu"]
* Select the next message to be transmitted (at the start of your next
Tx sequence) by clicking on the circle under *Next*.
* To change to a specified Tx message immediately during a
transmission, click on a rectangular button under the *Now* label.
Changing a Tx message in mid-stream will slightly reduce the chance of
a correct decode, but it is usually OK if done in the first 10-15 s of
a transmission.
* All six Tx message fields are editable. You can modify an
automatically generated message or enter a desired message, keeping in
mind the limits on message content. See <<PROTOCOLS,Protocol
Specifications>> for details.
* Click on the pull-down arrow for message #5 to select one of the
pre-stored messages entered on the *Settings | Tx Macros* tab.
Pressing *Enter* on a modified message #5 automatically adds that
message to the stored macros.
The second arrangement of controls for generating and selecting
Tx messages appears on *Tab 2* of the Message Control Panel:
//.New Message Menu
image::new-msg-box.png[align="center",alt="New Message Menu"]
With this setup you normally follow a top-to-bottom sequence of
transmissions from the left column if you are calling CQ, or the right
column if answering a CQ.
* Clicking a button puts the appropriate message in the *Gen Msg* box.
If you are already transmitting, the Tx message is changed
immediately.
* You can enter and transmit anything (up to 13 characters, including
spaces) in the *Free Msg* box.
* Click on the pull-down arrow in the *Free Msg* box to select a
pre-stored macro. Pressing *Enter* on a modified message here
automatically adds that message to the table of stored macros.
TIP: During a transmission the actual message being sent always
appears in the first box of the status bar (bottom left of the main
screen).
@@ -0,0 +1,354 @@
/*=============================================================================
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)
==============================================================================*/
// No include guard. This file is meant to be included many times
#if !defined(FUSION_MACRO_05042005)
#define FUSION_MACRO_05042005
#define FUSION_VECTOR_CTOR_DEFAULT_INIT(z, n, _) \
m##n()
#define FUSION_VECTOR_CTOR_INIT(z, n, _) \
m##n(_##n)
#define FUSION_VECTOR_MEMBER_CTOR_INIT(z, n, _) \
m##n(other.m##n)
#define FUSION_VECTOR_CTOR_FORWARD(z, n, _) \
m##n(BOOST_FUSION_FWD_ELEM(T##n, other.m##n))
#define FUSION_VECTOR_CTOR_ARG_FWD(z, n, _) \
m##n(BOOST_FUSION_FWD_ELEM(U##n, _##n))
#define FUSION_VECTOR_MEMBER_DECL(z, n, _) \
T##n m##n;
#define FUSION_VECTOR_MEMBER_FORWARD(z, n, _) \
BOOST_FUSION_FWD_ELEM(U##n, _##n)
#define FUSION_VECTOR_MEMBER_ASSIGN(z, n, _) \
this->BOOST_PP_CAT(m, n) = vec.BOOST_PP_CAT(m, n);
#define FUSION_VECTOR_MEMBER_DEREF_ASSIGN(z, n, _) \
this->BOOST_PP_CAT(m, n) = *BOOST_PP_CAT(i, n);
#define FUSION_VECTOR_MEMBER_MOVE(z, n, _) \
this->BOOST_PP_CAT(m, n) = std::forward< \
BOOST_PP_CAT(T, n)>(vec.BOOST_PP_CAT(m, n));
#define FUSION_VECTOR_MEMBER_AT_IMPL(z, n, _) \
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
typename add_reference<T##n>::type \
at_impl(mpl::int_<n>) { return this->m##n; } \
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
typename add_reference<typename add_const<T##n>::type>::type \
at_impl(mpl::int_<n>) const { return this->m##n; }
#define FUSION_VECTOR_MEMBER_ITER_DECL_VAR(z, n, _) \
typedef typename result_of::next< \
BOOST_PP_CAT(I, BOOST_PP_DEC(n))>::type BOOST_PP_CAT(I, n); \
BOOST_PP_CAT(I, n) BOOST_PP_CAT(i, n) \
= fusion::next(BOOST_PP_CAT(i, BOOST_PP_DEC(n)));
#endif
#define N BOOST_PP_ITERATION()
template <BOOST_PP_ENUM_PARAMS(N, typename T)>
struct BOOST_PP_CAT(vector_data, N)
{
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector_data, N)()
: BOOST_PP_ENUM(N, FUSION_VECTOR_CTOR_DEFAULT_INIT, _) {}
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#endif
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \
(defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
template <BOOST_PP_ENUM_PARAMS(N, typename U)>
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
FUSION_HASH endif
#else
#if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
#endif
#endif
BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector_data, N)(BOOST_PP_ENUM_BINARY_PARAMS(N, U, && arg)
, typename boost::enable_if<is_convertible<U0, T0> >::type* /*dummy*/ = 0
)
: BOOST_PP_ENUM(N, FUSION_VECTOR_CTOR_ARG_FWD, arg) {}
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector_data, N)(
BOOST_PP_CAT(vector_data, N)&& other)
: BOOST_PP_ENUM(N, FUSION_VECTOR_CTOR_FORWARD, arg) {}
#endif
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH endif
#endif
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH if !defined(BOOST_CLANG)
BOOST_CONSTEXPR
FUSION_HASH endif
#else
#if !defined(BOOST_CLANG)
BOOST_CONSTEXPR
#endif
#endif
BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector_data, N)(
BOOST_PP_ENUM_BINARY_PARAMS(
N, typename detail::call_param<T, >::type arg))
: BOOST_PP_ENUM(N, FUSION_VECTOR_CTOR_INIT, arg) {}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector_data, N)(
BOOST_PP_CAT(vector_data, N) const& other)
: BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_CTOR_INIT, _) {}
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector_data, N)&
operator=(BOOST_PP_CAT(vector_data, N) const& vec)
{
BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_ASSIGN, _)
return *this;
}
template <typename Sequence>
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
FUSION_HASH endif
#else
#if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
#endif
#endif
BOOST_FUSION_GPU_ENABLED
static BOOST_PP_CAT(vector_data, N)
init_from_sequence(Sequence const& seq)
{
typedef typename result_of::begin<Sequence const>::type I0;
I0 i0 = fusion::begin(seq);
BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_VECTOR_MEMBER_ITER_DECL_VAR, _)
return BOOST_PP_CAT(vector_data, N)(BOOST_PP_ENUM_PARAMS(N, *i));
}
template <typename Sequence>
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
FUSION_HASH endif
#else
#if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
#endif
#endif
BOOST_FUSION_GPU_ENABLED
static BOOST_PP_CAT(vector_data, N)
init_from_sequence(Sequence& seq)
{
typedef typename result_of::begin<Sequence>::type I0;
I0 i0 = fusion::begin(seq);
BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_VECTOR_MEMBER_ITER_DECL_VAR, _)
return BOOST_PP_CAT(vector_data, N)(BOOST_PP_ENUM_PARAMS(N, *i));
}
BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_DECL, _)
};
template <BOOST_PP_ENUM_PARAMS(N, typename T)>
struct BOOST_PP_CAT(vector, N)
: BOOST_PP_CAT(vector_data, N)<BOOST_PP_ENUM_PARAMS(N, T)>
, sequence_base<BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, T)> >
{
typedef BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, T)> this_type;
typedef BOOST_PP_CAT(vector_data, N)<BOOST_PP_ENUM_PARAMS(N, T)> base_type;
typedef mpl::BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, T)> types;
typedef vector_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef mpl::false_ is_view;
typedef random_access_traversal_tag category;
typedef mpl::int_<N> size;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector, N)() {}
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH if !defined(BOOST_CLANG)
BOOST_CONSTEXPR
FUSION_HASH endif
#else
#if !defined(BOOST_CLANG)
BOOST_CONSTEXPR
#endif
#endif
BOOST_FUSION_GPU_ENABLED
#if (N == 1)
explicit
#endif
BOOST_PP_CAT(vector, N)(
BOOST_PP_ENUM_BINARY_PARAMS(
N, typename detail::call_param<T, >::type arg))
: base_type(BOOST_PP_ENUM_PARAMS(N, arg)) {}
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#endif
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \
(defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
template <BOOST_PP_ENUM_PARAMS(N, typename U)>
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
FUSION_HASH endif
#else
#if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
#endif
#endif
BOOST_FUSION_GPU_ENABLED
#if (N == 1)
explicit
BOOST_PP_CAT(vector, N)(U0&& _0
, typename boost::enable_if<is_convertible<U0, T0> >::type* /*dummy*/ = 0
)
: base_type(BOOST_FUSION_FWD_ELEM(U0, _0)) {}
#else
BOOST_PP_CAT(vector, N)(BOOST_PP_ENUM_BINARY_PARAMS(N, U, && arg))
: base_type(BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_FORWARD, arg)) {}
#endif
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector, N)(BOOST_PP_CAT(vector, N)&& rhs)
: base_type(std::forward<base_type>(rhs)) {}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector, N)(BOOST_PP_CAT(vector, N) const& rhs)
: base_type(static_cast<base_type const&>(rhs)) {}
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector, N)&
operator=(BOOST_PP_CAT(vector, N) const& vec)
{
base_type::operator=(vec);
return *this;
}
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector, N)&
operator=(BOOST_PP_CAT(vector, N)&& vec)
{
BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_MOVE, _)
return *this;
}
#endif
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH endif
#endif
template <BOOST_PP_ENUM_PARAMS(N, typename U)>
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
FUSION_HASH endif
#else
#if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
#endif
#endif
BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector, N)(
BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, U)> const& vec)
: base_type(BOOST_PP_ENUM_PARAMS(N, vec.m)) {}
template <typename Sequence>
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
FUSION_HASH endif
#else
#if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
#endif
#endif
BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector, N)(
Sequence const& seq
, typename boost::enable_if<traits::is_sequence<Sequence> >::type* = 0
#if (N == 1)
, typename boost::disable_if<is_convertible<Sequence, T0> >::type* /*dummy*/ = 0
#endif
)
: base_type(base_type::init_from_sequence(seq)) {}
template <typename Sequence>
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
FUSION_HASH endif
#else
#if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
#endif
#endif
BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector, N)(
Sequence& seq
, typename boost::enable_if<traits::is_sequence<Sequence> >::type* = 0
#if (N == 1)
, typename boost::disable_if<is_convertible<Sequence, T0> >::type* /*dummy*/ = 0
#endif
)
: base_type(base_type::init_from_sequence(seq)) {}
template <BOOST_PP_ENUM_PARAMS(N, typename U)>
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector, N)&
operator=(BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, U)> const& vec)
{
BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_ASSIGN, _)
return *this;
}
template <typename Sequence>
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
typename boost::disable_if<is_convertible<Sequence, T0>, this_type&>::type
operator=(Sequence const& seq)
{
typedef typename result_of::begin<Sequence const>::type I0;
I0 i0 = fusion::begin(seq);
BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_VECTOR_MEMBER_ITER_DECL_VAR, _)
BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_DEREF_ASSIGN, _)
return *this;
}
BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_AT_IMPL, _)
template<typename I>
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
typename add_reference<typename mpl::at<types, I>::type>::type
at_impl(I)
{
return this->at_impl(mpl::int_<I::value>());
}
template<typename I>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
typename add_reference<typename add_const<typename mpl::at<types, I>::type>::type>::type
at_impl(I) const
{
return this->at_impl(mpl::int_<I::value>());
}
};
#undef N