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
@@ -0,0 +1,74 @@
// Copyright Vladimir Prus 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)
#ifndef BOOST_PROGRAM_OPTIONS_POSITIONAL_OPTIONS_VP_2004_03_02
#define BOOST_PROGRAM_OPTIONS_POSITIONAL_OPTIONS_VP_2004_03_02
#include <boost/program_options/config.hpp>
#include <vector>
#include <string>
#if defined(BOOST_MSVC)
# pragma warning (push)
# pragma warning (disable:4251) // class 'std::vector<_Ty>' needs to have dll-interface to be used by clients of class 'boost::program_options::positional_options_description'
#endif
namespace boost { namespace program_options {
/** Describes positional options.
The class allows to guess option names for positional options, which
are specified on the command line and are identified by the position.
The class uses the information provided by the user to associate a name
with every positional option, or tell that no name is known.
The primary assumption is that only the relative order of the
positional options themselves matters, and that any interleaving
ordinary options don't affect interpretation of positional options.
The user initializes the class by specifying that first N positional
options should be given the name X1, following M options should be given
the name X2 and so on.
*/
class BOOST_PROGRAM_OPTIONS_DECL positional_options_description {
public:
positional_options_description();
/** Species that up to 'max_count' next positional options
should be given the 'name'. The value of '-1' means 'unlimited'.
No calls to 'add' can be made after call with 'max_value' equal to
'-1'.
*/
positional_options_description&
add(const char* name, int max_count);
/** Returns the maximum number of positional options that can
be present. Can return (numeric_limits<unsigned>::max)() to
indicate unlimited number. */
unsigned max_total_count() const;
/** Returns the name that should be associated with positional
options at 'position'.
Precondition: position < max_total_count()
*/
const std::string& name_for_position(unsigned position) const;
private:
// List of names corresponding to the positions. If the number of
// positions is unlimited, then the last name is stored in
// m_trailing;
std::vector<std::string> m_names;
std::string m_trailing;
};
}}
#if defined(BOOST_MSVC)
# pragma warning (pop)
#endif
#endif
@@ -0,0 +1,67 @@
// Boost io_fwd.hpp header file --------------------------------------------//
// Copyright 2002 Daryle Walker. Use, modification, and distribution are subject
// to the Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or a copy at <http://www.boost.org/LICENSE_1_0.txt>.)
// See <http://www.boost.org/libs/io/> for the library's home page.
#ifndef BOOST_IO_FWD_HPP
#define BOOST_IO_FWD_HPP
#include <iosfwd> // for std::char_traits (declaration)
namespace boost
{
namespace io
{
// From <boost/io/ios_state.hpp> -------------------------------------------//
class ios_flags_saver;
class ios_precision_saver;
class ios_width_saver;
class ios_base_all_saver;
template < typename Ch, class Tr = ::std::char_traits<Ch> >
class basic_ios_iostate_saver;
template < typename Ch, class Tr = ::std::char_traits<Ch> >
class basic_ios_exception_saver;
template < typename Ch, class Tr = ::std::char_traits<Ch> >
class basic_ios_tie_saver;
template < typename Ch, class Tr = ::std::char_traits<Ch> >
class basic_ios_rdbuf_saver;
template < typename Ch, class Tr = ::std::char_traits<Ch> >
class basic_ios_fill_saver;
template < typename Ch, class Tr = ::std::char_traits<Ch> >
class basic_ios_locale_saver;
template < typename Ch, class Tr = ::std::char_traits<Ch> >
class basic_ios_all_saver;
typedef basic_ios_iostate_saver<char> ios_iostate_saver;
typedef basic_ios_iostate_saver<wchar_t> wios_iostate_saver;
typedef basic_ios_exception_saver<char> ios_exception_saver;
typedef basic_ios_exception_saver<wchar_t> wios_exception_saver;
typedef basic_ios_tie_saver<char> ios_tie_saver;
typedef basic_ios_tie_saver<wchar_t> wios_tie_saver;
typedef basic_ios_rdbuf_saver<char> ios_rdbuf_saver;
typedef basic_ios_rdbuf_saver<wchar_t> wios_rdbuf_saver;
typedef basic_ios_fill_saver<char> ios_fill_saver;
typedef basic_ios_fill_saver<wchar_t> wios_fill_saver;
typedef basic_ios_locale_saver<char> ios_locale_saver;
typedef basic_ios_locale_saver<wchar_t> wios_locale_saver;
typedef basic_ios_all_saver<char> ios_all_saver;
typedef basic_ios_all_saver<wchar_t> wios_all_saver;
class ios_iword_saver;
class ios_pword_saver;
class ios_all_word_saver;
} // namespace io
} // namespace boost
#endif // BOOST_IO_FWD_HPP
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,57 @@
#ifndef BOOST_MPL_BEGIN_END_HPP_INCLUDED
#define BOOST_MPL_BEGIN_END_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#include <boost/mpl/begin_end_fwd.hpp>
#include <boost/mpl/aux_/begin_end_impl.hpp>
#include <boost/mpl/sequence_tag.hpp>
#include <boost/mpl/aux_/na_spec.hpp>
#include <boost/mpl/aux_/lambda_support.hpp>
namespace boost { namespace mpl {
// agurt, 13/sep/02: switched from inheritance to typedef; MSVC is more
// happy this way (less ETI-related errors), and it doesn't affect
// anything else
template<
typename BOOST_MPL_AUX_NA_PARAM(Sequence)
>
struct begin
{
typedef typename sequence_tag<Sequence>::type tag_;
typedef typename begin_impl< tag_ >
::template apply< Sequence >::type type;
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,begin,(Sequence))
};
template<
typename BOOST_MPL_AUX_NA_PARAM(Sequence)
>
struct end
{
typedef typename sequence_tag<Sequence>::type tag_;
typedef typename end_impl< tag_ >
::template apply< Sequence >::type type;
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,end,(Sequence))
};
BOOST_MPL_AUX_NA_SPEC(1, begin)
BOOST_MPL_AUX_NA_SPEC(1, end)
}}
#endif // BOOST_MPL_BEGIN_END_HPP_INCLUDED
@@ -0,0 +1,585 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2012-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)
//
// See http://www.boost.org/libs/move for documentation.
//
//////////////////////////////////////////////////////////////////////////////
//! \file
#ifndef BOOST_MOVE_DETAIL_META_UTILS_HPP
#define BOOST_MOVE_DETAIL_META_UTILS_HPP
#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#include <boost/move/detail/config_begin.hpp>
#include <boost/move/detail/workaround.hpp> //forceinline
#include <boost/move/detail/meta_utils_core.hpp>
#include <cstddef> //for std::size_t
//Small meta-typetraits to support move
namespace boost {
//Forward declare boost::rv
template <class T> class rv;
namespace move_detail {
//////////////////////////////////////
// is_different
//////////////////////////////////////
template<class T, class U>
struct is_different
{
static const bool value = !is_same<T, U>::value;
};
//////////////////////////////////////
// apply
//////////////////////////////////////
template<class F, class Param>
struct apply
{
typedef typename F::template apply<Param>::type type;
};
//////////////////////////////////////
// bool_
//////////////////////////////////////
template< bool C_ >
struct bool_ : integral_constant<bool, C_>
{
operator bool() const { return C_; }
bool operator()() const { return C_; }
};
typedef bool_<true> true_;
typedef bool_<false> false_;
//////////////////////////////////////
// nat
//////////////////////////////////////
struct nat{};
//////////////////////////////////////
// yes_type/no_type
//////////////////////////////////////
typedef char yes_type;
struct no_type
{
char _[2];
};
//////////////////////////////////////
// natify
//////////////////////////////////////
template <class T> struct natify{};
//////////////////////////////////////
// remove_reference
//////////////////////////////////////
template<class T>
struct remove_reference
{
typedef T type;
};
template<class T>
struct remove_reference<T&>
{
typedef T type;
};
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template<class T>
struct remove_reference<T&&>
{
typedef T type;
};
#else
template<class T>
struct remove_reference< rv<T> >
{
typedef T type;
};
template<class T>
struct remove_reference< rv<T> &>
{
typedef T type;
};
template<class T>
struct remove_reference< const rv<T> &>
{
typedef T type;
};
#endif
//////////////////////////////////////
// remove_pointer
//////////////////////////////////////
template< class T > struct remove_pointer { typedef T type; };
template< class T > struct remove_pointer<T*> { typedef T type; };
template< class T > struct remove_pointer<T* const> { typedef T type; };
template< class T > struct remove_pointer<T* volatile> { typedef T type; };
template< class T > struct remove_pointer<T* const volatile> { typedef T type; };
//////////////////////////////////////
// add_pointer
//////////////////////////////////////
template< class T >
struct add_pointer
{
typedef typename remove_reference<T>::type* type;
};
//////////////////////////////////////
// add_const
//////////////////////////////////////
template<class T>
struct add_const
{
typedef const T type;
};
template<class T>
struct add_const<T&>
{
typedef const T& type;
};
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template<class T>
struct add_const<T&&>
{
typedef T&& type;
};
#endif
//////////////////////////////////////
// add_lvalue_reference
//////////////////////////////////////
template<class T>
struct add_lvalue_reference
{ typedef T& type; };
template<class T> struct add_lvalue_reference<T&> { typedef T& type; };
template<> struct add_lvalue_reference<void> { typedef void type; };
template<> struct add_lvalue_reference<const void> { typedef const void type; };
template<> struct add_lvalue_reference<volatile void> { typedef volatile void type; };
template<> struct add_lvalue_reference<const volatile void>{ typedef const volatile void type; };
template<class T>
struct add_const_lvalue_reference
{
typedef typename remove_reference<T>::type t_unreferenced;
typedef typename add_const<t_unreferenced>::type t_unreferenced_const;
typedef typename add_lvalue_reference
<t_unreferenced_const>::type type;
};
//////////////////////////////////////
// is_lvalue_reference
//////////////////////////////////////
template<class T>
struct is_lvalue_reference
{
static const bool value = false;
};
template<class T>
struct is_lvalue_reference<T&>
{
static const bool value = true;
};
//////////////////////////////////////
// identity
//////////////////////////////////////
template <class T>
struct identity
{
typedef T type;
typedef typename add_const_lvalue_reference<T>::type reference;
reference operator()(reference t)
{ return t; }
};
//////////////////////////////////////
// is_class_or_union
//////////////////////////////////////
template<class T>
struct is_class_or_union
{
struct twochar { char dummy[2]; };
template <class U>
static char is_class_or_union_tester(void(U::*)(void));
template <class U>
static twochar is_class_or_union_tester(...);
static const bool value = sizeof(is_class_or_union_tester<T>(0)) == sizeof(char);
};
//////////////////////////////////////
// addressof
//////////////////////////////////////
template<class T>
struct addr_impl_ref
{
T & v_;
BOOST_MOVE_FORCEINLINE addr_impl_ref( T & v ): v_( v ) {}
BOOST_MOVE_FORCEINLINE operator T& () const { return v_; }
private:
addr_impl_ref & operator=(const addr_impl_ref &);
};
template<class T>
struct addressof_impl
{
BOOST_MOVE_FORCEINLINE static T * f( T & v, long )
{
return reinterpret_cast<T*>(
&const_cast<char&>(reinterpret_cast<const volatile char &>(v)));
}
BOOST_MOVE_FORCEINLINE static T * f( T * v, int )
{ return v; }
};
template<class T>
BOOST_MOVE_FORCEINLINE T * addressof( T & v )
{
return ::boost::move_detail::addressof_impl<T>::f
( ::boost::move_detail::addr_impl_ref<T>( v ), 0 );
}
//////////////////////////////////////
// has_pointer_type
//////////////////////////////////////
template <class T>
struct has_pointer_type
{
struct two { char c[2]; };
template <class U> static two test(...);
template <class U> static char test(typename U::pointer* = 0);
static const bool value = sizeof(test<T>(0)) == 1;
};
//////////////////////////////////////
// is_convertible
//////////////////////////////////////
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
//use intrinsic since in MSVC
//overaligned types can't go through ellipsis
template <class T, class U>
struct is_convertible
{
static const bool value = __is_convertible_to(T, U);
};
#else
template <class T, class U>
class is_convertible
{
typedef typename add_lvalue_reference<T>::type t_reference;
typedef char true_t;
class false_t { char dummy[2]; };
static false_t dispatch(...);
static true_t dispatch(U);
static t_reference trigger();
public:
static const bool value = sizeof(dispatch(trigger())) == sizeof(true_t);
};
#endif
template <class T, class U, bool IsSame = is_same<T, U>::value>
struct is_same_or_convertible
: is_convertible<T, U>
{};
template <class T, class U>
struct is_same_or_convertible<T, U, true>
{
static const bool value = true;
};
template<
bool C
, typename F1
, typename F2
>
struct eval_if_c
: if_c<C,F1,F2>::type
{};
template<
typename C
, typename T1
, typename T2
>
struct eval_if
: if_<C,T1,T2>::type
{};
#if defined(BOOST_GCC) && (BOOST_GCC <= 40000)
#define BOOST_MOVE_HELPERS_RETURN_SFINAE_BROKEN
#endif
template<class T, class U, class R = void>
struct enable_if_convertible
: enable_if< is_convertible<T, U>, R>
{};
template<class T, class U, class R = void>
struct disable_if_convertible
: disable_if< is_convertible<T, U>, R>
{};
template<class T, class U, class R = void>
struct enable_if_same_or_convertible
: enable_if< is_same_or_convertible<T, U>, R>
{};
template<class T, class U, class R = void>
struct disable_if_same_or_convertible
: disable_if< is_same_or_convertible<T, U>, R>
{};
//////////////////////////////////////////////////////////////////////////////
//
// and_
//
//////////////////////////////////////////////////////////////////////////////
template<bool, class B = true_, class C = true_, class D = true_>
struct and_impl
: and_impl<B::value, C, D>
{};
template<>
struct and_impl<true, true_, true_, true_>
{
static const bool value = true;
};
template<class B, class C, class D>
struct and_impl<false, B, C, D>
{
static const bool value = false;
};
template<class A, class B, class C = true_, class D = true_>
struct and_
: and_impl<A::value, B, C, D>
{};
//////////////////////////////////////////////////////////////////////////////
//
// or_
//
//////////////////////////////////////////////////////////////////////////////
template<bool, class B = false_, class C = false_, class D = false_>
struct or_impl
: or_impl<B::value, C, D>
{};
template<>
struct or_impl<false, false_, false_, false_>
{
static const bool value = false;
};
template<class B, class C, class D>
struct or_impl<true, B, C, D>
{
static const bool value = true;
};
template<class A, class B, class C = false_, class D = false_>
struct or_
: or_impl<A::value, B, C, D>
{};
//////////////////////////////////////////////////////////////////////////////
//
// not_
//
//////////////////////////////////////////////////////////////////////////////
template<class T>
struct not_
{
static const bool value = !T::value;
};
//////////////////////////////////////////////////////////////////////////////
//
// enable_if_and / disable_if_and / enable_if_or / disable_if_or
//
//////////////////////////////////////////////////////////////////////////////
template<class R, class A, class B, class C = true_, class D = true_>
struct enable_if_and
: enable_if_c< and_<A, B, C, D>::value, R>
{};
template<class R, class A, class B, class C = true_, class D = true_>
struct disable_if_and
: disable_if_c< and_<A, B, C, D>::value, R>
{};
template<class R, class A, class B, class C = false_, class D = false_>
struct enable_if_or
: enable_if_c< or_<A, B, C, D>::value, R>
{};
template<class R, class A, class B, class C = false_, class D = false_>
struct disable_if_or
: disable_if_c< or_<A, B, C, D>::value, R>
{};
//////////////////////////////////////////////////////////////////////////////
//
// has_move_emulation_enabled_impl
//
//////////////////////////////////////////////////////////////////////////////
template<class T>
struct has_move_emulation_enabled_impl
: is_convertible< T, ::boost::rv<T>& >
{};
template<class T>
struct has_move_emulation_enabled_impl<T&>
{ static const bool value = false; };
template<class T>
struct has_move_emulation_enabled_impl< ::boost::rv<T> >
{ static const bool value = false; };
//////////////////////////////////////////////////////////////////////////////
//
// is_rv_impl
//
//////////////////////////////////////////////////////////////////////////////
template <class T>
struct is_rv_impl
{ static const bool value = false; };
template <class T>
struct is_rv_impl< rv<T> >
{ static const bool value = true; };
template <class T>
struct is_rv_impl< const rv<T> >
{ static const bool value = true; };
// Code from Jeffrey Lee Hellrung, many thanks
template< class T >
struct is_rvalue_reference
{ static const bool value = false; };
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template< class T >
struct is_rvalue_reference< T&& >
{ static const bool value = true; };
#else // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template< class T >
struct is_rvalue_reference< boost::rv<T>& >
{ static const bool value = true; };
template< class T >
struct is_rvalue_reference< const boost::rv<T>& >
{ static const bool value = true; };
#endif // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template< class T >
struct add_rvalue_reference
{ typedef T&& type; };
#else // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
namespace detail_add_rvalue_reference
{
template< class T
, bool emulation = has_move_emulation_enabled_impl<T>::value
, bool rv = is_rv_impl<T>::value >
struct add_rvalue_reference_impl { typedef T type; };
template< class T, bool emulation>
struct add_rvalue_reference_impl< T, emulation, true > { typedef T & type; };
template< class T, bool rv >
struct add_rvalue_reference_impl< T, true, rv > { typedef ::boost::rv<T>& type; };
} // namespace detail_add_rvalue_reference
template< class T >
struct add_rvalue_reference
: detail_add_rvalue_reference::add_rvalue_reference_impl<T>
{ };
template< class T >
struct add_rvalue_reference<T &>
{ typedef T & type; };
#endif // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template< class T > struct remove_rvalue_reference { typedef T type; };
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template< class T > struct remove_rvalue_reference< T&& > { typedef T type; };
#else // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template< class T > struct remove_rvalue_reference< rv<T> > { typedef T type; };
template< class T > struct remove_rvalue_reference< const rv<T> > { typedef T type; };
template< class T > struct remove_rvalue_reference< volatile rv<T> > { typedef T type; };
template< class T > struct remove_rvalue_reference< const volatile rv<T> > { typedef T type; };
template< class T > struct remove_rvalue_reference< rv<T>& > { typedef T type; };
template< class T > struct remove_rvalue_reference< const rv<T>& > { typedef T type; };
template< class T > struct remove_rvalue_reference< volatile rv<T>& > { typedef T type; };
template< class T > struct remove_rvalue_reference< const volatile rv<T>& >{ typedef T type; };
#endif // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
// Ideas from Boost.Move review, Jeffrey Lee Hellrung:
//
//- TypeTraits metafunctions is_lvalue_reference, add_lvalue_reference, and remove_lvalue_reference ?
// Perhaps add_reference and remove_reference can be modified so that they behave wrt emulated rvalue
// references the same as wrt real rvalue references, i.e., add_reference< rv<T>& > -> T& rather than
// rv<T>& (since T&& & -> T&).
//
//- Add'l TypeTraits has_[trivial_]move_{constructor,assign}...?
//
//- An as_lvalue(T& x) function, which amounts to an identity operation in C++0x, but strips emulated
// rvalue references in C++03. This may be necessary to prevent "accidental moves".
} //namespace move_detail {
} //namespace boost {
#include <boost/move/detail/config_end.hpp>
#endif //#ifndef BOOST_MOVE_DETAIL_META_UTILS_HPP
@@ -0,0 +1,92 @@
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// Preprocessed version of "boost/mpl/equal_to.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl {
template<
typename Tag1
, typename Tag2
>
struct equal_to_impl
: if_c<
( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1)
> BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2)
)
, aux::cast2nd_impl< equal_to_impl< Tag1,Tag1 >,Tag1, Tag2 >
, aux::cast1st_impl< equal_to_impl< Tag2,Tag2 >,Tag1, Tag2 >
>::type
{
};
/// for Digital Mars C++/compilers with no CTPS/TTP support
template<> struct equal_to_impl< na,na >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename Tag > struct equal_to_impl< na,Tag >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename Tag > struct equal_to_impl< Tag,na >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename T > struct equal_to_tag
{
typedef typename T::tag type;
};
template<
typename BOOST_MPL_AUX_NA_PARAM(N1)
, typename BOOST_MPL_AUX_NA_PARAM(N2)
>
struct equal_to
: equal_to_impl<
typename equal_to_tag<N1>::type
, typename equal_to_tag<N2>::type
>::template apply< N1,N2 >::type
{
};
BOOST_MPL_AUX_NA_SPEC2(2, 2, equal_to)
}}
namespace boost { namespace mpl {
template<>
struct equal_to_impl< integral_c_tag,integral_c_tag >
{
template< typename N1, typename N2 > struct apply
: bool_< ( BOOST_MPL_AUX_VALUE_WKND(N1)::value == BOOST_MPL_AUX_VALUE_WKND(N2)::value ) >
{
};
};
}}
@@ -0,0 +1,93 @@
// Copyright (C) 2001-2003
// William E. Kempf
// Copyright (C) 2007-8 Anthony Williams
//
// 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_XTIME_WEK070601_HPP
#define BOOST_XTIME_WEK070601_HPP
#include <boost/thread/detail/config.hpp>
#if defined BOOST_THREAD_USES_DATETIME
#include <boost/cstdint.hpp>
#include <boost/thread/thread_time.hpp>
#include <boost/date_time/posix_time/conversion.hpp>
#include <boost/config/abi_prefix.hpp>
namespace boost {
enum xtime_clock_types
{
TIME_UTC_=1
// TIME_TAI,
// TIME_MONOTONIC,
// TIME_PROCESS,
// TIME_THREAD,
// TIME_LOCAL,
// TIME_SYNC,
// TIME_RESOLUTION
};
struct xtime
{
#if defined(BOOST_NO_INT64_T)
typedef int_fast32_t xtime_sec_t; //INT_FAST32_MIN <= sec <= INT_FAST32_MAX
#else
typedef int_fast64_t xtime_sec_t; //INT_FAST64_MIN <= sec <= INT_FAST64_MAX
#endif
typedef int_fast32_t xtime_nsec_t; //0 <= xtime.nsec < NANOSECONDS_PER_SECOND
xtime_sec_t sec;
xtime_nsec_t nsec;
operator system_time() const
{
return boost::posix_time::from_time_t(0)+
boost::posix_time::seconds(static_cast<long>(sec))+
#ifdef BOOST_DATE_TIME_HAS_NANOSECONDS
boost::posix_time::nanoseconds(nsec);
#else
boost::posix_time::microseconds((nsec+500)/1000);
#endif
}
};
inline xtime get_xtime(boost::system_time const& abs_time)
{
xtime res;
boost::posix_time::time_duration const time_since_epoch=abs_time-boost::posix_time::from_time_t(0);
res.sec=static_cast<xtime::xtime_sec_t>(time_since_epoch.total_seconds());
res.nsec=static_cast<xtime::xtime_nsec_t>(time_since_epoch.fractional_seconds()*(1000000000/time_since_epoch.ticks_per_second()));
return res;
}
inline int xtime_get(struct xtime* xtp, int clock_type)
{
if (clock_type == TIME_UTC_)
{
*xtp=get_xtime(get_system_time());
return clock_type;
}
return 0;
}
inline int xtime_cmp(const xtime& xt1, const xtime& xt2)
{
if (xt1.sec == xt2.sec)
return (int)(xt1.nsec - xt2.nsec);
else
return (xt1.sec > xt2.sec) ? 1 : -1;
}
} // namespace boost
#include <boost/config/abi_suffix.hpp>
#endif
#endif //BOOST_XTIME_WEK070601_HPP
@@ -0,0 +1,32 @@
/*=============================================================================
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_BEGIN_10022005_1620)
#define FUSION_BEGIN_10022005_1620
#include <boost/fusion/support/config.hpp>
#include <boost/mpl/begin_end.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/adapted/mpl/detail/begin_impl.hpp>
#include <boost/fusion/iterator/mpl/fusion_iterator.hpp>
namespace boost { namespace mpl
{
template <typename Tag>
struct begin_impl;
template <>
struct begin_impl<fusion::fusion_sequence_tag>
{
template <typename Sequence>
struct apply
{
typedef fusion_iterator<typename fusion::result_of::begin<Sequence>::type> type;
};
};
}}
#endif
@@ -0,0 +1,107 @@
// Simple bargraph dB meter
// Implemented by Edson Pereira PY2SDR
//
#include "signalmeter.h"
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <QPainter>
#include <QFontMetrics>
#include <QDebug>
#include <meterwidget.h>
#include "moc_signalmeter.cpp"
#define MAXDB 90
class Scale final
: public QWidget
{
public:
explicit Scale (QWidget * parent = 0)
: QWidget {parent}
{
setSizePolicy (QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
}
QSize sizeHint () const override
{
return minimumSizeHint ();
}
QSize minimumSizeHint () const override
{
QFontMetrics font_metrics {font (), nullptr};
return {tick_length + text_indent + font_metrics.width ("00+"), (font_metrics.height () + line_spacing) * range};
}
protected:
void paintEvent (QPaintEvent * event) override
{
QWidget::paintEvent (event);
QPainter p {this};
auto const& target = contentsRect ();
QFontMetrics font_metrics {p.font (), this};
auto font_offset = font_metrics.ascent () / 2;
p.drawLine (target.left (), target.top () + font_offset, target.left (), target.bottom () - font_offset - font_metrics.descent ());
for (int i = 0; i <= range; ++i)
{
p.save ();
p.translate (target.left ()
, target.top () + font_offset + i * (target.height () - font_metrics.ascent () - font_metrics.descent ()) / range);
p.drawLine (0, 0, tick_length, 0);
if((i%2==1)) {
auto text = QString::number ((range - i) * scale);
p.drawText (tick_length + text_indent, font_offset, text);
}
p.restore ();
}
}
private:
static int constexpr tick_length {4};
static int constexpr text_indent {2};
static int constexpr line_spacing {0};
static int constexpr range {MAXDB/10};
static int constexpr scale {10};
};
SignalMeter::SignalMeter (QWidget * parent)
: QFrame {parent}
{
auto outer_layout = new QVBoxLayout;
outer_layout->setSpacing (0);
auto inner_layout = new QHBoxLayout;
inner_layout->setContentsMargins (9, 0, 9, 0);
inner_layout->setSpacing (0);
m_meter = new MeterWidget;
m_meter->setSizePolicy (QSizePolicy::Minimum, QSizePolicy::Minimum);
inner_layout->addWidget (m_meter);
m_scale = new Scale;
inner_layout->addWidget (m_scale);
m_reading = new QLabel(this);
outer_layout->addLayout (inner_layout);
outer_layout->addWidget (m_reading);
setLayout (outer_layout);
}
void SignalMeter::setValue(float value, float valueMax)
{
if(value<0) value=0;
QFontMetrics font_metrics {m_scale->font (), nullptr};
m_meter->setContentsMargins (0, font_metrics.ascent () / 2, 0, font_metrics.ascent () / 2 + font_metrics.descent ());
m_meter->setValue(int(value));
m_meter->set_sigPeak(valueMax);
QString t;
t.sprintf("%d dB",int(value+0.5));
m_reading->setText(t);
}
@@ -0,0 +1,95 @@
- Select *WSPR* from the *Mode* menu. The main window will
reconfigure itself to the WSPR interface, removing some controls not
used in WSPR mode.
- Set the Wide Graph controls as suggested below.
image::WSPR_WideGraphControls.png[align="center",alt="WSPR_WideGraphControls"]
- Use the mouse to drag the width and height of the main window to the
desired size.
- Select an active WSPR frequency (for example, 10.1387 or 14.0956 MHz).
IMPORTANT: If you will transmit in the 60 m band, be sure to choose a
frequency that conforms with your local regulations.
- Click *Monitor* to start a 2-minute WSPR receiving period.
- If you will be transmitting as well as receiving, select a suitable
value for *Tx Pct* (average percentage of 2-minute sequences devoted
to transmitting) and activate the *Enable Tx* button. Transmitting
periods are also 2 minutes duration, and will occur randomly in time
to reduce the chance of clashing with other stations you may be
monitoring.
- Select your Tx power (in dBm) from the drop-down list.
=== Band Hopping
WSPR mode allows those with CAT-controlled radios to investigate
propagation on many bands without user intervention. Coordinated
hopping enables a sizable group of stations around the world to move
together from band to band, thereby maximizing the chances of
identifying open propagation paths.
- To enable automatic band hopping, check the *Band Hopping* box on
the main window.
- Click *Schedule* to open the *WSPR Band Hopping* window, and select
the bands you wish to use at each time of day.
image::band_hopping.png[align="center",alt="Band Hopping"]
- Band-switching occurs after each 2-minute interval. Preferred bands
are identified with time slots in a repeating 20-minute cycle,
according to the following table:
[width="80%",align="center",cols=">20,10*>8",options="header"]
|===
|Band: |160|80|60|40|30|20|17|15|12|10
.3+|*UTC minute:* | 00|02|04|06|08|10|12|14|16|18
>| 20|22|24|26|28|30|32|34|36|38
>| 40|42|44|46|48|50|52|54|56|58
|===
- If the preferred band is not active according to your band-hopping
schedule, a band will be selected at random from among the active
bands.
- If the box labeled *Tune* is checked for a particular band, _WSJT-X_
transmits an unmodulated carrier for several seconds just after
switching to that band and before the normal Rx or Tx period
starts. This feature can be used to activate an automatic antenna
tuner (ATU) to tune a multi-band antenna to the newly selected band.
- Depending on your station and antenna setup, band changes might
require other switching besides retuning your radio. To make this
possible in an automated way, whenever _WSJT-X_ executes a successful
band-change command to a CAT-controlled radio, it looks for a file
named `user_hardware.bat`, `user_hardware.cmd`, `user_hardware.exe`,
or `user_hardware` in the working directory. If one of these is found,
_WSJT-X_ tries to execute the command
user_hardware nnn
- In the above command `nnn` is the band-designation wavelength in
meters. You must write your own program, script, or batch file to do
the necessary switching at your station.
The following screen shot is an example of WSPR operation with
band hopping enabled:
image::WSPR_2.png[align="center",alt="WSPR_2"]
A careful look at the screen shot above illustrates some of the
impressive capabilities of the WSPR decoder. For example, look at the
decodes at UTC 0152, 0154, and 0156 along with the corresponding
minutes from the waterfall display below. Yellow ovals have been
added to highlight two isolated signals decoded at -28 and -29 dB in
the first and third two-minute interval. At 0154 UTC signals from
VE3FAL, AB4QS, and K5CZD fall within a 5 Hz interval near audio
frequency 1492 Hz; similarly, K3FEF, DL2XL/P, and LZ1UBO fall within
a 6 Hz interval near 1543 Hz. Each of the overlapping signals is
decoded flawlessly.
image::WSPR_1a.png[align="center",alt="WSPR_1a"]
@@ -0,0 +1,33 @@
// Boost.Range library concept checks
//
// Copyright Neil Groves 2009. 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_RANGE_DETAIL_MISC_CONCEPT_HPP_INCLUDED
#define BOOST_RANGE_DETAIL_MISC_CONCEPT_HPP_INCLUDED
#include <boost/concept_check.hpp>
namespace boost
{
namespace range_detail
{
template<typename T1, typename T2>
class SameTypeConcept
{
public:
BOOST_CONCEPT_USAGE(SameTypeConcept)
{
same_type(a,b);
}
private:
template<typename T> void same_type(T,T) {}
T1 a;
T2 b;
};
}
}
#endif // include guard
@@ -0,0 +1,29 @@
/*=============================================================================
Copyright (c) 2009 Christopher Schmidt
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#ifndef BOOST_FUSION_VIEW_JOINT_VIEW_DETAIL_VALUE_OF_DATA_IMPL_HPP
#define BOOST_FUSION_VIEW_JOINT_VIEW_DETAIL_VALUE_OF_DATA_IMPL_HPP
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/iterator/value_of_data.hpp>
namespace boost { namespace fusion { namespace extension
{
template <typename>
struct value_of_data_impl;
template <>
struct value_of_data_impl<joint_view_iterator_tag>
{
template <typename It>
struct apply
: result_of::value_of_data<typename It::first_type>
{};
};
}}}
#endif
@@ -0,0 +1,168 @@
/*
[auto_generated]
boost/numeric/odeint/stepper/detail/adams_bashforth_coefficients.hpp
[begin_description]
Definition of the coefficients for the Adams-Bashforth method.
[end_description]
Copyright 2011-2012 Karsten Ahnert
Copyright 2011-2012 Mario Mulansky
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_STEPPER_DETAIL_ADAMS_BASHFORTH_COEFFICIENTS_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_COEFFICIENTS_HPP_INCLUDED
#include <boost/array.hpp>
namespace boost {
namespace numeric {
namespace odeint {
namespace detail {
template< class Value , size_t Steps >
class adams_bashforth_coefficients ;
template< class Value >
class adams_bashforth_coefficients< Value , 1 > : public boost::array< Value , 1 >
{
public:
adams_bashforth_coefficients( void )
: boost::array< Value , 1 >()
{
(*this)[0] = static_cast< Value >( 1 );
}
};
template< class Value >
class adams_bashforth_coefficients< Value , 2 > : public boost::array< Value , 2 >
{
public:
adams_bashforth_coefficients( void )
: boost::array< Value , 2 >()
{
(*this)[0] = static_cast< Value >( 3 ) / static_cast< Value >( 2 );
(*this)[1] = -static_cast< Value >( 1 ) / static_cast< Value >( 2 );
}
};
template< class Value >
class adams_bashforth_coefficients< Value , 3 > : public boost::array< Value , 3 >
{
public:
adams_bashforth_coefficients( void )
: boost::array< Value , 3 >()
{
(*this)[0] = static_cast< Value >( 23 ) / static_cast< Value >( 12 );
(*this)[1] = -static_cast< Value >( 4 ) / static_cast< Value >( 3 );
(*this)[2] = static_cast< Value >( 5 ) / static_cast< Value >( 12 );
}
};
template< class Value >
class adams_bashforth_coefficients< Value , 4 > : public boost::array< Value , 4 >
{
public:
adams_bashforth_coefficients( void )
: boost::array< Value , 4 >()
{
(*this)[0] = static_cast< Value >( 55 ) / static_cast< Value >( 24 );
(*this)[1] = -static_cast< Value >( 59 ) / static_cast< Value >( 24 );
(*this)[2] = static_cast< Value >( 37 ) / static_cast< Value >( 24 );
(*this)[3] = -static_cast< Value >( 3 ) / static_cast< Value >( 8 );
}
};
template< class Value >
class adams_bashforth_coefficients< Value , 5 > : public boost::array< Value , 5 >
{
public:
adams_bashforth_coefficients( void )
: boost::array< Value , 5 >()
{
(*this)[0] = static_cast< Value >( 1901 ) / static_cast< Value >( 720 );
(*this)[1] = -static_cast< Value >( 1387 ) / static_cast< Value >( 360 );
(*this)[2] = static_cast< Value >( 109 ) / static_cast< Value >( 30 );
(*this)[3] = -static_cast< Value >( 637 ) / static_cast< Value >( 360 );
(*this)[4] = static_cast< Value >( 251 ) / static_cast< Value >( 720 );
}
};
template< class Value >
class adams_bashforth_coefficients< Value , 6 > : public boost::array< Value , 6 >
{
public:
adams_bashforth_coefficients( void )
: boost::array< Value , 6 >()
{
(*this)[0] = static_cast< Value >( 4277 ) / static_cast< Value >( 1440 );
(*this)[1] = -static_cast< Value >( 2641 ) / static_cast< Value >( 480 );
(*this)[2] = static_cast< Value >( 4991 ) / static_cast< Value >( 720 );
(*this)[3] = -static_cast< Value >( 3649 ) / static_cast< Value >( 720 );
(*this)[4] = static_cast< Value >( 959 ) / static_cast< Value >( 480 );
(*this)[5] = -static_cast< Value >( 95 ) / static_cast< Value >( 288 );
}
};
template< class Value >
class adams_bashforth_coefficients< Value , 7 > : public boost::array< Value , 7 >
{
public:
adams_bashforth_coefficients( void )
: boost::array< Value , 7 >()
{
(*this)[0] = static_cast< Value >( 198721 ) / static_cast< Value >( 60480 );
(*this)[1] = -static_cast< Value >( 18637 ) / static_cast< Value >( 2520 );
(*this)[2] = static_cast< Value >( 235183 ) / static_cast< Value >( 20160 );
(*this)[3] = -static_cast< Value >( 10754 ) / static_cast< Value >( 945 );
(*this)[4] = static_cast< Value >( 135713 ) / static_cast< Value >( 20160 );
(*this)[5] = -static_cast< Value >( 5603 ) / static_cast< Value >( 2520 );
(*this)[6] = static_cast< Value >( 19087 ) / static_cast< Value >( 60480 );
}
};
template< class Value >
class adams_bashforth_coefficients< Value , 8 > : public boost::array< Value , 8 >
{
public:
adams_bashforth_coefficients( void )
: boost::array< Value , 8 >()
{
(*this)[0] = static_cast< Value >( 16083 ) / static_cast< Value >( 4480 );
(*this)[1] = -static_cast< Value >( 1152169 ) / static_cast< Value >( 120960 );
(*this)[2] = static_cast< Value >( 242653 ) / static_cast< Value >( 13440 );
(*this)[3] = -static_cast< Value >( 296053 ) / static_cast< Value >( 13440 );
(*this)[4] = static_cast< Value >( 2102243 ) / static_cast< Value >( 120960 );
(*this)[5] = -static_cast< Value >( 115747 ) / static_cast< Value >( 13440 );
(*this)[6] = static_cast< Value >( 32863 ) / static_cast< Value >( 13440 );
(*this)[7] = -static_cast< Value >( 5257 ) / static_cast< Value >( 17280 );
}
};
} // detail
} // odeint
} // numeric
} // boost
#endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ADAMS_BASHFORTH_COEFFICIENTS_HPP_INCLUDED
@@ -0,0 +1,39 @@
// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See library home page at http://www.boost.org/libs/numeric/conversion
//
// Contact the author at: fernando_cacciola@hotmail.com
//
#ifndef BOOST_NUMERIC_CONVERSION_CONVERSION_TRAITS_FLC_12NOV2002_HPP
#define BOOST_NUMERIC_CONVERSION_CONVERSION_TRAITS_FLC_12NOV2002_HPP
#include "boost/numeric/conversion/detail/conversion_traits.hpp"
#include "boost/detail/workaround.hpp"
#include "boost/config.hpp"
namespace boost { namespace numeric
{
template<class T, class S>
struct conversion_traits
: convdetail::get_conversion_traits<T,S>::type
{
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
typedef typename convdetail::get_conversion_traits<T,S>::type base_;
typedef typename base_::target_type target_type;
typedef typename base_::source_type source_type;
typedef typename base_::result_type result_type;
typedef typename base_::argument_type argument_type;
#endif
} ;
} } // namespace boost::numeric
#endif
//
///////////////////////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,64 @@
//---------------------------------------------------------------------------//
// Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
//
// Distributed under the Boost Software License, Version 1.0
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
// See http://boostorg.github.com/compute for more information.
//---------------------------------------------------------------------------//
#ifndef BOOST_COMPUTE_ALGORITHM_IS_SORTED_HPP
#define BOOST_COMPUTE_ALGORITHM_IS_SORTED_HPP
#include <boost/compute/command_queue.hpp>
#include <boost/compute/system.hpp>
#include <boost/compute/functional/bind.hpp>
#include <boost/compute/functional/operator.hpp>
#include <boost/compute/algorithm/adjacent_find.hpp>
namespace boost {
namespace compute {
/// Returns \c true if the values in the range [\p first, \p last)
/// are in sorted order.
///
/// \param first first element in the range to check
/// \param last last element in the range to check
/// \param compare comparison function (by default \c less)
/// \param queue command queue to perform the operation
///
/// \return \c true if the range [\p first, \p last) is sorted
///
/// \see sort()
template<class InputIterator, class Compare>
inline bool is_sorted(InputIterator first,
InputIterator last,
Compare compare,
command_queue &queue = system::default_queue())
{
using ::boost::compute::placeholders::_1;
using ::boost::compute::placeholders::_2;
return ::boost::compute::adjacent_find(
first, last, ::boost::compute::bind(compare, _2, _1), queue
) == last;
}
/// \overload
template<class InputIterator>
inline bool is_sorted(InputIterator first,
InputIterator last,
command_queue &queue = system::default_queue())
{
typedef typename std::iterator_traits<InputIterator>::value_type value_type;
return ::boost::compute::is_sorted(
first, last, ::boost::compute::less<value_type>(), queue
);
}
} // end compute namespace
} // end boost namespace
#endif // BOOST_COMPUTE_ALGORITHM_IS_SORTED_HPP
@@ -0,0 +1,116 @@
// (C) Copyright Gennadiy Rozental 2001.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
// File : $RCSfile$
//
// Version : $Revision: 74640 $
//
// Description : defines fixture interface and object makers
// ***************************************************************************
#ifndef BOOST_TEST_TREE_FIXTURE_HPP_100311GER
#define BOOST_TEST_TREE_FIXTURE_HPP_100311GER
// Boost.Test
#include <boost/test/detail/config.hpp>
// Boost
#include <boost/shared_ptr.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/function/function0.hpp>
#include <boost/test/detail/suppress_warnings.hpp>
//____________________________________________________________________________//
namespace boost {
namespace unit_test {
// ************************************************************************** //
// ************** test_unit_fixture ************** //
// ************************************************************************** //
class BOOST_TEST_DECL test_unit_fixture {
public:
virtual ~test_unit_fixture() {}
// Fixture interface
virtual void setup() = 0;
virtual void teardown() = 0;
};
typedef shared_ptr<test_unit_fixture> test_unit_fixture_ptr;
// ************************************************************************** //
// ************** class_based_fixture ************** //
// ************************************************************************** //
template<typename F, typename Arg=void>
class class_based_fixture : public test_unit_fixture {
public:
// Constructor
explicit class_based_fixture( Arg const& arg ) : m_inst(), m_arg( arg ) {}
private:
// Fixture interface
virtual void setup() { m_inst.reset( new F( m_arg ) ); }
virtual void teardown() { m_inst.reset(); }
// Data members
scoped_ptr<F> m_inst;
Arg m_arg;
};
//____________________________________________________________________________//
template<typename F>
class class_based_fixture<F,void> : public test_unit_fixture {
public:
// Constructor
class_based_fixture() : m_inst( 0 ) {}
private:
// Fixture interface
virtual void setup() { m_inst.reset( new F ); }
virtual void teardown() { m_inst.reset(); }
// Data members
scoped_ptr<F> m_inst;
};
//____________________________________________________________________________//
// ************************************************************************** //
// ************** function_based_fixture ************** //
// ************************************************************************** //
class function_based_fixture : public test_unit_fixture {
public:
// Constructor
function_based_fixture( boost::function<void ()> const& setup_, boost::function<void ()> const& teardown_ )
: m_setup( setup_ )
, m_teardown( teardown_ )
{
}
private:
// Fixture interface
virtual void setup() { if( m_setup ) m_setup(); }
virtual void teardown() { if( m_teardown ) m_teardown(); }
// Data members
boost::function<void ()> m_setup;
boost::function<void ()> m_teardown;
};
} // namespace unit_test
} // namespace boost
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_TREE_FIXTURE_HPP_100311GER
@@ -0,0 +1,168 @@
// ----------------------------------------------------------------------------
// Copyright (C) 2002-2006 Marcin Kalicinski
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// For more information, see www.boost.org
// ----------------------------------------------------------------------------
#ifndef BOOST_PROPERTY_TREE_DETAIL_JSON_PARSER_WRITE_HPP_INCLUDED
#define BOOST_PROPERTY_TREE_DETAIL_JSON_PARSER_WRITE_HPP_INCLUDED
#include <boost/property_tree/ptree.hpp>
#include <boost/next_prior.hpp>
#include <boost/type_traits/make_unsigned.hpp>
#include <string>
#include <ostream>
#include <iomanip>
namespace boost { namespace property_tree { namespace json_parser
{
// Create necessary escape sequences from illegal characters
template<class Ch>
std::basic_string<Ch> create_escapes(const std::basic_string<Ch> &s)
{
std::basic_string<Ch> result;
typename std::basic_string<Ch>::const_iterator b = s.begin();
typename std::basic_string<Ch>::const_iterator e = s.end();
while (b != e)
{
typedef typename make_unsigned<Ch>::type UCh;
UCh c(*b);
// This assumes an ASCII superset. But so does everything in PTree.
// We escape everything outside ASCII, because this code can't
// handle high unicode characters.
if (c == 0x20 || c == 0x21 || (c >= 0x23 && c <= 0x2E) ||
(c >= 0x30 && c <= 0x5B) || (c >= 0x5D && c <= 0xFF))
result += *b;
else if (*b == Ch('\b')) result += Ch('\\'), result += Ch('b');
else if (*b == Ch('\f')) result += Ch('\\'), result += Ch('f');
else if (*b == Ch('\n')) result += Ch('\\'), result += Ch('n');
else if (*b == Ch('\r')) result += Ch('\\'), result += Ch('r');
else if (*b == Ch('\t')) result += Ch('\\'), result += Ch('t');
else if (*b == Ch('/')) result += Ch('\\'), result += Ch('/');
else if (*b == Ch('"')) result += Ch('\\'), result += Ch('"');
else if (*b == Ch('\\')) result += Ch('\\'), result += Ch('\\');
else
{
const char *hexdigits = "0123456789ABCDEF";
unsigned long u = (std::min)(static_cast<unsigned long>(
static_cast<UCh>(*b)),
0xFFFFul);
unsigned long d1 = u / 4096; u -= d1 * 4096;
unsigned long d2 = u / 256; u -= d2 * 256;
unsigned long d3 = u / 16; u -= d3 * 16;
unsigned long d4 = u;
result += Ch('\\'); result += Ch('u');
result += Ch(hexdigits[d1]); result += Ch(hexdigits[d2]);
result += Ch(hexdigits[d3]); result += Ch(hexdigits[d4]);
}
++b;
}
return result;
}
template<class Ptree>
void write_json_helper(std::basic_ostream<typename Ptree::key_type::value_type> &stream,
const Ptree &pt,
int indent, bool pretty)
{
typedef typename Ptree::key_type::value_type Ch;
typedef typename std::basic_string<Ch> Str;
// Value or object or array
if (indent > 0 && pt.empty())
{
// Write value
Str data = create_escapes(pt.template get_value<Str>());
stream << Ch('"') << data << Ch('"');
}
else if (indent > 0 && pt.count(Str()) == pt.size())
{
// Write array
stream << Ch('[');
if (pretty) stream << Ch('\n');
typename Ptree::const_iterator it = pt.begin();
for (; it != pt.end(); ++it)
{
if (pretty) stream << Str(4 * (indent + 1), Ch(' '));
write_json_helper(stream, it->second, indent + 1, pretty);
if (boost::next(it) != pt.end())
stream << Ch(',');
if (pretty) stream << Ch('\n');
}
if (pretty) stream << Str(4 * indent, Ch(' '));
stream << Ch(']');
}
else
{
// Write object
stream << Ch('{');
if (pretty) stream << Ch('\n');
typename Ptree::const_iterator it = pt.begin();
for (; it != pt.end(); ++it)
{
if (pretty) stream << Str(4 * (indent + 1), Ch(' '));
stream << Ch('"') << create_escapes(it->first) << Ch('"') << Ch(':');
if (pretty) stream << Ch(' ');
write_json_helper(stream, it->second, indent + 1, pretty);
if (boost::next(it) != pt.end())
stream << Ch(',');
if (pretty) stream << Ch('\n');
}
if (pretty) stream << Str(4 * indent, Ch(' '));
stream << Ch('}');
}
}
// Verify if ptree does not contain information that cannot be written to json
template<class Ptree>
bool verify_json(const Ptree &pt, int depth)
{
typedef typename Ptree::key_type::value_type Ch;
typedef typename std::basic_string<Ch> Str;
// Root ptree cannot have data
if (depth == 0 && !pt.template get_value<Str>().empty())
return false;
// Ptree cannot have both children and data
if (!pt.template get_value<Str>().empty() && !pt.empty())
return false;
// Check children
typename Ptree::const_iterator it = pt.begin();
for (; it != pt.end(); ++it)
if (!verify_json(it->second, depth + 1))
return false;
// Success
return true;
}
// Write ptree to json stream
template<class Ptree>
void write_json_internal(std::basic_ostream<typename Ptree::key_type::value_type> &stream,
const Ptree &pt,
const std::string &filename,
bool pretty)
{
if (!verify_json(pt, 0))
BOOST_PROPERTY_TREE_THROW(json_parser_error("ptree contains data that cannot be represented in JSON format", filename, 0));
write_json_helper(stream, pt, 0, pretty);
stream << std::endl;
if (!stream.good())
BOOST_PROPERTY_TREE_THROW(json_parser_error("write error", filename, 0));
}
} } }
#endif
@@ -0,0 +1,99 @@
#include "LiveFrequencyValidator.hpp"
#include <QLocale>
#include <QString>
#include <QComboBox>
#include <QLineEdit>
#include "Bands.hpp"
#include "FrequencyList.hpp"
#include "moc_LiveFrequencyValidator.cpp"
LiveFrequencyValidator::LiveFrequencyValidator (QComboBox * combo_box
, Bands const * bands
, FrequencyList_v2 const * frequencies
, Frequency const * nominal_frequency
, QWidget * parent)
: QRegExpValidator {
QRegExp { // frequency in MHz or band
bands->data (QModelIndex {}).toString () // out of band string
+ QString {R"(|((\d{0,6}(\)"} // or up to 6 digits
+ QLocale {}.decimalPoint () // (followed by decimal separator
+ R"(\d{0,2})?)([Mm]{1,2}|([Cc][Mm])))|(\d{0,6}(\)" // followed by up to 2 digits and either 'm' or 'cm' or 'mm' (case insensitive))
+ QLocale {}.decimalPoint () // or a decimal separator
+ R"(\d{0,6})?)|(\d{0,3}(\)" // followed by up to 6
// digits or a decimal number
+ QLocale {}.decimalPoint () // or a decimal separator
+ R"(\d{0,6})?[Kk]))" // followed by a 'k' or 'K'
}
, parent
}
, bands_ {bands}
, frequencies_ {frequencies}
, nominal_frequency_ {nominal_frequency}
, combo_box_ {combo_box}
{
}
auto LiveFrequencyValidator::validate (QString& input, int& pos) const -> State
{
auto state = QRegExpValidator::validate (input, pos);
// by never being Acceptable we force fixup calls on ENTER or
// losing focus
return Acceptable == state ? Intermediate : state;
}
void LiveFrequencyValidator::fixup (QString& input) const
{
QRegExpValidator::fixup (input);
if (!bands_->oob ().startsWith (input))
{
if (input.contains ('m', Qt::CaseInsensitive))
{
input = input.toLower ();
QVector<QVariant> frequencies;
for (auto const& item : frequencies_->frequency_list ())
{
if (bands_->find (item.frequency_) == input)
{
frequencies << item.frequency_;
}
}
if (!frequencies.isEmpty ())
{
Q_EMIT valid (frequencies.first ().value<Frequency> ());
}
else
{
input = QString {};
}
}
else if (input.contains (QChar {'k'}, Qt::CaseInsensitive))
{
// kHz in current MHz input
auto f = Radio::frequency (input.remove (QChar {'k'}, Qt::CaseInsensitive), 3);
f += *nominal_frequency_ / 1000000u * 1000000u;
input = bands_->find (f);
Q_EMIT valid (f);
}
else
{
// frequency input
auto f = Radio::frequency (input, 6);
input = bands_->find (f);
Q_EMIT valid (f);
}
if (bands_->oob () == input)
{
combo_box_->lineEdit ()->setStyleSheet ("QLineEdit {color: yellow; background-color : red;}");
}
else
{
combo_box_->lineEdit ()->setStyleSheet ({});
}
combo_box_->setCurrentText (input);
}
}
@@ -0,0 +1,31 @@
subroutine spec8(c,s,savg)
include 'wspr_fsk8_params.f90'
complex c(0:NMAXD-1)
complex c1(0:NSPS-1)
real s(0:NH2,NN)
real savg(0:NH2)
fs=12000.0/NDOWN
df=fs/NSPS
savg=0.
do j=1,NN
ia=(j-1)*NSPS
ib=ia + NSPS-1
c1(0:NSPS-1)=c(ia:ib)
c1(NSPS:)=0.
call four2a(c1,NSPS,1,-1,1)
do i=0,NH2
s(i,j)=real(c1(i))**2 + aimag(c1(i))**2
enddo
savg=savg+s(0:NH2,j)
enddo
s=s/NZ
savg=savg/(NN*NZ)
! do i=0,NH2
! write(31,3101) i*df,savg(i)
!3101 format(f10.3,f12.3)
! enddo
return
end subroutine spec8
@@ -0,0 +1,279 @@
#include "astro.h"
#include <stdio.h>
#include <QApplication>
#include <QFile>
#include <QTextStream>
#include <QSettings>
#include <QDateTime>
#include <QStandardPaths>
#include <QDir>
#include <QDebug>
#include "commons.h"
#include "MessageBox.hpp"
#include "Configuration.hpp"
#include "SettingsGroup.hpp"
#include "qt_helpers.hpp"
#include "ui_astro.h"
#include "moc_astro.cpp"
extern "C" {
void astrosub_(int* nyear, int* month, int* nday, double* uth, double* freqMoon,
const char* mygrid, const char* hisgrid, double* azsun,
double* elsun, double* azmoon, double* elmoon, double* azmoondx,
double* elmoondx, int* ntsky, int* ndop, int* ndop00,
double* ramoon, double* decmoon, double* dgrd, double* poloffset,
double* xnr, double* techo, double* width1, double* width2,
bool* bTx, const char* AzElFileName, const char* jpleph,
int len1, int len2, int len3, int len4);
}
Astro::Astro(QSettings * settings, Configuration const * configuration, QWidget * parent)
: QDialog {parent, Qt::WindowTitleHint}
, settings_ {settings}
, configuration_ {configuration}
, ui_ {new Ui::Astro}
, m_DopplerMethod {0}
{
ui_->setupUi (this);
setWindowTitle (QApplication::applicationName () + " - " + tr ("Astronomical Data"));
setStyleSheet ("QWidget {background: white;}");
connect (ui_->cbDopplerTracking, &QAbstractButton::toggled, ui_->doppler_widget, &QWidget::setVisible);
read_settings ();
ui_->text_label->clear ();
}
Astro::~Astro ()
{
ui_->cbDopplerTracking->setChecked (false);
Q_EMIT tracking_update ();
if (isVisible ()) write_settings ();
}
void Astro::closeEvent (QCloseEvent * e)
{
write_settings ();
QWidget::closeEvent (e);
}
void Astro::read_settings ()
{
SettingsGroup g (settings_, "Astro");
ui_->doppler_widget->setVisible (ui_->cbDopplerTracking->isChecked ());
m_DopplerMethod=settings_->value("DopplerMethod",0).toInt();
switch (m_DopplerMethod)
{
case 0: ui_->rbNoDoppler->setChecked (true); break;
case 1: ui_->rbFullTrack->setChecked (true); break;
case 2: ui_->rbConstFreqOnMoon->setChecked (true); break;
case 3: ui_->rbRxOnly->setChecked (true); break;
}
move (settings_->value ("window/pos", pos ()).toPoint ());
}
void Astro::write_settings ()
{
SettingsGroup g (settings_, "Astro");
//settings_->setValue ("DopplerTracking", ui_->cbDopplerTracking->isChecked ());
settings_->setValue ("DopplerMethod",m_DopplerMethod);
settings_->setValue ("window/pos", pos ());
}
auto Astro::astroUpdate(QDateTime const& t, QString const& mygrid, QString const& hisgrid, Frequency freq,
bool dx_is_self, bool bTx, bool no_tx_QSY, int TR_period) -> Correction
{
Frequency freq_moon {freq};
double azsun,elsun,azmoon,elmoon,azmoondx,elmoondx;
double ramoon,decmoon,dgrd,poloffset,xnr,techo,width1,width2;
int ntsky;
QString date {t.date().toString("yyyy MMM dd").trimmed ()};
QString utc {t.time().toString().trimmed ()};
int nyear {t.date().year()};
int month {t.date().month()};
int nday {t.date().day()};
int nhr {t.time().hour()};
int nmin {t.time().minute()};
double sec {t.time().second() + 0.001*t.time().msec()};
double uth {nhr + nmin/60.0 + sec/3600.0};
if(freq_moon < 1) freq_moon = 144000000;
int nfreq {static_cast<int> (freq_moon / 1000000u)};
double freq8 {static_cast<double> (freq_moon)};
auto const& AzElFileName = QDir::toNativeSeparators (configuration_->azel_directory ().absoluteFilePath ("azel.dat"));
auto const& jpleph = configuration_->data_dir ().absoluteFilePath ("JPLEPH");
int ndop;
int ndop00;
QString mygrid_padded {(mygrid + " ").left (6)};
QString hisgrid_padded {(hisgrid + " ").left (6)};
astrosub_(&nyear, &month, &nday, &uth, &freq8, mygrid_padded.toLatin1().constData(),
hisgrid_padded.toLatin1().constData(), &azsun, &elsun, &azmoon, &elmoon,
&azmoondx, &elmoondx, &ntsky, &ndop, &ndop00, &ramoon, &decmoon,
&dgrd, &poloffset, &xnr, &techo, &width1, &width2, &bTx,
AzElFileName.toLatin1().constData(), jpleph.toLatin1().constData(), 6, 6,
AzElFileName.length(), jpleph.length());
if(hisgrid_padded==" ") {
azmoondx=0.0;
elmoondx=0.0;
ndop=0;
width2=0.0;
}
QString message;
{
QTextStream out {&message};
out << " " << date << "\n"
"UTC: " << utc << "\n"
<< fixed
<< qSetFieldWidth (6)
<< qSetRealNumberPrecision (1)
<< "Az: " << azmoon << "\n"
"El: " << elmoon << "\n"
"SelfDop:" << ndop00 << "\n"
"Width: " << int(width1) << "\n"
<< qSetRealNumberPrecision (2)
<< "Delay: " << techo << "\n"
<< qSetRealNumberPrecision (1)
<< "DxAz: " << azmoondx << "\n"
"DxEl: " << elmoondx << "\n"
"DxDop: " << ndop << "\n"
"DxWid: " << int(width2) << "\n"
"Dec: " << decmoon << "\n"
"SunAz: " << azsun << "\n"
"SunEl: " << elsun << "\n"
"Freq: " << nfreq << "\n";
if(nfreq>=50) { //Suppress data not relevant below VHF
out << "Tsky: " << ntsky << "\n"
"Dpol: " << poloffset << "\n"
"MNR: " << xnr << "\n"
"Dgrd: " << dgrd;
}
}
ui_->text_label->setText(message);
Correction correction;
if (ui_->cbDopplerTracking->isChecked ()) {
switch (m_DopplerMethod)
{
case 1: // All Doppler correction done here; DX station stays at nominal dial frequency.
case 3: // Both stations do full correction on Rx and none on Tx
correction.rx = dx_is_self ? ndop00 : ndop;
break;
case 2:
// Doppler correction to constant frequency on Moon
correction.rx = ndop00 / 2;
break;
}
if (3 != m_DopplerMethod) correction.tx = -correction.rx;
if(dx_is_self && m_DopplerMethod == 1) correction.rx = 0;
if (no_tx_QSY && 3 != m_DopplerMethod && 0 != m_DopplerMethod)
{
// calculate a single correction for transmit half way through
// the period as a compromise for rigs that can't CAT QSY
// while transmitting
//
// use a base time of (secs-since-epoch + 2) so as to be sure
// we do the next period if we calculate just before it starts
auto sec_since_epoch = t.toMSecsSinceEpoch () / 1000 + 2;
auto target_sec = sec_since_epoch - sec_since_epoch % TR_period + TR_period / 2;
auto target_date_time = QDateTime::fromMSecsSinceEpoch (target_sec * 1000);
QString date {target_date_time.date().toString("yyyy MMM dd").trimmed ()};
QString utc {target_date_time.time().toString().trimmed ()};
int nyear {target_date_time.date().year()};
int month {target_date_time.date().month()};
int nday {target_date_time.date().day()};
int nhr {target_date_time.time().hour()};
int nmin {target_date_time.time().minute()};
double sec {target_date_time.time().second() + 0.001*target_date_time.time().msec()};
double uth {nhr + nmin/60.0 + sec/3600.0};
astrosub_(&nyear, &month, &nday, &uth, &freq8, mygrid_padded.toLatin1().constData(),
hisgrid_padded.toLatin1().constData(), &azsun, &elsun, &azmoon, &elmoon,
&azmoondx, &elmoondx, &ntsky, &ndop, &ndop00, &ramoon, &decmoon,
&dgrd, &poloffset, &xnr, &techo, &width1, &width2, &bTx,
"", jpleph.toLatin1().constData(), 6, 6,
0, jpleph.length());
FrequencyDelta offset {0};
switch (m_DopplerMethod)
{
case 1:
// All Doppler correction done here; DX station stays at nominal dial frequency.
offset = dx_is_self ? ndop00 : ndop;
break;
case 2:
// Doppler correction to constant frequency on Moon
offset = ndop00 / 2;
break;
}
correction.tx = -offset;
}
}
return correction;
}
void Astro::check_split ()
{
if (doppler_tracking () && !configuration_->split_mode ())
{
MessageBox::warning_message (this, tr ("Doppler Tracking Error"),
tr ("Split operating is required for Doppler tracking"),
tr ("Go to \"Menu->File->Settings->Radio\" to enable split operation"));
ui_->rbNoDoppler->click ();
}
}
void Astro::on_rbFullTrack_clicked()
{
m_DopplerMethod = 1;
check_split ();
Q_EMIT tracking_update ();
}
void Astro::on_rbRxOnly_clicked()
{
m_DopplerMethod = 3;
check_split ();
Q_EMIT tracking_update ();
}
void Astro::on_rbConstFreqOnMoon_clicked()
{
m_DopplerMethod = 2;
check_split ();
Q_EMIT tracking_update ();
}
void Astro::on_rbNoDoppler_clicked()
{
m_DopplerMethod = 0;
Q_EMIT tracking_update ();
}
bool Astro::doppler_tracking () const
{
return ui_->cbDopplerTracking->isChecked () && m_DopplerMethod;
}
void Astro::on_cbDopplerTracking_toggled(bool)
{
check_split ();
Q_EMIT tracking_update ();
}
void Astro::nominal_frequency (Frequency rx, Frequency tx)
{
ui_->sked_frequency_label->setText (Radio::pretty_frequency_MHz_string (rx));
ui_->sked_tx_frequency_label->setText (Radio::pretty_frequency_MHz_string (tx));
}
void Astro::hideEvent (QHideEvent * e)
{
Q_EMIT tracking_update ();
QWidget::hideEvent (e);
}
@@ -0,0 +1,90 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright Vicente J. Botet Escriba 2009-2011
// Copyright 2012 John Maddock. 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_MP_EXPLICIT_CONVERTIBLE_HPP
#define BOOST_MP_EXPLICIT_CONVERTIBLE_HPP
#include <boost/type_traits/is_convertible.hpp>
#include <boost/utility/declval.hpp>
namespace boost {
namespace multiprecision {
namespace detail {
template <int N>
struct dummy_size {};
template<typename S, typename T>
struct has_generic_interconversion
{
typedef typename mpl::if_c <
is_number<S>::value && is_number<T>::value,
typename mpl::if_c <
number_category<S>::value == number_kind_integer,
typename mpl::if_c<
number_category<T>::value == number_kind_integer
|| number_category<T>::value == number_kind_floating_point
|| number_category<T>::value == number_kind_rational
|| number_category<T>::value == number_kind_fixed_point,
mpl::true_,
mpl::false_
>::type,
typename mpl::if_c<
number_category<S>::value == number_kind_rational,
typename mpl::if_c<
number_category<T>::value == number_kind_rational
|| number_category<T>::value == number_kind_rational,
mpl::true_,
mpl::false_
>::type,
typename mpl::if_c<
number_category<T>::value == number_kind_floating_point,
mpl::true_,
mpl::false_
>::type
>::type
> ::type,
mpl::false_
> ::type type;
};
template<typename S, typename T>
struct is_explicitly_convertible_imp
{
#ifndef BOOST_NO_SFINAE_EXPR
template<typename S1, typename T1>
static type_traits::yes_type selector(dummy_size<sizeof(static_cast<T1>(declval<S1>()))>*);
template<typename S1, typename T1>
static type_traits::no_type selector(...);
static const bool value = sizeof(selector<S, T>(0)) == sizeof(type_traits::yes_type);
typedef boost::integral_constant<bool, value> type;
#else
typedef typename has_generic_interconversion<S, T>::type gen_type;
typedef mpl::bool_<boost::is_convertible<S, T>::value || gen_type::value> type;
#endif
};
template<typename From, typename To>
struct is_explicitly_convertible : public is_explicitly_convertible_imp<From, To>::type
{
};
#ifdef BOOST_NO_SFINAE_EXPR
template<class Backend1, expression_template_option ExpressionTemplates1, class Backend2, expression_template_option ExpressionTemplates2>
struct is_explicitly_convertible<number<Backend1, ExpressionTemplates1>, number<Backend2, ExpressionTemplates2> >
: public is_explicitly_convertible<Backend1, Backend2>
{
};
#endif
}}} // namespaces
#endif
@@ -0,0 +1,154 @@
subroutine refspectrum(id2,bclear,brefspec,buseref,fname)
! Input:
! id2 i*2 Raw 16-bit integer data, 12000 Hz sample rate
! brefspec logical True when accumulating a reference spectrum
parameter (NFFT=6912,NH=NFFT/2,NPOLYLOW=400,NPOLYHIGH=2600)
integer*2 id2(NFFT)
logical*1 bclear,brefspec,buseref,blastuse
real x0(0:NH-1) !Input samples
real x1(0:NH-1) !Output samples (delayed by one block)
real x0s(0:NH-1) !Saved upper half of input samples
real x1s(0:NH-1) !Saved upper half of output samples
real x(0:NFFT-1) !Work array
real*4 w(0:NFFT-1) !Window function
real*4 s(0:NH) !Average spectrum
real*4 fil(0:NH)
real*8 xfit(1500),yfit(1500),sigmay(1500),a(5),chisqr !Polyfit arrays
logical first
complex cx(0:NH) !Complex frequency-domain work array
character*(*) fname
common/spectra/syellow(6827),ref(0:NH),filter(0:NH)
equivalence(x,cx)
data first/.true./,blastuse/.false./
save
if(first) then
pi=4.0*atan(1.0)
do i=0,NFFT-1
ww=sin(i*pi/NFFT)
w(i)=ww*ww/NFFT
enddo
nsave=0
s=0.0
filter=1.0
x0s=0.
x1s=0.
first=.false.
endif
if(bclear) s=0.
if(brefspec) then
x(0:NH-1)=0.001*id2(1:NH)
x(NH:NFFT-1)=0.0
call four2a(x,NFFT,1,-1,0) !r2c FFT
do i=1,NH
s(i)=s(i) + real(cx(i))**2 + aimag(cx(i))**2
enddo
nsave=nsave+1
fac0=0.9
if(mod(nsave,4).eq.0) then
df=12000.0/NFFT
ia=nint(1000.0/df)
ib=nint(2000.0/df)
avemid=sum(s(ia:ib))/(ib-ia+1)
do i=0,NH
fil(i)=0.
if(s(i).gt.0.0) then
fil(i)=sqrt(avemid/s(i))
endif
enddo
! Default range is 240 - 4000 Hz. For narrower filters, use frequencies
! at which gain is -20 dB relative to 1500 Hz.
ia=nint(240.0/df)
ib=nint(4000.0/df)
i0=nint(1500.0/df)
do i=i0,ia,-1
if(s(i)/s(i0).lt.0.01) exit
enddo
ia=i
do i=i0,ib,1
if(s(i)/s(i0).lt.0.01) exit
enddo
ib=i
fac=fac0
do i=ia,1,-1
fac=fac*fac0
fil(i)=fac*fil(i)
enddo
fac=fac0
do i=ib,NH
fac=fac*fac0
fil(i)=fac*fil(i)
enddo
do iter=1,100 !### ??? ###
call smo121(fil,NH)
enddo
do i=0,NH
filter(i)=-60.0
if(s(i).gt.0.0) filter(i)=20.0*log10(fil(i))
enddo
il=nint(NPOLYLOW/df)
ih=nint(NPOLYHIGH/df)
nfit=ih-il+1
mode=0
nterms=5
do i=1,nfit
xfit(i)=((i+il-1)*df-1500.0)/1000.0
yfit(i)=fil(i+il-1)
sigmay(i)=1.0
enddo
call polyfit(xfit,yfit,sigmay,nfit,nterms,mode,a,chisqr)
open(16,file=fname,status='unknown')
write(16,1003) NPOLYLOW,NPOLYHIGH,nterms,a
1003 format(3i5,5e25.16)
do i=1,NH
freq=i*df
ref(i)=db(s(i)/avemid)
write(16,1005) freq,s(i),ref(i),fil(i),filter(i)
1005 format(f10.3,e12.3,f12.6,e12.3,f12.6)
enddo
close(16)
endif
return
endif
if(buseref) then
if(blastuse.neqv.buseref) then !just enabled so read filter
fil=1.0
open(16,file=fname,status='old',err=110)
read(16,1003,err=20,end=100) ndummy,ndummy,nterms,a
goto 30
20 rewind(16) !allow for old style refspec.dat with no header
30 do i=1,NH
read(16,1005,err=100,end=100) freq,s(i),ref(i),fil(i),filter(i)
enddo
100 close(16)
110 continue
endif
x0=id2(1:NH)
x(0:NH-1)=x0s !Previous 2nd half to new 1st half
x(NH:NFFT-1)=x0 !New 2nd half
x0s=x0 !Save the new 2nd half
x=w*x !Apply window
call four2a(x,NFFT,1,-1,0) !r2c FFT (to frequency domain)
cx=fil*cx
call four2a(cx,NFFT,1,1,-1) !c2r FFT (back to time domain)
x1=x1s + x(0:NH-1) !Add previous segment's 2nd half
id2(1:NH)=nint(x1)
x1s=x(NH:NFFT-1) !Save the new 2nd half
endif
blastuse=buseref
return
end subroutine refspectrum
@@ -0,0 +1,15 @@
// chrono.hpp --------------------------------------------------------------//
// Copyright 2009-2011 Vicente J. Botet Escriba
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
#ifndef BOOST_CHRONO_CHRONO_HPP
#define BOOST_CHRONO_CHRONO_HPP
#include <boost/chrono/duration.hpp>
#include <boost/chrono/time_point.hpp>
#include <boost/chrono/system_clocks.hpp>
#endif // BOOST_CHRONO_CHRONO_HPP
@@ -0,0 +1,18 @@
// Copyright (C) 2003, Fernando Luis Cacciola Carballal.
//
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/optional for documentation.
//
// You are welcome to contact the author at:
// fernando_cacciola@hotmail.com
//
#ifndef BOOST_OPTIONAL_FLC_19NOV2002_HPP
#define BOOST_OPTIONAL_FLC_19NOV2002_HPP
#include "boost/optional/optional.hpp"
#endif
@@ -0,0 +1,343 @@
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// Preprocessed version of "boost/mpl/aux_/reverse_fold_impl.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl { namespace aux {
/// forward declaration
template<
long N
, typename First
, typename Last
, typename State
, typename BackwardOp
, typename ForwardOp
>
struct reverse_fold_impl;
template< long N >
struct reverse_fold_chunk;
template<> struct reverse_fold_chunk<0>
{
template<
typename First
, typename Last
, typename State
, typename BackwardOp
, typename ForwardOp
>
struct result_
{
typedef First iter0;
typedef State fwd_state0;
typedef fwd_state0 bkwd_state0;
typedef bkwd_state0 state;
typedef iter0 iterator;
};
/// ETI workaround
template<> struct result_< int,int,int,int,int >
{
typedef int state;
typedef int iterator;
};
};
template<> struct reverse_fold_chunk<1>
{
template<
typename First
, typename Last
, typename State
, typename BackwardOp
, typename ForwardOp
>
struct result_
{
typedef First iter0;
typedef State fwd_state0;
typedef typename apply2< ForwardOp, fwd_state0, typename deref<iter0>::type >::type fwd_state1;
typedef typename mpl::next<iter0>::type iter1;
typedef fwd_state1 bkwd_state1;
typedef typename apply2< BackwardOp, bkwd_state1, typename deref<iter0>::type >::type bkwd_state0;
typedef bkwd_state0 state;
typedef iter1 iterator;
};
/// ETI workaround
template<> struct result_< int,int,int,int,int >
{
typedef int state;
typedef int iterator;
};
};
template<> struct reverse_fold_chunk<2>
{
template<
typename First
, typename Last
, typename State
, typename BackwardOp
, typename ForwardOp
>
struct result_
{
typedef First iter0;
typedef State fwd_state0;
typedef typename apply2< ForwardOp, fwd_state0, typename deref<iter0>::type >::type fwd_state1;
typedef typename mpl::next<iter0>::type iter1;
typedef typename apply2< ForwardOp, fwd_state1, typename deref<iter1>::type >::type fwd_state2;
typedef typename mpl::next<iter1>::type iter2;
typedef fwd_state2 bkwd_state2;
typedef typename apply2< BackwardOp, bkwd_state2, typename deref<iter1>::type >::type bkwd_state1;
typedef typename apply2< BackwardOp, bkwd_state1, typename deref<iter0>::type >::type bkwd_state0;
typedef bkwd_state0 state;
typedef iter2 iterator;
};
/// ETI workaround
template<> struct result_< int,int,int,int,int >
{
typedef int state;
typedef int iterator;
};
};
template<> struct reverse_fold_chunk<3>
{
template<
typename First
, typename Last
, typename State
, typename BackwardOp
, typename ForwardOp
>
struct result_
{
typedef First iter0;
typedef State fwd_state0;
typedef typename apply2< ForwardOp, fwd_state0, typename deref<iter0>::type >::type fwd_state1;
typedef typename mpl::next<iter0>::type iter1;
typedef typename apply2< ForwardOp, fwd_state1, typename deref<iter1>::type >::type fwd_state2;
typedef typename mpl::next<iter1>::type iter2;
typedef typename apply2< ForwardOp, fwd_state2, typename deref<iter2>::type >::type fwd_state3;
typedef typename mpl::next<iter2>::type iter3;
typedef fwd_state3 bkwd_state3;
typedef typename apply2< BackwardOp, bkwd_state3, typename deref<iter2>::type >::type bkwd_state2;
typedef typename apply2< BackwardOp, bkwd_state2, typename deref<iter1>::type >::type bkwd_state1;
typedef typename apply2< BackwardOp, bkwd_state1, typename deref<iter0>::type >::type bkwd_state0;
typedef bkwd_state0 state;
typedef iter3 iterator;
};
/// ETI workaround
template<> struct result_< int,int,int,int,int >
{
typedef int state;
typedef int iterator;
};
};
template<> struct reverse_fold_chunk<4>
{
template<
typename First
, typename Last
, typename State
, typename BackwardOp
, typename ForwardOp
>
struct result_
{
typedef First iter0;
typedef State fwd_state0;
typedef typename apply2< ForwardOp, fwd_state0, typename deref<iter0>::type >::type fwd_state1;
typedef typename mpl::next<iter0>::type iter1;
typedef typename apply2< ForwardOp, fwd_state1, typename deref<iter1>::type >::type fwd_state2;
typedef typename mpl::next<iter1>::type iter2;
typedef typename apply2< ForwardOp, fwd_state2, typename deref<iter2>::type >::type fwd_state3;
typedef typename mpl::next<iter2>::type iter3;
typedef typename apply2< ForwardOp, fwd_state3, typename deref<iter3>::type >::type fwd_state4;
typedef typename mpl::next<iter3>::type iter4;
typedef fwd_state4 bkwd_state4;
typedef typename apply2< BackwardOp, bkwd_state4, typename deref<iter3>::type >::type bkwd_state3;
typedef typename apply2< BackwardOp, bkwd_state3, typename deref<iter2>::type >::type bkwd_state2;
typedef typename apply2< BackwardOp, bkwd_state2, typename deref<iter1>::type >::type bkwd_state1;
typedef typename apply2< BackwardOp, bkwd_state1, typename deref<iter0>::type >::type bkwd_state0;
typedef bkwd_state0 state;
typedef iter4 iterator;
};
/// ETI workaround
template<> struct result_< int,int,int,int,int >
{
typedef int state;
typedef int iterator;
};
};
template< long N >
struct reverse_fold_chunk
{
template<
typename First
, typename Last
, typename State
, typename BackwardOp
, typename ForwardOp
>
struct result_
{
typedef First iter0;
typedef State fwd_state0;
typedef typename apply2< ForwardOp, fwd_state0, typename deref<iter0>::type >::type fwd_state1;
typedef typename mpl::next<iter0>::type iter1;
typedef typename apply2< ForwardOp, fwd_state1, typename deref<iter1>::type >::type fwd_state2;
typedef typename mpl::next<iter1>::type iter2;
typedef typename apply2< ForwardOp, fwd_state2, typename deref<iter2>::type >::type fwd_state3;
typedef typename mpl::next<iter2>::type iter3;
typedef typename apply2< ForwardOp, fwd_state3, typename deref<iter3>::type >::type fwd_state4;
typedef typename mpl::next<iter3>::type iter4;
typedef reverse_fold_impl<
( (N - 4) < 0 ? 0 : N - 4 )
, iter4
, Last
, fwd_state4
, BackwardOp
, ForwardOp
> nested_chunk;
typedef typename nested_chunk::state bkwd_state4;
typedef typename apply2< BackwardOp, bkwd_state4, typename deref<iter3>::type >::type bkwd_state3;
typedef typename apply2< BackwardOp, bkwd_state3, typename deref<iter2>::type >::type bkwd_state2;
typedef typename apply2< BackwardOp, bkwd_state2, typename deref<iter1>::type >::type bkwd_state1;
typedef typename apply2< BackwardOp, bkwd_state1, typename deref<iter0>::type >::type bkwd_state0;
typedef bkwd_state0 state;
typedef typename nested_chunk::iterator iterator;
};
};
template<
typename First
, typename Last
, typename State
, typename BackwardOp
, typename ForwardOp
>
struct reverse_fold_step;
template<
typename Last
, typename State
>
struct reverse_fold_null_step
{
typedef Last iterator;
typedef State state;
};
template<>
struct reverse_fold_chunk< -1 >
{
template<
typename First
, typename Last
, typename State
, typename BackwardOp
, typename ForwardOp
>
struct result_
{
typedef typename if_<
typename is_same< First,Last >::type
, reverse_fold_null_step< Last,State >
, reverse_fold_step< First,Last,State,BackwardOp,ForwardOp >
>::type res_;
typedef typename res_::state state;
typedef typename res_::iterator iterator;
};
/// ETI workaround
template<> struct result_< int,int,int,int,int >
{
typedef int state;
typedef int iterator;
};
};
template<
typename First
, typename Last
, typename State
, typename BackwardOp
, typename ForwardOp
>
struct reverse_fold_step
{
typedef reverse_fold_chunk< -1 >::template result_<
typename mpl::next<First>::type
, Last
, typename apply2<ForwardOp,State, typename deref<First>::type>::type
, BackwardOp
, ForwardOp
> nested_step;
typedef typename apply2<
BackwardOp
, typename nested_step::state
, typename deref<First>::type
>::type state;
typedef typename nested_step::iterator iterator;
};
template<
long N
, typename First
, typename Last
, typename State
, typename BackwardOp
, typename ForwardOp
>
struct reverse_fold_impl
: reverse_fold_chunk<N>
::template result_< First,Last,State,BackwardOp,ForwardOp >
{
};
}}}
@@ -0,0 +1,149 @@
// Copyright Aleksey Gurtovoy 2000-2004
// Copyright Jaap Suter 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)
//
// Preprocessed version of "boost/mpl/bitand.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl {
template<
typename Tag1
, typename Tag2
, BOOST_MPL_AUX_NTTP_DECL(int, tag1_) = BOOST_MPL_AUX_MSVC_VALUE_WKND(Tag1)::value
, BOOST_MPL_AUX_NTTP_DECL(int, tag2_) = BOOST_MPL_AUX_MSVC_VALUE_WKND(Tag2)::value
>
struct bitand_impl
: if_c<
( tag1_ > tag2_ )
, aux::cast2nd_impl< bitand_impl< Tag1,Tag1 >,Tag1, Tag2 >
, aux::cast1st_impl< bitand_impl< Tag2,Tag2 >,Tag1, Tag2 >
>::type
{
};
/// for Digital Mars C++/compilers with no CTPS/TTP support
template<> struct bitand_impl< na,na >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template<> struct bitand_impl< na,integral_c_tag >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template<> struct bitand_impl< integral_c_tag,na >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename T > struct bitand_tag
{
typedef typename T::tag type;
};
/// forward declaration
template<
typename BOOST_MPL_AUX_NA_PARAM(N1)
, typename BOOST_MPL_AUX_NA_PARAM(N2)
>
struct bitand_2;
template<
typename BOOST_MPL_AUX_NA_PARAM(N1)
, typename BOOST_MPL_AUX_NA_PARAM(N2)
, typename N3 = na, typename N4 = na, typename N5 = na
>
struct bitand_
: if_<
is_na<N3>
, bitand_2< N1,N2 >
, bitand_<
bitand_2< N1,N2 >
, N3, N4, N5
>
>::type
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(
5
, bitand_
, ( N1, N2, N3, N4, N5 )
)
};
template<
typename N1
, typename N2
>
struct bitand_2
: aux::msvc_eti_base< typename apply_wrap2<
bitand_impl<
typename bitand_tag<N1>::type
, typename bitand_tag<N2>::type
>
, N1
, N2
>::type >::type
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(2, bitand_2, (N1, N2))
};
BOOST_MPL_AUX_NA_SPEC2(2, 5, bitand_)
}}
namespace boost { namespace mpl {
namespace aux {
template< typename T, T n1, T n2 >
struct bitand_wknd
{
BOOST_STATIC_CONSTANT(T, value = (n1 & n2));
typedef integral_c< T,value > type;
};
}
template<>
struct bitand_impl< integral_c_tag,integral_c_tag >
{
template< typename N1, typename N2 > struct apply
: aux::bitand_wknd<
typename aux::largest_int<
typename N1::value_type
, typename N2::value_type
>::type
, N1::value
, N2::value
>::type
{
};
};
}}
@@ -0,0 +1,23 @@
/*==============================================================================
Copyright (c) 2005-2010 Joel de Guzman
Copyright (c) 2010 Thomas Heller
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#ifndef BOOST_PHOENIX_OPERATOR_HPP
#define BOOST_PHOENIX_OPERATOR_HPP
#include <boost/phoenix/version.hpp>
#include <boost/phoenix/operator/arithmetic.hpp>
#include <boost/phoenix/operator/bitwise.hpp>
#include <boost/phoenix/operator/comparison.hpp>
#include <boost/phoenix/operator/if_else.hpp>
#include <boost/phoenix/operator/self.hpp>
#include <boost/phoenix/operator/logical.hpp>
#include <boost/phoenix/operator/io.hpp>
#include <boost/phoenix/operator/member.hpp>
#include <boost/phoenix/scope/local_variable.hpp> // to fix 5824
#endif
@@ -0,0 +1,38 @@
#ifndef BOOST_MPL_FIND_HPP_INCLUDED
#define BOOST_MPL_FIND_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2000-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/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#include <boost/mpl/find_if.hpp>
#include <boost/mpl/same_as.hpp>
#include <boost/mpl/aux_/na_spec.hpp>
#include <boost/mpl/aux_/lambda_support.hpp>
namespace boost { namespace mpl {
template<
typename BOOST_MPL_AUX_NA_PARAM(Sequence)
, typename BOOST_MPL_AUX_NA_PARAM(T)
>
struct find
: find_if< Sequence,same_as<T> >
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(2,find,(Sequence,T))
};
BOOST_MPL_AUX_NA_SPEC(2, find)
}}
#endif // BOOST_MPL_FIND_HPP_INCLUDED
@@ -0,0 +1,50 @@
/* Boost interval/detail/c99_rounding_control.hpp file
*
* Copyright 2000 Jens Maurer
* Copyright 2002 Hervé Brönnimann, Guillaume Melquiond, Sylvain Pion
*
* 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_INTERVAL_DETAIL_C99_ROUNDING_CONTROL_HPP
#define BOOST_NUMERIC_INTERVAL_DETAIL_C99_ROUNDING_CONTROL_HPP
#include <boost/numeric/interval/detail/c99sub_rounding_control.hpp>
namespace boost {
namespace numeric {
namespace interval_lib {
template<>
struct rounding_control<float>:
detail::c99_rounding_control
{
static float force_rounding(float const &r)
{ volatile float r_ = r; return r_; }
};
template<>
struct rounding_control<double>:
detail::c99_rounding_control
{
static double force_rounding(double const &r)
{ volatile double r_ = r; return r_; }
};
template<>
struct rounding_control<long double>:
detail::c99_rounding_control
{
static long double force_rounding(long double const &r)
{ volatile long double r_ = r; return r_; }
};
} // namespace interval_lib
} // namespace numeric
} // namespace boost
#undef BOOST_NUMERIC_INTERVAL_NO_HARDWARE
#endif // BOOST_NUMERIC_INTERVAL_DETAIL_C99_ROUNDING_CONTROL_HPP
@@ -0,0 +1,170 @@
//---------------------------------------------------------------------------//
// Copyright (c) 2014 Roshan <thisisroshansmail@gmail.com>
//
// Distributed under the Boost Software License, Version 1.0
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
// See http://boostorg.github.com/compute for more information.
//---------------------------------------------------------------------------//
#ifndef BOOST_COMPUTE_ALGORITHM_NEXT_PERMUTATION_HPP
#define BOOST_COMPUTE_ALGORITHM_NEXT_PERMUTATION_HPP
#include <iterator>
#include <boost/compute/system.hpp>
#include <boost/compute/command_queue.hpp>
#include <boost/compute/container/detail/scalar.hpp>
#include <boost/compute/algorithm/reverse.hpp>
namespace boost {
namespace compute {
namespace detail {
///
/// \brief Helper function for next_permutation
///
/// To find rightmost element which is smaller
/// than its next element
///
template<class InputIterator>
inline InputIterator next_permutation_helper(InputIterator first,
InputIterator last,
command_queue &queue)
{
typedef typename std::iterator_traits<InputIterator>::value_type value_type;
size_t count = detail::iterator_range_size(first, last);
if(count == 0 || count == 1){
return last;
}
count = count - 1;
const context &context = queue.get_context();
detail::meta_kernel k("next_permutation");
size_t index_arg = k.add_arg<int *>(memory_object::global_memory, "index");
atomic_max<int_> atomic_max_int;
k << k.decl<const int_>("i") << " = get_global_id(0);\n"
<< k.decl<const value_type>("cur_value") << "="
<< first[k.var<const int_>("i")] << ";\n"
<< k.decl<const value_type>("next_value") << "="
<< first[k.expr<const int_>("i+1")] << ";\n"
<< "if(cur_value < next_value){\n"
<< " " << atomic_max_int(k.var<int_ *>("index"), k.var<int_>("i")) << ";\n"
<< "}\n";
kernel kernel = k.compile(context);
scalar<int_> index(context);
kernel.set_arg(index_arg, index.get_buffer());
index.write(static_cast<int_>(-1), queue);
queue.enqueue_1d_range_kernel(kernel, 0, count, 0);
int result = static_cast<int>(index.read(queue));
if(result == -1) return last;
else return first + result;
}
///
/// \brief Helper function for next_permutation
///
/// To find the smallest element to the right of the element found above
/// that is greater than it
///
template<class InputIterator, class ValueType>
inline InputIterator np_ceiling(InputIterator first,
InputIterator last,
ValueType value,
command_queue &queue)
{
typedef typename std::iterator_traits<InputIterator>::value_type value_type;
size_t count = detail::iterator_range_size(first, last);
if(count == 0){
return last;
}
const context &context = queue.get_context();
detail::meta_kernel k("np_ceiling");
size_t index_arg = k.add_arg<int *>(memory_object::global_memory, "index");
size_t value_arg = k.add_arg<value_type>(memory_object::private_memory, "value");
atomic_max<int_> atomic_max_int;
k << k.decl<const int_>("i") << " = get_global_id(0);\n"
<< k.decl<const value_type>("cur_value") << "="
<< first[k.var<const int_>("i")] << ";\n"
<< "if(cur_value <= " << first[k.expr<int_>("*index")]
<< " && cur_value > value){\n"
<< " " << atomic_max_int(k.var<int_ *>("index"), k.var<int_>("i")) << ";\n"
<< "}\n";
kernel kernel = k.compile(context);
scalar<int_> index(context);
kernel.set_arg(index_arg, index.get_buffer());
index.write(static_cast<int_>(0), queue);
kernel.set_arg(value_arg, value);
queue.enqueue_1d_range_kernel(kernel, 0, count, 0);
int result = static_cast<int>(index.read(queue));
return first + result;
}
} // end detail namespace
///
/// \brief Permutation generating algorithm
///
/// Transforms the range [first, last) into the next permutation from the
/// set of all permutations arranged in lexicographic order
/// \return Boolean value signifying if the last permutation was crossed
/// and the range was reset
///
/// \param first Iterator pointing to start of range
/// \param last Iterator pointing to end of range
/// \param queue Queue on which to execute
///
template<class InputIterator>
inline bool next_permutation(InputIterator first,
InputIterator last,
command_queue &queue = system::default_queue())
{
typedef typename std::iterator_traits<InputIterator>::value_type value_type;
if(first == last) return false;
InputIterator first_element =
detail::next_permutation_helper(first, last, queue);
if(first_element == last)
{
reverse(first, last, queue);
return false;
}
value_type first_value = first_element.read(queue);
InputIterator ceiling_element =
detail::np_ceiling(first_element + 1, last, first_value, queue);
value_type ceiling_value = ceiling_element.read(queue);
first_element.write(ceiling_value, queue);
ceiling_element.write(first_value, queue);
reverse(first_element + 1, last, queue);
return true;
}
} // end compute namespace
} // end boost namespace
#endif // BOOST_COMPUTE_ALGORITHM_NEXT_PERMUTATION_HPP
@@ -0,0 +1,20 @@
This directory contains the resources necessary to build the WSJT-X
samples database. The CMake build script creates a directory structure
ready for upload to the project samples web or ftp file server. The
CMake script also defines a build target 'upload-samples' which
uploads the sample database to the the destination defined by the
project CMake variable PROJECT_SAMPLES_UPLOAD_DEST (defined in the
project root CMake script). A suitably authorized user may use this
target to update the server with the latest samples.
The samples database includes a JSON contents file for each
major/minor version combination of WSJT-X, this file is generated by
CMake and should not be manually edited.
To add new samples simply add the files here and update the
SAMPLE_FILES list variable in the CMakeLists.txt file in this
directory. Sample files must be checked into source control. A
meaningful directory structure is advisable, the same directory
structure will be replicated by the WSJT-X sample downloader dialog
allowing WSJT-X users to easily identify wath each sample file
contains.
@@ -0,0 +1,137 @@
#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED
#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
//
// detail/sp_counted_base_pt.hpp
//
// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
// Copyright 2004-2005 Peter Dimov
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/assert.hpp>
#include <pthread.h>
namespace boost
{
namespace detail
{
class sp_counted_base
{
private:
sp_counted_base( sp_counted_base const & );
sp_counted_base & operator= ( sp_counted_base const & );
long use_count_; // #shared
long weak_count_; // #weak + (#shared != 0)
mutable pthread_mutex_t m_;
public:
sp_counted_base(): use_count_( 1 ), weak_count_( 1 )
{
// HPUX 10.20 / DCE has a nonstandard pthread_mutex_init
#if defined(__hpux) && defined(_DECTHREADS_)
BOOST_VERIFY( pthread_mutex_init( &m_, pthread_mutexattr_default ) == 0 );
#else
BOOST_VERIFY( pthread_mutex_init( &m_, 0 ) == 0 );
#endif
}
virtual ~sp_counted_base() // nothrow
{
BOOST_VERIFY( pthread_mutex_destroy( &m_ ) == 0 );
}
// dispose() is called when use_count_ drops to zero, to release
// the resources managed by *this.
virtual void dispose() = 0; // nothrow
// destroy() is called when weak_count_ drops to zero.
virtual void destroy() // nothrow
{
delete this;
}
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_untyped_deleter() = 0;
void add_ref_copy()
{
BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 );
++use_count_;
BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 );
}
bool add_ref_lock() // true on success
{
BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 );
bool r = use_count_ == 0? false: ( ++use_count_, true );
BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 );
return r;
}
void release() // nothrow
{
BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 );
long new_use_count = --use_count_;
BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 );
if( new_use_count == 0 )
{
dispose();
weak_release();
}
}
void weak_add_ref() // nothrow
{
BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 );
++weak_count_;
BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 );
}
void weak_release() // nothrow
{
BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 );
long new_weak_count = --weak_count_;
BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 );
if( new_weak_count == 0 )
{
destroy();
}
}
long use_count() const // nothrow
{
BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 );
long r = use_count_;
BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 );
return r;
}
};
} // namespace detail
} // namespace boost
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED