Initial Commit
This commit is contained in:
@@ -0,0 +1,217 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-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 regex_search.hpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Provides regex_search implementation.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_REGEX_V4_REGEX_SEARCH_HPP
|
||||
#define BOOST_REGEX_V4_REGEX_SEARCH_HPP
|
||||
|
||||
|
||||
namespace boost{
|
||||
|
||||
#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
|
||||
|
||||
template <class BidiIterator, class Allocator, class charT, class traits>
|
||||
bool regex_search(BidiIterator first, BidiIterator last,
|
||||
match_results<BidiIterator, Allocator>& m,
|
||||
const basic_regex<charT, traits>& e,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
return regex_search(first, last, m, e, flags, first);
|
||||
}
|
||||
|
||||
template <class BidiIterator, class Allocator, class charT, class traits>
|
||||
bool regex_search(BidiIterator first, BidiIterator last,
|
||||
match_results<BidiIterator, Allocator>& m,
|
||||
const basic_regex<charT, traits>& e,
|
||||
match_flag_type flags,
|
||||
BidiIterator base)
|
||||
{
|
||||
if(e.flags() & regex_constants::failbit)
|
||||
return false;
|
||||
|
||||
BOOST_REGEX_DETAIL_NS::perl_matcher<BidiIterator, Allocator, traits> matcher(first, last, m, e, flags, base);
|
||||
return matcher.find();
|
||||
}
|
||||
|
||||
//
|
||||
// regex_search convenience interfaces:
|
||||
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
//
|
||||
// this isn't really a partial specialisation, but template function
|
||||
// overloading - if the compiler doesn't support partial specialisation
|
||||
// then it really won't support this either:
|
||||
template <class charT, class Allocator, class traits>
|
||||
inline bool regex_search(const charT* str,
|
||||
match_results<const charT*, Allocator>& m,
|
||||
const basic_regex<charT, traits>& e,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
return regex_search(str, str + traits::length(str), m, e, flags);
|
||||
}
|
||||
|
||||
template <class ST, class SA, class Allocator, class charT, class traits>
|
||||
inline bool regex_search(const std::basic_string<charT, ST, SA>& s,
|
||||
match_results<typename std::basic_string<charT, ST, SA>::const_iterator, Allocator>& m,
|
||||
const basic_regex<charT, traits>& e,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
return regex_search(s.begin(), s.end(), m, e, flags);
|
||||
}
|
||||
#else // partial overloads:
|
||||
inline bool regex_search(const char* str,
|
||||
cmatch& m,
|
||||
const regex& e,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
return regex_search(str, str + regex::traits_type::length(str), m, e, flags);
|
||||
}
|
||||
inline bool regex_search(const char* first, const char* last,
|
||||
const regex& e,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
cmatch m;
|
||||
return regex_search(first, last, m, e, flags | regex_constants::match_any);
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
inline bool regex_search(const wchar_t* str,
|
||||
wcmatch& m,
|
||||
const wregex& e,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
return regex_search(str, str + wregex::traits_type::length(str), m, e, flags);
|
||||
}
|
||||
inline bool regex_search(const wchar_t* first, const wchar_t* last,
|
||||
const wregex& e,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
wcmatch m;
|
||||
return regex_search(first, last, m, e, flags | regex_constants::match_any);
|
||||
}
|
||||
#endif
|
||||
inline bool regex_search(const std::string& s,
|
||||
smatch& m,
|
||||
const regex& e,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
return regex_search(s.begin(), s.end(), m, e, flags);
|
||||
}
|
||||
#if !defined(BOOST_NO_WREGEX)
|
||||
inline bool regex_search(const std::basic_string<wchar_t>& s,
|
||||
wsmatch& m,
|
||||
const wregex& e,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
return regex_search(s.begin(), s.end(), m, e, flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
template <class BidiIterator, class charT, class traits>
|
||||
bool regex_search(BidiIterator first, BidiIterator last,
|
||||
const basic_regex<charT, traits>& e,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
if(e.flags() & regex_constants::failbit)
|
||||
return false;
|
||||
|
||||
match_results<BidiIterator> m;
|
||||
typedef typename match_results<BidiIterator>::allocator_type match_alloc_type;
|
||||
BOOST_REGEX_DETAIL_NS::perl_matcher<BidiIterator, match_alloc_type, traits> matcher(first, last, m, e, flags | regex_constants::match_any, first);
|
||||
return matcher.find();
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
template <class charT, class traits>
|
||||
inline bool regex_search(const charT* str,
|
||||
const basic_regex<charT, traits>& e,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
return regex_search(str, str + traits::length(str), e, flags);
|
||||
}
|
||||
|
||||
template <class ST, class SA, class charT, class traits>
|
||||
inline bool regex_search(const std::basic_string<charT, ST, SA>& s,
|
||||
const basic_regex<charT, traits>& e,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
return regex_search(s.begin(), s.end(), e, flags);
|
||||
}
|
||||
#else // non-template function overloads
|
||||
inline bool regex_search(const char* str,
|
||||
const regex& e,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
cmatch m;
|
||||
return regex_search(str, str + regex::traits_type::length(str), m, e, flags | regex_constants::match_any);
|
||||
}
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
inline bool regex_search(const wchar_t* str,
|
||||
const wregex& e,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
wcmatch m;
|
||||
return regex_search(str, str + wregex::traits_type::length(str), m, e, flags | regex_constants::match_any);
|
||||
}
|
||||
#endif
|
||||
inline bool regex_search(const std::string& s,
|
||||
const regex& e,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
smatch m;
|
||||
return regex_search(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
|
||||
}
|
||||
#if !defined(BOOST_NO_WREGEX)
|
||||
inline bool regex_search(const std::basic_string<wchar_t>& s,
|
||||
const wregex& e,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
wsmatch m;
|
||||
return regex_search(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
|
||||
}
|
||||
|
||||
#endif // BOOST_NO_WREGEX
|
||||
|
||||
#endif // partial overload
|
||||
|
||||
#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
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_REGEX_V4_REGEX_SEARCH_HPP
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
// See http://boostorg.github.com/compute for more information.
|
||||
//---------------------------------------------------------------------------//
|
||||
|
||||
#ifndef BOOST_COMPUTE_TYPES_HPP
|
||||
#define BOOST_COMPUTE_TYPES_HPP
|
||||
|
||||
/// \file
|
||||
///
|
||||
/// Meta-header to include all Boost.Compute types headers.
|
||||
|
||||
#include <boost/compute/types/complex.hpp>
|
||||
#include <boost/compute/types/fundamental.hpp>
|
||||
#include <boost/compute/types/pair.hpp>
|
||||
#include <boost/compute/types/struct.hpp>
|
||||
#include <boost/compute/types/tuple.hpp>
|
||||
|
||||
#endif // BOOST_COMPUTE_TYPES_HPP
|
||||
@@ -0,0 +1,47 @@
|
||||
#ifndef BOOST_ARCHIVE_DETAIL_AUTO_LINK_WARCHIVE_HPP
|
||||
#define BOOST_ARCHIVE_DETAIL_AUTO_LINK_WARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// auto_link_warchive.hpp
|
||||
//
|
||||
// (c) Copyright Robert Ramey 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/serialization
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
// This header implements separate compilation features as described in
|
||||
// http://www.boost.org/more/separate_compilation.html
|
||||
|
||||
// enable automatic library variant selection ------------------------------//
|
||||
|
||||
#include <boost/archive/detail/decl.hpp>
|
||||
|
||||
#if !defined(BOOST_WARCHIVE_SOURCE) \
|
||||
&& !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_SERIALIZATION_NO_LIB)
|
||||
|
||||
// Set the name of our library, this will get undef'ed by auto_link.hpp
|
||||
// once it's done with it:
|
||||
//
|
||||
#define BOOST_LIB_NAME boost_wserialization
|
||||
//
|
||||
// If we're importing code from a dll, then tell auto_link.hpp about it:
|
||||
//
|
||||
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK)
|
||||
# define BOOST_DYN_LINK
|
||||
#endif
|
||||
//
|
||||
// And include the header that does the work:
|
||||
//
|
||||
#include <boost/config/auto_link.hpp>
|
||||
#endif // auto-linking disabled
|
||||
|
||||
#endif // ARCHIVE_DETAIL_AUTO_LINK_ARCHIVE_HPP
|
||||
@@ -0,0 +1,26 @@
|
||||
// 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
|
||||
|
||||
#ifndef BOOST_FUNCTION_PROLOGUE_HPP
|
||||
#define BOOST_FUNCTION_PROLOGUE_HPP
|
||||
# include <cassert>
|
||||
# include <algorithm>
|
||||
# include <boost/config/no_tr1/functional.hpp> // unary_function, binary_function
|
||||
# include <boost/throw_exception.hpp>
|
||||
# include <boost/config.hpp>
|
||||
# include <boost/function/function_base.hpp>
|
||||
# include <boost/mem_fn.hpp>
|
||||
# include <boost/type_traits/is_integral.hpp>
|
||||
# include <boost/preprocessor/enum.hpp>
|
||||
# include <boost/preprocessor/enum_params.hpp>
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <boost/preprocessor/repeat.hpp>
|
||||
# include <boost/preprocessor/inc.hpp>
|
||||
# include <boost/type_traits/is_void.hpp>
|
||||
#endif // BOOST_FUNCTION_PROLOGUE_HPP
|
||||
@@ -0,0 +1,94 @@
|
||||
=== AP Decoding
|
||||
|
||||
With the QRA64 decoder Nico Palermo, IV3NWV, introduced a technique
|
||||
for decoding with the aid of information that naturally accumulates
|
||||
during a minimal QSO. This _a priori_ (AP) information can be
|
||||
used to increase the sensitivity of the decoder.
|
||||
|
||||
When an operator decides to answer a CQ, he already knows his own
|
||||
callsign and that of his potential QSO partner. He therefore knows
|
||||
what to expect for at least 56 of the 72 message bits in a
|
||||
standard-format response to his call. The _WSJT-X_ decoders for QRA64
|
||||
and FT8 can use these AP bits to decode messages containing them with
|
||||
higher sensitivity than otherwise possible.
|
||||
|
||||
We have implemented AP decoding in slightly different ways in QRA64
|
||||
and FT8. To provide some explicit examples for users, we provide here
|
||||
a brief description of the FT8 behavior.
|
||||
|
||||
The FT8 decoder always tries first to decode a signal without using
|
||||
any AP information. If this attempt fails, and if *Enable AP* is
|
||||
checked on the *Decode* menu, a second attempt hypothesizes that the
|
||||
message contains callsigns MyCall and DxCall. If the QSO has
|
||||
progressed to the point where signal reports have been exchanged, a
|
||||
third attempt hypothesizes that the message contains the known
|
||||
callsigns followed by RRR, RR73, or 73.
|
||||
|
||||
AP decoding attempts effectively set the AP bits to the hypothesized
|
||||
values, as if they had been received perfectly. The decoder then
|
||||
proceeds to determine whether the remaining message and parity bits
|
||||
are consistent with the hypothesized AP bits. If a codeword is found
|
||||
that the decoder judges to have high (but not overwhelmingly high)
|
||||
probability of being correct, a ? character is appended when the
|
||||
decoded message is displayed. Decodes thus marked are not sent to
|
||||
{pskreporter} to avoid occasional misleading spots of false decodes.
|
||||
|
||||
Successful AP decodes are always labeled with an end-of-line indicator
|
||||
of the form aP, where P is one of the single-digit AP decoding types
|
||||
listed in Table 1. For example, an a2 designator says that the
|
||||
successful decode used MyCall as hypothetically known information.
|
||||
|
||||
[[AP_INFO_TABLE]]
|
||||
.AP information types
|
||||
[width="35%",cols="h10,<m20",frame=topbot,options="header"]
|
||||
|===============================================
|
||||
|P | Message components
|
||||
|1 | CQ     ?     ?
|
||||
|2 | MyCall     ?     ?
|
||||
|3 | MyCall DxCall     ?
|
||||
|4 | MyCall DxCall RRR
|
||||
|5 | MyCall DxCall 73
|
||||
|6 | MyCall DxCall RR73
|
||||
|===============================================
|
||||
|
||||
=== Decoded Lines
|
||||
|
||||
Displayed information accompanying decoded messages generally includes UTC,
|
||||
signal-to-noise ratio in dB, time offset DT in seconds, and
|
||||
audio frequency in Hz. Some modes include additional information such
|
||||
as frequency offset from nominal (DF), frequency drift (Drift or F1),
|
||||
or distance (km or mi).
|
||||
|
||||
There may also be some cryptic characters with special meanings
|
||||
summarized in the following Table:
|
||||
|
||||
[[DECODED_LINES_TABLE]]
|
||||
.Notations used on decoded text lines
|
||||
[width="50%",cols="h,3*^",frame=topbot,options="header"]
|
||||
|===========================================
|
||||
|Mode |Mode character|Sync character|End of line information
|
||||
|FT8 | ~ | | ?   aP
|
||||
|JT4 | $ | *, # | f, fN, dNC
|
||||
|JT9 | @ | |
|
||||
|JT65 | # | |
|
||||
|JT65 VHF| # | *, # | f, fN, dNC
|
||||
|QRA64 | : | * | R
|
||||
|ISCAT | | * | M N C T
|
||||
|MSK144 | & | | N
|
||||
|===========================================
|
||||
Sync character::
|
||||
`*` - Normal sync +
|
||||
`#` - Alternate sync
|
||||
|
||||
End of line information::
|
||||
`?` - Decoded with lower confidence +
|
||||
`a` - Decoded with aid of some a priori (AP) information +
|
||||
`C` - Confidence indicator [ISCAT and Deep Search; (0-9,*)] +
|
||||
`d` - Deep Search algorithm +
|
||||
`f` - Franke-Taylor or Fano algorithm +
|
||||
`M` - Message length (characters) +
|
||||
`N` - Number of Rx intervals or frames averaged +
|
||||
`P` - Number indicating type of AP information (Table 1, above) +
|
||||
`R` - Return code from QRA64 decoder +
|
||||
`T` - Length of analyzed region (s)
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
// (C) Copyright John Maddock 2006.
|
||||
// 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_MATH_SF_CBRT_HPP
|
||||
#define BOOST_MATH_SF_CBRT_HPP
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/math/tools/rational.hpp>
|
||||
#include <boost/math/policies/error_handling.hpp>
|
||||
#include <boost/math/special_functions/math_fwd.hpp>
|
||||
#include <boost/math/special_functions/fpclassify.hpp>
|
||||
#include <boost/mpl/divides.hpp>
|
||||
#include <boost/mpl/plus.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
|
||||
namespace boost{ namespace math{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
struct big_int_type
|
||||
{
|
||||
operator boost::uintmax_t()const;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct largest_cbrt_int_type
|
||||
{
|
||||
typedef typename mpl::if_<
|
||||
boost::is_convertible<big_int_type, T>,
|
||||
boost::uintmax_t,
|
||||
unsigned int
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template <class T, class Policy>
|
||||
T cbrt_imp(T z, const Policy& pol)
|
||||
{
|
||||
BOOST_MATH_STD_USING
|
||||
//
|
||||
// cbrt approximation for z in the range [0.5,1]
|
||||
// It's hard to say what number of terms gives the optimum
|
||||
// trade off between precision and performance, this seems
|
||||
// to be about the best for double precision.
|
||||
//
|
||||
// Maximum Deviation Found: 1.231e-006
|
||||
// Expected Error Term: -1.231e-006
|
||||
// Maximum Relative Change in Control Points: 5.982e-004
|
||||
//
|
||||
static const T P[] = {
|
||||
static_cast<T>(0.37568269008611818),
|
||||
static_cast<T>(1.3304968705558024),
|
||||
static_cast<T>(-1.4897101632445036),
|
||||
static_cast<T>(1.2875573098219835),
|
||||
static_cast<T>(-0.6398703759826468),
|
||||
static_cast<T>(0.13584489959258635),
|
||||
};
|
||||
static const T correction[] = {
|
||||
static_cast<T>(0.62996052494743658238360530363911), // 2^-2/3
|
||||
static_cast<T>(0.79370052598409973737585281963615), // 2^-1/3
|
||||
static_cast<T>(1),
|
||||
static_cast<T>(1.2599210498948731647672106072782), // 2^1/3
|
||||
static_cast<T>(1.5874010519681994747517056392723), // 2^2/3
|
||||
};
|
||||
|
||||
if(!(boost::math::isfinite)(z))
|
||||
{
|
||||
return policies::raise_domain_error("boost::math::cbrt<%1%>(%1%)", "Argument to function must be finite but got %1%.", z, pol);
|
||||
}
|
||||
|
||||
int i_exp, sign(1);
|
||||
if(z < 0)
|
||||
{
|
||||
z = -z;
|
||||
sign = -sign;
|
||||
}
|
||||
if(z == 0)
|
||||
return 0;
|
||||
|
||||
T guess = frexp(z, &i_exp);
|
||||
int original_i_exp = i_exp; // save for later
|
||||
guess = tools::evaluate_polynomial(P, guess);
|
||||
int i_exp3 = i_exp / 3;
|
||||
|
||||
typedef typename largest_cbrt_int_type<T>::type shift_type;
|
||||
|
||||
BOOST_STATIC_ASSERT( ::std::numeric_limits<shift_type>::radix == 2);
|
||||
|
||||
if(abs(i_exp3) < std::numeric_limits<shift_type>::digits)
|
||||
{
|
||||
if(i_exp3 > 0)
|
||||
guess *= shift_type(1u) << i_exp3;
|
||||
else
|
||||
guess /= shift_type(1u) << -i_exp3;
|
||||
}
|
||||
else
|
||||
{
|
||||
guess = ldexp(guess, i_exp3);
|
||||
}
|
||||
i_exp %= 3;
|
||||
guess *= correction[i_exp + 2];
|
||||
//
|
||||
// Now inline Halley iteration.
|
||||
// We do this here rather than calling tools::halley_iterate since we can
|
||||
// simplify the expressions algebraically, and don't need most of the error
|
||||
// checking of the boilerplate version as we know in advance that the function
|
||||
// is well behaved...
|
||||
//
|
||||
typedef typename policies::precision<T, Policy>::type prec;
|
||||
typedef typename mpl::divides<prec, mpl::int_<3> >::type prec3;
|
||||
typedef typename mpl::plus<prec3, mpl::int_<3> >::type new_prec;
|
||||
typedef typename policies::normalise<Policy, policies::digits2<new_prec::value> >::type new_policy;
|
||||
//
|
||||
// Epsilon calculation uses compile time arithmetic when it's available for type T,
|
||||
// otherwise uses ldexp to calculate at runtime:
|
||||
//
|
||||
T eps = (new_prec::value > 3) ? policies::get_epsilon<T, new_policy>() : ldexp(T(1), -2 - tools::digits<T>() / 3);
|
||||
T diff;
|
||||
|
||||
if(original_i_exp < std::numeric_limits<T>::max_exponent - 3)
|
||||
{
|
||||
//
|
||||
// Safe from overflow, use the fast method:
|
||||
//
|
||||
do
|
||||
{
|
||||
T g3 = guess * guess * guess;
|
||||
diff = (g3 + z + z) / (g3 + g3 + z);
|
||||
guess *= diff;
|
||||
}
|
||||
while(fabs(1 - diff) > eps);
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Either we're ready to overflow, or we can't tell because numeric_limits isn't
|
||||
// available for type T:
|
||||
//
|
||||
do
|
||||
{
|
||||
T g2 = guess * guess;
|
||||
diff = (g2 - z / guess) / (2 * guess + z / g2);
|
||||
guess -= diff;
|
||||
}
|
||||
while((guess * eps) < fabs(diff));
|
||||
}
|
||||
|
||||
return sign * guess;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <class T, class Policy>
|
||||
inline typename tools::promote_args<T>::type cbrt(T z, const Policy& pol)
|
||||
{
|
||||
typedef typename tools::promote_args<T>::type result_type;
|
||||
typedef typename policies::evaluation<result_type, Policy>::type value_type;
|
||||
return static_cast<result_type>(detail::cbrt_imp(value_type(z), pol));
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline typename tools::promote_args<T>::type cbrt(T z)
|
||||
{
|
||||
return cbrt(z, policies::policy<>());
|
||||
}
|
||||
|
||||
} // namespace math
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_MATH_SF_CBRT_HPP
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,240 @@
|
||||
#include "TransceiverBase.hpp"
|
||||
|
||||
#include <exception>
|
||||
|
||||
#include <QString>
|
||||
#include <QTimer>
|
||||
#include <QThread>
|
||||
#include <QDebug>
|
||||
|
||||
#include "moc_TransceiverBase.cpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
auto const unexpected = TransceiverBase::tr ("Unexpected rig error");
|
||||
}
|
||||
|
||||
void TransceiverBase::start (unsigned sequence_number) noexcept
|
||||
{
|
||||
QString message;
|
||||
try
|
||||
{
|
||||
may_update u {this, true};
|
||||
shutdown ();
|
||||
startup ();
|
||||
last_sequence_number_ = sequence_number;
|
||||
}
|
||||
catch (std::exception const& e)
|
||||
{
|
||||
message = e.what ();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
message = unexpected;
|
||||
}
|
||||
if (!message.isEmpty ())
|
||||
{
|
||||
offline (message);
|
||||
}
|
||||
}
|
||||
|
||||
void TransceiverBase::set (TransceiverState const& s,
|
||||
unsigned sequence_number) noexcept
|
||||
{
|
||||
TRACE_CAT ("TransceiverBase", "#:" << sequence_number << s);
|
||||
|
||||
QString message;
|
||||
try
|
||||
{
|
||||
may_update u {this, true};
|
||||
bool was_online {requested_.online ()};
|
||||
if (!s.online () && was_online)
|
||||
{
|
||||
shutdown ();
|
||||
}
|
||||
else if (s.online () && !was_online)
|
||||
{
|
||||
shutdown ();
|
||||
startup ();
|
||||
}
|
||||
if (requested_.online ())
|
||||
{
|
||||
bool ptt_on {false};
|
||||
bool ptt_off {false};
|
||||
if (s.ptt () != requested_.ptt ())
|
||||
{
|
||||
ptt_on = s.ptt ();
|
||||
ptt_off = !s.ptt ();
|
||||
}
|
||||
if (ptt_off)
|
||||
{
|
||||
do_ptt (false);
|
||||
do_post_ptt (false);
|
||||
QThread::msleep (100); // some rigs cannot process CAT
|
||||
// commands while switching from
|
||||
// Tx to Rx
|
||||
}
|
||||
if (s.frequency () // ignore bogus zero frequencies
|
||||
&& ((s.frequency () != requested_.frequency () // and QSY
|
||||
|| (s.mode () != UNK && s.mode () != requested_.mode ())) // or mode change
|
||||
|| ptt_off)) // or just returned to rx
|
||||
{
|
||||
do_frequency (s.frequency (), s.mode (), ptt_off);
|
||||
do_post_frequency (s.frequency (), s.mode ());
|
||||
|
||||
// record what actually changed
|
||||
requested_.frequency (actual_.frequency ());
|
||||
requested_.mode (actual_.mode ());
|
||||
}
|
||||
if (!s.tx_frequency () || s.tx_frequency () > 10000) // ignore bogus startup values
|
||||
{
|
||||
if ((s.tx_frequency () != requested_.tx_frequency () // and QSY
|
||||
|| (s.mode () != UNK && s.mode () != requested_.mode ())) // or mode change
|
||||
// || s.split () != requested_.split ())) // or split change
|
||||
|| (s.tx_frequency () && ptt_on)) // or about to tx split
|
||||
{
|
||||
do_tx_frequency (s.tx_frequency (), s.mode (), ptt_on);
|
||||
do_post_tx_frequency (s.tx_frequency (), s.mode ());
|
||||
|
||||
// record what actually changed
|
||||
requested_.tx_frequency (actual_.tx_frequency ());
|
||||
requested_.split (actual_.split ());
|
||||
}
|
||||
}
|
||||
if (ptt_on)
|
||||
{
|
||||
do_ptt (true);
|
||||
do_post_ptt (true);
|
||||
QThread::msleep (100); // some rigs cannot process CAT
|
||||
// commands while switching from
|
||||
// Rx to Tx
|
||||
}
|
||||
|
||||
// record what actually changed
|
||||
requested_.ptt (actual_.ptt ());
|
||||
}
|
||||
last_sequence_number_ = sequence_number;
|
||||
}
|
||||
catch (std::exception const& e)
|
||||
{
|
||||
message = e.what ();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
message = unexpected;
|
||||
}
|
||||
if (!message.isEmpty ())
|
||||
{
|
||||
offline (message);
|
||||
}
|
||||
}
|
||||
|
||||
void TransceiverBase::startup ()
|
||||
{
|
||||
Q_EMIT resolution (do_start ());
|
||||
do_post_start ();
|
||||
actual_.online (true);
|
||||
requested_.online (true);
|
||||
}
|
||||
|
||||
void TransceiverBase::shutdown ()
|
||||
{
|
||||
may_update u {this};
|
||||
if (requested_.online ())
|
||||
{
|
||||
try
|
||||
{
|
||||
// try and ensure PTT isn't left set
|
||||
do_ptt (false);
|
||||
do_post_ptt (false);
|
||||
if (requested_.split ())
|
||||
{
|
||||
// try and reset split mode
|
||||
do_tx_frequency (0, UNK, true);
|
||||
do_post_tx_frequency (0, UNK);
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// don't care about exceptions
|
||||
}
|
||||
}
|
||||
do_stop ();
|
||||
do_post_stop ();
|
||||
actual_.online (false);
|
||||
requested_.online (false);
|
||||
}
|
||||
|
||||
void TransceiverBase::stop () noexcept
|
||||
{
|
||||
QString message;
|
||||
try
|
||||
{
|
||||
shutdown ();
|
||||
}
|
||||
catch (std::exception const& e)
|
||||
{
|
||||
message = e.what ();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
message = unexpected;
|
||||
}
|
||||
if (!message.isEmpty ())
|
||||
{
|
||||
offline (message);
|
||||
}
|
||||
else
|
||||
{
|
||||
Q_EMIT finished ();
|
||||
}
|
||||
}
|
||||
|
||||
void TransceiverBase::update_rx_frequency (Frequency rx)
|
||||
{
|
||||
actual_.frequency (rx);
|
||||
requested_.frequency (rx); // track rig changes
|
||||
}
|
||||
|
||||
void TransceiverBase::update_other_frequency (Frequency tx)
|
||||
{
|
||||
actual_.tx_frequency (tx);
|
||||
}
|
||||
|
||||
void TransceiverBase::update_split (bool state)
|
||||
{
|
||||
actual_.split (state);
|
||||
}
|
||||
|
||||
void TransceiverBase::update_mode (MODE m)
|
||||
{
|
||||
actual_.mode (m);
|
||||
requested_.mode (m); // track rig changes
|
||||
}
|
||||
|
||||
void TransceiverBase::update_PTT (bool state)
|
||||
{
|
||||
actual_.ptt (state);
|
||||
}
|
||||
|
||||
void TransceiverBase::update_complete (bool force_signal)
|
||||
{
|
||||
if ((do_pre_update () && actual_ != last_) || force_signal)
|
||||
{
|
||||
Q_EMIT update (actual_, last_sequence_number_);
|
||||
last_ = actual_;
|
||||
}
|
||||
}
|
||||
|
||||
void TransceiverBase::offline (QString const& reason)
|
||||
{
|
||||
Q_EMIT failure (reason);
|
||||
try
|
||||
{
|
||||
shutdown ();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// don't care
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,400 @@
|
||||
// Boost.Assign library
|
||||
//
|
||||
// Copyright Thorsten Ottosen 2003-2004. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/assign/
|
||||
//
|
||||
|
||||
#ifndef BOOST_ASSIGN_LIST_INSERTER_HPP
|
||||
#define BOOST_ASSIGN_LIST_INSERTER_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/iteration/local.hpp>
|
||||
#include <boost/preprocessor/arithmetic/inc.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace assign_detail
|
||||
{
|
||||
template< class T >
|
||||
struct repeater
|
||||
{
|
||||
std::size_t sz;
|
||||
T val;
|
||||
|
||||
repeater( std::size_t sz_, T r ) : sz( sz_ ), val( r )
|
||||
{ }
|
||||
};
|
||||
|
||||
template< class Fun >
|
||||
struct fun_repeater
|
||||
{
|
||||
std::size_t sz;
|
||||
Fun val;
|
||||
|
||||
fun_repeater( std::size_t sz_, Fun r ) : sz( sz_ ), val( r )
|
||||
{ }
|
||||
};
|
||||
|
||||
template< class C >
|
||||
class call_push_back
|
||||
{
|
||||
C& c_;
|
||||
public:
|
||||
call_push_back( C& c ) : c_( c )
|
||||
{ }
|
||||
|
||||
template< class T >
|
||||
void operator()( T r )
|
||||
{
|
||||
c_.push_back( r );
|
||||
}
|
||||
};
|
||||
|
||||
template< class C >
|
||||
class call_push_front
|
||||
{
|
||||
C& c_;
|
||||
public:
|
||||
call_push_front( C& c ) : c_( c )
|
||||
{ }
|
||||
|
||||
template< class T >
|
||||
void operator()( T r )
|
||||
{
|
||||
c_.push_front( r );
|
||||
}
|
||||
};
|
||||
|
||||
template< class C >
|
||||
class call_push
|
||||
{
|
||||
C& c_;
|
||||
public:
|
||||
call_push( C& c ) : c_( c )
|
||||
{ }
|
||||
|
||||
template< class T >
|
||||
void operator()( T r )
|
||||
{
|
||||
c_.push( r );
|
||||
}
|
||||
};
|
||||
|
||||
template< class C >
|
||||
class call_insert
|
||||
{
|
||||
C& c_;
|
||||
public:
|
||||
call_insert( C& c ) : c_( c )
|
||||
{ }
|
||||
|
||||
template< class T >
|
||||
void operator()( T r )
|
||||
{
|
||||
c_.insert( r );
|
||||
}
|
||||
};
|
||||
|
||||
template< class C >
|
||||
class call_add_edge
|
||||
{
|
||||
C& c_;
|
||||
public:
|
||||
call_add_edge( C& c ) : c_(c)
|
||||
{ }
|
||||
|
||||
template< class T >
|
||||
void operator()( T l, T r )
|
||||
{
|
||||
add_edge( l, r, c_ );
|
||||
}
|
||||
|
||||
template< class T, class EP >
|
||||
void operator()( T l, T r, const EP& ep )
|
||||
{
|
||||
add_edge( l, r, ep, c_ );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
struct forward_n_arguments {};
|
||||
|
||||
} // namespace 'assign_detail'
|
||||
|
||||
namespace assign
|
||||
{
|
||||
|
||||
template< class T >
|
||||
inline assign_detail::repeater<T>
|
||||
repeat( std::size_t sz, T r )
|
||||
{
|
||||
return assign_detail::repeater<T>( sz, r );
|
||||
}
|
||||
|
||||
template< class Function >
|
||||
inline assign_detail::fun_repeater<Function>
|
||||
repeat_fun( std::size_t sz, Function r )
|
||||
{
|
||||
return assign_detail::fun_repeater<Function>( sz, r );
|
||||
}
|
||||
|
||||
|
||||
template< class Function, class Argument = assign_detail::forward_n_arguments >
|
||||
class list_inserter
|
||||
{
|
||||
struct single_arg_type {};
|
||||
struct n_arg_type {};
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME mpl::if_c< is_same<Argument,assign_detail::forward_n_arguments>::value,
|
||||
n_arg_type,
|
||||
single_arg_type >::type arg_type;
|
||||
|
||||
public:
|
||||
|
||||
list_inserter( Function fun ) : insert_( fun )
|
||||
{}
|
||||
|
||||
template< class Function2, class Arg >
|
||||
list_inserter( const list_inserter<Function2,Arg>& r )
|
||||
: insert_( r.fun_private() )
|
||||
{}
|
||||
|
||||
list_inserter( const list_inserter& r ) : insert_( r.insert_ )
|
||||
{}
|
||||
|
||||
list_inserter& operator()()
|
||||
{
|
||||
insert_( Argument() );
|
||||
return *this;
|
||||
}
|
||||
|
||||
template< class T >
|
||||
list_inserter& operator=( const T& r )
|
||||
{
|
||||
insert_( r );
|
||||
return *this;
|
||||
}
|
||||
|
||||
template< class T >
|
||||
list_inserter& operator=( assign_detail::repeater<T> r )
|
||||
{
|
||||
return operator,( r );
|
||||
}
|
||||
|
||||
template< class Nullary_function >
|
||||
list_inserter& operator=( const assign_detail::fun_repeater<Nullary_function>& r )
|
||||
{
|
||||
return operator,( r );
|
||||
}
|
||||
|
||||
template< class T >
|
||||
list_inserter& operator,( const T& r )
|
||||
{
|
||||
insert_( r );
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205))
|
||||
template< class T >
|
||||
list_inserter& operator,( const assign_detail::repeater<T> & r )
|
||||
{
|
||||
return repeat( r.sz, r.val );
|
||||
}
|
||||
#else
|
||||
template< class T >
|
||||
list_inserter& operator,( assign_detail::repeater<T> r )
|
||||
{
|
||||
return repeat( r.sz, r.val );
|
||||
}
|
||||
#endif
|
||||
|
||||
template< class Nullary_function >
|
||||
list_inserter& operator,( const assign_detail::fun_repeater<Nullary_function>& r )
|
||||
{
|
||||
return repeat_fun( r.sz, r.val );
|
||||
}
|
||||
|
||||
template< class T >
|
||||
list_inserter& repeat( std::size_t sz, T r )
|
||||
{
|
||||
std::size_t i = 0;
|
||||
while( i++ != sz )
|
||||
insert_( r );
|
||||
return *this;
|
||||
}
|
||||
|
||||
template< class Nullary_function >
|
||||
list_inserter& repeat_fun( std::size_t sz, Nullary_function fun )
|
||||
{
|
||||
std::size_t i = 0;
|
||||
while( i++ != sz )
|
||||
insert_( fun() );
|
||||
return *this;
|
||||
}
|
||||
|
||||
template< class SinglePassIterator >
|
||||
list_inserter& range( SinglePassIterator first,
|
||||
SinglePassIterator last )
|
||||
{
|
||||
for( ; first != last; ++first )
|
||||
insert_( *first );
|
||||
return *this;
|
||||
}
|
||||
|
||||
template< class SinglePassRange >
|
||||
list_inserter& range( const SinglePassRange& r )
|
||||
{
|
||||
return range( boost::begin(r), boost::end(r) );
|
||||
}
|
||||
|
||||
template< class T >
|
||||
list_inserter& operator()( const T& t )
|
||||
{
|
||||
insert_( t );
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef BOOST_ASSIGN_MAX_PARAMS // use user's value
|
||||
#define BOOST_ASSIGN_MAX_PARAMS 5
|
||||
#endif
|
||||
#define BOOST_ASSIGN_MAX_PARAMETERS (BOOST_ASSIGN_MAX_PARAMS - 1)
|
||||
#define BOOST_ASSIGN_PARAMS1(n) BOOST_PP_ENUM_PARAMS(n, class T)
|
||||
#define BOOST_ASSIGN_PARAMS2(n) BOOST_PP_ENUM_BINARY_PARAMS(n, T, const& t)
|
||||
#define BOOST_ASSIGN_PARAMS3(n) BOOST_PP_ENUM_PARAMS(n, t)
|
||||
|
||||
#define BOOST_PP_LOCAL_LIMITS (1, BOOST_ASSIGN_MAX_PARAMETERS)
|
||||
#define BOOST_PP_LOCAL_MACRO(n) \
|
||||
template< class T, BOOST_ASSIGN_PARAMS1(n) > \
|
||||
list_inserter& operator()(T t, BOOST_ASSIGN_PARAMS2(n) ) \
|
||||
{ \
|
||||
BOOST_PP_CAT(insert, BOOST_PP_INC(n))(t, BOOST_ASSIGN_PARAMS3(n), arg_type()); \
|
||||
return *this; \
|
||||
} \
|
||||
/**/
|
||||
|
||||
#include BOOST_PP_LOCAL_ITERATE()
|
||||
|
||||
|
||||
#define BOOST_PP_LOCAL_LIMITS (1, BOOST_ASSIGN_MAX_PARAMETERS)
|
||||
#define BOOST_PP_LOCAL_MACRO(n) \
|
||||
template< class T, BOOST_ASSIGN_PARAMS1(n) > \
|
||||
void BOOST_PP_CAT(insert, BOOST_PP_INC(n))(T const& t, BOOST_ASSIGN_PARAMS2(n), single_arg_type) \
|
||||
{ \
|
||||
insert_( Argument(t, BOOST_ASSIGN_PARAMS3(n) )); \
|
||||
} \
|
||||
/**/
|
||||
|
||||
#include BOOST_PP_LOCAL_ITERATE()
|
||||
|
||||
#define BOOST_PP_LOCAL_LIMITS (1, BOOST_ASSIGN_MAX_PARAMETERS)
|
||||
#define BOOST_PP_LOCAL_MACRO(n) \
|
||||
template< class T, BOOST_ASSIGN_PARAMS1(n) > \
|
||||
void BOOST_PP_CAT(insert, BOOST_PP_INC(n))(T const& t, BOOST_ASSIGN_PARAMS2(n), n_arg_type) \
|
||||
{ \
|
||||
insert_(t, BOOST_ASSIGN_PARAMS3(n) ); \
|
||||
} \
|
||||
/**/
|
||||
|
||||
#include BOOST_PP_LOCAL_ITERATE()
|
||||
|
||||
|
||||
Function fun_private() const
|
||||
{
|
||||
return insert_;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
list_inserter& operator=( const list_inserter& );
|
||||
Function insert_;
|
||||
};
|
||||
|
||||
template< class Function >
|
||||
inline list_inserter< Function >
|
||||
make_list_inserter( Function fun )
|
||||
{
|
||||
return list_inserter< Function >( fun );
|
||||
}
|
||||
|
||||
template< class Function, class Argument >
|
||||
inline list_inserter<Function,Argument>
|
||||
make_list_inserter( Function fun, Argument* )
|
||||
{
|
||||
return list_inserter<Function,Argument>( fun );
|
||||
}
|
||||
|
||||
template< class C >
|
||||
inline list_inserter< assign_detail::call_push_back<C>,
|
||||
BOOST_DEDUCED_TYPENAME C::value_type >
|
||||
push_back( C& c )
|
||||
{
|
||||
static BOOST_DEDUCED_TYPENAME C::value_type* p = 0;
|
||||
return make_list_inserter( assign_detail::call_push_back<C>( c ),
|
||||
p );
|
||||
}
|
||||
|
||||
template< class C >
|
||||
inline list_inserter< assign_detail::call_push_front<C>,
|
||||
BOOST_DEDUCED_TYPENAME C::value_type >
|
||||
push_front( C& c )
|
||||
{
|
||||
static BOOST_DEDUCED_TYPENAME C::value_type* p = 0;
|
||||
return make_list_inserter( assign_detail::call_push_front<C>( c ),
|
||||
p );
|
||||
}
|
||||
|
||||
template< class C >
|
||||
inline list_inserter< assign_detail::call_insert<C>,
|
||||
BOOST_DEDUCED_TYPENAME C::value_type >
|
||||
insert( C& c )
|
||||
{
|
||||
static BOOST_DEDUCED_TYPENAME C::value_type* p = 0;
|
||||
return make_list_inserter( assign_detail::call_insert<C>( c ),
|
||||
p );
|
||||
}
|
||||
|
||||
template< class C >
|
||||
inline list_inserter< assign_detail::call_push<C>,
|
||||
BOOST_DEDUCED_TYPENAME C::value_type >
|
||||
push( C& c )
|
||||
{
|
||||
static BOOST_DEDUCED_TYPENAME C::value_type* p = 0;
|
||||
return make_list_inserter( assign_detail::call_push<C>( c ),
|
||||
p );
|
||||
}
|
||||
|
||||
template< class C >
|
||||
inline list_inserter< assign_detail::call_add_edge<C> >
|
||||
add_edge( C& c )
|
||||
{
|
||||
return make_list_inserter( assign_detail::call_add_edge<C>( c ) );
|
||||
}
|
||||
|
||||
} // namespace 'assign'
|
||||
} // namespace 'boost'
|
||||
|
||||
#undef BOOST_ASSIGN_PARAMS1
|
||||
#undef BOOST_ASSIGN_PARAMS2
|
||||
#undef BOOST_ASSIGN_PARAMS3
|
||||
#undef BOOST_ASSIGN_MAX_PARAMETERS
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,87 @@
|
||||
# /* Copyright (C) 2001
|
||||
# * Housemarque Oy
|
||||
# * http://www.housemarque.com
|
||||
# *
|
||||
# * Distributed under the Boost Software License, Version 1.0. (See
|
||||
# * accompanying file LICENSE_1_0.txt or copy at
|
||||
# * http://www.boost.org/LICENSE_1_0.txt)
|
||||
# */
|
||||
#
|
||||
# /* Revised by Paul Mensonides (2002) */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# ifndef BOOST_PREPROCESSOR_REPETITION_REPEAT_FROM_TO_HPP
|
||||
# define BOOST_PREPROCESSOR_REPETITION_REPEAT_FROM_TO_HPP
|
||||
#
|
||||
# include <boost/preprocessor/arithmetic/add.hpp>
|
||||
# include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <boost/preprocessor/config/config.hpp>
|
||||
# include <boost/preprocessor/control/while.hpp>
|
||||
# include <boost/preprocessor/debug/error.hpp>
|
||||
# include <boost/preprocessor/detail/auto_rec.hpp>
|
||||
# include <boost/preprocessor/repetition/repeat.hpp>
|
||||
# include <boost/preprocessor/tuple/elem.hpp>
|
||||
# include <boost/preprocessor/tuple/rem.hpp>
|
||||
#
|
||||
# /* BOOST_PP_REPEAT_FROM_TO */
|
||||
#
|
||||
# if 0
|
||||
# define BOOST_PP_REPEAT_FROM_TO(first, last, macro, data)
|
||||
# endif
|
||||
#
|
||||
# define BOOST_PP_REPEAT_FROM_TO BOOST_PP_CAT(BOOST_PP_REPEAT_FROM_TO_, BOOST_PP_AUTO_REC(BOOST_PP_REPEAT_P, 4))
|
||||
#
|
||||
# define BOOST_PP_REPEAT_FROM_TO_1(f, l, m, dt) BOOST_PP_REPEAT_FROM_TO_D_1(BOOST_PP_AUTO_REC(BOOST_PP_WHILE_P, 256), f, l, m, dt)
|
||||
# define BOOST_PP_REPEAT_FROM_TO_2(f, l, m, dt) BOOST_PP_REPEAT_FROM_TO_D_2(BOOST_PP_AUTO_REC(BOOST_PP_WHILE_P, 256), f, l, m, dt)
|
||||
# define BOOST_PP_REPEAT_FROM_TO_3(f, l, m, dt) BOOST_PP_REPEAT_FROM_TO_D_3(BOOST_PP_AUTO_REC(BOOST_PP_WHILE_P, 256), f, l, m, dt)
|
||||
# define BOOST_PP_REPEAT_FROM_TO_4(f, l, m, dt) BOOST_PP_ERROR(0x0003)
|
||||
#
|
||||
# define BOOST_PP_REPEAT_FROM_TO_1ST BOOST_PP_REPEAT_FROM_TO_1
|
||||
# define BOOST_PP_REPEAT_FROM_TO_2ND BOOST_PP_REPEAT_FROM_TO_2
|
||||
# define BOOST_PP_REPEAT_FROM_TO_3RD BOOST_PP_REPEAT_FROM_TO_3
|
||||
#
|
||||
# /* BOOST_PP_REPEAT_FROM_TO_D */
|
||||
#
|
||||
# if 0
|
||||
# define BOOST_PP_REPEAT_FROM_TO_D(d, first, last, macro, data)
|
||||
# endif
|
||||
#
|
||||
# define BOOST_PP_REPEAT_FROM_TO_D BOOST_PP_CAT(BOOST_PP_REPEAT_FROM_TO_D_, BOOST_PP_AUTO_REC(BOOST_PP_REPEAT_P, 4))
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
|
||||
# define BOOST_PP_REPEAT_FROM_TO_D_1(d, f, l, m, dt) BOOST_PP_REPEAT_1(BOOST_PP_SUB_D(d, l, f), BOOST_PP_REPEAT_FROM_TO_M_1, (d, f, m, dt))
|
||||
# define BOOST_PP_REPEAT_FROM_TO_D_2(d, f, l, m, dt) BOOST_PP_REPEAT_2(BOOST_PP_SUB_D(d, l, f), BOOST_PP_REPEAT_FROM_TO_M_2, (d, f, m, dt))
|
||||
# define BOOST_PP_REPEAT_FROM_TO_D_3(d, f, l, m, dt) BOOST_PP_REPEAT_3(BOOST_PP_SUB_D(d, l, f), BOOST_PP_REPEAT_FROM_TO_M_3, (d, f, m, dt))
|
||||
# else
|
||||
# define BOOST_PP_REPEAT_FROM_TO_D_1(d, f, l, m, dt) BOOST_PP_REPEAT_FROM_TO_D_1_I(d, f, l, m, dt)
|
||||
# define BOOST_PP_REPEAT_FROM_TO_D_2(d, f, l, m, dt) BOOST_PP_REPEAT_FROM_TO_D_2_I(d, f, l, m, dt)
|
||||
# define BOOST_PP_REPEAT_FROM_TO_D_3(d, f, l, m, dt) BOOST_PP_REPEAT_FROM_TO_D_3_I(d, f, l, m, dt)
|
||||
# define BOOST_PP_REPEAT_FROM_TO_D_1_I(d, f, l, m, dt) BOOST_PP_REPEAT_1(BOOST_PP_SUB_D(d, l, f), BOOST_PP_REPEAT_FROM_TO_M_1, (d, f, m, dt))
|
||||
# define BOOST_PP_REPEAT_FROM_TO_D_2_I(d, f, l, m, dt) BOOST_PP_REPEAT_2(BOOST_PP_SUB_D(d, l, f), BOOST_PP_REPEAT_FROM_TO_M_2, (d, f, m, dt))
|
||||
# define BOOST_PP_REPEAT_FROM_TO_D_3_I(d, f, l, m, dt) BOOST_PP_REPEAT_3(BOOST_PP_SUB_D(d, l, f), BOOST_PP_REPEAT_FROM_TO_M_3, (d, f, m, dt))
|
||||
# endif
|
||||
#
|
||||
# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
|
||||
# define BOOST_PP_REPEAT_FROM_TO_M_1(z, n, dfmd) BOOST_PP_REPEAT_FROM_TO_M_1_IM(z, n, BOOST_PP_TUPLE_REM_4 dfmd)
|
||||
# define BOOST_PP_REPEAT_FROM_TO_M_2(z, n, dfmd) BOOST_PP_REPEAT_FROM_TO_M_2_IM(z, n, BOOST_PP_TUPLE_REM_4 dfmd)
|
||||
# define BOOST_PP_REPEAT_FROM_TO_M_3(z, n, dfmd) BOOST_PP_REPEAT_FROM_TO_M_3_IM(z, n, BOOST_PP_TUPLE_REM_4 dfmd)
|
||||
# define BOOST_PP_REPEAT_FROM_TO_M_1_IM(z, n, im) BOOST_PP_REPEAT_FROM_TO_M_1_I(z, n, im)
|
||||
# define BOOST_PP_REPEAT_FROM_TO_M_2_IM(z, n, im) BOOST_PP_REPEAT_FROM_TO_M_2_I(z, n, im)
|
||||
# define BOOST_PP_REPEAT_FROM_TO_M_3_IM(z, n, im) BOOST_PP_REPEAT_FROM_TO_M_3_I(z, n, im)
|
||||
# else
|
||||
# define BOOST_PP_REPEAT_FROM_TO_M_1(z, n, dfmd) BOOST_PP_REPEAT_FROM_TO_M_1_I(z, n, BOOST_PP_TUPLE_ELEM(4, 0, dfmd), BOOST_PP_TUPLE_ELEM(4, 1, dfmd), BOOST_PP_TUPLE_ELEM(4, 2, dfmd), BOOST_PP_TUPLE_ELEM(4, 3, dfmd))
|
||||
# define BOOST_PP_REPEAT_FROM_TO_M_2(z, n, dfmd) BOOST_PP_REPEAT_FROM_TO_M_2_I(z, n, BOOST_PP_TUPLE_ELEM(4, 0, dfmd), BOOST_PP_TUPLE_ELEM(4, 1, dfmd), BOOST_PP_TUPLE_ELEM(4, 2, dfmd), BOOST_PP_TUPLE_ELEM(4, 3, dfmd))
|
||||
# define BOOST_PP_REPEAT_FROM_TO_M_3(z, n, dfmd) BOOST_PP_REPEAT_FROM_TO_M_3_I(z, n, BOOST_PP_TUPLE_ELEM(4, 0, dfmd), BOOST_PP_TUPLE_ELEM(4, 1, dfmd), BOOST_PP_TUPLE_ELEM(4, 2, dfmd), BOOST_PP_TUPLE_ELEM(4, 3, dfmd))
|
||||
# endif
|
||||
#
|
||||
# define BOOST_PP_REPEAT_FROM_TO_M_1_I(z, n, d, f, m, dt) BOOST_PP_REPEAT_FROM_TO_M_1_II(z, BOOST_PP_ADD_D(d, n, f), m, dt)
|
||||
# define BOOST_PP_REPEAT_FROM_TO_M_2_I(z, n, d, f, m, dt) BOOST_PP_REPEAT_FROM_TO_M_2_II(z, BOOST_PP_ADD_D(d, n, f), m, dt)
|
||||
# define BOOST_PP_REPEAT_FROM_TO_M_3_I(z, n, d, f, m, dt) BOOST_PP_REPEAT_FROM_TO_M_3_II(z, BOOST_PP_ADD_D(d, n, f), m, dt)
|
||||
#
|
||||
# define BOOST_PP_REPEAT_FROM_TO_M_1_II(z, n, m, dt) m(z, n, dt)
|
||||
# define BOOST_PP_REPEAT_FROM_TO_M_2_II(z, n, m, dt) m(z, n, dt)
|
||||
# define BOOST_PP_REPEAT_FROM_TO_M_3_II(z, n, m, dt) m(z, n, dt)
|
||||
#
|
||||
# endif
|
||||
@@ -0,0 +1,195 @@
|
||||
program fer65
|
||||
|
||||
! End-to-end simulator for testing JT65.
|
||||
|
||||
! Options
|
||||
! jt65sim jt65
|
||||
!----------------------------------------------------------------
|
||||
! -a aggressive
|
||||
! -d Doppler spread -d depth
|
||||
! -f Number of files -f freq
|
||||
! -m (sub)mode -m (sub)mode
|
||||
! -n number of generated sigs -n ntrials
|
||||
! -t Time offset (s) -r robust sync
|
||||
! -p Do not seed random #s -c mycall
|
||||
! -x hiscall
|
||||
! -g hisgrid
|
||||
! -X hinted-decode flags
|
||||
! -s S/N in 2500 Hz -s single-decode mode
|
||||
|
||||
implicit real*8 (a-h,o-z)
|
||||
real*8 s(7),sq(7)
|
||||
character arg*12,cmnd*100,decoded*22,submode*1,csync*1,f1*15,f2*15
|
||||
character*12 outfile
|
||||
logical syncok
|
||||
|
||||
nargs=iargc()
|
||||
if(nargs.ne.7) then
|
||||
print*,'Usage: fer65 submode fspread snr1 snr2 Navg DS iters'
|
||||
print*,'Example: fer65 C 3.0 -28 -12 8 1 1000'
|
||||
go to 999
|
||||
endif
|
||||
|
||||
call getarg(1,submode)
|
||||
call getarg(2,arg)
|
||||
read(arg,*) d
|
||||
call getarg(3,arg)
|
||||
read(arg,*) snr1
|
||||
call getarg(4,arg)
|
||||
read(arg,*) snr2
|
||||
call getarg(5,arg)
|
||||
read(arg,*) navg
|
||||
call getarg(6,arg)
|
||||
read(arg,*) nds
|
||||
call getarg(7,arg)
|
||||
read(arg,*) iters
|
||||
|
||||
write(outfile,1001) submode,d,navg,nds
|
||||
1001 format(a1,f6.2,'_',i2.2,'_',i1)
|
||||
if(outfile(2:2).eq.' ') outfile(2:2)='0'
|
||||
if(outfile(3:3).eq.' ') outfile(3:3)='0'
|
||||
|
||||
ndepth=3
|
||||
if(navg.gt.1) ndepth=ndepth+16
|
||||
if(nds.ne.0) ndepth=ndepth+32
|
||||
|
||||
dfmax=3
|
||||
if(submode.eq.'b' .or. submode.eq.'B') dfmax=6
|
||||
if(submode.eq.'c' .or. submode.eq.'C') dfmax=11
|
||||
|
||||
ntrials=1000
|
||||
naggressive=10
|
||||
|
||||
open(20,file=outfile,status='unknown')
|
||||
open(21,file='fer65.21',status='unknown')
|
||||
|
||||
write(20,1000) submode,iters,ntrials,naggressive,d,ndepth,navg,nds
|
||||
1000 format(/'JT65',a1,' Iters:',i5,' T:',i6,' Aggr:',i3, &
|
||||
' Dop:',f6.2,' Depth:',i2,' Navg:',i3,' DS:',i2)
|
||||
write(20,1002)
|
||||
1002 format(/' dB nsync ngood nbad sync dsnr ', &
|
||||
'DT Freq Nsum Width'/85('-'))
|
||||
flush(20)
|
||||
|
||||
do isnr=0,20
|
||||
snr=snr1+isnr
|
||||
if(snr.gt.snr2) exit
|
||||
nsync=0
|
||||
ngood=0
|
||||
nbad=0
|
||||
s=0.
|
||||
sq=0.
|
||||
do iter=1,iters
|
||||
write(cmnd,1010) submode,d,snr,navg
|
||||
1010 format('./jt65sim -n 1 -m ',a1,' -d',f7.2,' -s \\',f5.1,' -f',i3,' >devnull')
|
||||
call unlink('000000_????.wav')
|
||||
call system(cmnd)
|
||||
if(navg.gt.1) then
|
||||
do i=navg,2,-1
|
||||
j=2*i-1
|
||||
write(f1,1011) i
|
||||
write(f2,1011) j
|
||||
1011 format('000000_',i4.4,'.wav')
|
||||
call rename(f1,f2)
|
||||
enddo
|
||||
endif
|
||||
call unlink('decoded.txt')
|
||||
call unlink('fort.13')
|
||||
isync=0
|
||||
nsnr=0
|
||||
dt=0.
|
||||
nfreq=0
|
||||
ndrift=0
|
||||
nwidth=0
|
||||
cmnd='./jt65 -m A -a 10 -c K1ABC -f 1500 -n 1000 -d 5 -s 000000_????.wav > decoded.txt'
|
||||
cmnd(11:11)=submode
|
||||
write(cmnd(47:48),'(i2)') ndepth
|
||||
call system(cmnd)
|
||||
open(13,file='fort.13',status='old',err=20)
|
||||
do i=1,navg
|
||||
read(13,1012) nutc,isync,nsnr,dt,nfreq,ndrift,nwidth,decoded, &
|
||||
nft,nsum,nsmo
|
||||
1012 format(i4,i4,i5,f6.2,i5,i4,i3,1x,a22,5x,3i3)
|
||||
if(nft.gt.0) exit
|
||||
enddo
|
||||
close(13)
|
||||
syncok=abs(dt).lt.0.2 .and. float(abs(nfreq-1500)).lt.dfmax
|
||||
csync=' '
|
||||
if(syncok) csync='*'
|
||||
write(21,1014) nutc,isync,nsnr,dt,nfreq,ndrift,nwidth, &
|
||||
nft,nsum,nsmo,csync,decoded(1:16),nft,nsum,nsmo
|
||||
1014 format(i4,i4,i5,f6.2,i5,i4,3x,4i3,1x,a1,1x,a16,i2,2i3)
|
||||
flush(21)
|
||||
|
||||
if(syncok) then
|
||||
nsync=nsync+1
|
||||
s(1)=s(1) + isync
|
||||
sq(1)=sq(1) + isync*isync
|
||||
s(6)=s(6) + nwidth
|
||||
sq(6)=sq(6) + nwidth*nwidth
|
||||
if(decoded.eq.'K1ABC W9XYZ EN37 ') then
|
||||
ngood=ngood+1
|
||||
s(2)=s(2) + nsnr
|
||||
s(3)=s(3) + dt
|
||||
s(4)=s(4) + nfreq
|
||||
s(5)=s(5) + ndrift
|
||||
s(7)=s(7) + nsum
|
||||
|
||||
sq(2)=sq(2) + nsnr*nsnr
|
||||
sq(3)=sq(3) + dt*dt
|
||||
sq(4)=sq(4) + nfreq*nfreq
|
||||
sq(5)=sq(5) + ndrift*ndrift
|
||||
sq(7)=sq(7) + nsum*nsum
|
||||
else if(decoded.ne.' ') then
|
||||
nbad=nbad+1
|
||||
print*,'Nbad:',nbad,decoded
|
||||
endif
|
||||
endif
|
||||
20 continue
|
||||
fsync=float(nsync)/iter
|
||||
fgood=float(ngood)/iter
|
||||
fbad=float(nbad)/iter
|
||||
write(*,1020) nint(snr),iter,isync,nsnr,dt,nfreq,ndrift,nwidth,fsync, &
|
||||
fgood,fbad,decoded(1:16),nft,nsum,nsmo
|
||||
1020 format(i3,i5,i3,i4,f6.2,i5,i3,i3,2f6.3,f7.4,1x,a16,i2,2i3)
|
||||
enddo
|
||||
|
||||
if(nsync.ge.1) then
|
||||
xsync=s(1)/nsync
|
||||
xwidth=s(6)/nsync
|
||||
endif
|
||||
esync=0.
|
||||
if(nsync.ge.2) then
|
||||
esync=sqrt(sq(1)/nsync - xsync**2)
|
||||
ewidth=sqrt(sq(6)/nsync - xwidth**2)
|
||||
endif
|
||||
|
||||
if(ngood.ge.1) then
|
||||
xsnr=s(2)/ngood
|
||||
xdt=s(3)/ngood
|
||||
xfreq=s(4)/ngood
|
||||
xdrift=s(5)/ngood
|
||||
xsum=s(7)/ngood
|
||||
endif
|
||||
if(ngood.ge.2) then
|
||||
esnr=sqrt(sq(2)/ngood - xsnr**2)
|
||||
edt=sqrt(sq(3)/ngood - xdt**2)
|
||||
efreq=sqrt(sq(4)/ngood - xfreq**2)
|
||||
edrift=sqrt(sq(5)/ngood - xdrift**2)
|
||||
esum=sqrt(sq(7)/ngood - xsum**2)
|
||||
endif
|
||||
|
||||
dsnr=xsnr-snr
|
||||
dfreq=xfreq-1500.0
|
||||
if(ngood.eq.0) then
|
||||
dsnr=0.
|
||||
dfreq=0.
|
||||
endif
|
||||
write(20,1100) snr,nsync,ngood,nbad,xsync,esync,dsnr,esnr, &
|
||||
xdt,edt,dfreq,efreq,xsum,esum,xwidth,ewidth
|
||||
1100 format(f5.1,2i6,i4,2f6.1,f6.1,f5.1,f6.2,f5.2,6f5.1)
|
||||
flush(20)
|
||||
if(ngood.ge.int(0.99*iters)) exit
|
||||
enddo
|
||||
|
||||
999 end program fer65
|
||||
@@ -0,0 +1,28 @@
|
||||
/*=============================================================================
|
||||
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_MAP_LIMITS_07212005_1104)
|
||||
#define FUSION_MAP_LIMITS_07212005_1104
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/container/vector/detail/cpp03/limits.hpp>
|
||||
|
||||
#if !defined(FUSION_MAX_MAP_SIZE)
|
||||
# define FUSION_MAX_MAP_SIZE FUSION_MAX_VECTOR_SIZE
|
||||
#else
|
||||
# if FUSION_MAX_MAP_SIZE < 3
|
||||
# undef FUSION_MAX_MAP_SIZE
|
||||
# if (FUSION_MAX_VECTOR_SIZE > 10)
|
||||
# define FUSION_MAX_MAP_SIZE 10
|
||||
# else
|
||||
# define FUSION_MAX_MAP_SIZE FUSION_MAX_VECTOR_SIZE
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define FUSION_MAX_MAP_SIZE_STR BOOST_PP_STRINGIZE(BOOST_FUSION_PP_ROUND_UP(FUSION_MAX_MAP_SIZE))
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,68 @@
|
||||
// (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
|
||||
/// @brief test tools compatibility header
|
||||
///
|
||||
/// This file is used to select the test tools implementation and includes all the necessary headers
|
||||
// ***************************************************************************
|
||||
|
||||
#ifndef BOOST_TEST_TOOLS_HPP_111812GER
|
||||
#define BOOST_TEST_TOOLS_HPP_111812GER
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
// brings some compiler configuration like BOOST_PP_VARIADICS
|
||||
#include <boost/test/detail/config.hpp>
|
||||
|
||||
#include <boost/preprocessor/config/config.hpp>
|
||||
|
||||
#if defined(BOOST_NO_CXX11_VARIADIC_MACROS) \
|
||||
|| defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) \
|
||||
|| defined(BOOST_NO_CXX11_DECLTYPE)
|
||||
# define BOOST_TEST_MACRO_LIMITED_SUPPORT
|
||||
#endif
|
||||
|
||||
// Boost.Test
|
||||
// #define BOOST_TEST_NO_OLD_TOOLS
|
||||
|
||||
#if defined(BOOST_TEST_MACRO_LIMITED_SUPPORT) \
|
||||
&& ( !BOOST_PP_VARIADICS \
|
||||
|| !(__cplusplus >= 201103L) && defined(BOOST_NO_CXX11_VARIADIC_MACROS))
|
||||
# define BOOST_TEST_NO_NEW_TOOLS
|
||||
#endif
|
||||
|
||||
// #define BOOST_TEST_TOOLS_UNDER_DEBUGGER
|
||||
// #define BOOST_TEST_TOOLS_DEBUGGABLE
|
||||
|
||||
#include <boost/test/tools/context.hpp>
|
||||
|
||||
#ifndef BOOST_TEST_NO_OLD_TOOLS
|
||||
# include <boost/test/tools/old/interface.hpp>
|
||||
# include <boost/test/tools/old/impl.hpp>
|
||||
|
||||
# include <boost/test/tools/detail/print_helper.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_TEST_NO_NEW_TOOLS
|
||||
# include <boost/test/tools/interface.hpp>
|
||||
# include <boost/test/tools/assertion.hpp>
|
||||
# include <boost/test/tools/fpc_op.hpp>
|
||||
# include <boost/test/tools/collection_comparison_op.hpp>
|
||||
# include <boost/test/tools/cstring_comparison_op.hpp>
|
||||
|
||||
# include <boost/test/tools/detail/fwd.hpp>
|
||||
# include <boost/test/tools/detail/print_helper.hpp>
|
||||
# include <boost/test/tools/detail/it_pair.hpp>
|
||||
|
||||
# include <boost/test/tools/detail/bitwise_manip.hpp>
|
||||
# include <boost/test/tools/detail/tolerance_manip.hpp>
|
||||
# include <boost/test/tools/detail/per_element_manip.hpp>
|
||||
# include <boost/test/tools/detail/lexicographic_manip.hpp>
|
||||
#endif
|
||||
|
||||
#endif // BOOST_TEST_TOOLS_HPP_111812GER
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,39 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2007-2012. 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/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTERPROCESS_DETAIL_INTERPROCESS_TESTER_HPP
|
||||
#define BOOST_INTERPROCESS_DETAIL_INTERPROCESS_TESTER_HPP
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
# include <boost/config.hpp>
|
||||
#endif
|
||||
#
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
namespace interprocess{
|
||||
namespace ipcdetail{
|
||||
|
||||
class interprocess_tester
|
||||
{
|
||||
public:
|
||||
template<class T>
|
||||
static void dont_close_on_destruction(T &t)
|
||||
{ t.dont_close_on_destruction(); }
|
||||
};
|
||||
|
||||
} //namespace ipcdetail{
|
||||
} //namespace interprocess{
|
||||
} //namespace boost{
|
||||
|
||||
#endif //#ifndef BOOST_INTERPROCESS_DETAIL_INTERPROCESS_TESTER_HPP
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,75 @@
|
||||
/* boost random/vector_io.hpp header file
|
||||
*
|
||||
* Copyright Steven Watanabe 2011
|
||||
* Distributed under the Boost Software License, Version 1.0. (See
|
||||
* accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* See http://www.boost.org for most recent version including documentation.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef BOOST_RANDOM_DETAIL_VECTOR_IO_HPP
|
||||
#define BOOST_RANDOM_DETAIL_VECTOR_IO_HPP
|
||||
|
||||
#include <vector>
|
||||
#include <iosfwd>
|
||||
#include <istream>
|
||||
|
||||
namespace boost {
|
||||
namespace random {
|
||||
namespace detail {
|
||||
|
||||
template<class CharT, class Traits, class T>
|
||||
void print_vector(std::basic_ostream<CharT, Traits>& os,
|
||||
const std::vector<T>& vec)
|
||||
{
|
||||
typename std::vector<T>::const_iterator
|
||||
iter = vec.begin(),
|
||||
end = vec.end();
|
||||
os << os.widen('[');
|
||||
if(iter != end) {
|
||||
os << *iter;
|
||||
++iter;
|
||||
for(; iter != end; ++iter)
|
||||
{
|
||||
os << os.widen(' ') << *iter;
|
||||
}
|
||||
}
|
||||
os << os.widen(']');
|
||||
}
|
||||
|
||||
template<class CharT, class Traits, class T>
|
||||
void read_vector(std::basic_istream<CharT, Traits>& is, std::vector<T>& vec)
|
||||
{
|
||||
CharT ch;
|
||||
if(!(is >> ch)) {
|
||||
return;
|
||||
}
|
||||
if(ch != is.widen('[')) {
|
||||
is.putback(ch);
|
||||
is.setstate(std::ios_base::failbit);
|
||||
return;
|
||||
}
|
||||
T val;
|
||||
while(is >> std::ws >> val) {
|
||||
vec.push_back(val);
|
||||
}
|
||||
if(is.fail()) {
|
||||
is.clear();
|
||||
if(!(is >> ch)) {
|
||||
return;
|
||||
}
|
||||
if(ch != is.widen(']')) {
|
||||
is.putback(ch);
|
||||
is.setstate(std::ios_base::failbit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BOOST_RANDOM_DETAIL_VECTOR_IO_HPP
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
|
||||
// Use, modification and distribution are subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt).
|
||||
//
|
||||
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
|
||||
|
||||
#ifndef BOOST_TT_IS_OBJECT_HPP_INCLUDED
|
||||
#define BOOST_TT_IS_OBJECT_HPP_INCLUDED
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/type_traits/is_reference.hpp>
|
||||
#include <boost/type_traits/is_void.hpp>
|
||||
#include <boost/type_traits/is_function.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
template <class T> struct is_object
|
||||
: public
|
||||
integral_constant<
|
||||
bool,
|
||||
! ::boost::is_reference<T>::value && ! ::boost::is_void<T>::value && ! ::boost::is_function<T>::value >
|
||||
{};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_TT_IS_OBJECT_HPP_INCLUDED
|
||||
@@ -0,0 +1,369 @@
|
||||
|
||||
// Copyright Peter Dimov 2001
|
||||
// Copyright Aleksey Gurtovoy 2001-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_/basic_bind.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename T, typename U1, typename U2, typename U3, typename U4
|
||||
, typename U5
|
||||
>
|
||||
struct resolve_bind_arg
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<
|
||||
int N, typename U1, typename U2, typename U3, typename U4, typename U5
|
||||
>
|
||||
struct resolve_bind_arg< arg<N>, U1, U2, U3, U4, U5 >
|
||||
{
|
||||
typedef typename apply_wrap5<mpl::arg<N>, U1, U2, U3, U4, U5>::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename U1, typename U2, typename U3, typename U4
|
||||
, typename U5
|
||||
>
|
||||
struct resolve_bind_arg< bind< F,T1,T2,T3,T4,T5 >, U1, U2, U3, U4, U5 >
|
||||
{
|
||||
typedef bind< F,T1,T2,T3,T4,T5 > f_;
|
||||
typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
template<
|
||||
typename F
|
||||
>
|
||||
struct bind0
|
||||
{
|
||||
template<
|
||||
typename U1 = na, typename U2 = na, typename U3 = na
|
||||
, typename U4 = na, typename U5 = na
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
private:
|
||||
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
|
||||
|
||||
public:
|
||||
typedef typename apply_wrap0<
|
||||
f_
|
||||
>::type type;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename F, typename U1, typename U2, typename U3, typename U4
|
||||
, typename U5
|
||||
>
|
||||
struct resolve_bind_arg<
|
||||
bind0<F>, U1, U2, U3, U4, U5
|
||||
>
|
||||
{
|
||||
typedef bind0<F> f_;
|
||||
typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
BOOST_MPL_AUX_ARITY_SPEC(1, bind0)
|
||||
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(1, bind0)
|
||||
|
||||
template<
|
||||
typename F
|
||||
>
|
||||
struct bind< F,na,na,na,na,na >
|
||||
: bind0<F>
|
||||
{
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1
|
||||
>
|
||||
struct bind1
|
||||
{
|
||||
template<
|
||||
typename U1 = na, typename U2 = na, typename U3 = na
|
||||
, typename U4 = na, typename U5 = na
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
private:
|
||||
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
|
||||
typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
|
||||
|
||||
public:
|
||||
typedef typename apply_wrap1<
|
||||
f_
|
||||
, typename t1::type
|
||||
>::type type;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename U1, typename U2, typename U3
|
||||
, typename U4, typename U5
|
||||
>
|
||||
struct resolve_bind_arg<
|
||||
bind1< F,T1 >, U1, U2, U3, U4, U5
|
||||
>
|
||||
{
|
||||
typedef bind1< F,T1 > f_;
|
||||
typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
BOOST_MPL_AUX_ARITY_SPEC(2, bind1)
|
||||
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(2, bind1)
|
||||
|
||||
template<
|
||||
typename F, typename T1
|
||||
>
|
||||
struct bind< F,T1,na,na,na,na >
|
||||
: bind1< F,T1 >
|
||||
{
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2
|
||||
>
|
||||
struct bind2
|
||||
{
|
||||
template<
|
||||
typename U1 = na, typename U2 = na, typename U3 = na
|
||||
, typename U4 = na, typename U5 = na
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
private:
|
||||
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
|
||||
typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
|
||||
typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
|
||||
|
||||
public:
|
||||
typedef typename apply_wrap2<
|
||||
f_
|
||||
, typename t1::type, typename t2::type
|
||||
>::type type;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename U1, typename U2
|
||||
, typename U3, typename U4, typename U5
|
||||
>
|
||||
struct resolve_bind_arg<
|
||||
bind2< F,T1,T2 >, U1, U2, U3, U4, U5
|
||||
>
|
||||
{
|
||||
typedef bind2< F,T1,T2 > f_;
|
||||
typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
BOOST_MPL_AUX_ARITY_SPEC(3, bind2)
|
||||
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(3, bind2)
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2
|
||||
>
|
||||
struct bind< F,T1,T2,na,na,na >
|
||||
: bind2< F,T1,T2 >
|
||||
{
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3
|
||||
>
|
||||
struct bind3
|
||||
{
|
||||
template<
|
||||
typename U1 = na, typename U2 = na, typename U3 = na
|
||||
, typename U4 = na, typename U5 = na
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
private:
|
||||
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
|
||||
typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
|
||||
typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
|
||||
typedef aux::resolve_bind_arg< T3,U1,U2,U3,U4,U5 > t3;
|
||||
|
||||
public:
|
||||
typedef typename apply_wrap3<
|
||||
f_
|
||||
, typename t1::type, typename t2::type, typename t3::type
|
||||
>::type type;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename U1
|
||||
, typename U2, typename U3, typename U4, typename U5
|
||||
>
|
||||
struct resolve_bind_arg<
|
||||
bind3< F,T1,T2,T3 >, U1, U2, U3, U4, U5
|
||||
>
|
||||
{
|
||||
typedef bind3< F,T1,T2,T3 > f_;
|
||||
typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
BOOST_MPL_AUX_ARITY_SPEC(4, bind3)
|
||||
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(4, bind3)
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3
|
||||
>
|
||||
struct bind< F,T1,T2,T3,na,na >
|
||||
: bind3< F,T1,T2,T3 >
|
||||
{
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
>
|
||||
struct bind4
|
||||
{
|
||||
template<
|
||||
typename U1 = na, typename U2 = na, typename U3 = na
|
||||
, typename U4 = na, typename U5 = na
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
private:
|
||||
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
|
||||
typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
|
||||
typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
|
||||
typedef aux::resolve_bind_arg< T3,U1,U2,U3,U4,U5 > t3;
|
||||
typedef aux::resolve_bind_arg< T4,U1,U2,U3,U4,U5 > t4;
|
||||
|
||||
public:
|
||||
typedef typename apply_wrap4<
|
||||
f_
|
||||
, typename t1::type, typename t2::type, typename t3::type
|
||||
, typename t4::type
|
||||
>::type type;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename U1, typename U2, typename U3, typename U4, typename U5
|
||||
>
|
||||
struct resolve_bind_arg<
|
||||
bind4< F,T1,T2,T3,T4 >, U1, U2, U3, U4, U5
|
||||
>
|
||||
{
|
||||
typedef bind4< F,T1,T2,T3,T4 > f_;
|
||||
typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
BOOST_MPL_AUX_ARITY_SPEC(5, bind4)
|
||||
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(5, bind4)
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
>
|
||||
struct bind< F,T1,T2,T3,T4,na >
|
||||
: bind4< F,T1,T2,T3,T4 >
|
||||
{
|
||||
};
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5
|
||||
>
|
||||
struct bind5
|
||||
{
|
||||
template<
|
||||
typename U1 = na, typename U2 = na, typename U3 = na
|
||||
, typename U4 = na, typename U5 = na
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
private:
|
||||
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
|
||||
typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
|
||||
typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
|
||||
typedef aux::resolve_bind_arg< T3,U1,U2,U3,U4,U5 > t3;
|
||||
typedef aux::resolve_bind_arg< T4,U1,U2,U3,U4,U5 > t4;
|
||||
typedef aux::resolve_bind_arg< T5,U1,U2,U3,U4,U5 > t5;
|
||||
|
||||
public:
|
||||
typedef typename apply_wrap5<
|
||||
f_
|
||||
, typename t1::type, typename t2::type, typename t3::type
|
||||
, typename t4::type, typename t5::type
|
||||
>::type type;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5, typename U1, typename U2, typename U3, typename U4
|
||||
, typename U5
|
||||
>
|
||||
struct resolve_bind_arg<
|
||||
bind5< F,T1,T2,T3,T4,T5 >, U1, U2, U3, U4, U5
|
||||
>
|
||||
{
|
||||
typedef bind5< F,T1,T2,T3,T4,T5 > f_;
|
||||
typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type;
|
||||
};
|
||||
|
||||
} // namespace aux
|
||||
|
||||
BOOST_MPL_AUX_ARITY_SPEC(6, bind5)
|
||||
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(6, bind5)
|
||||
|
||||
/// primary template (not a specialization!)
|
||||
|
||||
template<
|
||||
typename F, typename T1, typename T2, typename T3, typename T4
|
||||
, typename T5
|
||||
>
|
||||
struct bind
|
||||
: bind5< F,T1,T2,T3,T4,T5 >
|
||||
{
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -0,0 +1,763 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||
//
|
||||
// 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/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_FWD_HPP
|
||||
#define BOOST_INTRUSIVE_FWD_HPP
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
# include <boost/config.hpp>
|
||||
#endif
|
||||
#
|
||||
#ifndef BOOST_CSTDINT_HPP
|
||||
# include <boost/cstdint.hpp>
|
||||
#endif
|
||||
#
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//! \file
|
||||
//! This header file forward declares most Intrusive classes.
|
||||
//!
|
||||
//! It forward declares the following containers and hooks:
|
||||
//! - boost::intrusive::slist / boost::intrusive::slist_base_hook / boost::intrusive::slist_member_hook
|
||||
//! - boost::intrusive::list / boost::intrusive::list_base_hook / boost::intrusive::list_member_hook
|
||||
//! - boost::intrusive::bstree / boost::intrusive::bs_set / boost::intrusive::bs_multiset /
|
||||
//! boost::intrusive::bs_set_base_hook / boost::intrusive::bs_set_member_hook
|
||||
//! - boost::intrusive::rbtree / boost::intrusive::set / boost::intrusive::multiset /
|
||||
//! boost::intrusive::set_base_hook / boost::intrusive::set_member_hook
|
||||
//! - boost::intrusive::avltree / boost::intrusive::avl_set / boost::intrusive::avl_multiset /
|
||||
//! boost::intrusive::avl_set_base_hook / boost::intrusive::avl_set_member_hook
|
||||
//! - boost::intrusive::splaytree / boost::intrusive::splay_set / boost::intrusive::splay_multiset
|
||||
//! - boost::intrusive::sgtree / boost::intrusive::sg_set / boost::intrusive::sg_multiset
|
||||
//! - boost::intrusive::treap / boost::intrusive::treap_set / boost::intrusive::treap_multiset
|
||||
//! - boost::intrusive::hashtable / boost::intrusive::unordered_set / boost::intrusive::unordered_multiset /
|
||||
//! boost::intrusive::unordered_set_base_hook / boost::intrusive::unordered_set_member_hook /
|
||||
//! - boost::intrusive::any_base_hook / boost::intrusive::any_member_hook
|
||||
//!
|
||||
//! It forward declares the following container or hook options:
|
||||
//! - boost::intrusive::constant_time_size / boost::intrusive::size_type / boost::intrusive::compare / boost::intrusive::equal
|
||||
//! - boost::intrusive::floating_point / boost::intrusive::priority / boost::intrusive::hash
|
||||
//! - boost::intrusive::value_traits / boost::intrusive::member_hook / boost::intrusive::function_hook / boost::intrusive::base_hook
|
||||
//! - boost::intrusive::void_pointer / boost::intrusive::tag / boost::intrusive::link_mode
|
||||
//! - boost::intrusive::optimize_size / boost::intrusive::linear / boost::intrusive::cache_last
|
||||
//! - boost::intrusive::bucket_traits / boost::intrusive::store_hash / boost::intrusive::optimize_multikey
|
||||
//! - boost::intrusive::power_2_buckets / boost::intrusive::cache_begin / boost::intrusive::compare_hash / boost::intrusive::incremental
|
||||
//!
|
||||
//! It forward declares the following value traits utilities:
|
||||
//! - boost::intrusive::value_traits / boost::intrusive::derivation_value_traits /
|
||||
//! boost::intrusive::trivial_value_traits
|
||||
//!
|
||||
//! Finally it forward declares the following general purpose utilities:
|
||||
//! - boost::intrusive::pointer_plus_bits / boost::intrusive::priority_compare.
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||
|
||||
#include <cstddef>
|
||||
#include <boost/intrusive/link_mode.hpp>
|
||||
#include <boost/intrusive/detail/workaround.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
||||
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
|
||||
# ifdef BOOST_HAS_INTPTR_T
|
||||
using ::boost::uintptr_t;
|
||||
# else
|
||||
typedef std::size_t uintptr_t;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
////////////////////////////
|
||||
// Node algorithms
|
||||
////////////////////////////
|
||||
|
||||
//Algorithms predeclarations
|
||||
template<class NodeTraits>
|
||||
class circular_list_algorithms;
|
||||
|
||||
template<class NodeTraits>
|
||||
class circular_slist_algorithms;
|
||||
|
||||
template<class NodeTraits>
|
||||
class linear_slist_algorithms;
|
||||
|
||||
template<class NodeTraits>
|
||||
class bstree_algorithms;
|
||||
|
||||
template<class NodeTraits>
|
||||
class rbtree_algorithms;
|
||||
|
||||
template<class NodeTraits>
|
||||
class avltree_algorithms;
|
||||
|
||||
template<class NodeTraits>
|
||||
class sgtree_algorithms;
|
||||
|
||||
template<class NodeTraits>
|
||||
class splaytree_algorithms;
|
||||
|
||||
template<class NodeTraits>
|
||||
class treap_algorithms;
|
||||
|
||||
////////////////////////////
|
||||
// Containers
|
||||
////////////////////////////
|
||||
|
||||
//slist
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class T
|
||||
, class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class slist;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
>
|
||||
#else
|
||||
template<class ...Options>
|
||||
#endif
|
||||
class slist_base_hook;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
>
|
||||
#else
|
||||
template<class ...Options>
|
||||
#endif
|
||||
class slist_member_hook;
|
||||
|
||||
//list
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class T
|
||||
, class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class list;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
>
|
||||
#else
|
||||
template<class ...Options>
|
||||
#endif
|
||||
class list_base_hook;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
>
|
||||
#else
|
||||
template<class ...Options>
|
||||
#endif
|
||||
class list_member_hook;
|
||||
|
||||
//rbtree/set/multiset
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class T
|
||||
, class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class rbtree;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class T
|
||||
, class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class set;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class T
|
||||
, class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class multiset;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
>
|
||||
#else
|
||||
template<class ...Options>
|
||||
#endif
|
||||
class set_base_hook;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
>
|
||||
#else
|
||||
template<class ...Options>
|
||||
#endif
|
||||
class set_member_hook;
|
||||
|
||||
//splaytree/splay_set/splay_multiset
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class T
|
||||
, class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class splaytree;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class T
|
||||
, class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class splay_set;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class T
|
||||
, class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class splay_multiset;
|
||||
|
||||
//avltree/avl_set/avl_multiset
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class T
|
||||
, class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class avltree;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class T
|
||||
, class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class avl_set;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class T
|
||||
, class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class avl_multiset;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
>
|
||||
#else
|
||||
template<class ...Options>
|
||||
#endif
|
||||
class avl_set_base_hook;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
>
|
||||
#else
|
||||
template<class ...Options>
|
||||
#endif
|
||||
class avl_set_member_hook;
|
||||
|
||||
|
||||
//treap/treap_set/treap_multiset
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class T
|
||||
, class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class treap;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class T
|
||||
, class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class treap_set;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class T
|
||||
, class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class treap_multiset;
|
||||
|
||||
//sgtree/sg_set/sg_multiset
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class T
|
||||
, class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class sgtree;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class T
|
||||
, class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class sg_set;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class T
|
||||
, class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class sg_multiset;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class T
|
||||
, class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class bstree;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class T
|
||||
, class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class bs_set;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class T
|
||||
, class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class bs_multiset;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
>
|
||||
#else
|
||||
template<class ...Options>
|
||||
#endif
|
||||
class bs_set_base_hook;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
>
|
||||
#else
|
||||
template<class ...Options>
|
||||
#endif
|
||||
class bs_set_member_hook;
|
||||
|
||||
//hashtable/unordered_set/unordered_multiset
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class T
|
||||
, class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
, class O7 = void
|
||||
, class O8 = void
|
||||
, class O9 = void
|
||||
, class O10 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class hashtable;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class T
|
||||
, class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
, class O7 = void
|
||||
, class O8 = void
|
||||
, class O9 = void
|
||||
, class O10 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class unordered_set;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class T
|
||||
, class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
, class O5 = void
|
||||
, class O6 = void
|
||||
, class O7 = void
|
||||
, class O8 = void
|
||||
, class O9 = void
|
||||
, class O10 = void
|
||||
>
|
||||
#else
|
||||
template<class T, class ...Options>
|
||||
#endif
|
||||
class unordered_multiset;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
>
|
||||
#else
|
||||
template<class ...Options>
|
||||
#endif
|
||||
class unordered_set_base_hook;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
, class O4 = void
|
||||
>
|
||||
#else
|
||||
template<class ...Options>
|
||||
#endif
|
||||
class unordered_set_member_hook;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
>
|
||||
#else
|
||||
template<class ...Options>
|
||||
#endif
|
||||
class any_base_hook;
|
||||
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template
|
||||
< class O1 = void
|
||||
, class O2 = void
|
||||
, class O3 = void
|
||||
>
|
||||
#else
|
||||
template<class ...Options>
|
||||
#endif
|
||||
class any_member_hook;
|
||||
|
||||
//Options
|
||||
|
||||
template<bool Enabled>
|
||||
struct constant_time_size;
|
||||
|
||||
template<typename SizeType>
|
||||
struct size_type;
|
||||
|
||||
template<typename Compare>
|
||||
struct compare;
|
||||
|
||||
template<bool Enabled>
|
||||
struct floating_point;
|
||||
|
||||
template<typename Equal>
|
||||
struct equal;
|
||||
|
||||
template<typename Priority>
|
||||
struct priority;
|
||||
|
||||
template<typename Hash>
|
||||
struct hash;
|
||||
|
||||
template<typename ValueTraits> struct value_traits;
|
||||
|
||||
template< typename Parent
|
||||
, typename MemberHook
|
||||
, MemberHook Parent::* PtrToMember>
|
||||
struct member_hook;
|
||||
|
||||
template<typename Functor>
|
||||
struct function_hook;
|
||||
|
||||
template<typename BaseHook>
|
||||
struct base_hook;
|
||||
|
||||
template<typename VoidPointer>
|
||||
struct void_pointer;
|
||||
|
||||
template<typename Tag>
|
||||
struct tag;
|
||||
|
||||
template<link_mode_type LinkType>
|
||||
struct link_mode;
|
||||
|
||||
template<bool Enabled> struct
|
||||
optimize_size;
|
||||
|
||||
template<bool Enabled>
|
||||
struct linear;
|
||||
|
||||
template<bool Enabled>
|
||||
struct cache_last;
|
||||
|
||||
template<typename BucketTraits>
|
||||
struct bucket_traits;
|
||||
|
||||
template<bool Enabled>
|
||||
struct store_hash;
|
||||
|
||||
template<bool Enabled>
|
||||
struct optimize_multikey;
|
||||
|
||||
template<bool Enabled>
|
||||
struct power_2_buckets;
|
||||
|
||||
template<bool Enabled>
|
||||
struct cache_begin;
|
||||
|
||||
template<bool Enabled>
|
||||
struct compare_hash;
|
||||
|
||||
template<bool Enabled>
|
||||
struct incremental;
|
||||
|
||||
//Value traits
|
||||
|
||||
template<typename ValueTraits>
|
||||
struct value_traits;
|
||||
|
||||
template< typename Parent
|
||||
, typename MemberHook
|
||||
, MemberHook Parent::* PtrToMember>
|
||||
struct member_hook;
|
||||
|
||||
template< typename Functor>
|
||||
struct function_hook;
|
||||
|
||||
template<typename BaseHook>
|
||||
struct base_hook;
|
||||
|
||||
template<class T, class NodeTraits, link_mode_type LinkMode = safe_link>
|
||||
struct derivation_value_traits;
|
||||
|
||||
template<class NodeTraits, link_mode_type LinkMode = normal_link>
|
||||
struct trivial_value_traits;
|
||||
|
||||
//Additional utilities
|
||||
|
||||
template<typename VoidPointer, std::size_t Alignment>
|
||||
struct max_pointer_plus_bits;
|
||||
|
||||
template<std::size_t Alignment>
|
||||
struct max_pointer_plus_bits<void *, Alignment>;
|
||||
|
||||
template<typename Pointer, std::size_t NumBits>
|
||||
struct pointer_plus_bits;
|
||||
|
||||
template<typename T, std::size_t NumBits>
|
||||
struct pointer_plus_bits<T *, NumBits>;
|
||||
|
||||
template<typename Ptr>
|
||||
struct pointer_traits;
|
||||
|
||||
template<typename T>
|
||||
struct pointer_traits<T *>;
|
||||
|
||||
} //namespace intrusive {
|
||||
} //namespace boost {
|
||||
|
||||
#endif //#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||
|
||||
#endif //#ifndef BOOST_INTRUSIVE_FWD_HPP
|
||||
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>548</width>
|
||||
<height>420</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>QCustomPlot plot examples</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QCustomPlot" name="customPlot" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusBar"/>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QCustomPlot</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>qcustomplot.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,133 @@
|
||||
program msk144d2
|
||||
|
||||
! Test the msk144 decoder for WSJT-X
|
||||
|
||||
use options
|
||||
use timer_module, only: timer
|
||||
use timer_impl, only: init_timer
|
||||
use readwav
|
||||
|
||||
character c
|
||||
character*80 line
|
||||
character*500 infile
|
||||
character*12 mycall,hiscall
|
||||
character*6 mygrid
|
||||
character(len=500) optarg
|
||||
|
||||
logical :: display_help=.false.
|
||||
logical*1 bShMsgs
|
||||
logical*1 bcontest
|
||||
logical*1 brxequal
|
||||
logical*1 bswl
|
||||
|
||||
type(wav_header) :: wav
|
||||
|
||||
integer*2 id2(30*12000)
|
||||
integer*2 ichunk(7*1024)
|
||||
|
||||
type (option) :: long_options(9) = [ &
|
||||
option ('ndepth',.true.,'c','ndepth',''), &
|
||||
option ('dxcall',.true.,'d','hiscall',''), &
|
||||
option ('evemode',.true.,'e','Must be used with -s.',''), &
|
||||
option ('frequency',.true.,'f','rxfreq',''), &
|
||||
option ('help',.false.,'h','Display this help message',''), &
|
||||
option ('mycall',.true.,'m','mycall',''), &
|
||||
option ('nftol',.true.,'n','nftol',''), &
|
||||
option ('rxequalize',.false.,'r','Rx Equalize',''), &
|
||||
option ('short',.false.,'s','enable Sh','') &
|
||||
]
|
||||
t0=0.0
|
||||
ndepth=3
|
||||
ntol=100
|
||||
nrxfreq=1500
|
||||
mycall=''
|
||||
mygrid='EN50WC'
|
||||
hiscall=''
|
||||
bShMsgs=.false.
|
||||
bcontest=.false.
|
||||
brxequal=.false.
|
||||
bswl=.false.
|
||||
|
||||
do
|
||||
call getopt('c:d:ef:hm:n:rs',long_options,c,optarg,narglen,nstat,noffset,nremain,.true.)
|
||||
if( nstat .ne. 0 ) then
|
||||
exit
|
||||
end if
|
||||
select case (c)
|
||||
case ('c')
|
||||
read (optarg(:narglen), *) ndepth
|
||||
case ('d')
|
||||
read (optarg(:narglen), *) hiscall
|
||||
case ('e')
|
||||
bswl=.true.
|
||||
case ('f')
|
||||
read (optarg(:narglen), *) nrxfreq
|
||||
case ('h')
|
||||
display_help = .true.
|
||||
case ('m')
|
||||
read (optarg(:narglen), *) mycall
|
||||
case ('n')
|
||||
read (optarg(:narglen), *) ntol
|
||||
case ('r')
|
||||
brxequal=.true.
|
||||
case ('s')
|
||||
bShMsgs=.true.
|
||||
end select
|
||||
end do
|
||||
|
||||
if(display_help .or. nstat.lt.0 .or. nremain.lt.1) then
|
||||
print *, ''
|
||||
print *, 'Usage: msk144d [OPTIONS] file1 [file2 ...]'
|
||||
print *, ''
|
||||
print *, ' msk144 decode pre-recorded .WAV file(s)'
|
||||
print *, ''
|
||||
print *, 'OPTIONS:'
|
||||
do i = 1, size (long_options)
|
||||
call long_options(i) % print (6)
|
||||
end do
|
||||
go to 999
|
||||
endif
|
||||
|
||||
call init_timer ('timer.out')
|
||||
call timer('msk144 ',0)
|
||||
ndecoded=0
|
||||
do ifile=noffset+1,noffset+nremain
|
||||
call get_command_argument(ifile,optarg,narglen)
|
||||
infile=optarg(:narglen)
|
||||
call timer('read ',0)
|
||||
call wav%read (infile)
|
||||
i1=index(infile,'.wav')
|
||||
if( i1 .eq. 0 ) i1=index(infile,'.WAV')
|
||||
read(infile(i1-6:i1-1),*,err=998) nutc
|
||||
inquire(FILE=infile,SIZE=isize)
|
||||
npts=min((isize-216)/2,360000)
|
||||
read(unit=wav%lun) id2(1:npts)
|
||||
close(unit=wav%lun)
|
||||
call timer('read ',1)
|
||||
|
||||
do i=1,npts-7*1024+1,7*512
|
||||
ichunk=id2(i:i+7*1024-1)
|
||||
tsec=(i-1)/12000.0
|
||||
tt=sum(float(abs(id2(i:i+7*512-1))))
|
||||
if( tt .ne. 0.0 ) then
|
||||
call mskrtd(ichunk,nutc,tsec,ntol,nrxfreq,ndepth,mycall,mygrid,hiscall,bShMsgs, &
|
||||
bcontest,brxequal,bswl,line)
|
||||
if( index(line,"&") .ne. 0 .or. &
|
||||
index(line,"^") .ne. 0 .or. &
|
||||
index(line,"!") .ne. 0 .or. &
|
||||
index(line,"@") .ne. 0 ) then
|
||||
write(*,*) line
|
||||
endif
|
||||
endif
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call timer('msk144 ',1)
|
||||
call timer('msk144 ',101)
|
||||
go to 999
|
||||
|
||||
998 print*,'Cannot read from file:'
|
||||
print*,infile
|
||||
|
||||
999 continue
|
||||
end program msk144d2
|
||||
@@ -0,0 +1,52 @@
|
||||
// Copyright (C) 2009 Trustees of Indiana University
|
||||
// Authors: Jeremiah Willcock, Andrew Lumsdaine
|
||||
|
||||
// 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/property_map for documentation.
|
||||
|
||||
#ifndef BOOST_SHARED_ARRAY_PROPERTY_MAP_HPP
|
||||
#define BOOST_SHARED_ARRAY_PROPERTY_MAP_HPP
|
||||
|
||||
#include <boost/smart_ptr/shared_array.hpp>
|
||||
#include <boost/property_map/property_map.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
template <class T, class IndexMap>
|
||||
class shared_array_property_map
|
||||
: public boost::put_get_helper<T&, shared_array_property_map<T, IndexMap> >
|
||||
{
|
||||
public:
|
||||
typedef typename property_traits<IndexMap>::key_type key_type;
|
||||
typedef T value_type;
|
||||
typedef T& reference;
|
||||
typedef boost::lvalue_property_map_tag category;
|
||||
|
||||
inline shared_array_property_map(): data(), index() {}
|
||||
|
||||
explicit inline shared_array_property_map(
|
||||
size_t n,
|
||||
const IndexMap& _id = IndexMap())
|
||||
: data(new T[n]), index(_id) {}
|
||||
|
||||
inline T& operator[](key_type v) const {
|
||||
return data[get(index, v)];
|
||||
}
|
||||
|
||||
private:
|
||||
boost::shared_array<T> data;
|
||||
IndexMap index;
|
||||
};
|
||||
|
||||
template <class T, class IndexMap>
|
||||
shared_array_property_map<T, IndexMap>
|
||||
make_shared_array_property_map(size_t n, const T&, const IndexMap& index) {
|
||||
return shared_array_property_map<T, IndexMap>(n, index);
|
||||
}
|
||||
|
||||
} // end namespace boost
|
||||
|
||||
#endif // BOOST_SHARED_ARRAY_PROPERTY_MAP_HPP
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
Copyright Rene Rivera 2008-2015
|
||||
Copyright Franz Detro 2014
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#if !defined(BOOST_PREDEF_OS_H) || defined(BOOST_PREDEF_INTERNAL_GENERATE_TESTS)
|
||||
#ifndef BOOST_PREDEF_OS_H
|
||||
#define BOOST_PREDEF_OS_H
|
||||
#endif
|
||||
|
||||
#include <boost/predef/os/aix.h>
|
||||
#include <boost/predef/os/amigaos.h>
|
||||
#include <boost/predef/os/android.h>
|
||||
#include <boost/predef/os/beos.h>
|
||||
#include <boost/predef/os/bsd.h>
|
||||
#include <boost/predef/os/cygwin.h>
|
||||
#include <boost/predef/os/haiku.h>
|
||||
#include <boost/predef/os/hpux.h>
|
||||
#include <boost/predef/os/irix.h>
|
||||
#include <boost/predef/os/ios.h>
|
||||
#include <boost/predef/os/linux.h>
|
||||
#include <boost/predef/os/macos.h>
|
||||
#include <boost/predef/os/os400.h>
|
||||
#include <boost/predef/os/qnxnto.h>
|
||||
#include <boost/predef/os/solaris.h>
|
||||
#include <boost/predef/os/unix.h>
|
||||
#include <boost/predef/os/vms.h>
|
||||
#include <boost/predef/os/windows.h>
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,14 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2010 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_INCLUDE_REVERSE_FOLD_HPP
|
||||
#define BOOST_FUSION_INCLUDE_REVERSE_FOLD_HPP
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/algorithm/iteration/reverse_fold.hpp>
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,444 @@
|
||||
// Copyright John Maddock 2007.
|
||||
// Copyright Paul A. Bristow 2007, 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_STATS_PARETO_HPP
|
||||
#define BOOST_STATS_PARETO_HPP
|
||||
|
||||
// http://en.wikipedia.org/wiki/Pareto_distribution
|
||||
// http://www.itl.nist.gov/div898/handbook/eda/section3/eda3661.htm
|
||||
// Also:
|
||||
// Weisstein, Eric W. "Pareto Distribution."
|
||||
// From MathWorld--A Wolfram Web Resource.
|
||||
// http://mathworld.wolfram.com/ParetoDistribution.html
|
||||
// Handbook of Statistical Distributions with Applications, K Krishnamoorthy, ISBN 1-58488-635-8, Chapter 23, pp 257 - 267.
|
||||
// Caution KK's a and b are the reverse of Mathworld!
|
||||
|
||||
#include <boost/math/distributions/fwd.hpp>
|
||||
#include <boost/math/distributions/complement.hpp>
|
||||
#include <boost/math/distributions/detail/common_error_handling.hpp>
|
||||
#include <boost/math/special_functions/powm1.hpp>
|
||||
|
||||
#include <utility> // for BOOST_CURRENT_VALUE?
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace math
|
||||
{
|
||||
namespace detail
|
||||
{ // Parameter checking.
|
||||
template <class RealType, class Policy>
|
||||
inline bool check_pareto_scale(
|
||||
const char* function,
|
||||
RealType scale,
|
||||
RealType* result, const Policy& pol)
|
||||
{
|
||||
if((boost::math::isfinite)(scale))
|
||||
{ // any > 0 finite value is OK.
|
||||
if (scale > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
*result = policies::raise_domain_error<RealType>(
|
||||
function,
|
||||
"Scale parameter is %1%, but must be > 0!", scale, pol);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Not finite.
|
||||
*result = policies::raise_domain_error<RealType>(
|
||||
function,
|
||||
"Scale parameter is %1%, but must be finite!", scale, pol);
|
||||
return false;
|
||||
}
|
||||
} // bool check_pareto_scale
|
||||
|
||||
template <class RealType, class Policy>
|
||||
inline bool check_pareto_shape(
|
||||
const char* function,
|
||||
RealType shape,
|
||||
RealType* result, const Policy& pol)
|
||||
{
|
||||
if((boost::math::isfinite)(shape))
|
||||
{ // Any finite value > 0 is OK.
|
||||
if (shape > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
*result = policies::raise_domain_error<RealType>(
|
||||
function,
|
||||
"Shape parameter is %1%, but must be > 0!", shape, pol);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Not finite.
|
||||
*result = policies::raise_domain_error<RealType>(
|
||||
function,
|
||||
"Shape parameter is %1%, but must be finite!", shape, pol);
|
||||
return false;
|
||||
}
|
||||
} // bool check_pareto_shape(
|
||||
|
||||
template <class RealType, class Policy>
|
||||
inline bool check_pareto_x(
|
||||
const char* function,
|
||||
RealType const& x,
|
||||
RealType* result, const Policy& pol)
|
||||
{
|
||||
if((boost::math::isfinite)(x))
|
||||
{ //
|
||||
if (x > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
*result = policies::raise_domain_error<RealType>(
|
||||
function,
|
||||
"x parameter is %1%, but must be > 0 !", x, pol);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Not finite..
|
||||
*result = policies::raise_domain_error<RealType>(
|
||||
function,
|
||||
"x parameter is %1%, but must be finite!", x, pol);
|
||||
return false;
|
||||
}
|
||||
} // bool check_pareto_x
|
||||
|
||||
template <class RealType, class Policy>
|
||||
inline bool check_pareto( // distribution parameters.
|
||||
const char* function,
|
||||
RealType scale,
|
||||
RealType shape,
|
||||
RealType* result, const Policy& pol)
|
||||
{
|
||||
return check_pareto_scale(function, scale, result, pol)
|
||||
&& check_pareto_shape(function, shape, result, pol);
|
||||
} // bool check_pareto(
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <class RealType = double, class Policy = policies::policy<> >
|
||||
class pareto_distribution
|
||||
{
|
||||
public:
|
||||
typedef RealType value_type;
|
||||
typedef Policy policy_type;
|
||||
|
||||
pareto_distribution(RealType l_scale = 1, RealType l_shape = 1)
|
||||
: m_scale(l_scale), m_shape(l_shape)
|
||||
{ // Constructor.
|
||||
RealType result = 0;
|
||||
detail::check_pareto("boost::math::pareto_distribution<%1%>::pareto_distribution", l_scale, l_shape, &result, Policy());
|
||||
}
|
||||
|
||||
RealType scale()const
|
||||
{ // AKA Xm and Wolfram b and beta
|
||||
return m_scale;
|
||||
}
|
||||
|
||||
RealType shape()const
|
||||
{ // AKA k and Wolfram a and alpha
|
||||
return m_shape;
|
||||
}
|
||||
private:
|
||||
// Data members:
|
||||
RealType m_scale; // distribution scale (xm) or beta
|
||||
RealType m_shape; // distribution shape (k) or alpha
|
||||
};
|
||||
|
||||
typedef pareto_distribution<double> pareto; // Convenience to allow pareto(2., 3.);
|
||||
|
||||
template <class RealType, class Policy>
|
||||
inline const std::pair<RealType, RealType> range(const pareto_distribution<RealType, Policy>& /*dist*/)
|
||||
{ // Range of permissible values for random variable x.
|
||||
using boost::math::tools::max_value;
|
||||
return std::pair<RealType, RealType>(static_cast<RealType>(0), max_value<RealType>()); // scale zero to + infinity.
|
||||
} // range
|
||||
|
||||
template <class RealType, class Policy>
|
||||
inline const std::pair<RealType, RealType> support(const pareto_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>(dist.scale(), max_value<RealType>() ); // scale to + infinity.
|
||||
} // support
|
||||
|
||||
template <class RealType, class Policy>
|
||||
inline RealType pdf(const pareto_distribution<RealType, Policy>& dist, const RealType& x)
|
||||
{
|
||||
BOOST_MATH_STD_USING // for ADL of std function pow.
|
||||
static const char* function = "boost::math::pdf(const pareto_distribution<%1%>&, %1%)";
|
||||
RealType scale = dist.scale();
|
||||
RealType shape = dist.shape();
|
||||
RealType result = 0;
|
||||
if(false == (detail::check_pareto_x(function, x, &result, Policy())
|
||||
&& detail::check_pareto(function, scale, shape, &result, Policy())))
|
||||
return result;
|
||||
if (x < scale)
|
||||
{ // regardless of shape, pdf is zero (or should be disallow x < scale and throw an exception?).
|
||||
return 0;
|
||||
}
|
||||
result = shape * pow(scale, shape) / pow(x, shape+1);
|
||||
return result;
|
||||
} // pdf
|
||||
|
||||
template <class RealType, class Policy>
|
||||
inline RealType cdf(const pareto_distribution<RealType, Policy>& dist, const RealType& x)
|
||||
{
|
||||
BOOST_MATH_STD_USING // for ADL of std function pow.
|
||||
static const char* function = "boost::math::cdf(const pareto_distribution<%1%>&, %1%)";
|
||||
RealType scale = dist.scale();
|
||||
RealType shape = dist.shape();
|
||||
RealType result = 0;
|
||||
|
||||
if(false == (detail::check_pareto_x(function, x, &result, Policy())
|
||||
&& detail::check_pareto(function, scale, shape, &result, Policy())))
|
||||
return result;
|
||||
|
||||
if (x <= scale)
|
||||
{ // regardless of shape, cdf is zero.
|
||||
return 0;
|
||||
}
|
||||
|
||||
// result = RealType(1) - pow((scale / x), shape);
|
||||
result = -boost::math::powm1(scale/x, shape, Policy()); // should be more accurate.
|
||||
return result;
|
||||
} // cdf
|
||||
|
||||
template <class RealType, class Policy>
|
||||
inline RealType quantile(const pareto_distribution<RealType, Policy>& dist, const RealType& p)
|
||||
{
|
||||
BOOST_MATH_STD_USING // for ADL of std function pow.
|
||||
static const char* function = "boost::math::quantile(const pareto_distribution<%1%>&, %1%)";
|
||||
RealType result = 0;
|
||||
RealType scale = dist.scale();
|
||||
RealType shape = dist.shape();
|
||||
if(false == (detail::check_probability(function, p, &result, Policy())
|
||||
&& detail::check_pareto(function, scale, shape, &result, Policy())))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
if (p == 0)
|
||||
{
|
||||
return scale; // x must be scale (or less).
|
||||
}
|
||||
if (p == 1)
|
||||
{
|
||||
return policies::raise_overflow_error<RealType>(function, 0, Policy()); // x = + infinity.
|
||||
}
|
||||
result = scale /
|
||||
(pow((1 - p), 1 / shape));
|
||||
// K. Krishnamoorthy, ISBN 1-58488-635-8 eq 23.1.3
|
||||
return result;
|
||||
} // quantile
|
||||
|
||||
template <class RealType, class Policy>
|
||||
inline RealType cdf(const complemented2_type<pareto_distribution<RealType, Policy>, RealType>& c)
|
||||
{
|
||||
BOOST_MATH_STD_USING // for ADL of std function pow.
|
||||
static const char* function = "boost::math::cdf(const pareto_distribution<%1%>&, %1%)";
|
||||
RealType result = 0;
|
||||
RealType x = c.param;
|
||||
RealType scale = c.dist.scale();
|
||||
RealType shape = c.dist.shape();
|
||||
if(false == (detail::check_pareto_x(function, x, &result, Policy())
|
||||
&& detail::check_pareto(function, scale, shape, &result, Policy())))
|
||||
return result;
|
||||
|
||||
if (x <= scale)
|
||||
{ // regardless of shape, cdf is zero, and complement is unity.
|
||||
return 1;
|
||||
}
|
||||
result = pow((scale/x), shape);
|
||||
|
||||
return result;
|
||||
} // cdf complement
|
||||
|
||||
template <class RealType, class Policy>
|
||||
inline RealType quantile(const complemented2_type<pareto_distribution<RealType, Policy>, RealType>& c)
|
||||
{
|
||||
BOOST_MATH_STD_USING // for ADL of std function pow.
|
||||
static const char* function = "boost::math::quantile(const pareto_distribution<%1%>&, %1%)";
|
||||
RealType result = 0;
|
||||
RealType q = c.param;
|
||||
RealType scale = c.dist.scale();
|
||||
RealType shape = c.dist.shape();
|
||||
if(false == (detail::check_probability(function, q, &result, Policy())
|
||||
&& detail::check_pareto(function, scale, shape, &result, Policy())))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
if (q == 1)
|
||||
{
|
||||
return scale; // x must be scale (or less).
|
||||
}
|
||||
if (q == 0)
|
||||
{
|
||||
return policies::raise_overflow_error<RealType>(function, 0, Policy()); // x = + infinity.
|
||||
}
|
||||
result = scale / (pow(q, 1 / shape));
|
||||
// K. Krishnamoorthy, ISBN 1-58488-635-8 eq 23.1.3
|
||||
return result;
|
||||
} // quantile complement
|
||||
|
||||
template <class RealType, class Policy>
|
||||
inline RealType mean(const pareto_distribution<RealType, Policy>& dist)
|
||||
{
|
||||
RealType result = 0;
|
||||
static const char* function = "boost::math::mean(const pareto_distribution<%1%>&, %1%)";
|
||||
if(false == detail::check_pareto(function, dist.scale(), dist.shape(), &result, Policy()))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
if (dist.shape() > RealType(1))
|
||||
{
|
||||
return dist.shape() * dist.scale() / (dist.shape() - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
using boost::math::tools::max_value;
|
||||
return max_value<RealType>(); // +infinity.
|
||||
}
|
||||
} // mean
|
||||
|
||||
template <class RealType, class Policy>
|
||||
inline RealType mode(const pareto_distribution<RealType, Policy>& dist)
|
||||
{
|
||||
return dist.scale();
|
||||
} // mode
|
||||
|
||||
template <class RealType, class Policy>
|
||||
inline RealType median(const pareto_distribution<RealType, Policy>& dist)
|
||||
{
|
||||
RealType result = 0;
|
||||
static const char* function = "boost::math::median(const pareto_distribution<%1%>&, %1%)";
|
||||
if(false == detail::check_pareto(function, dist.scale(), dist.shape(), &result, Policy()))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
BOOST_MATH_STD_USING
|
||||
return dist.scale() * pow(RealType(2), (1/dist.shape()));
|
||||
} // median
|
||||
|
||||
template <class RealType, class Policy>
|
||||
inline RealType variance(const pareto_distribution<RealType, Policy>& dist)
|
||||
{
|
||||
RealType result = 0;
|
||||
RealType scale = dist.scale();
|
||||
RealType shape = dist.shape();
|
||||
static const char* function = "boost::math::variance(const pareto_distribution<%1%>&, %1%)";
|
||||
if(false == detail::check_pareto(function, scale, shape, &result, Policy()))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
if (shape > 2)
|
||||
{
|
||||
result = (scale * scale * shape) /
|
||||
((shape - 1) * (shape - 1) * (shape - 2));
|
||||
}
|
||||
else
|
||||
{
|
||||
result = policies::raise_domain_error<RealType>(
|
||||
function,
|
||||
"variance is undefined for shape <= 2, but got %1%.", dist.shape(), Policy());
|
||||
}
|
||||
return result;
|
||||
} // variance
|
||||
|
||||
template <class RealType, class Policy>
|
||||
inline RealType skewness(const pareto_distribution<RealType, Policy>& dist)
|
||||
{
|
||||
BOOST_MATH_STD_USING
|
||||
RealType result = 0;
|
||||
RealType shape = dist.shape();
|
||||
static const char* function = "boost::math::pdf(const pareto_distribution<%1%>&, %1%)";
|
||||
if(false == detail::check_pareto(function, dist.scale(), shape, &result, Policy()))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
if (shape > 3)
|
||||
{
|
||||
result = sqrt((shape - 2) / shape) *
|
||||
2 * (shape + 1) /
|
||||
(shape - 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = policies::raise_domain_error<RealType>(
|
||||
function,
|
||||
"skewness is undefined for shape <= 3, but got %1%.", dist.shape(), Policy());
|
||||
}
|
||||
return result;
|
||||
} // skewness
|
||||
|
||||
template <class RealType, class Policy>
|
||||
inline RealType kurtosis(const pareto_distribution<RealType, Policy>& dist)
|
||||
{
|
||||
RealType result = 0;
|
||||
RealType shape = dist.shape();
|
||||
static const char* function = "boost::math::pdf(const pareto_distribution<%1%>&, %1%)";
|
||||
if(false == detail::check_pareto(function, dist.scale(), shape, &result, Policy()))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
if (shape > 4)
|
||||
{
|
||||
result = 3 * ((shape - 2) * (3 * shape * shape + shape + 2)) /
|
||||
(shape * (shape - 3) * (shape - 4));
|
||||
}
|
||||
else
|
||||
{
|
||||
result = policies::raise_domain_error<RealType>(
|
||||
function,
|
||||
"kurtosis_excess is undefined for shape <= 4, but got %1%.", shape, Policy());
|
||||
}
|
||||
return result;
|
||||
} // kurtosis
|
||||
|
||||
template <class RealType, class Policy>
|
||||
inline RealType kurtosis_excess(const pareto_distribution<RealType, Policy>& dist)
|
||||
{
|
||||
RealType result = 0;
|
||||
RealType shape = dist.shape();
|
||||
static const char* function = "boost::math::pdf(const pareto_distribution<%1%>&, %1%)";
|
||||
if(false == detail::check_pareto(function, dist.scale(), shape, &result, Policy()))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
if (shape > 4)
|
||||
{
|
||||
result = 6 * ((shape * shape * shape) + (shape * shape) - 6 * shape - 2) /
|
||||
(shape * (shape - 3) * (shape - 4));
|
||||
}
|
||||
else
|
||||
{
|
||||
result = policies::raise_domain_error<RealType>(
|
||||
function,
|
||||
"kurtosis_excess is undefined for shape <= 4, but got %1%.", dist.shape(), Policy());
|
||||
}
|
||||
return result;
|
||||
} // kurtosis_excess
|
||||
|
||||
} // 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_PARETO_HPP
|
||||
|
||||
|
||||
@@ -0,0 +1,296 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
// (C) Copyright Ion Gaztanaga 2006-2013
|
||||
//
|
||||
// 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/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_SLIST_HOOK_HPP
|
||||
#define BOOST_INTRUSIVE_SLIST_HOOK_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/intrusive_fwd.hpp>
|
||||
|
||||
#include <boost/intrusive/detail/slist_node.hpp>
|
||||
#include <boost/intrusive/circular_slist_algorithms.hpp>
|
||||
#include <boost/intrusive/link_mode.hpp>
|
||||
#include <boost/intrusive/options.hpp>
|
||||
#include <boost/intrusive/detail/generic_hook.hpp>
|
||||
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
||||
//! Helper metafunction to define a \c slist_base_hook that yields to the same
|
||||
//! type when the same options (either explicitly or implicitly) are used.
|
||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class ...Options>
|
||||
#else
|
||||
template<class O1 = void, class O2 = void, class O3 = void>
|
||||
#endif
|
||||
struct make_slist_base_hook
|
||||
{
|
||||
/// @cond
|
||||
typedef typename pack_options
|
||||
< hook_defaults,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
>::type packed_options;
|
||||
|
||||
typedef generic_hook
|
||||
< CircularSListAlgorithms
|
||||
, slist_node_traits<typename packed_options::void_pointer>
|
||||
, typename packed_options::tag
|
||||
, packed_options::link_mode
|
||||
, SlistBaseHookId
|
||||
> implementation_defined;
|
||||
/// @endcond
|
||||
typedef implementation_defined type;
|
||||
};
|
||||
|
||||
//! Derive a class from slist_base_hook in order to store objects in
|
||||
//! in an list. slist_base_hook holds the data necessary to maintain the
|
||||
//! list and provides an appropriate value_traits class for list.
|
||||
//!
|
||||
//! The hook admits the following options: \c tag<>, \c void_pointer<> and
|
||||
//! \c link_mode<>.
|
||||
//!
|
||||
//! \c tag<> defines a tag to identify the node.
|
||||
//! The same tag value can be used in different classes, but if a class is
|
||||
//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its
|
||||
//! unique tag.
|
||||
//!
|
||||
//! \c link_mode<> will specify the linking mode of the hook (\c normal_link,
|
||||
//! \c auto_unlink or \c safe_link).
|
||||
//!
|
||||
//! \c void_pointer<> is the pointer type that will be used internally in the hook
|
||||
//! and the container configured to use this hook.
|
||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class ...Options>
|
||||
#else
|
||||
template<class O1, class O2, class O3>
|
||||
#endif
|
||||
class slist_base_hook
|
||||
: public make_slist_base_hook<
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
>::type
|
||||
{
|
||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||
public:
|
||||
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
|
||||
//! initializes the node to an unlinked state.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
slist_base_hook();
|
||||
|
||||
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
|
||||
//! initializes the node to an unlinked state. The argument is ignored.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Rationale</b>: Providing a copy-constructor
|
||||
//! makes classes using the hook STL-compliant without forcing the
|
||||
//! user to do some additional work. \c swap can be used to emulate
|
||||
//! move-semantics.
|
||||
slist_base_hook(const slist_base_hook& );
|
||||
|
||||
//! <b>Effects</b>: Empty function. The argument is ignored.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Rationale</b>: Providing an assignment operator
|
||||
//! makes classes using the hook STL-compliant without forcing the
|
||||
//! user to do some additional work. \c swap can be used to emulate
|
||||
//! move-semantics.
|
||||
slist_base_hook& operator=(const slist_base_hook& );
|
||||
|
||||
//! <b>Effects</b>: If link_mode is \c normal_link, the destructor does
|
||||
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
||||
//! object is stored in an slist an assertion is raised. If link_mode is
|
||||
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
~slist_base_hook();
|
||||
|
||||
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
||||
//! related to those nodes in one or two containers. That is, if the node
|
||||
//! this is part of the element e1, the node x is part of the element e2
|
||||
//! and both elements are included in the containers s1 and s2, then after
|
||||
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
||||
//! at the position of e1. If one element is not in a container, then
|
||||
//! after the swap-operation the other element is not in a container.
|
||||
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
void swap_nodes(slist_base_hook &other);
|
||||
|
||||
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
||||
//!
|
||||
//! <b>Returns</b>: true, if the node belongs to a container, false
|
||||
//! otherwise. This function can be used to test whether \c slist::iterator_to
|
||||
//! will return a valid iterator.
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant
|
||||
bool is_linked() const;
|
||||
|
||||
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
||||
//! This function is only allowed if link_mode is \c auto_unlink.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
void unlink();
|
||||
#endif
|
||||
};
|
||||
|
||||
//! Helper metafunction to define a \c slist_member_hook that yields to the same
|
||||
//! type when the same options (either explicitly or implicitly) are used.
|
||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class ...Options>
|
||||
#else
|
||||
template<class O1 = void, class O2 = void, class O3 = void>
|
||||
#endif
|
||||
struct make_slist_member_hook
|
||||
{
|
||||
/// @cond
|
||||
typedef typename pack_options
|
||||
< hook_defaults,
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
>::type packed_options;
|
||||
|
||||
typedef generic_hook
|
||||
< CircularSListAlgorithms
|
||||
, slist_node_traits<typename packed_options::void_pointer>
|
||||
, member_tag
|
||||
, packed_options::link_mode
|
||||
, NoBaseHookId
|
||||
> implementation_defined;
|
||||
/// @endcond
|
||||
typedef implementation_defined type;
|
||||
};
|
||||
|
||||
//! Put a public data member slist_member_hook in order to store objects of this class in
|
||||
//! an list. slist_member_hook holds the data necessary for maintaining the list and
|
||||
//! provides an appropriate value_traits class for list.
|
||||
//!
|
||||
//! The hook admits the following options: \c void_pointer<> and
|
||||
//! \c link_mode<>.
|
||||
//!
|
||||
//! \c link_mode<> will specify the linking mode of the hook (\c normal_link,
|
||||
//! \c auto_unlink or \c safe_link).
|
||||
//!
|
||||
//! \c void_pointer<> is the pointer type that will be used internally in the hook
|
||||
//! and the container configured to use this hook.
|
||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
template<class ...Options>
|
||||
#else
|
||||
template<class O1, class O2, class O3>
|
||||
#endif
|
||||
class slist_member_hook
|
||||
: public make_slist_member_hook<
|
||||
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
|
||||
O1, O2, O3
|
||||
#else
|
||||
Options...
|
||||
#endif
|
||||
>::type
|
||||
{
|
||||
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
|
||||
public:
|
||||
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
|
||||
//! initializes the node to an unlinked state.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
slist_member_hook();
|
||||
|
||||
//! <b>Effects</b>: If link_mode is \c auto_unlink or \c safe_link
|
||||
//! initializes the node to an unlinked state. The argument is ignored.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Rationale</b>: Providing a copy-constructor
|
||||
//! makes classes using the hook STL-compliant without forcing the
|
||||
//! user to do some additional work. \c swap can be used to emulate
|
||||
//! move-semantics.
|
||||
slist_member_hook(const slist_member_hook& );
|
||||
|
||||
//! <b>Effects</b>: Empty function. The argument is ignored.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Rationale</b>: Providing an assignment operator
|
||||
//! makes classes using the hook STL-compliant without forcing the
|
||||
//! user to do some additional work. \c swap can be used to emulate
|
||||
//! move-semantics.
|
||||
slist_member_hook& operator=(const slist_member_hook& );
|
||||
|
||||
//! <b>Effects</b>: If link_mode is \c normal_link, the destructor does
|
||||
//! nothing (ie. no code is generated). If link_mode is \c safe_link and the
|
||||
//! object is stored in an slist an assertion is raised. If link_mode is
|
||||
//! \c auto_unlink and \c is_linked() is true, the node is unlinked.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
~slist_member_hook();
|
||||
|
||||
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
|
||||
//! related to those nodes in one or two containers. That is, if the node
|
||||
//! this is part of the element e1, the node x is part of the element e2
|
||||
//! and both elements are included in the containers s1 and s2, then after
|
||||
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
|
||||
//! at the position of e1. If one element is not in a container, then
|
||||
//! after the swap-operation the other element is not in a container.
|
||||
//! Iterators to e1 and e2 related to those nodes are invalidated.
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
void swap_nodes(slist_member_hook &other);
|
||||
|
||||
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
|
||||
//!
|
||||
//! <b>Returns</b>: true, if the node belongs to a container, false
|
||||
//! otherwise. This function can be used to test whether \c slist::iterator_to
|
||||
//! will return a valid iterator.
|
||||
//!
|
||||
//! <b>Note</b>: If this member is called when the value is inserted in a
|
||||
//! slist with the option linear<true>, this function will return "false"
|
||||
//! for the last element, as it is not linked to anything (the next element is null),
|
||||
//! so use with care.
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant
|
||||
bool is_linked() const;
|
||||
|
||||
//! <b>Effects</b>: Removes the node if it's inserted in a container.
|
||||
//! This function is only allowed if link_mode is \c auto_unlink.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
void unlink();
|
||||
#endif
|
||||
};
|
||||
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_INTRUSIVE_SLIST_HOOK_HPP
|
||||
@@ -0,0 +1,97 @@
|
||||
# - Try to find FFTW3.
|
||||
# Usage: find_package(FFTW3 [COMPONENTS [single double long-double threads]])
|
||||
#
|
||||
# Variables used by this module:
|
||||
# FFTW3_ROOT_DIR - FFTW3 root directory
|
||||
# Variables defined by this module:
|
||||
# FFTW3_FOUND - system has FFTW3
|
||||
# FFTW3_INCLUDE_DIR - the FFTW3 include directory (cached)
|
||||
# FFTW3_INCLUDE_DIRS - the FFTW3 include directories
|
||||
# (identical to FFTW3_INCLUDE_DIR)
|
||||
# FFTW3[FL]?_LIBRARY - the FFTW3 library - double, single(F),
|
||||
# long-double(L) precision (cached)
|
||||
# FFTW3[FL]?_THREADS_LIBRARY - the threaded FFTW3 library - double, single(F),
|
||||
# long-double(L) precision (cached)
|
||||
# FFTW3_LIBRARIES - list of all FFTW3 libraries found
|
||||
|
||||
# Copyright (C) 2009-2010
|
||||
# ASTRON (Netherlands Institute for Radio Astronomy)
|
||||
# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
|
||||
#
|
||||
# This file is part of the LOFAR software suite.
|
||||
# The LOFAR software suite is free software: you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# The LOFAR software suite is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# $Id: FindFFTW3.cmake 15918 2010-06-25 11:12:42Z loose $
|
||||
|
||||
# Use double precision by default.
|
||||
if (FFTW3_FIND_COMPONENTS MATCHES "^$")
|
||||
set (_components double)
|
||||
else ()
|
||||
set (_components ${FFTW3_FIND_COMPONENTS})
|
||||
endif ()
|
||||
|
||||
# Loop over each component.
|
||||
set (_libraries)
|
||||
foreach (_comp ${_components})
|
||||
if (_comp STREQUAL "single")
|
||||
list (APPEND _libraries fftw3f)
|
||||
elseif (_comp STREQUAL "double")
|
||||
list (APPEND _libraries fftw3)
|
||||
elseif (_comp STREQUAL "long-double")
|
||||
list (APPEND _libraries fftw3l)
|
||||
elseif (_comp STREQUAL "threads")
|
||||
set (_use_threads ON)
|
||||
else (_comp STREQUAL "single")
|
||||
message (FATAL_ERROR "FindFFTW3: unknown component `${_comp}' specified. "
|
||||
"Valid components are `single', `double', `long-double', and `threads'.")
|
||||
endif (_comp STREQUAL "single")
|
||||
endforeach (_comp ${_components})
|
||||
|
||||
# If using threads, we need to link against threaded libraries as well - except on Windows.
|
||||
if (NOT WIN32 AND _use_threads)
|
||||
set (_thread_libs)
|
||||
foreach (_lib ${_libraries})
|
||||
list (APPEND _thread_libs ${_lib}_threads)
|
||||
endforeach (_lib ${_libraries})
|
||||
set (_libraries ${_thread_libs} ${_libraries})
|
||||
endif (NOT WIN32 AND _use_threads)
|
||||
|
||||
# Keep a list of variable names that we need to pass on to
|
||||
# find_package_handle_standard_args().
|
||||
set (_check_list)
|
||||
|
||||
# Search for all requested libraries.
|
||||
foreach (_lib ${_libraries})
|
||||
string (TOUPPER ${_lib} _LIB)
|
||||
find_library (${_LIB}_LIBRARY NAMES ${_lib} ${_lib}-3
|
||||
HINTS ${FFTW3_ROOT_DIR} PATH_SUFFIXES lib)
|
||||
mark_as_advanced (${_LIB}_LIBRARY)
|
||||
list (APPEND FFTW3_LIBRARIES ${${_LIB}_LIBRARY})
|
||||
list (APPEND _check_list ${_LIB}_LIBRARY)
|
||||
endforeach (_lib ${_libraries})
|
||||
|
||||
# Search for the header file.
|
||||
find_path (FFTW3_INCLUDE_DIR fftw3.h
|
||||
HINTS ${FFTW3_ROOT_DIR} PATH_SUFFIXES include)
|
||||
mark_as_advanced (FFTW3_INCLUDE_DIR)
|
||||
list(APPEND _check_list FFTW3_INCLUDE_DIR)
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
include (FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (FFTW3 DEFAULT_MSG ${_check_list})
|
||||
|
||||
if (FFTW3_FOUND)
|
||||
set (FFTW3_INCLUDE_DIRS ${FFTW3_INCLUDE_DIR})
|
||||
endif (FFTW3_FOUND)
|
||||
@@ -0,0 +1,114 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Thorsten Ottosen 2003-2004. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
|
||||
#ifndef BOOST_RANGE_DETAIL_IMPLEMENTATION_HELP_HPP
|
||||
#define BOOST_RANGE_DETAIL_IMPLEMENTATION_HELP_HPP
|
||||
|
||||
#include <boost/range/config.hpp>
|
||||
#include <boost/range/detail/common.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <cstddef>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
#include <wchar.h>
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range_detail
|
||||
{
|
||||
template <typename T>
|
||||
inline void boost_range_silence_warning( const T& ) { }
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// end() help
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline const char* str_end( const char* s, const char* )
|
||||
{
|
||||
return s + strlen( s );
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
inline const wchar_t* str_end( const wchar_t* s, const wchar_t* )
|
||||
{
|
||||
return s + wcslen( s );
|
||||
}
|
||||
#else
|
||||
inline const wchar_t* str_end( const wchar_t* s, const wchar_t* )
|
||||
{
|
||||
if( s == 0 || s[0] == 0 )
|
||||
return s;
|
||||
while( *++s != 0 )
|
||||
;
|
||||
return s;
|
||||
}
|
||||
#endif
|
||||
|
||||
template< class Char >
|
||||
inline Char* str_end( Char* s )
|
||||
{
|
||||
return const_cast<Char*>( str_end( s, s ) );
|
||||
}
|
||||
|
||||
template< class T, std::size_t sz >
|
||||
inline T* array_end( T BOOST_RANGE_ARRAY_REF()[sz] )
|
||||
{
|
||||
return boost_range_array + sz;
|
||||
}
|
||||
|
||||
template< class T, std::size_t sz >
|
||||
inline const T* array_end( const T BOOST_RANGE_ARRAY_REF()[sz] )
|
||||
{
|
||||
return boost_range_array + sz;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// size() help
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
template< class Char >
|
||||
inline std::size_t str_size( const Char* const& s )
|
||||
{
|
||||
return str_end( s ) - s;
|
||||
}
|
||||
|
||||
template< class T, std::size_t sz >
|
||||
inline std::size_t array_size( T BOOST_RANGE_ARRAY_REF()[sz] )
|
||||
{
|
||||
boost_range_silence_warning( boost_range_array );
|
||||
return sz;
|
||||
}
|
||||
|
||||
template< class T, std::size_t sz >
|
||||
inline std::size_t array_size( const T BOOST_RANGE_ARRAY_REF()[sz] )
|
||||
{
|
||||
boost_range_silence_warning( boost_range_array );
|
||||
return sz;
|
||||
}
|
||||
|
||||
inline bool is_same_address(const void* l, const void* r)
|
||||
{
|
||||
return l == r;
|
||||
}
|
||||
|
||||
template<class T1, class T2>
|
||||
inline bool is_same_object(const T1& l, const T2& r)
|
||||
{
|
||||
return range_detail::is_same_address(&l, &r);
|
||||
}
|
||||
|
||||
} // namespace 'range_detail'
|
||||
|
||||
} // namespace 'boost'
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright Neil Groves 2009. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
#ifndef BOOST_RANGE_ALGORITHM_REPLACE_COPY_HPP_INCLUDED
|
||||
#define BOOST_RANGE_ALGORITHM_REPLACE_COPY_HPP_INCLUDED
|
||||
|
||||
#include <boost/concept_check.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range
|
||||
{
|
||||
|
||||
/// \brief template function replace_copy
|
||||
///
|
||||
/// range-based version of the replace_copy std algorithm
|
||||
///
|
||||
/// \pre ForwardRange is a model of the ForwardRangeConcept
|
||||
template< class ForwardRange, class OutputIterator, class Value >
|
||||
inline OutputIterator
|
||||
replace_copy(const ForwardRange& rng, OutputIterator out_it, const Value& what,
|
||||
const Value& with_what)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
|
||||
return std::replace_copy(boost::begin(rng), boost::end(rng), out_it,
|
||||
what, with_what);
|
||||
}
|
||||
|
||||
} // namespace range
|
||||
using range::replace_copy;
|
||||
} // namespace boost
|
||||
|
||||
#endif // include guard
|
||||
@@ -0,0 +1,592 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2003 Joel de Guzman
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
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)
|
||||
=============================================================================*/
|
||||
#ifndef BOOST_SPIRIT_CHSET_OPERATORS_IPP
|
||||
#define BOOST_SPIRIT_CHSET_OPERATORS_IPP
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/limits.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// chset free operators implementation
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator|(chset<CharT> const& a, chset<CharT> const& b)
|
||||
{
|
||||
return chset<CharT>(a) |= b;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator-(chset<CharT> const& a, chset<CharT> const& b)
|
||||
{
|
||||
return chset<CharT>(a) -= b;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator~(chset<CharT> const& a)
|
||||
{
|
||||
return chset<CharT>(a).inverse();
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator&(chset<CharT> const& a, chset<CharT> const& b)
|
||||
{
|
||||
return chset<CharT>(a) &= b;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator^(chset<CharT> const& a, chset<CharT> const& b)
|
||||
{
|
||||
return chset<CharT>(a) ^= b;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// range <--> chset free operators implementation
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator|(chset<CharT> const& a, range<CharT> const& b)
|
||||
{
|
||||
chset<CharT> a_(a);
|
||||
a_.set(b);
|
||||
return a_;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator&(chset<CharT> const& a, range<CharT> const& b)
|
||||
{
|
||||
chset<CharT> a_(a);
|
||||
if(b.first != (std::numeric_limits<CharT>::min)()) {
|
||||
a_.clear(range<CharT>((std::numeric_limits<CharT>::min)(), b.first - 1));
|
||||
}
|
||||
if(b.last != (std::numeric_limits<CharT>::max)()) {
|
||||
a_.clear(range<CharT>(b.last + 1, (std::numeric_limits<CharT>::max)()));
|
||||
}
|
||||
return a_;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator-(chset<CharT> const& a, range<CharT> const& b)
|
||||
{
|
||||
chset<CharT> a_(a);
|
||||
a_.clear(b);
|
||||
return a_;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator^(chset<CharT> const& a, range<CharT> const& b)
|
||||
{
|
||||
return a ^ chset<CharT>(b);
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator|(range<CharT> const& a, chset<CharT> const& b)
|
||||
{
|
||||
chset<CharT> b_(b);
|
||||
b_.set(a);
|
||||
return b_;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator&(range<CharT> const& a, chset<CharT> const& b)
|
||||
{
|
||||
chset<CharT> b_(b);
|
||||
if(a.first != (std::numeric_limits<CharT>::min)()) {
|
||||
b_.clear(range<CharT>((std::numeric_limits<CharT>::min)(), a.first - 1));
|
||||
}
|
||||
if(a.last != (std::numeric_limits<CharT>::max)()) {
|
||||
b_.clear(range<CharT>(a.last + 1, (std::numeric_limits<CharT>::max)()));
|
||||
}
|
||||
return b_;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator-(range<CharT> const& a, chset<CharT> const& b)
|
||||
{
|
||||
return chset<CharT>(a) - b;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator^(range<CharT> const& a, chset<CharT> const& b)
|
||||
{
|
||||
return chset<CharT>(a) ^ b;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// literal primitives <--> chset free operators implementation
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator|(chset<CharT> const& a, CharT b)
|
||||
{
|
||||
return a | chset<CharT>(b);
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator&(chset<CharT> const& a, CharT b)
|
||||
{
|
||||
return a & chset<CharT>(b);
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator-(chset<CharT> const& a, CharT b)
|
||||
{
|
||||
return a - chset<CharT>(b);
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator^(chset<CharT> const& a, CharT b)
|
||||
{
|
||||
return a ^ chset<CharT>(b);
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator|(CharT a, chset<CharT> const& b)
|
||||
{
|
||||
return chset<CharT>(a) | b;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator&(CharT a, chset<CharT> const& b)
|
||||
{
|
||||
return chset<CharT>(a) & b;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator-(CharT a, chset<CharT> const& b)
|
||||
{
|
||||
return chset<CharT>(a) - b;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator^(CharT a, chset<CharT> const& b)
|
||||
{
|
||||
return chset<CharT>(a) ^ b;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// chlit <--> chset free operators implementation
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator|(chset<CharT> const& a, chlit<CharT> const& b)
|
||||
{
|
||||
return a | chset<CharT>(b.ch);
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator&(chset<CharT> const& a, chlit<CharT> const& b)
|
||||
{
|
||||
return a & chset<CharT>(b.ch);
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator-(chset<CharT> const& a, chlit<CharT> const& b)
|
||||
{
|
||||
return a - chset<CharT>(b.ch);
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator^(chset<CharT> const& a, chlit<CharT> const& b)
|
||||
{
|
||||
return a ^ chset<CharT>(b.ch);
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator|(chlit<CharT> const& a, chset<CharT> const& b)
|
||||
{
|
||||
return chset<CharT>(a.ch) | b;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator&(chlit<CharT> const& a, chset<CharT> const& b)
|
||||
{
|
||||
return chset<CharT>(a.ch) & b;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator-(chlit<CharT> const& a, chset<CharT> const& b)
|
||||
{
|
||||
return chset<CharT>(a.ch) - b;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator^(chlit<CharT> const& a, chset<CharT> const& b)
|
||||
{
|
||||
return chset<CharT>(a.ch) ^ b;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// negated_char_parser<range> <--> chset free operators implementation
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator|(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b)
|
||||
{
|
||||
return a | chset<CharT>(b);
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator&(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b)
|
||||
{
|
||||
return a & chset<CharT>(b);
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator-(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b)
|
||||
{
|
||||
return a - chset<CharT>(b);
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator^(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b)
|
||||
{
|
||||
return a ^ chset<CharT>(b);
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator|(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b)
|
||||
{
|
||||
return chset<CharT>(a) | b;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator&(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b)
|
||||
{
|
||||
return chset<CharT>(a) & b;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator-(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b)
|
||||
{
|
||||
return chset<CharT>(a) - b;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator^(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b)
|
||||
{
|
||||
return chset<CharT>(a) ^ b;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// negated_char_parser<chlit> <--> chset free operators implementation
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator|(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b)
|
||||
{
|
||||
return a | chset<CharT>(b);
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator&(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b)
|
||||
{
|
||||
return a & chset<CharT>(b);
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator-(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b)
|
||||
{
|
||||
return a - chset<CharT>(b);
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator^(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b)
|
||||
{
|
||||
return a ^ chset<CharT>(b);
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator|(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b)
|
||||
{
|
||||
return chset<CharT>(a) | b;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator&(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b)
|
||||
{
|
||||
return chset<CharT>(a) & b;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator-(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b)
|
||||
{
|
||||
return chset<CharT>(a) - b;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator^(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b)
|
||||
{
|
||||
return chset<CharT>(a) ^ b;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// anychar_parser <--> chset free operators
|
||||
//
|
||||
// Where a is chset and b is a anychar_parser, and vice-versa, implements:
|
||||
//
|
||||
// a | b, a & b, a - b, a ^ b
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace impl {
|
||||
|
||||
template <typename CharT>
|
||||
inline BOOST_SPIRIT_CLASSIC_NS::range<CharT> const&
|
||||
full()
|
||||
{
|
||||
static BOOST_SPIRIT_CLASSIC_NS::range<CharT> full_(
|
||||
(std::numeric_limits<CharT>::min)(),
|
||||
(std::numeric_limits<CharT>::max)());
|
||||
return full_;
|
||||
}
|
||||
|
||||
template <typename CharT>
|
||||
inline BOOST_SPIRIT_CLASSIC_NS::range<CharT> const&
|
||||
empty()
|
||||
{
|
||||
static BOOST_SPIRIT_CLASSIC_NS::range<CharT> empty_;
|
||||
return empty_;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator|(chset<CharT> const&, anychar_parser)
|
||||
{
|
||||
return chset<CharT>(impl::full<CharT>());
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator&(chset<CharT> const& a, anychar_parser)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator-(chset<CharT> const&, anychar_parser)
|
||||
{
|
||||
return chset<CharT>();
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator^(chset<CharT> const& a, anychar_parser)
|
||||
{
|
||||
return ~a;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator|(anychar_parser, chset<CharT> const& /*b*/)
|
||||
{
|
||||
return chset<CharT>(impl::full<CharT>());
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator&(anychar_parser, chset<CharT> const& b)
|
||||
{
|
||||
return b;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator-(anychar_parser, chset<CharT> const& b)
|
||||
{
|
||||
return ~b;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator^(anychar_parser, chset<CharT> const& b)
|
||||
{
|
||||
return ~b;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// nothing_parser <--> chset free operators implementation
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator|(chset<CharT> const& a, nothing_parser)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator&(chset<CharT> const& /*a*/, nothing_parser)
|
||||
{
|
||||
return impl::empty<CharT>();
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator-(chset<CharT> const& a, nothing_parser)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator^(chset<CharT> const& a, nothing_parser)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator|(nothing_parser, chset<CharT> const& b)
|
||||
{
|
||||
return b;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator&(nothing_parser, chset<CharT> const& /*b*/)
|
||||
{
|
||||
return impl::empty<CharT>();
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator-(nothing_parser, chset<CharT> const& /*b*/)
|
||||
{
|
||||
return impl::empty<CharT>();
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
inline chset<CharT>
|
||||
operator^(nothing_parser, chset<CharT> const& b)
|
||||
{
|
||||
return b;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}} // namespace boost::spirit
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,261 @@
|
||||
// (C) Copyright Howard Hinnant
|
||||
// (C) Copyright 2011 Vicente J. Botet Escriba
|
||||
// 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).
|
||||
//
|
||||
|
||||
/**
|
||||
* Duration formatting facet for output.
|
||||
*/
|
||||
#ifndef BOOST_CHRONO_IO_TIME_POINT_PUT_HPP
|
||||
#define BOOST_CHRONO_IO_TIME_POINT_PUT_HPP
|
||||
|
||||
#include <boost/chrono/config.hpp>
|
||||
#include <boost/chrono/io/time_point_units.hpp>
|
||||
#include <boost/chrono/io/duration_put.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <locale>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace chrono
|
||||
{
|
||||
|
||||
/**
|
||||
* @tparam ChatT a character type
|
||||
* @tparam OutputIterator a model of @c OutputIterator
|
||||
*
|
||||
* The @c time_point_put facet provides facilities for formatted output of @c time_point values.
|
||||
* The member function of @c time_point_put take a @c time_point and format it into character string representation.
|
||||
*
|
||||
*/
|
||||
template <class CharT, class OutputIterator = std::ostreambuf_iterator<CharT> >
|
||||
class time_point_put: public std::locale::facet
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Type of character the facet is instantiated on.
|
||||
*/
|
||||
typedef CharT char_type;
|
||||
/**
|
||||
* Type of character string passed to member functions.
|
||||
*/
|
||||
typedef std::basic_string<CharT> string_type;
|
||||
/**
|
||||
* Type of iterator used to write in the character buffer.
|
||||
*/
|
||||
typedef OutputIterator iter_type;
|
||||
|
||||
/**
|
||||
* Construct a time_point_put facet.
|
||||
* @param refs
|
||||
* @Effects Construct a time_point_put facet.
|
||||
* If the @c refs argument is @c 0 then destruction of the object is
|
||||
* delegated to the @c locale, or locales, containing it. This allows
|
||||
* the user to ignore lifetime management issues. On the other had,
|
||||
* if @c refs is @c 1 then the object must be explicitly deleted;
|
||||
* the @c locale will not do so. In this case, the object can be
|
||||
* maintained across the lifetime of multiple locales.
|
||||
*/
|
||||
explicit time_point_put(size_t refs = 0) :
|
||||
std::locale::facet(refs)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param i an output stream iterator
|
||||
* @param ios a reference to a ios_base
|
||||
* @param fill the character used as filler
|
||||
* @param tp the @c time_point
|
||||
* @param pattern begin of the formatting pattern
|
||||
* @param pat_end end of the formatting pattern
|
||||
*
|
||||
* @Effects Steps through the sequence from @c pattern to @c pat_end,
|
||||
* identifying characters that are part of a pattern sequence. Each character
|
||||
* that is not part of a pattern sequence is written to @c s immediately, and
|
||||
* each pattern sequence, as it is identified, results in a call to
|
||||
* @c put_duration or @c put_epoch;
|
||||
* thus, pattern elements and other characters are interleaved in the output
|
||||
* in the order in which they appear in the pattern. Pattern sequences are
|
||||
* identified by converting each character @c c to a @c char value as if by
|
||||
* @c ct.narrow(c,0), where @c ct is a reference to @c ctype<charT> obtained from
|
||||
* @c ios.getloc(). The first character of each sequence is equal to @c '%',
|
||||
* followed by a pattern specifier character @c spec, which can be @c 'd' for
|
||||
* the duration value or @c 'e' for the epoch.
|
||||
* For each valid pattern sequence identified, calls
|
||||
* <c>put_duration(s, ios, fill, tp.time_since_epoch())</c> or <c>put_epoch(s, ios)</c>.
|
||||
*
|
||||
* @Returns An iterator pointing immediately after the last character produced.
|
||||
*/
|
||||
|
||||
template <class Clock, class Duration>
|
||||
iter_type put(iter_type i, std::ios_base& ios, char_type fill, time_point<Clock, Duration> const& tp, const CharT* pattern,
|
||||
const CharT* pat_end) const
|
||||
{
|
||||
if (std::has_facet<time_point_units<CharT> >(ios.getloc()))
|
||||
{
|
||||
time_point_units<CharT> const &facet =
|
||||
std::use_facet<time_point_units<CharT> >(ios.getloc());
|
||||
return put(facet, i, ios, fill, tp, pattern, pat_end);
|
||||
}
|
||||
else
|
||||
{
|
||||
time_point_units_default<CharT> facet;
|
||||
return put(facet, i, ios, fill, tp, pattern, pat_end);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Clock, class Duration>
|
||||
iter_type put(time_point_units<CharT> const& units_facet, iter_type s, std::ios_base& ios, char_type fill,
|
||||
time_point<Clock, Duration> const& tp, const CharT* pattern, const CharT* pat_end) const
|
||||
{
|
||||
|
||||
const std::ctype<char_type>& ct = std::use_facet<std::ctype<char_type> >(ios.getloc());
|
||||
for (; pattern != pat_end; ++pattern)
|
||||
{
|
||||
if (ct.narrow(*pattern, 0) == '%')
|
||||
{
|
||||
if (++pattern == pat_end)
|
||||
{
|
||||
*s++ = pattern[-1];
|
||||
break;
|
||||
}
|
||||
char fmt = ct.narrow(*pattern, 0);
|
||||
switch (fmt)
|
||||
{
|
||||
case 'd':
|
||||
{
|
||||
s = put_duration(s, ios, fill, tp.time_since_epoch());
|
||||
break;
|
||||
}
|
||||
case 'e':
|
||||
{
|
||||
s = put_epoch<Clock> (units_facet, s, ios);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
BOOST_ASSERT(false && "Boost::Chrono internal error.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
*s++ = *pattern;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param i an output stream iterator
|
||||
* @param ios a reference to a ios_base
|
||||
* @param fill the character used as filler
|
||||
* @param tp the @c time_point
|
||||
* @param pattern begin of the formatting pattern
|
||||
* @param pat_end end of the formatting pattern
|
||||
*
|
||||
* @Effects Stores the time_point pattern from the @c time_point_unit facet in let say @c str. Last as if
|
||||
* @code
|
||||
* return put(s, ios, dill, tp, str.data(), str.data() + str.size());
|
||||
* @endcode
|
||||
* @Returns An iterator pointing immediately after the last character produced.
|
||||
*/
|
||||
template <class Clock, class Duration>
|
||||
iter_type put(iter_type i, std::ios_base& ios, char_type fill, time_point<Clock, Duration> const& tp) const
|
||||
{
|
||||
if (std::has_facet<time_point_units<CharT> >(ios.getloc()))
|
||||
{
|
||||
time_point_units<CharT> const &facet =
|
||||
std::use_facet<time_point_units<CharT> >(ios.getloc());
|
||||
std::basic_string<CharT> str = facet.get_pattern();
|
||||
return put(facet, i, ios, fill, tp, str.data(), str.data() + str.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
time_point_units_default<CharT> facet;
|
||||
std::basic_string<CharT> str = facet.get_pattern();
|
||||
return put(facet, i, ios, fill, tp, str.data(), str.data() + str.size());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param i an output stream iterator
|
||||
* @param ios a reference to a ios_base
|
||||
* @param fill the character used as filler
|
||||
* @param d the @c duration
|
||||
* @Effects As if <c>facet.put(s, ios, fill, d)</c> where facet is the @c duration_put<CharT> facet associated
|
||||
* to the @c ios or a new instance of @c duration_put<CharT>.
|
||||
* @Returns An iterator pointing immediately after the last character produced.
|
||||
*/
|
||||
template <typename Rep, typename Period>
|
||||
iter_type put_duration(iter_type i, std::ios_base& ios, char_type fill, duration<Rep, Period> const& d) const
|
||||
{
|
||||
if (std::has_facet<duration_put<CharT> >(ios.getloc()))
|
||||
{
|
||||
duration_put<CharT> const &facet = std::use_facet<duration_put<CharT> >(ios.getloc());
|
||||
return facet.put(i, ios, fill, d);
|
||||
}
|
||||
else
|
||||
{
|
||||
duration_put<CharT> facet;
|
||||
return facet.put(i, ios, fill, d);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param i an output stream iterator
|
||||
* @param ios a reference to a ios_base
|
||||
* @Effects As if
|
||||
* @code
|
||||
* string_type str = facet.template get_epoch<Clock>();
|
||||
* s=std::copy(str.begin(), str.end(), s);
|
||||
* @endcode
|
||||
* where facet is the @c time_point_units<CharT> facet associated
|
||||
* to the @c ios or a new instance of @c time_point_units_default<CharT>.
|
||||
* @Returns s, iterator pointing immediately after the last character produced.
|
||||
*/
|
||||
|
||||
template <typename Clock>
|
||||
iter_type put_epoch(iter_type i, std::ios_base& os) const
|
||||
{
|
||||
if (std::has_facet<time_point_units<CharT> >(os.getloc()))
|
||||
{
|
||||
time_point_units<CharT> const &facet = std::use_facet<time_point_units<CharT> >(os.getloc());
|
||||
return put_epoch<Clock> (facet, i, os);
|
||||
}
|
||||
else
|
||||
{
|
||||
time_point_units_default<CharT> facet;
|
||||
return put_epoch<Clock> (facet, i, os);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Clock>
|
||||
iter_type put_epoch(time_point_units<CharT> const& facet, iter_type s, std::ios_base&) const
|
||||
{
|
||||
string_type str = facet.template get_epoch<Clock>();
|
||||
s= std::copy(str.begin(), str.end(), s);
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier for this type of facet.
|
||||
*/
|
||||
static std::locale::id id;
|
||||
|
||||
/**
|
||||
* @Effects Destroy the facet
|
||||
*/
|
||||
~time_point_put()
|
||||
{
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template <class CharT, class OutputIterator>
|
||||
std::locale::id time_point_put<CharT, OutputIterator>::id;
|
||||
|
||||
} // chrono
|
||||
} // boost
|
||||
|
||||
#endif // header
|
||||
@@ -0,0 +1,83 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright (C) 2002-2006 Marcin Kalicinski
|
||||
// Copyright (C) 2009 Sebastian Redl
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see www.boost.org
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef BOOST_PROPERTY_TREE_DETAIL_EXCEPTIONS_IMPLEMENTATION_HPP_INCLUDED
|
||||
#define BOOST_PROPERTY_TREE_DETAIL_EXCEPTIONS_IMPLEMENTATION_HPP_INCLUDED
|
||||
|
||||
namespace boost { namespace property_tree
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Helper for preparing what string in ptree_bad_path exception
|
||||
template<class P> inline
|
||||
std::string prepare_bad_path_what(const std::string &what,
|
||||
const P &path)
|
||||
{
|
||||
return what + " (" + path.dump() + ")";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// ptree_error
|
||||
|
||||
inline ptree_error::ptree_error(const std::string &w):
|
||||
std::runtime_error(w)
|
||||
{
|
||||
}
|
||||
|
||||
inline ptree_error::~ptree_error() throw()
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// ptree_bad_data
|
||||
|
||||
template<class D> inline
|
||||
ptree_bad_data::ptree_bad_data(const std::string &w, const D &d):
|
||||
ptree_error(w), m_data(d)
|
||||
{
|
||||
}
|
||||
|
||||
inline ptree_bad_data::~ptree_bad_data() throw()
|
||||
{
|
||||
}
|
||||
|
||||
template<class D> inline
|
||||
D ptree_bad_data::data() const
|
||||
{
|
||||
return boost::any_cast<D>(m_data);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// ptree_bad_path
|
||||
|
||||
template<class P> inline
|
||||
ptree_bad_path::ptree_bad_path(const std::string &w, const P &p):
|
||||
ptree_error(detail::prepare_bad_path_what(w, p)), m_path(p)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
inline ptree_bad_path::~ptree_bad_path() throw()
|
||||
{
|
||||
}
|
||||
|
||||
template<class P> inline
|
||||
P ptree_bad_path::path() const
|
||||
{
|
||||
return boost::any_cast<P>(m_path);
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user