Initial Commit
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
// (C) Copyright 2009-2011 Frederic Bron.
|
||||
//
|
||||
// Use, modification and distribution are subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt).
|
||||
//
|
||||
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
|
||||
|
||||
#ifndef BOOST_TT_HAS_POST_INCREMENT_HPP_INCLUDED
|
||||
#define BOOST_TT_HAS_POST_INCREMENT_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
|
||||
#define BOOST_TT_TRAIT_NAME has_post_increment
|
||||
#define BOOST_TT_TRAIT_OP ++
|
||||
#define BOOST_TT_FORBIDDEN_IF\
|
||||
(\
|
||||
/* bool */\
|
||||
::boost::is_same< bool, Lhs_nocv >::value || \
|
||||
/* void* */\
|
||||
(\
|
||||
::boost::is_pointer< Lhs_noref >::value && \
|
||||
::boost::is_void< Lhs_noptr >::value\
|
||||
) || \
|
||||
/* (fundamental or pointer) and const */\
|
||||
(\
|
||||
( \
|
||||
::boost::is_fundamental< Lhs_nocv >::value || \
|
||||
::boost::is_pointer< Lhs_noref >::value\
|
||||
) && \
|
||||
::boost::is_const< Lhs_noref >::value\
|
||||
)||\
|
||||
/* Arrays */ \
|
||||
::boost::is_array<Lhs_noref>::value\
|
||||
)
|
||||
|
||||
|
||||
#include <boost/type_traits/detail/has_postfix_operator.hpp>
|
||||
|
||||
#undef BOOST_TT_TRAIT_NAME
|
||||
#undef BOOST_TT_TRAIT_OP
|
||||
#undef BOOST_TT_FORBIDDEN_IF
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,72 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
// See http://boostorg.github.com/compute for more information.
|
||||
//---------------------------------------------------------------------------//
|
||||
|
||||
#ifndef BOOST_COMPUTE_TYPE_TRAITS_SCALAR_TYPE_HPP
|
||||
#define BOOST_COMPUTE_TYPE_TRAITS_SCALAR_TYPE_HPP
|
||||
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
|
||||
#include <boost/compute/types/fundamental.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
|
||||
/// Meta-function returning the scalar type for a vector type.
|
||||
///
|
||||
/// For example,
|
||||
/// \code
|
||||
/// scalar_type<float4_>::type == float
|
||||
/// \endcode
|
||||
template<class Vector>
|
||||
struct scalar_type
|
||||
{
|
||||
/// \internal_
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
/// \internal_
|
||||
#define BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTION(scalar) \
|
||||
template<> \
|
||||
struct scalar_type<BOOST_PP_CAT(scalar, _)> \
|
||||
{ \
|
||||
typedef BOOST_PP_CAT(scalar, _) type; \
|
||||
};
|
||||
|
||||
/// \internal_
|
||||
#define BOOST_COMPUTE_DECLARE_VECTOR_SCALAR_TYPE_FUNCTION(scalar, size) \
|
||||
template<> \
|
||||
struct scalar_type<BOOST_PP_CAT(BOOST_PP_CAT(scalar, size), _)> \
|
||||
{ \
|
||||
typedef BOOST_PP_CAT(scalar, _) type; \
|
||||
};
|
||||
|
||||
/// \internal_
|
||||
#define BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(scalar) \
|
||||
BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTION(scalar) \
|
||||
BOOST_COMPUTE_DECLARE_VECTOR_SCALAR_TYPE_FUNCTION(scalar, 2) \
|
||||
BOOST_COMPUTE_DECLARE_VECTOR_SCALAR_TYPE_FUNCTION(scalar, 4) \
|
||||
BOOST_COMPUTE_DECLARE_VECTOR_SCALAR_TYPE_FUNCTION(scalar, 8) \
|
||||
BOOST_COMPUTE_DECLARE_VECTOR_SCALAR_TYPE_FUNCTION(scalar, 16)
|
||||
|
||||
BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(char)
|
||||
BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(uchar)
|
||||
BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(short)
|
||||
BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(ushort)
|
||||
BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(int)
|
||||
BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(uint)
|
||||
BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(long)
|
||||
BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(ulong)
|
||||
BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(float)
|
||||
BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(double)
|
||||
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_TYPE_TRAITS_SCALAR_TYPE_HPP
|
||||
@@ -0,0 +1,89 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_VALUE_WKND_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_VALUE_WKND_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id$
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
#include <boost/mpl/aux_/static_cast.hpp>
|
||||
#include <boost/mpl/aux_/config/integral.hpp>
|
||||
#include <boost/mpl/aux_/config/eti.hpp>
|
||||
#include <boost/mpl/aux_/config/workaround.hpp>
|
||||
|
||||
#if defined(BOOST_MPL_CFG_BCC_INTEGRAL_CONSTANTS) \
|
||||
|| defined(BOOST_MPL_CFG_MSVC_60_ETI_BUG)
|
||||
|
||||
# include <boost/mpl/int.hpp>
|
||||
|
||||
namespace boost { namespace mpl { namespace aux {
|
||||
template< typename C_ > struct value_wknd
|
||||
: C_
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(BOOST_MPL_CFG_MSVC_60_ETI_BUG)
|
||||
template<> struct value_wknd<int>
|
||||
: int_<1>
|
||||
{
|
||||
using int_<1>::value;
|
||||
};
|
||||
#endif
|
||||
}}}
|
||||
|
||||
|
||||
#if !defined(BOOST_MPL_CFG_MSVC_60_ETI_BUG)
|
||||
# define BOOST_MPL_AUX_VALUE_WKND(C) \
|
||||
::BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::aux::value_wknd< C > \
|
||||
/**/
|
||||
# define BOOST_MPL_AUX_MSVC_VALUE_WKND(C) BOOST_MPL_AUX_VALUE_WKND(C)
|
||||
#else
|
||||
# define BOOST_MPL_AUX_VALUE_WKND(C) C
|
||||
# define BOOST_MPL_AUX_MSVC_VALUE_WKND(C) \
|
||||
::boost::mpl::aux::value_wknd< C > \
|
||||
/**/
|
||||
#endif
|
||||
|
||||
#else // BOOST_MPL_CFG_BCC_INTEGRAL_CONSTANTS
|
||||
|
||||
# define BOOST_MPL_AUX_VALUE_WKND(C) C
|
||||
# define BOOST_MPL_AUX_MSVC_VALUE_WKND(C) C
|
||||
|
||||
#endif
|
||||
|
||||
#if BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
|
||||
# define BOOST_MPL_AUX_NESTED_VALUE_WKND(T, C) \
|
||||
BOOST_MPL_AUX_STATIC_CAST(T, C::value) \
|
||||
/**/
|
||||
#else
|
||||
# define BOOST_MPL_AUX_NESTED_VALUE_WKND(T, C) \
|
||||
BOOST_MPL_AUX_VALUE_WKND(C)::value \
|
||||
/**/
|
||||
#endif
|
||||
|
||||
|
||||
namespace boost { namespace mpl { namespace aux {
|
||||
|
||||
template< typename T > struct value_type_wknd
|
||||
{
|
||||
typedef typename T::value_type type;
|
||||
};
|
||||
|
||||
#if defined(BOOST_MPL_CFG_MSVC_ETI_BUG)
|
||||
template<> struct value_type_wknd<int>
|
||||
{
|
||||
typedef int type;
|
||||
};
|
||||
#endif
|
||||
|
||||
}}}
|
||||
|
||||
#endif // BOOST_MPL_AUX_VALUE_WKND_HPP_INCLUDED
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,54 @@
|
||||
|
||||
// (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_REMOVE_REFERENCE_HPP_INCLUDED
|
||||
#define BOOST_TT_REMOVE_REFERENCE_HPP_INCLUDED
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
|
||||
namespace detail{
|
||||
//
|
||||
// We can't filter out rvalue_references at the same level as
|
||||
// references or we get ambiguities from msvc:
|
||||
//
|
||||
template <class T>
|
||||
struct remove_rvalue_ref
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
template <class T>
|
||||
struct remove_rvalue_ref<T&&>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <class T> struct remove_reference{ typedef typename boost::detail::remove_rvalue_ref<T>::type type; };
|
||||
template <class T> struct remove_reference<T&>{ typedef T type; };
|
||||
|
||||
#if defined(BOOST_ILLEGAL_CV_REFERENCES)
|
||||
// these are illegal specialisations; cv-qualifies applied to
|
||||
// references have no effect according to [8.3.2p1],
|
||||
// C++ Builder requires them though as it treats cv-qualified
|
||||
// references as distinct types...
|
||||
template <class T> struct remove_reference<T&const>{ typedef T type; };
|
||||
template <class T> struct remove_reference<T&volatile>{ typedef T type; };
|
||||
template <class T> struct remove_reference<T&const volatile>{ typedef T type; };
|
||||
#endif
|
||||
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_TT_REMOVE_REFERENCE_HPP_INCLUDED
|
||||
@@ -0,0 +1,416 @@
|
||||
// Copyright Vladimir Prus 2002-2004.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
#ifndef BOOST_ERRORS_VP_2003_01_02
|
||||
#define BOOST_ERRORS_VP_2003_01_02
|
||||
|
||||
#include <boost/program_options/config.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning (push)
|
||||
# pragma warning (disable:4275) // non dll-interface class 'std::logic_error' used as base for dll-interface class 'boost::program_options::error'
|
||||
# pragma warning (disable:4251) // class 'std::vector<_Ty>' needs to have dll-interface to be used by clients of class 'boost::program_options::ambiguous_option'
|
||||
#endif
|
||||
|
||||
namespace boost { namespace program_options {
|
||||
|
||||
inline std::string strip_prefixes(const std::string& text)
|
||||
{
|
||||
// "--foo-bar" -> "foo-bar"
|
||||
return text.substr(text.find_first_not_of("-/"));
|
||||
}
|
||||
|
||||
/** Base class for all errors in the library. */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL error : public std::logic_error {
|
||||
public:
|
||||
error(const std::string& xwhat) : std::logic_error(xwhat) {}
|
||||
};
|
||||
|
||||
|
||||
/** Class thrown when there are too many positional options.
|
||||
This is a programming error.
|
||||
*/
|
||||
class BOOST_PROGRAM_OPTIONS_DECL too_many_positional_options_error : public error {
|
||||
public:
|
||||
too_many_positional_options_error()
|
||||
: error("too many positional options have been specified on the command line")
|
||||
{}
|
||||
};
|
||||
|
||||
/** Class thrown when there are programming error related to style */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL invalid_command_line_style : public error {
|
||||
public:
|
||||
invalid_command_line_style(const std::string& msg)
|
||||
: error(msg)
|
||||
{}
|
||||
};
|
||||
|
||||
/** Class thrown if config file can not be read */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL reading_file : public error {
|
||||
public:
|
||||
reading_file(const char* filename)
|
||||
: error(std::string("can not read options configuration file '").append(filename).append("'"))
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
/** Base class for most exceptions in the library.
|
||||
*
|
||||
* Substitutes the values for the parameter name
|
||||
* placeholders in the template to create the human
|
||||
* readable error message
|
||||
*
|
||||
* Placeholders are surrounded by % signs: %example%
|
||||
* Poor man's version of boost::format
|
||||
*
|
||||
* If a parameter name is absent, perform default substitutions
|
||||
* instead so ugly placeholders are never left in-place.
|
||||
*
|
||||
* Options are displayed in "canonical" form
|
||||
* This is the most unambiguous form of the
|
||||
* *parsed* option name and would correspond to
|
||||
* option_description::format_name()
|
||||
* i.e. what is shown by print_usage()
|
||||
*
|
||||
* The "canonical" form depends on whether the option is
|
||||
* specified in short or long form, using dashes or slashes
|
||||
* or without a prefix (from a configuration file)
|
||||
*
|
||||
* */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL error_with_option_name : public error {
|
||||
|
||||
protected:
|
||||
/** can be
|
||||
* 0 = no prefix (config file options)
|
||||
* allow_long
|
||||
* allow_dash_for_short
|
||||
* allow_slash_for_short
|
||||
* allow_long_disguise */
|
||||
int m_option_style;
|
||||
|
||||
|
||||
/** substitutions
|
||||
* from placeholders to values */
|
||||
std::map<std::string, std::string> m_substitutions;
|
||||
typedef std::pair<std::string, std::string> string_pair;
|
||||
std::map<std::string, string_pair > m_substitution_defaults;
|
||||
|
||||
public:
|
||||
/** template with placeholders */
|
||||
std::string m_error_template;
|
||||
|
||||
error_with_option_name(const std::string& template_,
|
||||
const std::string& option_name = "",
|
||||
const std::string& original_token = "",
|
||||
int option_style = 0);
|
||||
|
||||
/** gcc says that throw specification on dtor is loosened
|
||||
* without this line
|
||||
* */
|
||||
~error_with_option_name() throw() {}
|
||||
|
||||
|
||||
//void dump() const
|
||||
//{
|
||||
// std::cerr << "m_substitution_defaults:\n";
|
||||
// for (std::map<std::string, string_pair>::const_iterator iter = m_substitution_defaults.begin();
|
||||
// iter != m_substitution_defaults.end(); ++iter)
|
||||
// std::cerr << "\t" << iter->first << ":" << iter->second.first << "=" << iter->second.second << "\n";
|
||||
// std::cerr << "m_substitutions:\n";
|
||||
// for (std::map<std::string, std::string>::const_iterator iter = m_substitutions.begin();
|
||||
// iter != m_substitutions.end(); ++iter)
|
||||
// std::cerr << "\t" << iter->first << "=" << iter->second << "\n";
|
||||
// std::cerr << "m_error_template:\n";
|
||||
// std::cerr << "\t" << m_error_template << "\n";
|
||||
// std::cerr << "canonical_option_prefix:[" << get_canonical_option_prefix() << "]\n";
|
||||
// std::cerr << "canonical_option_name:[" << get_canonical_option_name() <<"]\n";
|
||||
// std::cerr << "what:[" << what() << "]\n";
|
||||
//}
|
||||
|
||||
/** Substitute
|
||||
* parameter_name->value to create the error message from
|
||||
* the error template */
|
||||
void set_substitute(const std::string& parameter_name, const std::string& value)
|
||||
{ m_substitutions[parameter_name] = value; }
|
||||
|
||||
/** If the parameter is missing, then make the
|
||||
* from->to substitution instead */
|
||||
void set_substitute_default(const std::string& parameter_name,
|
||||
const std::string& from,
|
||||
const std::string& to)
|
||||
{
|
||||
m_substitution_defaults[parameter_name] = std::make_pair(from, to);
|
||||
}
|
||||
|
||||
|
||||
/** Add context to an exception */
|
||||
void add_context(const std::string& option_name,
|
||||
const std::string& original_token,
|
||||
int option_style)
|
||||
{
|
||||
set_option_name(option_name);
|
||||
set_original_token(original_token);
|
||||
set_prefix(option_style);
|
||||
}
|
||||
|
||||
void set_prefix(int option_style)
|
||||
{ m_option_style = option_style;}
|
||||
|
||||
/** Overridden in error_with_no_option_name */
|
||||
virtual void set_option_name(const std::string& option_name)
|
||||
{ set_substitute("option", option_name);}
|
||||
|
||||
std::string get_option_name() const throw()
|
||||
{ return get_canonical_option_name(); }
|
||||
|
||||
void set_original_token(const std::string& original_token)
|
||||
{ set_substitute("original_token", original_token);}
|
||||
|
||||
|
||||
/** Creates the error_message on the fly
|
||||
* Currently a thin wrapper for substitute_placeholders() */
|
||||
virtual const char* what() const throw();
|
||||
|
||||
protected:
|
||||
/** Used to hold the error text returned by what() */
|
||||
mutable std::string m_message; // For on-demand formatting in 'what'
|
||||
|
||||
/** Makes all substitutions using the template */
|
||||
virtual void substitute_placeholders(const std::string& error_template) const;
|
||||
|
||||
// helper function for substitute_placeholders
|
||||
void replace_token(const std::string& from, const std::string& to) const;
|
||||
|
||||
/** Construct option name in accordance with the appropriate
|
||||
* prefix style: i.e. long dash or short slash etc */
|
||||
std::string get_canonical_option_name() const;
|
||||
std::string get_canonical_option_prefix() const;
|
||||
};
|
||||
|
||||
|
||||
/** Class thrown when there are several option values, but
|
||||
user called a method which cannot return them all. */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL multiple_values : public error_with_option_name {
|
||||
public:
|
||||
multiple_values()
|
||||
: error_with_option_name("option '%canonical_option%' only takes a single argument"){}
|
||||
|
||||
~multiple_values() throw() {}
|
||||
};
|
||||
|
||||
/** Class thrown when there are several occurrences of an
|
||||
option, but user called a method which cannot return
|
||||
them all. */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL multiple_occurrences : public error_with_option_name {
|
||||
public:
|
||||
multiple_occurrences()
|
||||
: error_with_option_name("option '%canonical_option%' cannot be specified more than once"){}
|
||||
|
||||
~multiple_occurrences() throw() {}
|
||||
|
||||
};
|
||||
|
||||
/** Class thrown when a required/mandatory option is missing */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL required_option : public error_with_option_name {
|
||||
public:
|
||||
// option name is constructed by the option_descriptor and never on the fly
|
||||
required_option(const std::string& option_name)
|
||||
: error_with_option_name("the option '%canonical_option%' is required but missing", "", option_name)
|
||||
{
|
||||
}
|
||||
|
||||
~required_option() throw() {}
|
||||
};
|
||||
|
||||
/** Base class of unparsable options,
|
||||
* when the desired option cannot be identified.
|
||||
*
|
||||
*
|
||||
* It makes no sense to have an option name, when we can't match an option to the
|
||||
* parameter
|
||||
*
|
||||
* Having this a part of the error_with_option_name hierachy makes error handling
|
||||
* a lot easier, even if the name indicates some sort of conceptual dissonance!
|
||||
*
|
||||
* */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL error_with_no_option_name : public error_with_option_name {
|
||||
public:
|
||||
error_with_no_option_name(const std::string& template_,
|
||||
const std::string& original_token = "")
|
||||
: error_with_option_name(template_, "", original_token)
|
||||
{
|
||||
}
|
||||
|
||||
/** Does NOT set option name, because no option name makes sense */
|
||||
virtual void set_option_name(const std::string&) {}
|
||||
|
||||
~error_with_no_option_name() throw() {}
|
||||
};
|
||||
|
||||
|
||||
/** Class thrown when option name is not recognized. */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL unknown_option : public error_with_no_option_name {
|
||||
public:
|
||||
unknown_option(const std::string& original_token = "")
|
||||
: error_with_no_option_name("unrecognised option '%canonical_option%'", original_token)
|
||||
{
|
||||
}
|
||||
|
||||
~unknown_option() throw() {}
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** Class thrown when there's ambiguity amoung several possible options. */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL ambiguous_option : public error_with_no_option_name {
|
||||
public:
|
||||
ambiguous_option(const std::vector<std::string>& xalternatives)
|
||||
: error_with_no_option_name("option '%canonical_option%' is ambiguous"),
|
||||
m_alternatives(xalternatives)
|
||||
{}
|
||||
|
||||
~ambiguous_option() throw() {}
|
||||
|
||||
const std::vector<std::string>& alternatives() const throw() {return m_alternatives;}
|
||||
|
||||
protected:
|
||||
/** Makes all substitutions using the template */
|
||||
virtual void substitute_placeholders(const std::string& error_template) const;
|
||||
private:
|
||||
// TODO: copy ctor might throw
|
||||
std::vector<std::string> m_alternatives;
|
||||
};
|
||||
|
||||
|
||||
/** Class thrown when there's syntax error either for command
|
||||
* line or config file options. See derived children for
|
||||
* concrete classes. */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL invalid_syntax : public error_with_option_name {
|
||||
public:
|
||||
enum kind_t {
|
||||
long_not_allowed = 30,
|
||||
long_adjacent_not_allowed,
|
||||
short_adjacent_not_allowed,
|
||||
empty_adjacent_parameter,
|
||||
missing_parameter,
|
||||
extra_parameter,
|
||||
unrecognized_line
|
||||
};
|
||||
|
||||
invalid_syntax(kind_t kind,
|
||||
const std::string& option_name = "",
|
||||
const std::string& original_token = "",
|
||||
int option_style = 0):
|
||||
error_with_option_name(get_template(kind), option_name, original_token, option_style),
|
||||
m_kind(kind)
|
||||
{
|
||||
}
|
||||
|
||||
~invalid_syntax() throw() {}
|
||||
|
||||
kind_t kind() const {return m_kind;}
|
||||
|
||||
/** Convenience functions for backwards compatibility */
|
||||
virtual std::string tokens() const {return get_option_name(); }
|
||||
protected:
|
||||
/** Used to convert kind_t to a related error text */
|
||||
std::string get_template(kind_t kind);
|
||||
kind_t m_kind;
|
||||
};
|
||||
|
||||
class BOOST_PROGRAM_OPTIONS_DECL invalid_config_file_syntax : public invalid_syntax {
|
||||
public:
|
||||
invalid_config_file_syntax(const std::string& invalid_line, kind_t kind):
|
||||
invalid_syntax(kind)
|
||||
{
|
||||
m_substitutions["invalid_line"] = invalid_line;
|
||||
}
|
||||
|
||||
~invalid_config_file_syntax() throw() {}
|
||||
|
||||
/** Convenience functions for backwards compatibility */
|
||||
virtual std::string tokens() const {return m_substitutions.find("invalid_line")->second; }
|
||||
};
|
||||
|
||||
|
||||
/** Class thrown when there are syntax errors in given command line */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL invalid_command_line_syntax : public invalid_syntax {
|
||||
public:
|
||||
invalid_command_line_syntax(kind_t kind,
|
||||
const std::string& option_name = "",
|
||||
const std::string& original_token = "",
|
||||
int option_style = 0):
|
||||
invalid_syntax(kind, option_name, original_token, option_style) {}
|
||||
~invalid_command_line_syntax() throw() {}
|
||||
};
|
||||
|
||||
|
||||
/** Class thrown when value of option is incorrect. */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL validation_error : public error_with_option_name {
|
||||
public:
|
||||
enum kind_t {
|
||||
multiple_values_not_allowed = 30,
|
||||
at_least_one_value_required,
|
||||
invalid_bool_value,
|
||||
invalid_option_value,
|
||||
invalid_option
|
||||
};
|
||||
|
||||
public:
|
||||
validation_error(kind_t kind,
|
||||
const std::string& option_name = "",
|
||||
const std::string& original_token = "",
|
||||
int option_style = 0):
|
||||
error_with_option_name(get_template(kind), option_name, original_token, option_style)
|
||||
{
|
||||
}
|
||||
|
||||
~validation_error() throw() {}
|
||||
|
||||
protected:
|
||||
/** Used to convert kind_t to a related error text */
|
||||
std::string get_template(kind_t kind);
|
||||
kind_t m_kind;
|
||||
};
|
||||
|
||||
/** Class thrown if there is an invalid option value given */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL invalid_option_value
|
||||
: public validation_error
|
||||
{
|
||||
public:
|
||||
invalid_option_value(const std::string& value);
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
invalid_option_value(const std::wstring& value);
|
||||
#endif
|
||||
};
|
||||
|
||||
/** Class thrown if there is an invalid bool value given */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL invalid_bool_value
|
||||
: public validation_error
|
||||
{
|
||||
public:
|
||||
invalid_bool_value(const std::string& value);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}}
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning (pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,73 @@
|
||||
# /* 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)
|
||||
# *
|
||||
# * See http://www.boost.org for most recent version.
|
||||
# */
|
||||
#
|
||||
# /* Revised by Paul Mensonides (2002) */
|
||||
#
|
||||
# ifndef BOOST_PREPROCESSOR_LIST_ADT_HPP
|
||||
# define BOOST_PREPROCESSOR_LIST_ADT_HPP
|
||||
#
|
||||
# include <boost/preprocessor/config/config.hpp>
|
||||
# include <boost/preprocessor/detail/is_binary.hpp>
|
||||
# include <boost/preprocessor/logical/compl.hpp>
|
||||
# include <boost/preprocessor/tuple/eat.hpp>
|
||||
#
|
||||
# /* BOOST_PP_LIST_CONS */
|
||||
#
|
||||
# define BOOST_PP_LIST_CONS(head, tail) (head, tail)
|
||||
#
|
||||
# /* BOOST_PP_LIST_NIL */
|
||||
#
|
||||
# define BOOST_PP_LIST_NIL BOOST_PP_NIL
|
||||
#
|
||||
# /* BOOST_PP_LIST_FIRST */
|
||||
#
|
||||
# define BOOST_PP_LIST_FIRST(list) BOOST_PP_LIST_FIRST_D(list)
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
|
||||
# define BOOST_PP_LIST_FIRST_D(list) BOOST_PP_LIST_FIRST_I list
|
||||
# else
|
||||
# define BOOST_PP_LIST_FIRST_D(list) BOOST_PP_LIST_FIRST_I ## list
|
||||
# endif
|
||||
#
|
||||
# define BOOST_PP_LIST_FIRST_I(head, tail) head
|
||||
#
|
||||
# /* BOOST_PP_LIST_REST */
|
||||
#
|
||||
# define BOOST_PP_LIST_REST(list) BOOST_PP_LIST_REST_D(list)
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
|
||||
# define BOOST_PP_LIST_REST_D(list) BOOST_PP_LIST_REST_I list
|
||||
# else
|
||||
# define BOOST_PP_LIST_REST_D(list) BOOST_PP_LIST_REST_I ## list
|
||||
# endif
|
||||
#
|
||||
# define BOOST_PP_LIST_REST_I(head, tail) tail
|
||||
#
|
||||
# /* BOOST_PP_LIST_IS_CONS */
|
||||
#
|
||||
# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_BCC()
|
||||
# define BOOST_PP_LIST_IS_CONS(list) BOOST_PP_LIST_IS_CONS_D(list)
|
||||
# define BOOST_PP_LIST_IS_CONS_D(list) BOOST_PP_LIST_IS_CONS_ ## list
|
||||
# define BOOST_PP_LIST_IS_CONS_(head, tail) 1
|
||||
# define BOOST_PP_LIST_IS_CONS_BOOST_PP_NIL 0
|
||||
# else
|
||||
# define BOOST_PP_LIST_IS_CONS(list) BOOST_PP_IS_BINARY(list)
|
||||
# endif
|
||||
#
|
||||
# /* BOOST_PP_LIST_IS_NIL */
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_BCC()
|
||||
# define BOOST_PP_LIST_IS_NIL(list) BOOST_PP_COMPL(BOOST_PP_IS_BINARY(list))
|
||||
# else
|
||||
# define BOOST_PP_LIST_IS_NIL(list) BOOST_PP_COMPL(BOOST_PP_LIST_IS_CONS(list))
|
||||
# endif
|
||||
#
|
||||
# endif
|
||||
@@ -0,0 +1,3 @@
|
||||
1
|
||||
4
|
||||
1.0
|
||||
@@ -0,0 +1,86 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// Copyright (c) 2014 Roshan <thisisroshansmail@gmail.com>
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
// See http://boostorg.github.com/compute for more information.
|
||||
//---------------------------------------------------------------------------//
|
||||
|
||||
#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_SEARCH_ALL_HPP
|
||||
#define BOOST_COMPUTE_ALGORITHM_DETAIL_SEARCH_ALL_HPP
|
||||
|
||||
#include <boost/compute/algorithm/copy.hpp>
|
||||
#include <boost/compute/container/vector.hpp>
|
||||
#include <boost/compute/detail/iterator_range_size.hpp>
|
||||
#include <boost/compute/detail/meta_kernel.hpp>
|
||||
#include <boost/compute/lambda.hpp>
|
||||
#include <boost/compute/system.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
namespace detail {
|
||||
|
||||
///
|
||||
/// \brief Search kernel class
|
||||
///
|
||||
/// Subclass of meta_kernel which is capable of performing pattern matching
|
||||
///
|
||||
template<class PatternIterator, class TextIterator, class OutputIterator>
|
||||
class search_kernel : public meta_kernel
|
||||
{
|
||||
public:
|
||||
search_kernel() : meta_kernel("search")
|
||||
{}
|
||||
|
||||
void set_range(PatternIterator p_first,
|
||||
PatternIterator p_last,
|
||||
TextIterator t_first,
|
||||
TextIterator t_last,
|
||||
OutputIterator result)
|
||||
{
|
||||
m_p_count = iterator_range_size(p_first, p_last);
|
||||
m_p_count_arg = add_arg<uint_>("p_count");
|
||||
|
||||
m_count = iterator_range_size(t_first, t_last);
|
||||
m_count = m_count + 1 - m_p_count;
|
||||
|
||||
*this <<
|
||||
"uint i = get_global_id(0);\n" <<
|
||||
"const uint i1 = i;\n" <<
|
||||
"uint j;\n" <<
|
||||
"for(j = 0; j<p_count; j++,i++)\n" <<
|
||||
"{\n" <<
|
||||
" if(" << p_first[expr<uint_>("j")] << " != " <<
|
||||
t_first[expr<uint_>("i")] << ")\n" <<
|
||||
" j = p_count + 1;\n" <<
|
||||
"}\n" <<
|
||||
"if(j == p_count)\n" <<
|
||||
result[expr<uint_>("i1")] << " = 1;\n" <<
|
||||
"else\n" <<
|
||||
result[expr<uint_>("i1")] << " = 0;\n";
|
||||
}
|
||||
|
||||
event exec(command_queue &queue)
|
||||
{
|
||||
if(m_count == 0) {
|
||||
return event();
|
||||
}
|
||||
|
||||
set_arg(m_p_count_arg, uint_(m_p_count));
|
||||
|
||||
return exec_1d(queue, 0, m_count);
|
||||
}
|
||||
|
||||
private:
|
||||
size_t m_p_count;
|
||||
size_t m_p_count_arg;
|
||||
size_t m_count;
|
||||
};
|
||||
|
||||
} //end detail namespace
|
||||
} //end compute namespace
|
||||
} //end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_SEARCH_ALL_HPP
|
||||
@@ -0,0 +1,27 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Paul Mensonides 2002.
|
||||
# * Distributed under the Boost Software License, Version 1.0. (See
|
||||
# * accompanying file LICENSE_1_0.txt or copy at
|
||||
# * http://www.boost.org/LICENSE_1_0.txt)
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# ifndef BOOST_PREPROCESSOR_SEQ_TO_TUPLE_HPP
|
||||
# define BOOST_PREPROCESSOR_SEQ_TO_TUPLE_HPP
|
||||
#
|
||||
# include <boost/preprocessor/config/config.hpp>
|
||||
# include <boost/preprocessor/seq/enum.hpp>
|
||||
#
|
||||
# /* BOOST_PP_SEQ_TO_TUPLE */
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
|
||||
# define BOOST_PP_SEQ_TO_TUPLE(seq) (BOOST_PP_SEQ_ENUM(seq))
|
||||
# else
|
||||
# define BOOST_PP_SEQ_TO_TUPLE(seq) BOOST_PP_SEQ_TO_TUPLE_I(seq)
|
||||
# define BOOST_PP_SEQ_TO_TUPLE_I(seq) (BOOST_PP_SEQ_ENUM(seq))
|
||||
# endif
|
||||
#
|
||||
# endif
|
||||
@@ -0,0 +1,9 @@
|
||||
0; 0; 0
|
||||
88; 88; 88
|
||||
126;126;126
|
||||
155;155;155
|
||||
179;179;179
|
||||
200;200;200
|
||||
220;220;220
|
||||
237;237;237
|
||||
254;254;254
|
||||
@@ -0,0 +1,76 @@
|
||||
module ft8_decode
|
||||
|
||||
type :: ft8_decoder
|
||||
procedure(ft8_decode_callback), pointer :: callback
|
||||
contains
|
||||
procedure :: decode
|
||||
end type ft8_decoder
|
||||
|
||||
abstract interface
|
||||
subroutine ft8_decode_callback (this,sync,snr,dt,freq,nbadcrc,decoded)
|
||||
import ft8_decoder
|
||||
implicit none
|
||||
class(ft8_decoder), intent(inout) :: this
|
||||
real, intent(in) :: sync
|
||||
integer, intent(in) :: snr
|
||||
real, intent(in) :: dt
|
||||
real, intent(in) :: freq
|
||||
integer, intent(in) :: nbadcrc
|
||||
character(len=22), intent(in) :: decoded
|
||||
end subroutine ft8_decode_callback
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
subroutine decode(this,callback,iwave,nfqso,newdat,nutc,nfa, &
|
||||
nfb,nagain,ndepth,nsubmode)
|
||||
|
||||
use timer_module, only: timer
|
||||
include 'fsk4hf/ft8_params.f90'
|
||||
|
||||
class(ft8_decoder), intent(inout) :: this
|
||||
procedure(ft8_decode_callback) :: callback
|
||||
real s(NH1,NHSYM)
|
||||
real candidate(3,100)
|
||||
real dd(15*12000)
|
||||
logical, intent(in) :: newdat, nagain
|
||||
integer*2 iwave(15*12000)
|
||||
character datetime*13,message*22
|
||||
save s,dd
|
||||
|
||||
this%callback => callback
|
||||
write(datetime,1001) nutc !### TEMPORARY ###
|
||||
1001 format("000000_",i6.6)
|
||||
|
||||
call timer('sync8 ',0)
|
||||
call sync8(iwave,nfa,nfb,nfqso,s,candidate,ncand)
|
||||
call timer('sync8 ',1)
|
||||
|
||||
dd=iwave
|
||||
syncmin=2.0
|
||||
! rewind 51
|
||||
do icand=1,ncand
|
||||
sync=candidate(3,icand)
|
||||
if(sync.lt.syncmin) cycle
|
||||
f1=candidate(1,icand)
|
||||
xdt=candidate(2,icand)
|
||||
nsnr=min(99,nint(10.0*log10(sync) - 25.5)) !### empirical ###
|
||||
call timer('ft8b ',0)
|
||||
call ft8b(dd,newdat,nfqso,f1,xdt,nharderrors,dmin,nbadcrc,message,xsnr)
|
||||
nsnr=xsnr
|
||||
xdt=xdt-0.6
|
||||
call timer('ft8b ',1)
|
||||
if (associated(this%callback)) call this%callback(sync,nsnr,xdt, &
|
||||
f1,nbadcrc,message)
|
||||
! write(*,'(f7.2,i5,f7.2,f9.1,i5,f7.2,2x,a22)') sync,nsnr,xdt,f1,nharderrors,dmin,message
|
||||
! write(13,1110) datetime,0,nsnr,xdt,f1,nharderrors,dmin,message
|
||||
1110 format(a13,2i4,f6.2,f7.1,i4,' ~ ',f6.2,2x,a22,' FT8')
|
||||
! write(51,3051) xdt,f1,sync,dmin,nsnr,nharderrors,nbadcrc,message
|
||||
!3051 format(4f9.1,3i5,2x,a22)
|
||||
! flush(51)
|
||||
enddo
|
||||
|
||||
return
|
||||
end subroutine decode
|
||||
|
||||
end module ft8_decode
|
||||
@@ -0,0 +1,75 @@
|
||||
/*=============================================================================
|
||||
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)
|
||||
==============================================================================*/
|
||||
#ifndef BOOST_PP_IS_ITERATING
|
||||
#if !defined(FUSION_VECTOR_FORWARD_CTOR_07122005_1123)
|
||||
#define FUSION_VECTOR_FORWARD_CTOR_07122005_1123
|
||||
|
||||
#define FUSION_FORWARD_CTOR_FORWARD(z, n, _) BOOST_FUSION_FWD_ELEM(U##n, _##n)
|
||||
|
||||
#define BOOST_PP_FILENAME_1 \
|
||||
<boost/fusion/container/vector/detail/cpp03/vector_forward_ctor.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE)
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#undef FUSION_FORWARD_CTOR_FORWARD
|
||||
#endif
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define M BOOST_PP_ITERATION()
|
||||
|
||||
// XXX:
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
FUSION_HASH if !defined(BOOST_CLANG)
|
||||
BOOST_CONSTEXPR
|
||||
FUSION_HASH endif
|
||||
#else
|
||||
#if !defined(BOOST_CLANG)
|
||||
BOOST_CONSTEXPR
|
||||
#endif
|
||||
#endif
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
#if M == 1
|
||||
explicit
|
||||
#endif
|
||||
vector(BOOST_PP_ENUM_BINARY_PARAMS(
|
||||
M, typename detail::call_param<T, >::type arg))
|
||||
: vec(BOOST_PP_ENUM_PARAMS(M, arg)) {}
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
FUSION_HASH if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
#endif
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \
|
||||
(defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
|
||||
template <BOOST_PP_ENUM_PARAMS(M, typename U)>
|
||||
// XXX:
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
FUSION_HASH if !defined(BOOST_CLANG)
|
||||
BOOST_CXX14_CONSTEXPR
|
||||
FUSION_HASH endif
|
||||
#else
|
||||
#if !defined(BOOST_CLANG)
|
||||
BOOST_CXX14_CONSTEXPR
|
||||
#endif
|
||||
#endif
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
#if M == 1
|
||||
explicit
|
||||
#endif
|
||||
vector(BOOST_PP_ENUM_BINARY_PARAMS(M, U, && arg))
|
||||
: vec(BOOST_PP_ENUM(M, FUSION_FORWARD_CTOR_FORWARD, arg)) {}
|
||||
#endif
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
FUSION_HASH endif
|
||||
#endif
|
||||
|
||||
#undef M
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
@@ -0,0 +1,61 @@
|
||||
|
||||
#ifndef BOOST_MPL_VECTOR_C_HPP_INCLUDED
|
||||
#define BOOST_MPL_VECTOR_C_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2008
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id$
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
#if !defined(BOOST_MPL_PREPROCESSING_MODE)
|
||||
# include <boost/mpl/limits/vector.hpp>
|
||||
# include <boost/mpl/aux_/nttp_decl.hpp>
|
||||
# include <boost/mpl/aux_/config/preprocessor.hpp>
|
||||
|
||||
# include <boost/preprocessor/inc.hpp>
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <boost/preprocessor/stringize.hpp>
|
||||
|
||||
#if !defined(BOOST_NEEDS_TOKEN_PASTING_OP_FOR_TOKENS_JUXTAPOSING)
|
||||
# define AUX778076_VECTOR_C_HEADER \
|
||||
BOOST_PP_CAT(BOOST_PP_CAT(vector,BOOST_MPL_LIMIT_VECTOR_SIZE),_c).hpp \
|
||||
/**/
|
||||
#else
|
||||
# define AUX778076_VECTOR_C_HEADER \
|
||||
BOOST_PP_CAT(BOOST_PP_CAT(vector,BOOST_MPL_LIMIT_VECTOR_SIZE),_c)##.hpp \
|
||||
/**/
|
||||
#endif
|
||||
|
||||
# include BOOST_PP_STRINGIZE(boost/mpl/vector/AUX778076_VECTOR_C_HEADER)
|
||||
# undef AUX778076_VECTOR_C_HEADER
|
||||
# include <climits>
|
||||
#endif
|
||||
|
||||
#include <boost/mpl/aux_/config/use_preprocessed.hpp>
|
||||
|
||||
#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
|
||||
&& !defined(BOOST_MPL_PREPROCESSING_MODE)
|
||||
|
||||
# define BOOST_MPL_PREPROCESSED_HEADER vector_c.hpp
|
||||
# include <boost/mpl/aux_/include_preprocessed.hpp>
|
||||
|
||||
#else
|
||||
|
||||
# include <boost/mpl/limits/vector.hpp>
|
||||
|
||||
# define AUX778076_SEQUENCE_NAME vector_c
|
||||
# define AUX778076_SEQUENCE_LIMIT BOOST_MPL_LIMIT_VECTOR_SIZE
|
||||
# define AUX778076_SEQUENCE_NAME_N(n) BOOST_PP_CAT(BOOST_PP_CAT(vector,n),_c)
|
||||
# define AUX778076_SEQUENCE_CONVERT_CN_TO(z,n,TARGET) TARGET(BOOST_PP_CAT(C,n))
|
||||
# define AUX778076_SEQUENCE_INTEGRAL_WRAPPER
|
||||
# include <boost/mpl/aux_/sequence_wrapper.hpp>
|
||||
|
||||
#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
|
||||
#endif // BOOST_MPL_VECTOR_C_HPP_INCLUDED
|
||||
@@ -0,0 +1,195 @@
|
||||
// (C) Copyright Gennadiy Rozental 2001.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/libs/test for the library home page.
|
||||
//
|
||||
// File : $RCSfile$
|
||||
//
|
||||
// Version : $Revision$
|
||||
//
|
||||
// Description : simple facility that mimmic notion of read-only read-write
|
||||
// properties in C++ classes. Original idea by Henrik Ravn.
|
||||
// ***************************************************************************
|
||||
|
||||
#ifndef BOOST_TEST_UTILS_CLASS_PROPERTIES_HPP
|
||||
#define BOOST_TEST_UTILS_CLASS_PROPERTIES_HPP
|
||||
|
||||
// Boost.Test
|
||||
#include <boost/test/detail/config.hpp>
|
||||
|
||||
// Boost
|
||||
#if !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
|
||||
#include <boost/preprocessor/seq/for_each.hpp>
|
||||
#endif
|
||||
#include <boost/call_traits.hpp>
|
||||
#include <boost/type_traits/add_pointer.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/utility/addressof.hpp>
|
||||
|
||||
// STL
|
||||
#include <iosfwd>
|
||||
|
||||
#include <boost/test/detail/suppress_warnings.hpp>
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
namespace boost {
|
||||
namespace unit_test {
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** class_property ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
template<class PropertyType>
|
||||
class class_property {
|
||||
protected:
|
||||
typedef typename call_traits<PropertyType>::const_reference read_access_t;
|
||||
typedef typename call_traits<PropertyType>::param_type write_param_t;
|
||||
typedef typename add_pointer<typename add_const<PropertyType>::type>::type address_res_t;
|
||||
public:
|
||||
// Constructor
|
||||
class_property() : value( PropertyType() ) {}
|
||||
explicit class_property( write_param_t init_value )
|
||||
: value( init_value ) {}
|
||||
|
||||
// Access methods
|
||||
operator read_access_t() const { return value; }
|
||||
read_access_t get() const { return value; }
|
||||
bool operator!() const { return !value; }
|
||||
address_res_t operator&() const { return &value; }
|
||||
|
||||
// Data members
|
||||
#ifndef BOOST_TEST_NO_PROTECTED_USING
|
||||
protected:
|
||||
#endif
|
||||
PropertyType value;
|
||||
};
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
#ifdef BOOST_CLASSIC_IOSTREAMS
|
||||
|
||||
template<class PropertyType>
|
||||
inline std::ostream&
|
||||
operator<<( std::ostream& os, class_property<PropertyType> const& p )
|
||||
|
||||
#else
|
||||
|
||||
template<typename CharT1, typename Tr,class PropertyType>
|
||||
inline std::basic_ostream<CharT1,Tr>&
|
||||
operator<<( std::basic_ostream<CharT1,Tr>& os, class_property<PropertyType> const& p )
|
||||
|
||||
#endif
|
||||
{
|
||||
return os << p.get();
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
#define DEFINE_PROPERTY_FREE_BINARY_OPERATOR( op ) \
|
||||
template<class PropertyType> \
|
||||
inline bool \
|
||||
operator op( PropertyType const& lhs, class_property<PropertyType> const& rhs ) \
|
||||
{ \
|
||||
return lhs op rhs.get(); \
|
||||
} \
|
||||
template<class PropertyType> \
|
||||
inline bool \
|
||||
operator op( class_property<PropertyType> const& lhs, PropertyType const& rhs ) \
|
||||
{ \
|
||||
return lhs.get() op rhs; \
|
||||
} \
|
||||
template<class PropertyType> \
|
||||
inline bool \
|
||||
operator op( class_property<PropertyType> const& lhs, \
|
||||
class_property<PropertyType> const& rhs ) \
|
||||
{ \
|
||||
return lhs.get() op rhs.get(); \
|
||||
} \
|
||||
/**/
|
||||
|
||||
DEFINE_PROPERTY_FREE_BINARY_OPERATOR( == )
|
||||
DEFINE_PROPERTY_FREE_BINARY_OPERATOR( != )
|
||||
|
||||
#undef DEFINE_PROPERTY_FREE_BINARY_OPERATOR
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** readonly_property ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
template<class PropertyType>
|
||||
class readonly_property : public class_property<PropertyType> {
|
||||
typedef class_property<PropertyType> base_prop;
|
||||
typedef typename base_prop::address_res_t arrow_res_t;
|
||||
protected:
|
||||
typedef typename base_prop::write_param_t write_param_t;
|
||||
public:
|
||||
// Constructor
|
||||
readonly_property() {}
|
||||
explicit readonly_property( write_param_t init_value ) : base_prop( init_value ) {}
|
||||
|
||||
// access methods
|
||||
arrow_res_t operator->() const { return boost::addressof( base_prop::value ); }
|
||||
};
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
|
||||
|
||||
#define BOOST_READONLY_PROPERTY( property_type, friends ) boost::unit_test::readwrite_property<property_type >
|
||||
|
||||
#else
|
||||
|
||||
#define BOOST_READONLY_PROPERTY_DECLARE_FRIEND(r, data, elem) friend class elem;
|
||||
|
||||
#define BOOST_READONLY_PROPERTY( property_type, friends ) \
|
||||
class BOOST_JOIN( readonly_property, __LINE__ ) \
|
||||
: public boost::unit_test::readonly_property<property_type > { \
|
||||
typedef boost::unit_test::readonly_property<property_type > base_prop; \
|
||||
BOOST_PP_SEQ_FOR_EACH( BOOST_READONLY_PROPERTY_DECLARE_FRIEND, ' ', friends ) \
|
||||
typedef base_prop::write_param_t write_param_t; \
|
||||
public: \
|
||||
BOOST_JOIN( readonly_property, __LINE__ )() {} \
|
||||
explicit BOOST_JOIN( readonly_property, __LINE__ )( write_param_t init_v ) \
|
||||
: base_prop( init_v ) {} \
|
||||
} \
|
||||
/**/
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** readwrite_property ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
template<class PropertyType>
|
||||
class readwrite_property : public class_property<PropertyType> {
|
||||
typedef class_property<PropertyType> base_prop;
|
||||
typedef typename add_pointer<PropertyType>::type arrow_res_t;
|
||||
typedef typename base_prop::address_res_t const_arrow_res_t;
|
||||
typedef typename base_prop::write_param_t write_param_t;
|
||||
public:
|
||||
readwrite_property() : base_prop() {}
|
||||
explicit readwrite_property( write_param_t init_value ) : base_prop( init_value ) {}
|
||||
|
||||
// access methods
|
||||
void set( write_param_t v ) { base_prop::value = v; }
|
||||
arrow_res_t operator->() { return boost::addressof( base_prop::value ); }
|
||||
const_arrow_res_t operator->() const { return boost::addressof( base_prop::value ); }
|
||||
|
||||
#ifndef BOOST_TEST_NO_PROTECTED_USING
|
||||
using base_prop::value;
|
||||
#endif
|
||||
};
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
} // unit_test
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/test/detail/enable_warnings.hpp>
|
||||
|
||||
#undef BOOST_TEST_NO_PROTECTED_USING
|
||||
|
||||
#endif // BOOST_TEST_UTILS_CLASS_PROPERTIES_HPP
|
||||
@@ -0,0 +1,320 @@
|
||||
// (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
|
||||
/// Addition to STL algorithms
|
||||
// ***************************************************************************
|
||||
|
||||
#ifndef BOOST_TEST_UTILS_ALGORITHM_HPP
|
||||
#define BOOST_TEST_UTILS_ALGORITHM_HPP
|
||||
|
||||
// STL
|
||||
#include <utility>
|
||||
#include <algorithm> // std::find
|
||||
#include <functional> // std::bind1st
|
||||
|
||||
#include <boost/test/detail/suppress_warnings.hpp>
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
namespace boost {
|
||||
namespace unit_test {
|
||||
namespace utils {
|
||||
|
||||
/// @brief this algorithm search through two collections for first mismatch position that get returned as a pair
|
||||
/// of iterators, first pointing to the mismatch position in first collection, second iterator in second one
|
||||
///
|
||||
/// @param first1 - first collection begin iterator
|
||||
/// @param last1 - first collection end iterator
|
||||
/// @param first2 - second collection begin iterator
|
||||
/// @param last2 - second collection end iterator
|
||||
template <class InputIter1, class InputIter2>
|
||||
inline std::pair<InputIter1, InputIter2>
|
||||
mismatch( InputIter1 first1, InputIter1 last1,
|
||||
InputIter2 first2, InputIter2 last2 )
|
||||
{
|
||||
while( first1 != last1 && first2 != last2 && *first1 == *first2 ) {
|
||||
++first1;
|
||||
++first2;
|
||||
}
|
||||
|
||||
return std::pair<InputIter1, InputIter2>(first1, first2);
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
/// @brief this algorithm search through two collections for first mismatch position that get returned as a pair
|
||||
/// of iterators, first pointing to the mismatch position in first collection, second iterator in second one. This algorithms
|
||||
/// uses supplied predicate for collection elements comparison
|
||||
///
|
||||
/// @param first1 - first collection begin iterator
|
||||
/// @param last1 - first collection end iterator
|
||||
/// @param first2 - second collection begin iterator
|
||||
/// @param last2 - second collection end iterator
|
||||
/// @param pred - predicate to be used for search
|
||||
template <class InputIter1, class InputIter2, class Predicate>
|
||||
inline std::pair<InputIter1, InputIter2>
|
||||
mismatch( InputIter1 first1, InputIter1 last1,
|
||||
InputIter2 first2, InputIter2 last2,
|
||||
Predicate pred )
|
||||
{
|
||||
while( first1 != last1 && first2 != last2 && pred( *first1, *first2 ) ) {
|
||||
++first1;
|
||||
++first2;
|
||||
}
|
||||
|
||||
return std::pair<InputIter1, InputIter2>(first1, first2);
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
/// @brief this algorithm search through first collection for first element that does not belong a second one
|
||||
///
|
||||
/// @param first1 - first collection begin iterator
|
||||
/// @param last1 - first collection end iterator
|
||||
/// @param first2 - second collection begin iterator
|
||||
/// @param last2 - second collection end iterator
|
||||
template<class ForwardIterator1, class ForwardIterator2>
|
||||
inline ForwardIterator1
|
||||
find_first_not_of( ForwardIterator1 first1, ForwardIterator1 last1,
|
||||
ForwardIterator2 first2, ForwardIterator2 last2 )
|
||||
{
|
||||
while( first1 != last1 ) {
|
||||
if( std::find( first2, last2, *first1 ) == last2 )
|
||||
break;
|
||||
++first1;
|
||||
}
|
||||
|
||||
return first1;
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
/// @brief this algorithm search through first collection for first element that does not satisfy binary
|
||||
/// predicate in conjunction will any element in second collection
|
||||
///
|
||||
/// @param first1 - first collection begin iterator
|
||||
/// @param last1 - first collection end iterator
|
||||
/// @param first2 - second collection begin iterator
|
||||
/// @param last2 - second collection end iterator
|
||||
/// @param pred - predicate to be used for search
|
||||
template<class ForwardIterator1, class ForwardIterator2, class Predicate>
|
||||
inline ForwardIterator1
|
||||
find_first_not_of( ForwardIterator1 first1, ForwardIterator1 last1,
|
||||
ForwardIterator2 first2, ForwardIterator2 last2,
|
||||
Predicate pred )
|
||||
{
|
||||
while( first1 != last1 ) {
|
||||
if( std::find_if( first2, last2, std::bind1st( pred, *first1 ) ) == last2 )
|
||||
break;
|
||||
++first1;
|
||||
}
|
||||
|
||||
return first1;
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
/// @brief this algorithm search through first collection for last element that belongs to a second one
|
||||
///
|
||||
/// @param first1 - first collection begin iterator
|
||||
/// @param last1 - first collection end iterator
|
||||
/// @param first2 - second collection begin iterator
|
||||
/// @param last2 - second collection end iterator
|
||||
template<class BidirectionalIterator1, class ForwardIterator2>
|
||||
inline BidirectionalIterator1
|
||||
find_last_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1,
|
||||
ForwardIterator2 first2, ForwardIterator2 last2 )
|
||||
{
|
||||
if( first1 == last1 || first2 == last2 )
|
||||
return last1;
|
||||
|
||||
BidirectionalIterator1 it1 = last1;
|
||||
while( --it1 != first1 && std::find( first2, last2, *it1 ) == last2 ) {}
|
||||
|
||||
return it1 == first1 && std::find( first2, last2, *it1 ) == last2 ? last1 : it1;
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
/// @brief this algorithm search through first collection for last element that satisfy binary
|
||||
/// predicate in conjunction will at least one element in second collection
|
||||
///
|
||||
/// @param first1 - first collection begin iterator
|
||||
/// @param last1 - first collection end iterator
|
||||
/// @param first2 - second collection begin iterator
|
||||
/// @param last2 - second collection end iterator
|
||||
/// @param pred - predicate to be used for search
|
||||
template<class BidirectionalIterator1, class ForwardIterator2, class Predicate>
|
||||
inline BidirectionalIterator1
|
||||
find_last_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1,
|
||||
ForwardIterator2 first2, ForwardIterator2 last2,
|
||||
Predicate pred )
|
||||
{
|
||||
if( first1 == last1 || first2 == last2 )
|
||||
return last1;
|
||||
|
||||
BidirectionalIterator1 it1 = last1;
|
||||
while( --it1 != first1 && std::find_if( first2, last2, std::bind1st( pred, *it1 ) ) == last2 ) {}
|
||||
|
||||
return it1 == first1 && std::find_if( first2, last2, std::bind1st( pred, *it1 ) ) == last2 ? last1 : it1;
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
/// @brief this algorithm search through first collection for last element that does not belong to a second one
|
||||
///
|
||||
/// @param first1 - first collection begin iterator
|
||||
/// @param last1 - first collection end iterator
|
||||
/// @param first2 - second collection begin iterator
|
||||
/// @param last2 - second collection end iterator
|
||||
template<class BidirectionalIterator1, class ForwardIterator2>
|
||||
inline BidirectionalIterator1
|
||||
find_last_not_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1,
|
||||
ForwardIterator2 first2, ForwardIterator2 last2 )
|
||||
{
|
||||
if( first1 == last1 || first2 == last2 )
|
||||
return last1;
|
||||
|
||||
BidirectionalIterator1 it1 = last1;
|
||||
while( --it1 != first1 && std::find( first2, last2, *it1 ) != last2 ) {}
|
||||
|
||||
return it1 == first1 && std::find( first2, last2, *it1 ) != last2 ? last1 : it1;
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
/// @brief this algorithm search through first collection for last element that does not satisfy binary
|
||||
/// predicate in conjunction will any element in second collection
|
||||
///
|
||||
/// @param first1 - first collection begin iterator
|
||||
/// @param last1 - first collection end iterator
|
||||
/// @param first2 - second collection begin iterator
|
||||
/// @param last2 - second collection end iterator
|
||||
/// @param pred - predicate to be used for search
|
||||
template<class BidirectionalIterator1, class ForwardIterator2, class Predicate>
|
||||
inline BidirectionalIterator1
|
||||
find_last_not_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1,
|
||||
ForwardIterator2 first2, ForwardIterator2 last2,
|
||||
Predicate pred )
|
||||
{
|
||||
if( first1 == last1 || first2 == last2 )
|
||||
return last1;
|
||||
|
||||
BidirectionalIterator1 it1 = last1;
|
||||
while( --it1 != first1 && std::find_if( first2, last2, std::bind1st( pred, *it1 ) ) != last2 ) {}
|
||||
|
||||
return it1 == first1 && std::find_if( first2, last2, std::bind1st( pred, *it1 ) ) == last2 ? last1 : it1;
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
|
||||
/// @brief This algorithm replaces all occurrences of a set of substrings by another substrings
|
||||
///
|
||||
/// @param str - string of operation
|
||||
/// @param first1 - iterator to the beginning of the substrings to replace
|
||||
/// @param last1 - iterator to the end of the substrings to replace
|
||||
/// @param first2 - iterator to the beginning of the substrings to replace with
|
||||
/// @param last2 - iterator to the end of the substrings to replace with
|
||||
template<class StringClass, class ForwardIterator>
|
||||
inline StringClass
|
||||
replace_all_occurrences_of( StringClass str,
|
||||
ForwardIterator first1, ForwardIterator last1,
|
||||
ForwardIterator first2, ForwardIterator last2)
|
||||
{
|
||||
for(; first1 != last1 && first2 != last2; ++first1, ++first2) {
|
||||
std::size_t found = str.find( *first1 );
|
||||
while( found != StringClass::npos ) {
|
||||
str.replace(found, first1->size(), *first2 );
|
||||
found = str.find( *first1, found + first2->size() );
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
/// @brief This algorithm replaces all occurrences of a string with basic wildcards
|
||||
/// with another (optionally containing wildcards as well).
|
||||
///
|
||||
/// @param str - string to transform
|
||||
/// @param it_string_to_find - iterator to the beginning of the substrings to replace
|
||||
/// @param it_string_to_find_end - iterator to the end of the substrings to replace
|
||||
/// @param it_string_to_replace - iterator to the beginning of the substrings to replace with
|
||||
/// @param it_string_to_replace_end - iterator to the end of the substrings to replace with
|
||||
///
|
||||
/// The wildcard is the symbol '*'. Only a unique wildcard per string is supported. The replacement
|
||||
/// string may also contain a wildcard, in which case it is considered as a placeholder to the content
|
||||
/// of the wildcard in the source string.
|
||||
/// Example:
|
||||
/// - In order to replace the occurrences of @c 'time=\"some-variable-value\"' to a constant string,
|
||||
/// one may use @c 'time=\"*\"' as the string to search for, and 'time=\"0.0\"' as the replacement string.
|
||||
/// - In order to replace the occurrences of 'file.cpp(XX)' per 'file.cpp:XX', where XX is a variable to keep,
|
||||
/// on may use @c 'file.cpp(*)' as the string to search for, and 'file.cpp:*' as the replacement string.
|
||||
template<class StringClass, class ForwardIterator>
|
||||
inline StringClass
|
||||
replace_all_occurrences_with_wildcards(
|
||||
StringClass str,
|
||||
ForwardIterator it_string_to_find, ForwardIterator it_string_to_find_end,
|
||||
ForwardIterator it_string_to_replace, ForwardIterator it_string_to_replace_end)
|
||||
{
|
||||
for(; it_string_to_find != it_string_to_find_end && it_string_to_replace != it_string_to_replace_end;
|
||||
++it_string_to_find, ++ it_string_to_replace) {
|
||||
|
||||
std::size_t wildcard_pos = it_string_to_find->find("*");
|
||||
if(wildcard_pos == StringClass::npos) {
|
||||
ForwardIterator it_to_find_current_end(it_string_to_find);
|
||||
ForwardIterator it_to_replace_current_end(it_string_to_replace);
|
||||
str = replace_all_occurrences_of(
|
||||
str,
|
||||
it_string_to_find, ++it_to_find_current_end,
|
||||
it_string_to_replace, ++it_to_replace_current_end);
|
||||
continue;
|
||||
}
|
||||
|
||||
std::size_t wildcard_pos_replace = it_string_to_replace->find("*");
|
||||
|
||||
std::size_t found_begin = str.find( it_string_to_find->substr(0, wildcard_pos) );
|
||||
while( found_begin != StringClass::npos ) {
|
||||
std::size_t found_end = str.find(it_string_to_find->substr(wildcard_pos+1), found_begin + wildcard_pos + 1); // to simplify
|
||||
if( found_end != StringClass::npos ) {
|
||||
|
||||
if( wildcard_pos_replace == StringClass::npos ) {
|
||||
StringClass replace_content = *it_string_to_replace;
|
||||
str.replace(
|
||||
found_begin,
|
||||
found_end + (it_string_to_find->size() - wildcard_pos - 1 ) - found_begin,
|
||||
replace_content);
|
||||
} else {
|
||||
StringClass replace_content =
|
||||
it_string_to_replace->substr(0, wildcard_pos_replace)
|
||||
+ str.substr(found_begin + wildcard_pos,
|
||||
found_end - found_begin - wildcard_pos)
|
||||
+ it_string_to_replace->substr(wildcard_pos_replace+1) ;
|
||||
str.replace(
|
||||
found_begin,
|
||||
found_end + (it_string_to_find->size() - wildcard_pos - 1 ) - found_begin,
|
||||
replace_content);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// may adapt the restart to the replacement and be more efficient
|
||||
found_begin = str.find( it_string_to_find->substr(0, wildcard_pos), found_begin + 1 );
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
} // namespace utils
|
||||
} // namespace unit_test
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/test/detail/enable_warnings.hpp>
|
||||
|
||||
#endif // BOOST_TEST_UTILS_ALGORITHM_HPP
|
||||
@@ -0,0 +1,204 @@
|
||||
#ifndef BOOST_ARCHIVE_BASIC_BINARY_IARCHIVE_HPP
|
||||
#define BOOST_ARCHIVE_BASIC_BINARY_IARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_binary_iarchive.hpp
|
||||
//
|
||||
// archives stored as native binary - this should be the fastest way
|
||||
// to archive the state of a group of obects. It makes no attempt to
|
||||
// convert to any canonical form.
|
||||
|
||||
// IN GENERAL, ARCHIVES CREATED WITH THIS CLASS WILL NOT BE READABLE
|
||||
// ON PLATFORM APART FROM THE ONE THEY ARE CREATED ON
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <boost/archive/basic_archive.hpp>
|
||||
#include <boost/archive/detail/common_iarchive.hpp>
|
||||
#include <boost/serialization/collection_size_type.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
#include <boost/serialization/item_version_type.hpp>
|
||||
#include <boost/integer_traits.hpp>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
template<class Archive> class interface_iarchive;
|
||||
} // namespace detail
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// class basic_binary_iarchive - read serialized objects from a input binary stream
|
||||
template<class Archive>
|
||||
class BOOST_SYMBOL_VISIBLE basic_binary_iarchive :
|
||||
public detail::common_iarchive<Archive>
|
||||
{
|
||||
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
|
||||
// for some inexplicable reason insertion of "class" generates compile erro
|
||||
// on msvc 7.1
|
||||
friend detail::interface_iarchive<Archive>;
|
||||
#else
|
||||
friend class detail::interface_iarchive<Archive>;
|
||||
#endif
|
||||
#endif
|
||||
// intermediate level to support override of operators
|
||||
// fot templates in the absence of partial function
|
||||
// template ordering. If we get here pass to base class
|
||||
// note extra nonsense to sneak it pass the borland compiers
|
||||
typedef detail::common_iarchive<Archive> detail_common_iarchive;
|
||||
template<class T>
|
||||
void load_override(T & t){
|
||||
this->detail_common_iarchive::load_override(t);
|
||||
}
|
||||
|
||||
// include these to trap a change in binary format which
|
||||
// isn't specifically handled
|
||||
// upto 32K classes
|
||||
BOOST_STATIC_ASSERT(sizeof(class_id_type) == sizeof(int_least16_t));
|
||||
BOOST_STATIC_ASSERT(sizeof(class_id_reference_type) == sizeof(int_least16_t));
|
||||
// upto 2G objects
|
||||
BOOST_STATIC_ASSERT(sizeof(object_id_type) == sizeof(uint_least32_t));
|
||||
BOOST_STATIC_ASSERT(sizeof(object_reference_type) == sizeof(uint_least32_t));
|
||||
|
||||
// binary files don't include the optional information
|
||||
void load_override(class_id_optional_type & /* t */){}
|
||||
|
||||
void load_override(tracking_type & t, int /*version*/){
|
||||
library_version_type lvt = this->get_library_version();
|
||||
if(boost::archive::library_version_type(6) < lvt){
|
||||
int_least8_t x=0;
|
||||
* this->This() >> x;
|
||||
t = boost::archive::tracking_type(x);
|
||||
}
|
||||
else{
|
||||
bool x=0;
|
||||
* this->This() >> x;
|
||||
t = boost::archive::tracking_type(x);
|
||||
}
|
||||
}
|
||||
void load_override(class_id_type & t){
|
||||
library_version_type lvt = this->get_library_version();
|
||||
if(boost::archive::library_version_type(7) < lvt){
|
||||
this->detail_common_iarchive::load_override(t);
|
||||
}
|
||||
else
|
||||
if(boost::archive::library_version_type(6) < lvt){
|
||||
int_least16_t x=0;
|
||||
* this->This() >> x;
|
||||
t = boost::archive::class_id_type(x);
|
||||
}
|
||||
else{
|
||||
int x=0;
|
||||
* this->This() >> x;
|
||||
t = boost::archive::class_id_type(x);
|
||||
}
|
||||
}
|
||||
void load_override(class_id_reference_type & t){
|
||||
load_override(static_cast<class_id_type &>(t));
|
||||
}
|
||||
|
||||
void load_override(version_type & t){
|
||||
library_version_type lvt = this->get_library_version();
|
||||
if(boost::archive::library_version_type(7) < lvt){
|
||||
this->detail_common_iarchive::load_override(t);
|
||||
}
|
||||
else
|
||||
if(boost::archive::library_version_type(6) < lvt){
|
||||
uint_least8_t x=0;
|
||||
* this->This() >> x;
|
||||
t = boost::archive::version_type(x);
|
||||
}
|
||||
else
|
||||
if(boost::archive::library_version_type(5) < lvt){
|
||||
uint_least16_t x=0;
|
||||
* this->This() >> x;
|
||||
t = boost::archive::version_type(x);
|
||||
}
|
||||
else
|
||||
if(boost::archive::library_version_type(2) < lvt){
|
||||
// upto 255 versions
|
||||
unsigned char x=0;
|
||||
* this->This() >> x;
|
||||
t = version_type(x);
|
||||
}
|
||||
else{
|
||||
unsigned int x=0;
|
||||
* this->This() >> x;
|
||||
t = boost::archive::version_type(x);
|
||||
}
|
||||
}
|
||||
|
||||
void load_override(boost::serialization::item_version_type & t){
|
||||
library_version_type lvt = this->get_library_version();
|
||||
// if(boost::archive::library_version_type(7) < lvt){
|
||||
if(boost::archive::library_version_type(6) < lvt){
|
||||
this->detail_common_iarchive::load_override(t);
|
||||
}
|
||||
else
|
||||
if(boost::archive::library_version_type(6) < lvt){
|
||||
uint_least16_t x=0;
|
||||
* this->This() >> x;
|
||||
t = boost::serialization::item_version_type(x);
|
||||
}
|
||||
else{
|
||||
unsigned int x=0;
|
||||
* this->This() >> x;
|
||||
t = boost::serialization::item_version_type(x);
|
||||
}
|
||||
}
|
||||
|
||||
void load_override(serialization::collection_size_type & t){
|
||||
if(boost::archive::library_version_type(5) < this->get_library_version()){
|
||||
this->detail_common_iarchive::load_override(t);
|
||||
}
|
||||
else{
|
||||
unsigned int x=0;
|
||||
* this->This() >> x;
|
||||
t = serialization::collection_size_type(x);
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
load_override(class_name_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
init();
|
||||
|
||||
basic_binary_iarchive(unsigned int flags) :
|
||||
detail::common_iarchive<Archive>(flags)
|
||||
{}
|
||||
};
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#endif // BOOST_ARCHIVE_BASIC_BINARY_IARCHIVE_HPP
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
@@ -0,0 +1,34 @@
|
||||
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
|
||||
// unit/quantity manipulation and conversion
|
||||
//
|
||||
// Copyright (C) 2003-2008 Matthias Christian Schabel
|
||||
// Copyright (C) 2008 Steven Watanabe
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_UNITS_PERMEABILITY_DERIVED_DIMENSION_HPP
|
||||
#define BOOST_UNITS_PERMEABILITY_DERIVED_DIMENSION_HPP
|
||||
|
||||
#include <boost/units/derived_dimension.hpp>
|
||||
#include <boost/units/physical_dimensions/length.hpp>
|
||||
#include <boost/units/physical_dimensions/mass.hpp>
|
||||
#include <boost/units/physical_dimensions/time.hpp>
|
||||
#include <boost/units/physical_dimensions/current.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace units {
|
||||
|
||||
/// derived dimension for permeability : L M T^-2 I^-2
|
||||
typedef derived_dimension<length_base_dimension,1,
|
||||
mass_base_dimension,1,
|
||||
time_base_dimension,-2,
|
||||
current_base_dimension,-2>::type permeability_dimension;
|
||||
|
||||
} // namespace units
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_UNITS_PERMEABILITY_DERIVED_DIMENSION_HPP
|
||||
@@ -0,0 +1,133 @@
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2001-2004
|
||||
// Copyright David Abrahams 2001-2002
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
// Preprocessed version of "boost/mpl/aux_/iter_fold_if_impl.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl { namespace aux {
|
||||
|
||||
template< typename Iterator, typename State >
|
||||
struct iter_fold_if_null_step
|
||||
{
|
||||
typedef State state;
|
||||
typedef Iterator iterator;
|
||||
};
|
||||
|
||||
template< bool >
|
||||
struct iter_fold_if_step_impl
|
||||
{
|
||||
template<
|
||||
typename Iterator
|
||||
, typename State
|
||||
, typename StateOp
|
||||
, typename IteratorOp
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef typename apply2< StateOp,State,Iterator >::type state;
|
||||
typedef typename IteratorOp::type iterator;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct iter_fold_if_step_impl<false>
|
||||
{
|
||||
template<
|
||||
typename Iterator
|
||||
, typename State
|
||||
, typename StateOp
|
||||
, typename IteratorOp
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef State state;
|
||||
typedef Iterator iterator;
|
||||
};
|
||||
};
|
||||
|
||||
template<
|
||||
typename Iterator
|
||||
, typename State
|
||||
, typename ForwardOp
|
||||
, typename Predicate
|
||||
>
|
||||
struct iter_fold_if_forward_step
|
||||
{
|
||||
typedef typename apply2< Predicate,State,Iterator >::type not_last;
|
||||
typedef typename iter_fold_if_step_impl<
|
||||
BOOST_MPL_AUX_MSVC_VALUE_WKND(not_last)::value
|
||||
>::template result_< Iterator,State,ForwardOp, mpl::next<Iterator> > impl_;
|
||||
|
||||
typedef typename impl_::state state;
|
||||
typedef typename impl_::iterator iterator;
|
||||
};
|
||||
|
||||
template<
|
||||
typename Iterator
|
||||
, typename State
|
||||
, typename BackwardOp
|
||||
, typename Predicate
|
||||
>
|
||||
struct iter_fold_if_backward_step
|
||||
{
|
||||
typedef typename apply2< Predicate,State,Iterator >::type not_last;
|
||||
typedef typename iter_fold_if_step_impl<
|
||||
BOOST_MPL_AUX_MSVC_VALUE_WKND(not_last)::value
|
||||
>::template result_< Iterator,State,BackwardOp, identity<Iterator> > impl_;
|
||||
|
||||
typedef typename impl_::state state;
|
||||
typedef typename impl_::iterator iterator;
|
||||
};
|
||||
|
||||
template<
|
||||
typename Iterator
|
||||
, typename State
|
||||
, typename ForwardOp
|
||||
, typename ForwardPredicate
|
||||
, typename BackwardOp
|
||||
, typename BackwardPredicate
|
||||
>
|
||||
struct iter_fold_if_impl
|
||||
{
|
||||
private:
|
||||
typedef iter_fold_if_null_step< Iterator,State > forward_step0;
|
||||
typedef iter_fold_if_forward_step< typename forward_step0::iterator, typename forward_step0::state, ForwardOp, ForwardPredicate > forward_step1;
|
||||
typedef iter_fold_if_forward_step< typename forward_step1::iterator, typename forward_step1::state, ForwardOp, ForwardPredicate > forward_step2;
|
||||
typedef iter_fold_if_forward_step< typename forward_step2::iterator, typename forward_step2::state, ForwardOp, ForwardPredicate > forward_step3;
|
||||
typedef iter_fold_if_forward_step< typename forward_step3::iterator, typename forward_step3::state, ForwardOp, ForwardPredicate > forward_step4;
|
||||
|
||||
|
||||
typedef typename if_<
|
||||
typename forward_step4::not_last
|
||||
, iter_fold_if_impl<
|
||||
typename forward_step4::iterator
|
||||
, typename forward_step4::state
|
||||
, ForwardOp
|
||||
, ForwardPredicate
|
||||
, BackwardOp
|
||||
, BackwardPredicate
|
||||
>
|
||||
, iter_fold_if_null_step<
|
||||
typename forward_step4::iterator
|
||||
, typename forward_step4::state
|
||||
>
|
||||
>::type backward_step4;
|
||||
|
||||
typedef iter_fold_if_backward_step< typename forward_step3::iterator, typename backward_step4::state, BackwardOp, BackwardPredicate > backward_step3;
|
||||
typedef iter_fold_if_backward_step< typename forward_step2::iterator, typename backward_step3::state, BackwardOp, BackwardPredicate > backward_step2;
|
||||
typedef iter_fold_if_backward_step< typename forward_step1::iterator, typename backward_step2::state, BackwardOp, BackwardPredicate > backward_step1;
|
||||
typedef iter_fold_if_backward_step< typename forward_step0::iterator, typename backward_step1::state, BackwardOp, BackwardPredicate > backward_step0;
|
||||
|
||||
|
||||
public:
|
||||
typedef typename backward_step0::state state;
|
||||
typedef typename backward_step4::iterator iterator;
|
||||
};
|
||||
|
||||
}}}
|
||||
@@ -0,0 +1,117 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_CONVERT_MAIN_09232005_1340)
|
||||
#define FUSION_CONVERT_MAIN_09232005_1340
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/container/map/map.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
template <typename It, bool is_assoc>
|
||||
struct pair_from
|
||||
{
|
||||
typedef typename result_of::value_of<It>::type type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static inline type call(It const& it)
|
||||
{
|
||||
return *it;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename It>
|
||||
struct pair_from<It, true>
|
||||
{
|
||||
typedef typename result_of::key_of<It>::type key_type;
|
||||
typedef typename result_of::value_of_data<It>::type data_type;
|
||||
typedef typename fusion::pair<key_type, data_type> type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static inline type call(It const& it)
|
||||
{
|
||||
return type(deref_data(it));
|
||||
}
|
||||
};
|
||||
}}}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Without variadics, we will use the PP version
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#if !defined(BOOST_FUSION_HAS_VARIADIC_MAP)
|
||||
# include <boost/fusion/container/map/detail/cpp03/convert.hpp>
|
||||
|
||||
#else
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// C++11 variadic implementation
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/fusion/container/map/detail/build_map.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct as_map :
|
||||
detail::build_map<
|
||||
typename result_of::begin<Sequence>::type
|
||||
, typename result_of::end<Sequence>::type
|
||||
, is_base_of<
|
||||
associative_tag
|
||||
, typename traits::category_of<Sequence>::type>::value
|
||||
>
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename result_of::as_map<Sequence>::type
|
||||
as_map(Sequence& seq)
|
||||
{
|
||||
typedef result_of::as_map<Sequence> gen;
|
||||
return gen::call(fusion::begin(seq), fusion::end(seq));
|
||||
}
|
||||
|
||||
template <typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename result_of::as_map<Sequence const>::type
|
||||
as_map(Sequence const& seq)
|
||||
{
|
||||
typedef result_of::as_map<Sequence const> gen;
|
||||
return gen::call(fusion::begin(seq), fusion::end(seq));
|
||||
}
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename T>
|
||||
struct convert_impl;
|
||||
|
||||
template <>
|
||||
struct convert_impl<map_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
typedef typename
|
||||
result_of::as_map<Sequence>::type
|
||||
type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type call(Sequence& seq)
|
||||
{
|
||||
typedef result_of::as_map<Sequence> gen;
|
||||
return gen::call(fusion::begin(seq), fusion::end(seq));
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2003 Joel de Guzman
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
=============================================================================*/
|
||||
#ifndef BOOST_SPIRIT_RANGE_RUN_HPP
|
||||
#define BOOST_SPIRIT_RANGE_RUN_HPP
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#include <vector>
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
namespace utility { namespace impl {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// range class
|
||||
//
|
||||
// Implements a closed range of values. This class is used in
|
||||
// the implementation of the range_run class.
|
||||
//
|
||||
// { Low level implementation detail }
|
||||
// { Not to be confused with BOOST_SPIRIT_CLASSIC_NS::range }
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename CharT>
|
||||
struct range {
|
||||
|
||||
range(CharT first, CharT last);
|
||||
|
||||
bool is_valid() const;
|
||||
bool includes(CharT v) const;
|
||||
bool includes(range const& r) const;
|
||||
bool overlaps(range const& r) const;
|
||||
void merge(range const& r);
|
||||
|
||||
CharT first;
|
||||
CharT last;
|
||||
};
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
struct range_char_compare {
|
||||
|
||||
bool operator()(range<CharT> const& x, const CharT y) const
|
||||
{ return x.first < y; }
|
||||
|
||||
bool operator()(const CharT x, range<CharT> const& y) const
|
||||
{ return x < y.first; }
|
||||
|
||||
// This additional operator is required for the checked STL shipped
|
||||
// with VC8 testing the ordering of the iterators passed to the
|
||||
// std::lower_bound algo this range_char_compare<> predicate is passed
|
||||
// to.
|
||||
bool operator()(range<CharT> const& x, range<CharT> const& y) const
|
||||
{ return x.first < y.first; }
|
||||
};
|
||||
|
||||
//////////////////////////////////
|
||||
template <typename CharT>
|
||||
struct range_compare {
|
||||
|
||||
bool operator()(range<CharT> const& x, range<CharT> const& y) const
|
||||
{ return x.first < y.first; }
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// range_run
|
||||
//
|
||||
// An implementation of a sparse bit (boolean) set. The set uses
|
||||
// a sorted vector of disjoint ranges. This class implements the
|
||||
// bare minimum essentials from which the full range of set
|
||||
// operators can be implemented. The set is constructed from
|
||||
// ranges. Internally, adjacent or overlapping ranges are
|
||||
// coalesced.
|
||||
//
|
||||
// range_runs are very space-economical in situations where there
|
||||
// are lots of ranges and a few individual disjoint values.
|
||||
// Searching is O(log n) where n is the number of ranges.
|
||||
//
|
||||
// { Low level implementation detail }
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename CharT>
|
||||
class range_run {
|
||||
|
||||
public:
|
||||
|
||||
typedef range<CharT> range_t;
|
||||
typedef std::vector<range_t> run_t;
|
||||
typedef typename run_t::iterator iterator;
|
||||
typedef typename run_t::const_iterator const_iterator;
|
||||
|
||||
void swap(range_run& rr);
|
||||
bool test(CharT v) const;
|
||||
void set(range_t const& r);
|
||||
void clear(range_t const& r);
|
||||
void clear();
|
||||
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
|
||||
private:
|
||||
|
||||
void merge(iterator iter, range_t const& r);
|
||||
|
||||
run_t run;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}} // namespace BOOST_SPIRIT_CLASSIC_NS::utility::impl
|
||||
|
||||
#endif
|
||||
|
||||
#include <boost/spirit/home/classic/utility/impl/chset/range_run.ipp>
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
Copyright Rene Rivera 2008-2015
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef BOOST_PREDEF_OS_BEOS_H
|
||||
#define BOOST_PREDEF_OS_BEOS_H
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
|
||||
/*`
|
||||
[heading `BOOST_OS_BEOS`]
|
||||
|
||||
[@http://en.wikipedia.org/wiki/BeOS BeOS] operating system.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`__BEOS__`] [__predef_detection__]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define BOOST_OS_BEOS BOOST_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \
|
||||
defined(__BEOS__) \
|
||||
)
|
||||
# undef BOOST_OS_BEOS
|
||||
# define BOOST_OS_BEOS BOOST_VERSION_NUMBER_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if BOOST_OS_BEOS
|
||||
# define BOOST_OS_BEOS_AVAILABLE
|
||||
# include <boost/predef/detail/os_detected.h>
|
||||
#endif
|
||||
|
||||
#define BOOST_OS_BEOS_NAME "BeOS"
|
||||
|
||||
#endif
|
||||
|
||||
#include <boost/predef/detail/test.h>
|
||||
BOOST_PREDEF_DECLARE_TEST(BOOST_OS_BEOS,BOOST_OS_BEOS_NAME)
|
||||
@@ -0,0 +1,172 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2005-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_PTHREAD_HELPERS_HPP
|
||||
#define BOOST_INTERPROCESS_PTHREAD_HELPERS_HPP
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
# include <boost/config.hpp>
|
||||
#endif
|
||||
#
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
#include <boost/interprocess/exceptions.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace interprocess {
|
||||
namespace ipcdetail{
|
||||
|
||||
#if defined BOOST_INTERPROCESS_POSIX_PROCESS_SHARED
|
||||
|
||||
//!Makes pthread_mutexattr_t cleanup easy when using exceptions
|
||||
struct mutexattr_wrapper
|
||||
{
|
||||
//!Constructor
|
||||
mutexattr_wrapper(bool recursive = false)
|
||||
{
|
||||
if(pthread_mutexattr_init(&m_attr)!=0 ||
|
||||
pthread_mutexattr_setpshared(&m_attr, PTHREAD_PROCESS_SHARED)!= 0 ||
|
||||
(recursive &&
|
||||
pthread_mutexattr_settype(&m_attr, PTHREAD_MUTEX_RECURSIVE)!= 0 ))
|
||||
throw interprocess_exception("pthread_mutexattr_xxxx failed");
|
||||
}
|
||||
|
||||
//!Destructor
|
||||
~mutexattr_wrapper() { pthread_mutexattr_destroy(&m_attr); }
|
||||
|
||||
//!This allows using mutexattr_wrapper as pthread_mutexattr_t
|
||||
operator pthread_mutexattr_t&() { return m_attr; }
|
||||
|
||||
pthread_mutexattr_t m_attr;
|
||||
};
|
||||
|
||||
//!Makes pthread_condattr_t cleanup easy when using exceptions
|
||||
struct condattr_wrapper
|
||||
{
|
||||
//!Constructor
|
||||
condattr_wrapper()
|
||||
{
|
||||
if(pthread_condattr_init(&m_attr)!=0 ||
|
||||
pthread_condattr_setpshared(&m_attr, PTHREAD_PROCESS_SHARED)!= 0)
|
||||
throw interprocess_exception("pthread_condattr_xxxx failed");
|
||||
}
|
||||
|
||||
//!Destructor
|
||||
~condattr_wrapper() { pthread_condattr_destroy(&m_attr); }
|
||||
|
||||
//!This allows using condattr_wrapper as pthread_condattr_t
|
||||
operator pthread_condattr_t&(){ return m_attr; }
|
||||
|
||||
pthread_condattr_t m_attr;
|
||||
};
|
||||
|
||||
//!Makes initialized pthread_mutex_t cleanup easy when using exceptions
|
||||
class mutex_initializer
|
||||
{
|
||||
public:
|
||||
//!Constructor. Takes interprocess_mutex attributes to initialize the interprocess_mutex
|
||||
mutex_initializer(pthread_mutex_t &mut, pthread_mutexattr_t &mut_attr)
|
||||
: mp_mut(&mut)
|
||||
{
|
||||
if(pthread_mutex_init(mp_mut, &mut_attr) != 0)
|
||||
throw interprocess_exception("pthread_mutex_init failed");
|
||||
}
|
||||
|
||||
~mutex_initializer() { if(mp_mut) pthread_mutex_destroy(mp_mut); }
|
||||
|
||||
void release() {mp_mut = 0; }
|
||||
|
||||
private:
|
||||
pthread_mutex_t *mp_mut;
|
||||
};
|
||||
|
||||
//!Makes initialized pthread_cond_t cleanup easy when using exceptions
|
||||
class condition_initializer
|
||||
{
|
||||
public:
|
||||
condition_initializer(pthread_cond_t &cond, pthread_condattr_t &cond_attr)
|
||||
: mp_cond(&cond)
|
||||
{
|
||||
if(pthread_cond_init(mp_cond, &cond_attr)!= 0)
|
||||
throw interprocess_exception("pthread_cond_init failed");
|
||||
}
|
||||
|
||||
~condition_initializer() { if(mp_cond) pthread_cond_destroy(mp_cond); }
|
||||
|
||||
void release() { mp_cond = 0; }
|
||||
|
||||
private:
|
||||
pthread_cond_t *mp_cond;
|
||||
};
|
||||
|
||||
#endif // #if defined BOOST_INTERPROCESS_POSIX_PROCESS_SHARED
|
||||
|
||||
#if defined(BOOST_INTERPROCESS_POSIX_BARRIERS) && defined(BOOST_INTERPROCESS_POSIX_PROCESS_SHARED)
|
||||
|
||||
//!Makes pthread_barrierattr_t cleanup easy when using exceptions
|
||||
struct barrierattr_wrapper
|
||||
{
|
||||
//!Constructor
|
||||
barrierattr_wrapper()
|
||||
{
|
||||
if(pthread_barrierattr_init(&m_attr)!=0 ||
|
||||
pthread_barrierattr_setpshared(&m_attr, PTHREAD_PROCESS_SHARED)!= 0)
|
||||
throw interprocess_exception("pthread_barrierattr_xxx failed");
|
||||
}
|
||||
|
||||
//!Destructor
|
||||
~barrierattr_wrapper() { pthread_barrierattr_destroy(&m_attr); }
|
||||
|
||||
//!This allows using mutexattr_wrapper as pthread_barrierattr_t
|
||||
operator pthread_barrierattr_t&() { return m_attr; }
|
||||
|
||||
pthread_barrierattr_t m_attr;
|
||||
};
|
||||
|
||||
//!Makes initialized pthread_barrier_t cleanup easy when using exceptions
|
||||
class barrier_initializer
|
||||
{
|
||||
public:
|
||||
//!Constructor. Takes barrier attributes to initialize the barrier
|
||||
barrier_initializer(pthread_barrier_t &mut,
|
||||
pthread_barrierattr_t &mut_attr,
|
||||
int count)
|
||||
: mp_barrier(&mut)
|
||||
{
|
||||
if(pthread_barrier_init(mp_barrier, &mut_attr, count) != 0)
|
||||
throw interprocess_exception("pthread_barrier_init failed");
|
||||
}
|
||||
|
||||
~barrier_initializer() { if(mp_barrier) pthread_barrier_destroy(mp_barrier); }
|
||||
|
||||
void release() {mp_barrier = 0; }
|
||||
|
||||
private:
|
||||
pthread_barrier_t *mp_barrier;
|
||||
};
|
||||
|
||||
#endif //#if defined(BOOST_INTERPROCESS_POSIX_BARRIERS) && defined(BOOST_INTERPROCESS_POSIX_PROCESS_SHARED)
|
||||
|
||||
}//namespace ipcdetail
|
||||
|
||||
}//namespace interprocess
|
||||
|
||||
}//namespace boost
|
||||
|
||||
#include <boost/interprocess/detail/config_end.hpp>
|
||||
|
||||
#endif //ifdef BOOST_INTERPROCESS_PTHREAD_HELPERS_HPP
|
||||
Reference in New Issue
Block a user