Python: Reverted to Boost 1.55
This commit is contained in:
@@ -91,7 +91,7 @@ def main():
|
||||
#Tweaks warning, because boost-numpy and boost-python won't compile cleanly without these changes
|
||||
cvars = sysconfig.get_config_vars()
|
||||
cvars['OPT'] = str.join(' ', remove_prefixes(cvars['OPT'].split(), ['-g', '-Wstrict-prototypes']))
|
||||
cvars["CFLAGS"] = cvars["BASECFLAGS"] + ' ' + cvars['OPT'] + ' -Wno-attributes -DBOOST_PYTHON_SOURCE '
|
||||
cvars["CFLAGS"] = cvars["BASECFLAGS"] + ' ' + cvars['OPT']
|
||||
cvars["LDFLAGS"] = '-Wl,--no-as-needed ' + cvars["LDFLAGS"]
|
||||
|
||||
#OpenCL
|
||||
@@ -140,7 +140,7 @@ def main():
|
||||
ext_package="isaac",
|
||||
ext_modules=[Extension(
|
||||
'_isaac',src,
|
||||
extra_compile_args= backend_defines + ['-std=c++11', '-Wno-unused-function', '-Wno-unused-local-typedefs', '-Wno-sign-compare'],
|
||||
extra_compile_args= backend_defines + ['-std=c++11', '-Wno-unused-function', '-Wno-unused-local-typedefs', '-Wno-sign-compare', '-Wno-attributes', '-DBOOST_PYTHON_SOURCE '],
|
||||
extra_link_args=['-Wl,-soname=_isaac.so'],
|
||||
undef_macros=[],
|
||||
include_dirs=include,
|
||||
|
50
python/external/boost/boost/aligned_storage.hpp
vendored
50
python/external/boost/boost/aligned_storage.hpp
vendored
@@ -48,10 +48,10 @@ struct aligned_storage_imp
|
||||
{
|
||||
char buf[size_];
|
||||
|
||||
typename ::boost::mpl::eval_if_c<
|
||||
typename mpl::eval_if_c<
|
||||
alignment_ == std::size_t(-1)
|
||||
, ::boost::mpl::identity< ::boost::detail::max_align >
|
||||
, ::boost::type_with_alignment<alignment_>
|
||||
, mpl::identity<detail::max_align>
|
||||
, type_with_alignment<alignment_>
|
||||
>::type align_;
|
||||
} data_;
|
||||
void* address() const { return const_cast<aligned_storage_imp*>(this); }
|
||||
@@ -76,12 +76,12 @@ class aligned_storage :
|
||||
#else
|
||||
public
|
||||
#endif
|
||||
::boost::detail::aligned_storage::aligned_storage_imp<size_, alignment_>
|
||||
detail::aligned_storage::aligned_storage_imp<size_, alignment_>
|
||||
{
|
||||
|
||||
public: // constants
|
||||
|
||||
typedef ::boost::detail::aligned_storage::aligned_storage_imp<size_, alignment_> type;
|
||||
typedef detail::aligned_storage::aligned_storage_imp<size_, alignment_> type;
|
||||
|
||||
BOOST_STATIC_CONSTANT(
|
||||
std::size_t
|
||||
@@ -96,11 +96,25 @@ public: // constants
|
||||
)
|
||||
);
|
||||
|
||||
#if defined(__GNUC__) &&\
|
||||
(__GNUC__ > 3) ||\
|
||||
(__GNUC__ == 3 && (__GNUC_MINOR__ > 2 ||\
|
||||
(__GNUC_MINOR__ == 2 && __GNUC_PATCHLEVEL__ >=3)))
|
||||
|
||||
private: // noncopyable
|
||||
|
||||
aligned_storage(const aligned_storage&);
|
||||
aligned_storage& operator=(const aligned_storage&);
|
||||
|
||||
#else // gcc less than 3.2.3
|
||||
|
||||
public: // _should_ be noncopyable, but GCC compiler emits error
|
||||
|
||||
aligned_storage(const aligned_storage&);
|
||||
aligned_storage& operator=(const aligned_storage&);
|
||||
|
||||
#endif // gcc < 3.2.3 workaround
|
||||
|
||||
public: // structors
|
||||
|
||||
aligned_storage()
|
||||
@@ -118,22 +132,46 @@ public: // accessors
|
||||
return static_cast<type*>(this)->address();
|
||||
}
|
||||
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
|
||||
const void* address() const
|
||||
{
|
||||
return static_cast<const type*>(this)->address();
|
||||
}
|
||||
|
||||
#else // MSVC6
|
||||
|
||||
const void* address() const;
|
||||
|
||||
#endif // MSVC6 workaround
|
||||
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
|
||||
// MSVC6 seems not to like inline functions with const void* returns, so we
|
||||
// declare the following here:
|
||||
|
||||
template <std::size_t S, std::size_t A>
|
||||
const void* aligned_storage<S,A>::address() const
|
||||
{
|
||||
return const_cast< aligned_storage<S,A>* >(this)->address();
|
||||
}
|
||||
|
||||
#endif // MSVC6 workaround
|
||||
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
//
|
||||
// Make sure that is_pod recognises aligned_storage<>::type
|
||||
// as a POD (Note that aligned_storage<> itself is not a POD):
|
||||
//
|
||||
template <std::size_t size_, std::size_t alignment_>
|
||||
struct is_pod< ::boost::detail::aligned_storage::aligned_storage_imp<size_,alignment_> >
|
||||
struct is_pod<boost::detail::aligned_storage::aligned_storage_imp<size_,alignment_> >
|
||||
BOOST_TT_AUX_BOOL_C_BASE(true)
|
||||
{
|
||||
BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(true)
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
} // namespace boost
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_ADD_FACET_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
typedef enum {
|
||||
no_exception, // initialized without code
|
||||
other_exception, // any excepton not listed below
|
||||
unregistered_class, // attempt to serialize a pointer of
|
||||
unregistered_class, // attempt to serialize a pointer of an
|
||||
// an unregistered class
|
||||
invalid_signature, // first line of archive does not contain
|
||||
// expected string
|
||||
@@ -57,8 +57,8 @@ public:
|
||||
// subsequent to this one
|
||||
pointer_conflict, // an attempt has been made to directly
|
||||
// serialize an object which has
|
||||
// already been serialized through a pointer.
|
||||
// Were this permitted, the archive load would result
|
||||
// already been serialzed through a pointer.
|
||||
// Were this permited, the archive load would result
|
||||
// in the creation of an extra copy of the obect.
|
||||
incompatible_native_format, // attempt to read native binary format
|
||||
// on incompatible platform
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
unregistered_cast, // base - derived relationship not registered with
|
||||
// void_cast_register
|
||||
unsupported_class_version, // type saved with a version # greater than the
|
||||
// one used by the program. This indicates that the program
|
||||
// one used by the program. This indicates that the proggram
|
||||
// needs to be rebuilt.
|
||||
multiple_code_instantiation, // code for implementing serialization for some
|
||||
// type has been instantiated in more than one module.
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_BASIC_ARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
#include <cstring> // count
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/cstdint.hpp> // size_t
|
||||
@@ -221,9 +221,6 @@ struct class_name_type :
|
||||
operator char * () {
|
||||
return t;
|
||||
}
|
||||
std::size_t size() const {
|
||||
return std::strlen(t);
|
||||
}
|
||||
explicit class_name_type(const char *key_)
|
||||
: t(const_cast<char *>(key_)){}
|
||||
explicit class_name_type(char *key_)
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_BASIC_BINARY_IARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -44,27 +44,21 @@
|
||||
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 basic_binary_iarchive :
|
||||
public detail::common_iarchive<Archive>
|
||||
{
|
||||
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
public:
|
||||
#elif defined(BOOST_MSVC)
|
||||
// for some inexplicable reason insertion of "class" generates compile erro
|
||||
// on msvc 7.1
|
||||
friend detail::interface_iarchive<Archive>;
|
||||
#else
|
||||
#else
|
||||
friend class detail::interface_iarchive<Archive>;
|
||||
#endif
|
||||
#endif
|
||||
// intermediate level to support override of operators
|
||||
// fot templates in the absence of partial function
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_BINARY_IPRIMITIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -49,21 +49,17 @@ namespace std{
|
||||
#include <boost/integer.hpp>
|
||||
#include <boost/integer_traits.hpp>
|
||||
|
||||
#include <boost/archive/basic_streambuf_locale_saver.hpp>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/mpl/placeholders.hpp>
|
||||
#include <boost/serialization/is_bitwise_serializable.hpp>
|
||||
#include <boost/serialization/array.hpp>
|
||||
|
||||
#include <boost/archive/basic_streambuf_locale_saver.hpp>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
template<class Ch>
|
||||
class codecvt_null;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// class binary_iarchive - read serialized objects from a input binary stream
|
||||
template<class Archive, class Elem, class Tr>
|
||||
@@ -82,7 +78,6 @@ public:
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
boost::scoped_ptr<codecvt_null<Elem> > codecvt_facet;
|
||||
boost::scoped_ptr<std::locale> archive_locale;
|
||||
basic_streambuf_locale_saver<Elem, Tr> locale_saver;
|
||||
#endif
|
||||
@@ -131,7 +126,7 @@ public:
|
||||
template <class T>
|
||||
#if defined(BOOST_NO_DEPENDENT_NESTED_DERIVATIONS)
|
||||
struct apply {
|
||||
typedef typename boost::serialization::is_bitwise_serializable< T >::type type;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::serialization::is_bitwise_serializable< T >::type type;
|
||||
};
|
||||
#else
|
||||
struct apply : public boost::serialization::is_bitwise_serializable< T > {};
|
||||
@@ -183,7 +178,7 @@ basic_binary_iprimitive<Archive, Elem, Tr>::load_binary(
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::input_stream_error)
|
||||
);
|
||||
std::memcpy(static_cast<char*>(address) + (count - s), &t, static_cast<std::size_t>(s));
|
||||
std::memcpy(static_cast<char*>(address) + (count - s), &t, s);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_BASIC_BINARY_OARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -46,10 +46,6 @@
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
template<class Archive> class interface_oarchive;
|
||||
} // namespace detail
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// class basic_binary_oarchive - write serialized objects to a binary output stream
|
||||
// note: this archive has no pretensions to portability. Archive format
|
||||
@@ -62,17 +58,15 @@ template<class Archive>
|
||||
class basic_binary_oarchive :
|
||||
public archive::detail::common_oarchive<Archive>
|
||||
{
|
||||
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
public:
|
||||
#elif defined(BOOST_MSVC)
|
||||
// for some inexplicable reason insertion of "class" generates compile erro
|
||||
// on msvc 7.1
|
||||
friend detail::interface_oarchive<Archive>;
|
||||
#else
|
||||
#else
|
||||
friend class detail::interface_oarchive<Archive>;
|
||||
#endif
|
||||
#endif
|
||||
// any datatype not specifed below will be handled by base class
|
||||
typedef detail::common_oarchive<Archive> detail_common_oarchive;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_BASIC_BINARY_OPRIMITIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -54,14 +54,12 @@ namespace std{
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
template<class Ch>
|
||||
class codecvt_null;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// class basic_binary_oprimitive - binary output of prmitives
|
||||
|
||||
template<class Archive, class Elem, class Tr>
|
||||
class basic_binary_oprimitive {
|
||||
class basic_binary_oprimitive
|
||||
{
|
||||
#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
friend class save_access;
|
||||
protected:
|
||||
@@ -74,7 +72,6 @@ public:
|
||||
return static_cast<Archive *>(this);
|
||||
}
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
boost::scoped_ptr<codecvt_null<Elem> > codecvt_facet;
|
||||
boost::scoped_ptr<std::locale> archive_locale;
|
||||
basic_streambuf_locale_saver<Elem, Tr> locale_saver;
|
||||
#endif
|
||||
@@ -125,7 +122,7 @@ public:
|
||||
template <class T>
|
||||
#if defined(BOOST_NO_DEPENDENT_NESTED_DERIVATIONS)
|
||||
struct apply {
|
||||
typedef typename boost::serialization::is_bitwise_serializable< T >::type type;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::serialization::is_bitwise_serializable< T >::type type;
|
||||
};
|
||||
#else
|
||||
struct apply : public boost::serialization::is_bitwise_serializable< T > {};
|
||||
@@ -173,7 +170,7 @@ basic_binary_oprimitive<Archive, Elem, Tr>::save_binary(
|
||||
archive_exception(archive_exception::output_stream_error)
|
||||
);
|
||||
//os.write(
|
||||
// static_cast<const typename OStream::char_type *>(address),
|
||||
// static_cast<const BOOST_DEDUCED_TYPENAME OStream::char_type *>(address),
|
||||
// count
|
||||
//);
|
||||
//BOOST_ASSERT(os.good());
|
||||
|
@@ -2,12 +2,12 @@
|
||||
#define BOOST_ARCHIVE_BASIC_STREAMBUF_LOCALE_SAVER_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_streambuf_locale_saver.hpp
|
||||
// basic_streambuf_local_saver.hpp
|
||||
|
||||
// (C) Copyright 2005 Robert Ramey - http://www.rrsd.com
|
||||
|
||||
@@ -50,15 +50,13 @@ public:
|
||||
explicit basic_streambuf_locale_saver( state_type &s )
|
||||
: s_save_( s ), a_save_( s.getloc() )
|
||||
{}
|
||||
explicit basic_streambuf_locale_saver( state_type &s, aspect_type const &a )
|
||||
basic_streambuf_locale_saver( state_type &s, aspect_type const &a )
|
||||
: s_save_( s ), a_save_( s.pubimbue(a) )
|
||||
{}
|
||||
~basic_streambuf_locale_saver()
|
||||
{ this->restore(); }
|
||||
void restore(){
|
||||
s_save_.pubsync();
|
||||
s_save_.pubimbue( a_save_ );
|
||||
}
|
||||
void restore()
|
||||
{ s_save_.pubimbue( a_save_ ); }
|
||||
private:
|
||||
state_type & s_save_;
|
||||
aspect_type const a_save_;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_BASIC_TEXT_IARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -40,27 +40,21 @@
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
template<class Archive> class interface_iarchive;
|
||||
} // namespace detail
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// class basic_text_iarchive - read serialized objects from a input text stream
|
||||
template<class Archive>
|
||||
class basic_text_iarchive :
|
||||
public detail::common_iarchive<Archive>
|
||||
{
|
||||
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
public:
|
||||
#elif defined(BOOST_MSVC)
|
||||
// for some inexplicable reason insertion of "class" generates compile erro
|
||||
// on msvc 7.1
|
||||
friend detail::interface_iarchive<Archive>;
|
||||
#else
|
||||
#else
|
||||
friend class detail::interface_iarchive<Archive>;
|
||||
#endif
|
||||
#endif
|
||||
// intermediate level to support override of operators
|
||||
// fot templates in the absence of partial function
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_BASIC_TEXT_IPRIMITIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -64,8 +64,13 @@ namespace archive {
|
||||
#endif
|
||||
|
||||
template<class IStream>
|
||||
class basic_text_iprimitive {
|
||||
class basic_text_iprimitive
|
||||
{
|
||||
#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
protected:
|
||||
#else
|
||||
public:
|
||||
#endif
|
||||
IStream &is;
|
||||
io::ios_flags_saver flags_saver;
|
||||
io::ios_precision_saver precision_saver;
|
||||
@@ -73,16 +78,18 @@ protected:
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
boost::scoped_ptr<std::locale> archive_locale;
|
||||
basic_streambuf_locale_saver<
|
||||
typename IStream::char_type,
|
||||
typename IStream::traits_type
|
||||
BOOST_DEDUCED_TYPENAME IStream::char_type,
|
||||
BOOST_DEDUCED_TYPENAME IStream::traits_type
|
||||
> locale_saver;
|
||||
#endif
|
||||
|
||||
template<class T>
|
||||
void load(T & t)
|
||||
{
|
||||
if(is >> t)
|
||||
if(! is.fail()){
|
||||
is >> t;
|
||||
return;
|
||||
}
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::input_stream_error)
|
||||
);
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -24,9 +24,11 @@
|
||||
// in such cases. So we can't use basic_ostream<OStream::char_type> but rather
|
||||
// use two template parameters
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/serialization/pfto.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <boost/archive/detail/common_oarchive.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
|
||||
@@ -40,29 +42,23 @@
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
template<class Archive> class interface_oarchive;
|
||||
} // namespace detail
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// class basic_text_oarchive
|
||||
template<class Archive>
|
||||
class basic_text_oarchive :
|
||||
public detail::common_oarchive<Archive>
|
||||
{
|
||||
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \
|
||||
|| BOOST_WORKAROUND(__BORLANDC__,BOOST_TESTED_AT(0x560))
|
||||
public:
|
||||
#elif defined(BOOST_MSVC)
|
||||
// for some inexplicable reason insertion of "class" generates compile erro
|
||||
// on msvc 7.1
|
||||
friend detail::interface_oarchive<Archive>;
|
||||
#else
|
||||
#else
|
||||
friend class detail::interface_oarchive<Archive>;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
enum {
|
||||
none,
|
||||
eol,
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_BASIC_TEXT_OPRIMITIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -26,14 +26,13 @@
|
||||
|
||||
#include <iomanip>
|
||||
#include <locale>
|
||||
#include <boost/config/no_tr1/cmath.hpp> // isnan
|
||||
#include <boost/assert.hpp>
|
||||
#include <cstddef> // size_t
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/io/ios_state.hpp>
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
|
||||
#include <boost/archive/dinkumware.hpp>
|
||||
#endif
|
||||
@@ -47,8 +46,6 @@ namespace std{
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/type_traits/is_floating_point.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/integer.hpp>
|
||||
#include <boost/io/ios_state.hpp>
|
||||
@@ -61,12 +58,18 @@ namespace std{
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
class save_access;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// class basic_text_oprimitive - output of prmitives to stream
|
||||
template<class OStream>
|
||||
class basic_text_oprimitive
|
||||
{
|
||||
#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
protected:
|
||||
#else
|
||||
public:
|
||||
#endif
|
||||
OStream &os;
|
||||
io::ios_flags_saver flags_saver;
|
||||
io::ios_precision_saver precision_saver;
|
||||
@@ -74,11 +77,21 @@ protected:
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
boost::scoped_ptr<std::locale> archive_locale;
|
||||
basic_streambuf_locale_saver<
|
||||
typename OStream::char_type,
|
||||
typename OStream::traits_type
|
||||
BOOST_DEDUCED_TYPENAME OStream::char_type,
|
||||
BOOST_DEDUCED_TYPENAME OStream::traits_type
|
||||
> locale_saver;
|
||||
#endif
|
||||
|
||||
// default saving of primitives.
|
||||
template<class T>
|
||||
void save(const T &t){
|
||||
if(os.fail())
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::output_stream_error)
|
||||
);
|
||||
os << t;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// fundamental types that need special treatment
|
||||
void save(const bool t){
|
||||
@@ -110,77 +123,33 @@ protected:
|
||||
save(static_cast<int>(t));
|
||||
}
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// saving of any types not listed above
|
||||
|
||||
template<class T>
|
||||
void save_impl(const T &t, boost::mpl::bool_<false> &){
|
||||
if(os.fail())
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::output_stream_error)
|
||||
);
|
||||
os << t;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// floating point types need even more special treatment
|
||||
// the following determines whether the type T is some sort
|
||||
// of floating point type. Note that we then assume that
|
||||
// the stream << operator is defined on that type - if not
|
||||
// we'll get a compile time error. This is meant to automatically
|
||||
// support synthesized types which support floating point
|
||||
// operations. Also it should handle compiler dependent types
|
||||
// such long double. Due to John Maddock.
|
||||
|
||||
template<class T>
|
||||
struct is_float {
|
||||
typedef typename mpl::bool_<
|
||||
boost::is_floating_point<T>::value
|
||||
|| (std::numeric_limits<T>::is_specialized
|
||||
&& !std::numeric_limits<T>::is_integer
|
||||
&& !std::numeric_limits<T>::is_exact
|
||||
&& std::numeric_limits<T>::max_exponent)
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
void save_impl(const T &t, boost::mpl::bool_<true> &){
|
||||
void save(const float t)
|
||||
{
|
||||
// must be a user mistake - can't serialize un-initialized data
|
||||
if(os.fail())
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::output_stream_error)
|
||||
);
|
||||
// The formulae for the number of decimla digits required is given in
|
||||
// http://www2.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1822.pdf
|
||||
// which is derived from Kahan's paper:
|
||||
// www.eecs.berkeley.edu/~wkahan/ieee754status/ieee754.ps
|
||||
// const unsigned int digits = (std::numeric_limits<T>::digits * 3010) / 10000;
|
||||
// note: I've commented out the above because I didn't get good results. e.g.
|
||||
// in one case I got a difference of 19 units.
|
||||
#ifndef BOOST_NO_CXX11_NUMERIC_LIMITS
|
||||
const unsigned int digits = std::numeric_limits<T>::max_digits10;
|
||||
#else
|
||||
const unsigned int digits = std::numeric_limits<T>::digits10 + 2;
|
||||
#endif
|
||||
os << std::setprecision(digits) << std::scientific << t;
|
||||
os << std::setprecision(std::numeric_limits<float>::digits10 + 2);
|
||||
os << t;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void save(const T & t){
|
||||
boost::io::ios_flags_saver fs(os);
|
||||
boost::io::ios_precision_saver ps(os);
|
||||
typename is_float<T>::type tf;
|
||||
save_impl(t, tf);
|
||||
void save(const double t)
|
||||
{
|
||||
// must be a user mistake - can't serialize un-initialized data
|
||||
if(os.fail())
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::output_stream_error)
|
||||
);
|
||||
os << std::setprecision(std::numeric_limits<double>::digits10 + 2);
|
||||
os << t;
|
||||
}
|
||||
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
|
||||
basic_text_oprimitive(OStream & os, bool no_codecvt);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
|
||||
~basic_text_oprimitive();
|
||||
public:
|
||||
// unformatted append of one character
|
||||
void put(typename OStream::char_type c){
|
||||
void put(BOOST_DEDUCED_TYPENAME OStream::char_type c){
|
||||
if(os.fail())
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::output_stream_error)
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_BASIC_XML_TEXT_ARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -37,27 +37,21 @@
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
template<class Archive> class interface_iarchive;
|
||||
} // namespace detail
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// class xml_iarchive - read serialized objects from a input text stream
|
||||
template<class Archive>
|
||||
class basic_xml_iarchive :
|
||||
public detail::common_iarchive<Archive>
|
||||
{
|
||||
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
public:
|
||||
#elif defined(BOOST_MSVC)
|
||||
// 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
|
||||
friend detail::interface_oarchive<Archive>;
|
||||
#else
|
||||
friend class detail::interface_oarchive<Archive>;
|
||||
#endif
|
||||
unsigned int depth;
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_BASIC_XML_OARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -17,9 +17,6 @@
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/serialization/pfto.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <boost/archive/detail/common_oarchive.hpp>
|
||||
|
||||
@@ -27,6 +24,7 @@
|
||||
#include <boost/serialization/tracking.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
|
||||
#include <boost/mpl/assert.hpp>
|
||||
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
@@ -38,29 +36,24 @@
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
template<class Archive> class interface_oarchive;
|
||||
} // namespace detail
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// class basic_xml_oarchive - write serialized objects to a xml output stream
|
||||
template<class Archive>
|
||||
class basic_xml_oarchive :
|
||||
public detail::common_oarchive<Archive>
|
||||
{
|
||||
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
#endif
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
public:
|
||||
#elif defined(BOOST_MSVC)
|
||||
// for some inexplicable reason insertion of "class" generates compile erro
|
||||
// on msvc 7.1
|
||||
friend detail::interface_oarchive<Archive>;
|
||||
friend class save_access;
|
||||
#else
|
||||
friend class detail::interface_oarchive<Archive>;
|
||||
#endif
|
||||
friend class save_access;
|
||||
#endif
|
||||
// special stuff for xml output
|
||||
unsigned int depth;
|
||||
bool indent_next;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_BINARY_IARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -28,6 +28,43 @@
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
// do not derive from the classes below. If you want to extend this functionality
|
||||
// via inhertance, derived from text_iarchive_impl instead. This will
|
||||
// preserve correct static polymorphism.
|
||||
|
||||
// same as binary_iarchive below - without the shared_ptr_helper
|
||||
class naked_binary_iarchive :
|
||||
public binary_iarchive_impl<
|
||||
boost::archive::naked_binary_iarchive,
|
||||
std::istream::char_type,
|
||||
std::istream::traits_type
|
||||
>
|
||||
{
|
||||
public:
|
||||
naked_binary_iarchive(std::istream & is, unsigned int flags = 0) :
|
||||
binary_iarchive_impl<
|
||||
naked_binary_iarchive, std::istream::char_type, std::istream::traits_type
|
||||
>(is, flags)
|
||||
{}
|
||||
naked_binary_iarchive(std::streambuf & bsb, unsigned int flags = 0) :
|
||||
binary_iarchive_impl<
|
||||
naked_binary_iarchive, std::istream::char_type, std::istream::traits_type
|
||||
>(bsb, flags)
|
||||
{}
|
||||
};
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
// note special treatment of shared_ptr. This type needs a special
|
||||
// structure associated with every archive. We created a "mix-in"
|
||||
// class to provide this functionality. Since shared_ptr holds a
|
||||
// special esteem in the boost library - we included it here by default.
|
||||
#include <boost/archive/shared_ptr_helper.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
// do not derive from this class. If you want to extend this functionality
|
||||
// via inhertance, derived from binary_iarchive_impl instead. This will
|
||||
// preserve correct static polymorphism.
|
||||
@@ -36,7 +73,9 @@ class binary_iarchive :
|
||||
boost::archive::binary_iarchive,
|
||||
std::istream::char_type,
|
||||
std::istream::traits_type
|
||||
>{
|
||||
>,
|
||||
public detail::shared_ptr_helper
|
||||
{
|
||||
public:
|
||||
binary_iarchive(std::istream & is, unsigned int flags = 0) :
|
||||
binary_iarchive_impl<
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_BINARY_IARCHIVE_IMPL_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -29,10 +29,6 @@
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
template<class Archive> class interface_iarchive;
|
||||
} // namespace detail
|
||||
|
||||
template<class Archive, class Elem, class Tr>
|
||||
class binary_iarchive_impl :
|
||||
public basic_binary_iprimitive<Archive, Elem, Tr>,
|
||||
@@ -41,18 +37,10 @@ class binary_iarchive_impl :
|
||||
#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>;
|
||||
friend basic_binary_iarchive<Archive>;
|
||||
friend load_access;
|
||||
#else
|
||||
friend class detail::interface_iarchive<Archive>;
|
||||
friend class basic_binary_iarchive<Archive>;
|
||||
friend class load_access;
|
||||
#endif
|
||||
protected:
|
||||
#endif
|
||||
// note: the following should not needed - but one compiler (vc 7.1)
|
||||
// fails to compile one test (test_shared_ptr) without it !!!
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_BINARY_OARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -50,6 +50,8 @@ public:
|
||||
{}
|
||||
};
|
||||
|
||||
typedef binary_oarchive naked_binary_oarchive;
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_BINARY_OARCHIVE_IMPL_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -30,10 +30,6 @@
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
template<class Archive> class interface_oarchive;
|
||||
} // namespace detail
|
||||
|
||||
template<class Archive, class Elem, class Tr>
|
||||
class binary_oarchive_impl :
|
||||
public basic_binary_oprimitive<Archive, Elem, Tr>,
|
||||
@@ -42,18 +38,10 @@ class binary_oarchive_impl :
|
||||
#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_oarchive<Archive>;
|
||||
friend basic_binary_oarchive<Archive>;
|
||||
friend save_access;
|
||||
#else
|
||||
friend class detail::interface_oarchive<Archive>;
|
||||
friend class basic_binary_oarchive<Archive>;
|
||||
friend class save_access;
|
||||
#endif
|
||||
protected:
|
||||
#endif
|
||||
// note: the following should not needed - but one compiler (vc 7.1)
|
||||
// fails to compile one test (test_shared_ptr) without it !!!
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_BINARY_WIARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -28,6 +28,43 @@
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
// same as binary_wiarchive below - without the shared_ptr_helper
|
||||
class naked_binary_wiarchive :
|
||||
public binary_iarchive_impl<
|
||||
boost::archive::naked_binary_wiarchive,
|
||||
std::wistream::char_type,
|
||||
std::wistream::traits_type
|
||||
>
|
||||
{
|
||||
public:
|
||||
naked_binary_wiarchive(std::wistream & is, unsigned int flags = 0) :
|
||||
binary_iarchive_impl<
|
||||
naked_binary_wiarchive,
|
||||
std::wistream::char_type,
|
||||
std::wistream::traits_type
|
||||
>(is, flags)
|
||||
{}
|
||||
naked_binary_wiarchive(std::wstreambuf & bsb, unsigned int flags = 0) :
|
||||
binary_iarchive_impl<
|
||||
naked_binary_wiarchive,
|
||||
std::wistream::char_type,
|
||||
std::wistream::traits_type
|
||||
>(bsb, flags)
|
||||
{}
|
||||
};
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
// note special treatment of shared_ptr. This type needs a special
|
||||
// structure associated with every archive. We created a "mix-in"
|
||||
// class to provide this functionality. Since shared_ptr holds a
|
||||
// special esteem in the boost library - we included it here by default.
|
||||
#include <boost/archive/shared_ptr_helper.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
class binary_wiarchive :
|
||||
public binary_iarchive_impl<
|
||||
binary_wiarchive, std::wistream::char_type, std::wistream::traits_type
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_BINARY_WOARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -49,6 +49,8 @@ public:
|
||||
{}
|
||||
};
|
||||
|
||||
typedef binary_woarchive naked_binary_woarchive;
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_CODECVT_NULL_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -87,10 +87,6 @@ class codecvt_null<wchar_t> : public std::codecvt<wchar_t, char, std::mbstate_t>
|
||||
virtual int do_max_length( ) const throw( ){
|
||||
return do_encoding();
|
||||
}
|
||||
public:
|
||||
explicit codecvt_null(std::size_t no_locale_manage = 0) :
|
||||
std::codecvt<wchar_t, char, std::mbstate_t>(no_locale_manage)
|
||||
{}
|
||||
};
|
||||
|
||||
} // namespace archive
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_SERIALIZER_MAP_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_DETAIL_AUTO_LINK_ARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_DETAIL_AUTO_LINK_WARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_DETAIL_BASIC_IARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -17,15 +17,15 @@
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
// can't use this - much as I'd like to as borland doesn't support it
|
||||
// #include <boost/scoped_ptr.hpp>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
#include <boost/type_traits/broken_compiler_spec.hpp>
|
||||
#include <boost/serialization/tracking_enum.hpp>
|
||||
#include <boost/archive/basic_archive.hpp>
|
||||
#include <boost/archive/detail/decl.hpp>
|
||||
#include <boost/archive/detail/helper_collection.hpp>
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
namespace boost {
|
||||
@@ -42,12 +42,13 @@ class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_iserializer;
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// class basic_iarchive - read serialized objects from a input stream
|
||||
class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iarchive :
|
||||
private boost::noncopyable,
|
||||
public boost::archive::detail::helper_collection
|
||||
private boost::noncopyable
|
||||
{
|
||||
friend class basic_iarchive_impl;
|
||||
// hide implementation of this class to minimize header conclusion
|
||||
boost::scoped_ptr<basic_iarchive_impl> pimpl;
|
||||
// in client code. I couldn't used scoped pointer with borland
|
||||
// boost::scoped_ptr<basic_iarchive_impl> pimpl;
|
||||
basic_iarchive_impl * pimpl;
|
||||
|
||||
virtual void vload(version_type &t) = 0;
|
||||
virtual void vload(object_id_type &t) = 0;
|
||||
@@ -57,12 +58,12 @@ class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iarchive :
|
||||
virtual void vload(tracking_type &t) = 0;
|
||||
protected:
|
||||
basic_iarchive(unsigned int flags);
|
||||
public:
|
||||
// account for bogus gcc warning
|
||||
#if defined(__GNUC__)
|
||||
virtual
|
||||
#endif
|
||||
~basic_iarchive();
|
||||
public:
|
||||
// note: NOT part of the public API.
|
||||
void next_object_pointer(void *t);
|
||||
void register_basic_serializer(
|
||||
@@ -98,6 +99,12 @@ public:
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
// required by smart_cast for compilers not implementing
|
||||
// partial template specialization
|
||||
BOOST_TT_BROKEN_COMPILER_SPEC(
|
||||
boost::archive::detail::basic_iarchive
|
||||
)
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#endif //BOOST_ARCHIVE_DETAIL_BASIC_IARCHIVE_HPP
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_DETAIL_BASIC_ISERIALIZER_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_BASIC_OARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -19,11 +19,15 @@
|
||||
#include <cstddef> // NULL
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
#include <boost/type_traits/broken_compiler_spec.hpp>
|
||||
|
||||
// can't use this - much as I'd like to as borland doesn't support it
|
||||
// #include <boost/scoped_ptr.hpp>
|
||||
|
||||
#include <boost/archive/basic_archive.hpp>
|
||||
#include <boost/serialization/tracking_enum.hpp>
|
||||
#include <boost/archive/detail/helper_collection.hpp>
|
||||
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
namespace boost {
|
||||
@@ -37,16 +41,16 @@ namespace detail {
|
||||
class basic_oarchive_impl;
|
||||
class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oserializer;
|
||||
class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_oserializer;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// class basic_oarchive - write serialized objects to an output stream
|
||||
class BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oarchive :
|
||||
private boost::noncopyable,
|
||||
public boost::archive::detail::helper_collection
|
||||
private boost::noncopyable
|
||||
{
|
||||
friend class basic_oarchive_impl;
|
||||
// hide implementation of this class to minimize header conclusion
|
||||
boost::scoped_ptr<basic_oarchive_impl> pimpl;
|
||||
// in client code. note: borland can't use scoped_ptr
|
||||
//boost::scoped_ptr<basic_oarchive_impl> pimpl;
|
||||
basic_oarchive_impl * pimpl;
|
||||
|
||||
// overload these to bracket object attributes. Used to implement
|
||||
// xml archives
|
||||
@@ -91,6 +95,12 @@ public:
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
// required by smart_cast for compilers not implementing
|
||||
// partial template specialization
|
||||
BOOST_TT_BROKEN_COMPILER_SPEC(
|
||||
boost::archive::detail::basic_oarchive
|
||||
)
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#endif //BOOST_ARCHIVE_BASIC_OARCHIVE_HPP
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_SERIALIZATION_BASIC_OSERIALIZER_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_BASIC_POINTER_ISERIALIZER_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -52,11 +52,10 @@ protected:
|
||||
#endif
|
||||
~basic_pointer_iserializer();
|
||||
public:
|
||||
virtual void * heap_allocation() const = 0;
|
||||
virtual const basic_iserializer & get_basic_serializer() const = 0;
|
||||
virtual void load_object_ptr(
|
||||
basic_iarchive & ar,
|
||||
void * x,
|
||||
void * & x,
|
||||
const unsigned int file_version
|
||||
) const = 0;
|
||||
};
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_BASIC_POINTER_OSERIALIZER_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_BASIC_SERIALIZER_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_SERIALIZER_MAP_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_DETAIL_CHECK_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#pragma inline_depth(511)
|
||||
#pragma inline_recursion(on)
|
||||
@@ -50,7 +50,7 @@ namespace detail {
|
||||
template<class T>
|
||||
inline void check_object_level(){
|
||||
typedef
|
||||
typename mpl::greater_equal<
|
||||
BOOST_DEDUCED_TYPENAME mpl::greater_equal<
|
||||
serialization::implementation_level< T >,
|
||||
mpl::int_<serialization::primitive_type>
|
||||
>::type typex;
|
||||
@@ -63,12 +63,12 @@ inline void check_object_level(){
|
||||
template<class T>
|
||||
inline void check_object_versioning(){
|
||||
typedef
|
||||
typename mpl::or_<
|
||||
typename mpl::greater<
|
||||
BOOST_DEDUCED_TYPENAME mpl::or_<
|
||||
BOOST_DEDUCED_TYPENAME mpl::greater<
|
||||
serialization::implementation_level< T >,
|
||||
mpl::int_<serialization::object_serializable>
|
||||
>,
|
||||
typename mpl::equal_to<
|
||||
BOOST_DEDUCED_TYPENAME mpl::equal_to<
|
||||
serialization::version< T >,
|
||||
mpl::int_<0>
|
||||
>
|
||||
@@ -83,7 +83,7 @@ inline void check_object_tracking(){
|
||||
// presume it has already been determined that
|
||||
// T is not a const
|
||||
BOOST_STATIC_ASSERT(! boost::is_const< T >::value);
|
||||
typedef typename mpl::equal_to<
|
||||
typedef BOOST_DEDUCED_TYPENAME mpl::equal_to<
|
||||
serialization::tracking_level< T >,
|
||||
mpl::int_<serialization::track_never>
|
||||
>::type typex;
|
||||
@@ -105,13 +105,13 @@ inline void check_pointer_level(){
|
||||
// we should only invoke this once we KNOW that T
|
||||
// has been used as a pointer!!
|
||||
typedef
|
||||
typename mpl::or_<
|
||||
typename mpl::greater<
|
||||
BOOST_DEDUCED_TYPENAME mpl::or_<
|
||||
BOOST_DEDUCED_TYPENAME mpl::greater<
|
||||
serialization::implementation_level< T >,
|
||||
mpl::int_<serialization::object_serializable>
|
||||
>,
|
||||
typename mpl::not_<
|
||||
typename mpl::equal_to<
|
||||
BOOST_DEDUCED_TYPENAME mpl::not_<
|
||||
BOOST_DEDUCED_TYPENAME mpl::equal_to<
|
||||
serialization::tracking_level< T >,
|
||||
mpl::int_<serialization::track_selectively>
|
||||
>
|
||||
@@ -139,7 +139,7 @@ inline void check_pointer_level(){
|
||||
|
||||
template<class T>
|
||||
void inline check_pointer_tracking(){
|
||||
typedef typename mpl::greater<
|
||||
typedef BOOST_DEDUCED_TYPENAME mpl::greater<
|
||||
serialization::tracking_level< T >,
|
||||
mpl::int_<serialization::track_never>
|
||||
>::type typex;
|
||||
@@ -151,10 +151,10 @@ void inline check_pointer_tracking(){
|
||||
template<class T>
|
||||
inline void check_const_loading(){
|
||||
typedef
|
||||
typename mpl::or_<
|
||||
typename boost::serialization::is_wrapper< T >,
|
||||
typename mpl::not_<
|
||||
typename boost::is_const< T >
|
||||
BOOST_DEDUCED_TYPENAME mpl::or_<
|
||||
BOOST_DEDUCED_TYPENAME boost::serialization::is_wrapper< T >,
|
||||
BOOST_DEDUCED_TYPENAME mpl::not_<
|
||||
BOOST_DEDUCED_TYPENAME boost::is_const< T >
|
||||
>
|
||||
>::type typex;
|
||||
// cannot load data into a "const" object unless it's a
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_DETAIL_COMMON_IARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_DETAIL_COMMON_OARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_DETAIL_DECL_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_DETAIL_INTERFACE_OARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_DETAIL_ISERIALIZER_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#pragma inline_depth(511)
|
||||
#pragma inline_recursion(on)
|
||||
@@ -23,6 +23,7 @@
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <new> // for placement new
|
||||
#include <memory> // for auto_ptr
|
||||
#include <cstddef> // size_t, NULL
|
||||
|
||||
#include <boost/config.hpp>
|
||||
@@ -40,7 +41,7 @@ namespace std{
|
||||
#include <boost/mpl/greater_equal.hpp>
|
||||
#include <boost/mpl/equal_to.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/detail/no_exceptions_support.hpp>
|
||||
|
||||
#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO
|
||||
#include <boost/serialization/extended_type_info_typeid.hpp>
|
||||
@@ -57,11 +58,14 @@ namespace std{
|
||||
#include <boost/type_traits/is_polymorphic.hpp>
|
||||
|
||||
#include <boost/serialization/assume_abstract.hpp>
|
||||
|
||||
#define DONT_USE_HAS_NEW_OPERATOR ( \
|
||||
defined(__BORLANDC__) \
|
||||
|| BOOST_WORKAROUND(__IBMCPP__, < 1210) \
|
||||
|| defined(BOOST_MSVC) && (BOOST_MSVC <= 1300) \
|
||||
|| defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x590) \
|
||||
)
|
||||
|
||||
#if ! DONT_USE_HAS_NEW_OPERATOR
|
||||
#include <boost/type_traits/has_new_operator.hpp>
|
||||
#endif
|
||||
@@ -123,7 +127,7 @@ protected:
|
||||
explicit iserializer() :
|
||||
basic_iserializer(
|
||||
boost::serialization::singleton<
|
||||
typename
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
boost::serialization::type_info_implementation< T >::type
|
||||
>::get_const_instance()
|
||||
)
|
||||
@@ -193,109 +197,11 @@ BOOST_DLLEXPORT void iserializer<Archive, T>::load_object_data(
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
// the purpose of this code is to allocate memory for an object
|
||||
// without requiring the constructor to be called. Presumably
|
||||
// the allocated object will be subsequently initialized with
|
||||
// "placement new".
|
||||
// note: we have the boost type trait has_new_operator but we
|
||||
// have no corresponding has_delete_operator. So we presume
|
||||
// that the former being true would imply that the a delete
|
||||
// operator is also defined for the class T.
|
||||
|
||||
template<class T>
|
||||
struct heap_allocation {
|
||||
// boost::has_new_operator< T > doesn't work on these compilers
|
||||
#if DONT_USE_HAS_NEW_OPERATOR
|
||||
// This doesn't handle operator new overload for class T
|
||||
static T * invoke_new(){
|
||||
return static_cast<T *>(operator new(sizeof(T)));
|
||||
}
|
||||
static void invoke_delete(T *t){
|
||||
(operator delete(t));
|
||||
}
|
||||
#else
|
||||
// note: we presume that a true value for has_new_operator
|
||||
// implies the existence of a class specific delete operator as well
|
||||
// as a class specific new operator.
|
||||
struct has_new_operator {
|
||||
static T * invoke_new() {
|
||||
return static_cast<T *>((T::operator new)(sizeof(T)));
|
||||
}
|
||||
static void invoke_delete(T * t) {
|
||||
// if compilation fails here, the likely cause that the class
|
||||
// T has a class specific new operator but no class specific
|
||||
// delete operator which matches the following signature. Fix
|
||||
// your program to have this. Note that adding operator delete
|
||||
// with only one parameter doesn't seem correct to me since
|
||||
// the standard(3.7.4.2) says "
|
||||
// "If a class T has a member deallocation function named
|
||||
// 'operator delete' with exactly one parameter, then that function
|
||||
// is a usual (non-placement) deallocation function" which I take
|
||||
// to mean that it will call the destructor of type T which we don't
|
||||
// want to do here.
|
||||
// Note: reliance upon automatic conversion from T * to void * here
|
||||
(T::operator delete)(t, sizeof(T));
|
||||
}
|
||||
};
|
||||
struct doesnt_have_new_operator {
|
||||
static T* invoke_new() {
|
||||
return static_cast<T *>(operator new(sizeof(T)));
|
||||
}
|
||||
static void invoke_delete(T * t) {
|
||||
// Note: I'm reliance upon automatic conversion from T * to void * here
|
||||
(operator delete)(t);
|
||||
}
|
||||
};
|
||||
static T * invoke_new() {
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
boost::has_new_operator< T >,
|
||||
mpl::identity<has_new_operator >,
|
||||
mpl::identity<doesnt_have_new_operator >
|
||||
>::type typex;
|
||||
return typex::invoke_new();
|
||||
}
|
||||
static void invoke_delete(T *t) {
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
boost::has_new_operator< T >,
|
||||
mpl::identity<has_new_operator >,
|
||||
mpl::identity<doesnt_have_new_operator >
|
||||
>::type typex;
|
||||
typex::invoke_delete(t);
|
||||
}
|
||||
#endif
|
||||
explicit heap_allocation(){
|
||||
m_p = invoke_new();
|
||||
}
|
||||
~heap_allocation(){
|
||||
if (0 != m_p)
|
||||
invoke_delete(m_p);
|
||||
}
|
||||
T* get() const {
|
||||
return m_p;
|
||||
}
|
||||
|
||||
T* release() {
|
||||
T* p = m_p;
|
||||
m_p = 0;
|
||||
return p;
|
||||
}
|
||||
private:
|
||||
T* m_p;
|
||||
};
|
||||
|
||||
template<class Archive, class T>
|
||||
class pointer_iserializer :
|
||||
public basic_pointer_iserializer
|
||||
{
|
||||
private:
|
||||
virtual void * heap_allocation() const {
|
||||
detail::heap_allocation<T> h;
|
||||
T * t = h.get();
|
||||
h.release();
|
||||
return t;
|
||||
}
|
||||
virtual const basic_iserializer & get_basic_serializer() const {
|
||||
return boost::serialization::singleton<
|
||||
iserializer<Archive, T>
|
||||
@@ -303,7 +209,7 @@ private:
|
||||
}
|
||||
BOOST_DLLEXPORT virtual void load_object_ptr(
|
||||
basic_iarchive & ar,
|
||||
void * x,
|
||||
void * & x,
|
||||
const unsigned int file_version
|
||||
) const BOOST_USED;
|
||||
protected:
|
||||
@@ -316,50 +222,121 @@ protected:
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
// note trick to be sure that operator new is using class specific
|
||||
// version if such exists. Due to Peter Dimov.
|
||||
// note: the following fails if T has no default constructor.
|
||||
// otherwise it would have been ideal
|
||||
//struct heap_allocator : public T
|
||||
//{
|
||||
// T * invoke(){
|
||||
// return ::new(sizeof(T));
|
||||
// }
|
||||
//}
|
||||
|
||||
template<class T>
|
||||
struct heap_allocator
|
||||
{
|
||||
// boost::has_new_operator< T > doesn't work on these compilers
|
||||
#if DONT_USE_HAS_NEW_OPERATOR
|
||||
// This doesn't handle operator new overload for class T
|
||||
static T * invoke(){
|
||||
return static_cast<T *>(operator new(sizeof(T)));
|
||||
}
|
||||
#else
|
||||
struct has_new_operator {
|
||||
static T* invoke() {
|
||||
return static_cast<T *>((T::operator new)(sizeof(T)));
|
||||
}
|
||||
};
|
||||
struct doesnt_have_new_operator {
|
||||
static T* invoke() {
|
||||
return static_cast<T *>(operator new(sizeof(T)));
|
||||
}
|
||||
};
|
||||
static T * invoke() {
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
mpl::eval_if<
|
||||
boost::has_new_operator< T >,
|
||||
mpl::identity<has_new_operator >,
|
||||
mpl::identity<doesnt_have_new_operator >
|
||||
>::type typex;
|
||||
return typex::invoke();
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
// due to Martin Ecker
|
||||
template <typename T>
|
||||
class auto_ptr_with_deleter
|
||||
{
|
||||
public:
|
||||
explicit auto_ptr_with_deleter(T* p) :
|
||||
m_p(p)
|
||||
{}
|
||||
~auto_ptr_with_deleter(){
|
||||
if (m_p)
|
||||
boost::serialization::access::destroy(m_p);
|
||||
}
|
||||
T* get() const {
|
||||
return m_p;
|
||||
}
|
||||
|
||||
T* release() {
|
||||
T* p = m_p;
|
||||
m_p = NULL;
|
||||
return p;
|
||||
}
|
||||
private:
|
||||
T* m_p;
|
||||
};
|
||||
|
||||
// note: BOOST_DLLEXPORT is so that code for polymorphic class
|
||||
// serialized only through base class won't get optimized out
|
||||
template<class Archive, class T>
|
||||
BOOST_DLLEXPORT void pointer_iserializer<Archive, T>::load_object_ptr(
|
||||
basic_iarchive & ar,
|
||||
void * t,
|
||||
void * & x,
|
||||
const unsigned int file_version
|
||||
) const
|
||||
{
|
||||
Archive & ar_impl =
|
||||
boost::serialization::smart_cast_reference<Archive &>(ar);
|
||||
|
||||
// note that the above will throw std::bad_alloc if the allocation
|
||||
// fails so we don't have to address this contingency here.
|
||||
auto_ptr_with_deleter< T > ap(heap_allocator< T >::invoke());
|
||||
if(NULL == ap.get())
|
||||
boost::serialization::throw_exception(std::bad_alloc()) ;
|
||||
|
||||
T * t = ap.get();
|
||||
x = t;
|
||||
|
||||
// catch exception during load_construct_data so that we don't
|
||||
// automatically delete the t which is most likely not fully
|
||||
// constructed
|
||||
BOOST_TRY {
|
||||
// this addresses an obscure situation that occurs when
|
||||
// this addresses an obscure situtation that occurs when
|
||||
// load_constructor de-serializes something through a pointer.
|
||||
ar.next_object_pointer(t);
|
||||
boost::serialization::load_construct_data_adl<Archive, T>(
|
||||
ar_impl,
|
||||
static_cast<T *>(t),
|
||||
t,
|
||||
file_version
|
||||
);
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
// if we get here the load_construct failed. The heap_allocation
|
||||
// will be automatically deleted so we don't have to do anything
|
||||
// special here.
|
||||
ap.release();
|
||||
BOOST_RETHROW;
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
|
||||
ar_impl >> boost::serialization::make_nvp(NULL, * static_cast<T *>(t));
|
||||
ar_impl >> boost::serialization::make_nvp(NULL, * t);
|
||||
ap.release();
|
||||
}
|
||||
|
||||
template<class Archive, class T>
|
||||
pointer_iserializer<Archive, T>::pointer_iserializer() :
|
||||
basic_pointer_iserializer(
|
||||
boost::serialization::singleton<
|
||||
typename
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
boost::serialization::type_info_implementation< T >::type
|
||||
>::get_const_instance()
|
||||
)
|
||||
@@ -428,7 +405,7 @@ struct load_non_pointer_type {
|
||||
|
||||
template<class T>
|
||||
static void invoke(Archive & ar, T &t){
|
||||
typedef typename mpl::eval_if<
|
||||
typedef BOOST_DEDUCED_TYPENAME mpl::eval_if<
|
||||
// if its primitive
|
||||
mpl::equal_to<
|
||||
boost::serialization::implementation_level< T >,
|
||||
@@ -436,7 +413,7 @@ struct load_non_pointer_type {
|
||||
>,
|
||||
mpl::identity<load_primitive>,
|
||||
// else
|
||||
typename mpl::eval_if<
|
||||
BOOST_DEDUCED_TYPENAME mpl::eval_if<
|
||||
// class info / version
|
||||
mpl::greater_equal<
|
||||
boost::serialization::implementation_level< T >,
|
||||
@@ -445,7 +422,7 @@ struct load_non_pointer_type {
|
||||
// do standard load
|
||||
mpl::identity<load_standard>,
|
||||
// else
|
||||
typename mpl::eval_if<
|
||||
BOOST_DEDUCED_TYPENAME mpl::eval_if<
|
||||
// no tracking
|
||||
mpl::equal_to<
|
||||
boost::serialization::tracking_level< T >,
|
||||
@@ -489,7 +466,7 @@ struct load_pointer_type {
|
||||
// class pointer. Inhibiting code generation for this
|
||||
// permits abstract base classes to be used - note: exception
|
||||
// virtual serialize functions used for plug-ins
|
||||
typedef typename
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
mpl::eval_if<
|
||||
boost::serialization::is_abstract<const T>,
|
||||
boost::mpl::identity<abstract>,
|
||||
@@ -505,21 +482,18 @@ struct load_pointer_type {
|
||||
const T &
|
||||
) {
|
||||
// tweak the pointer back to the base class
|
||||
void * upcast = const_cast<void *>(
|
||||
return static_cast<T *>(
|
||||
const_cast<void *>(
|
||||
boost::serialization::void_upcast(
|
||||
eti,
|
||||
boost::serialization::singleton<
|
||||
typename
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
boost::serialization::type_info_implementation< T >::type
|
||||
>::get_const_instance(),
|
||||
t
|
||||
)
|
||||
)
|
||||
);
|
||||
if(NULL == upcast)
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::unregistered_class)
|
||||
);
|
||||
return static_cast<T *>(upcast);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
@@ -570,7 +544,7 @@ template<class Archive>
|
||||
struct load_array_type {
|
||||
template<class T>
|
||||
static void invoke(Archive &ar, T &t){
|
||||
typedef typename remove_extent< T >::type value_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME remove_extent< T >::type value_type;
|
||||
|
||||
// convert integers to correct enum to load
|
||||
// determine number of elements in the array. Consider the
|
||||
@@ -602,13 +576,13 @@ inline void load(Archive & ar, T &t){
|
||||
// handled below.
|
||||
detail::check_const_loading< T >();
|
||||
typedef
|
||||
typename mpl::eval_if<is_pointer< T >,
|
||||
BOOST_DEDUCED_TYPENAME mpl::eval_if<is_pointer< T >,
|
||||
mpl::identity<detail::load_pointer_type<Archive> >
|
||||
,//else
|
||||
typename mpl::eval_if<is_array< T >,
|
||||
BOOST_DEDUCED_TYPENAME mpl::eval_if<is_array< T >,
|
||||
mpl::identity<detail::load_array_type<Archive> >
|
||||
,//else
|
||||
typename mpl::eval_if<is_enum< T >,
|
||||
BOOST_DEDUCED_TYPENAME mpl::eval_if<is_enum< T >,
|
||||
mpl::identity<detail::load_enum_type<Archive> >
|
||||
,//else
|
||||
mpl::identity<detail::load_non_pointer_type<Archive> >
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_OSERIALIZER_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#pragma inline_depth(511)
|
||||
#pragma inline_recursion(on)
|
||||
@@ -106,7 +106,7 @@ public:
|
||||
explicit BOOST_DLLEXPORT oserializer() :
|
||||
basic_oserializer(
|
||||
boost::serialization::singleton<
|
||||
typename
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
boost::serialization::type_info_implementation< T >::type
|
||||
>::get_const_instance()
|
||||
)
|
||||
@@ -205,7 +205,7 @@ template<class Archive, class T>
|
||||
pointer_oserializer<Archive, T>::pointer_oserializer() :
|
||||
basic_pointer_oserializer(
|
||||
boost::serialization::singleton<
|
||||
typename
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
boost::serialization::type_info_implementation< T >::type
|
||||
>::get_const_instance()
|
||||
)
|
||||
@@ -275,7 +275,7 @@ struct save_non_pointer_type {
|
||||
template<class T>
|
||||
static void invoke(Archive & ar, const T & t){
|
||||
typedef
|
||||
typename mpl::eval_if<
|
||||
BOOST_DEDUCED_TYPENAME mpl::eval_if<
|
||||
// if its primitive
|
||||
mpl::equal_to<
|
||||
boost::serialization::implementation_level< T >,
|
||||
@@ -283,7 +283,7 @@ struct save_non_pointer_type {
|
||||
>,
|
||||
mpl::identity<save_primitive>,
|
||||
// else
|
||||
typename mpl::eval_if<
|
||||
BOOST_DEDUCED_TYPENAME mpl::eval_if<
|
||||
// class info / version
|
||||
mpl::greater_equal<
|
||||
boost::serialization::implementation_level< T >,
|
||||
@@ -292,7 +292,7 @@ struct save_non_pointer_type {
|
||||
// do standard save
|
||||
mpl::identity<save_standard>,
|
||||
// else
|
||||
typename mpl::eval_if<
|
||||
BOOST_DEDUCED_TYPENAME mpl::eval_if<
|
||||
// no tracking
|
||||
mpl::equal_to<
|
||||
boost::serialization::tracking_level< T >,
|
||||
@@ -342,7 +342,7 @@ struct save_pointer_type {
|
||||
// permits abstract base classes to be used - note: exception
|
||||
// virtual serialize functions used for plug-ins
|
||||
typedef
|
||||
typename mpl::eval_if<
|
||||
BOOST_DEDUCED_TYPENAME mpl::eval_if<
|
||||
boost::serialization::is_abstract< T >,
|
||||
mpl::identity<abstract>,
|
||||
mpl::identity<non_abstract>
|
||||
@@ -373,10 +373,10 @@ struct save_pointer_type {
|
||||
Archive &ar,
|
||||
T & t
|
||||
){
|
||||
typename
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
boost::serialization::type_info_implementation< T >::type const
|
||||
& i = boost::serialization::singleton<
|
||||
typename
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
boost::serialization::type_info_implementation< T >::type
|
||||
>::get_const_instance();
|
||||
|
||||
@@ -452,7 +452,7 @@ struct save_pointer_type {
|
||||
){
|
||||
check_pointer_level< T >();
|
||||
check_pointer_tracking< T >();
|
||||
typedef typename mpl::eval_if<
|
||||
typedef BOOST_DEDUCED_TYPENAME mpl::eval_if<
|
||||
is_polymorphic< T >,
|
||||
mpl::identity<polymorphic>,
|
||||
mpl::identity<non_polymorphic>
|
||||
@@ -490,7 +490,7 @@ struct save_array_type
|
||||
{
|
||||
template<class T>
|
||||
static void invoke(Archive &ar, const T &t){
|
||||
typedef typename boost::remove_extent< T >::type value_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::remove_extent< T >::type value_type;
|
||||
|
||||
save_access::end_preamble(ar);
|
||||
// consider alignment
|
||||
@@ -509,13 +509,13 @@ struct save_array_type
|
||||
template<class Archive, class T>
|
||||
inline void save(Archive & ar, /*const*/ T &t){
|
||||
typedef
|
||||
typename mpl::eval_if<is_pointer< T >,
|
||||
BOOST_DEDUCED_TYPENAME mpl::eval_if<is_pointer< T >,
|
||||
mpl::identity<detail::save_pointer_type<Archive> >,
|
||||
//else
|
||||
typename mpl::eval_if<is_enum< T >,
|
||||
BOOST_DEDUCED_TYPENAME mpl::eval_if<is_enum< T >,
|
||||
mpl::identity<detail::save_enum_type<Archive> >,
|
||||
//else
|
||||
typename mpl::eval_if<is_array< T >,
|
||||
BOOST_DEDUCED_TYPENAME mpl::eval_if<is_array< T >,
|
||||
mpl::identity<detail::save_array_type<Archive> >,
|
||||
//else
|
||||
mpl::identity<detail::save_non_pointer_type<Archive> >
|
||||
|
@@ -28,7 +28,7 @@ struct _ptr_serialization_support
|
||||
typedef int type;
|
||||
};
|
||||
|
||||
#if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5130)
|
||||
#ifdef __SUNPRO_CC
|
||||
|
||||
template<int N>
|
||||
struct counter : counter<N-1> {};
|
||||
@@ -81,7 +81,7 @@ void instantiate_ptr_serialization(Serializable*, int, adl_tag ) {}
|
||||
namespace boost { namespace archive { namespace detail { \
|
||||
\
|
||||
template <class Serializable> \
|
||||
typename _ptr_serialization_support<Archive, Serializable>::type \
|
||||
BOOST_DEDUCED_TYPENAME _ptr_serialization_support<Archive, Serializable>::type \
|
||||
instantiate_ptr_serialization( Serializable*, Archive*, adl_tag ); \
|
||||
\
|
||||
}}}
|
||||
|
@@ -7,17 +7,15 @@
|
||||
#ifndef BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP
|
||||
#define BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP
|
||||
|
||||
#ifdef BOOST_NO_CXX11_HDR_CODECVT
|
||||
#define BOOST_UTF8_BEGIN_NAMESPACE \
|
||||
#define BOOST_UTF8_BEGIN_NAMESPACE \
|
||||
namespace boost { namespace archive { namespace detail {
|
||||
#define BOOST_UTF8_DECL
|
||||
#define BOOST_UTF8_END_NAMESPACE }}}
|
||||
#define BOOST_UTF8_DECL
|
||||
#define BOOST_UTF8_END_NAMESPACE }}}
|
||||
|
||||
#include <boost/detail/utf8_codecvt_facet.hpp>
|
||||
#include <boost/detail/utf8_codecvt_facet.hpp>
|
||||
|
||||
#undef BOOST_UTF8_END_NAMESPACE
|
||||
#undef BOOST_UTF8_DECL
|
||||
#undef BOOST_UTF8_BEGIN_NAMESPACE
|
||||
|
||||
#undef BOOST_UTF8_END_NAMESPACE
|
||||
#undef BOOST_UTF8_DECL
|
||||
#undef BOOST_UTF8_BEGIN_NAMESPACE
|
||||
#endif // BOOST_NO_CXX11_HDR_CODECVT
|
||||
#endif // BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_DINKUMWARE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
|
@@ -12,7 +12,7 @@
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::memcpy;
|
||||
@@ -51,9 +51,7 @@ BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
|
||||
basic_binary_iarchive<Archive>::init(){
|
||||
// read signature in an archive version independent manner
|
||||
std::string file_signature;
|
||||
|
||||
#if 0 // commented out since it interfers with derivation
|
||||
BOOST_TRY {
|
||||
try {
|
||||
std::size_t l;
|
||||
this->This()->load(l);
|
||||
if(l == std::strlen(BOOST_ARCHIVE_SIGNATURE())) {
|
||||
@@ -67,16 +65,10 @@ basic_binary_iarchive<Archive>::init(){
|
||||
this->This()->load_binary(&(*file_signature.begin()), l);
|
||||
}
|
||||
}
|
||||
BOOST_CATCH(archive_exception const &) { // catch stream_error archive exceptions
|
||||
catch(archive_exception const &) { // catch stream_error archive exceptions
|
||||
// will cause invalid_signature archive exception to be thrown below
|
||||
file_signature = "";
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
#else
|
||||
// https://svn.boost.org/trac/boost/ticket/7301
|
||||
* this->This() >> file_signature;
|
||||
#endif
|
||||
|
||||
if(file_signature != BOOST_ARCHIVE_SIGNATURE())
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::invalid_signature)
|
||||
@@ -121,7 +113,10 @@ basic_binary_iarchive<Archive>::init(){
|
||||
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205))
|
||||
this->set_library_version(input_library_version);
|
||||
#else
|
||||
detail::basic_iarchive::set_library_version(input_library_version);
|
||||
#if ! BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
|
||||
detail::
|
||||
#endif
|
||||
basic_iarchive::set_library_version(input_library_version);
|
||||
#endif
|
||||
|
||||
if(BOOST_ARCHIVE_VERSION() < input_library_version)
|
||||
|
@@ -23,12 +23,11 @@ namespace std{
|
||||
#include <boost/detail/workaround.hpp> // fixup for RogueWave
|
||||
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/archive/codecvt_null.hpp>
|
||||
#include <boost/archive/add_facet.hpp>
|
||||
#include <boost/archive/basic_binary_iprimitive.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
@@ -152,16 +151,17 @@ basic_binary_iprimitive<Archive, Elem, Tr>::basic_binary_iprimitive(
|
||||
) :
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
m_sb(sb),
|
||||
archive_locale(NULL),
|
||||
locale_saver(m_sb)
|
||||
{
|
||||
if(! no_codecvt){
|
||||
archive_locale.reset(
|
||||
add_facet(
|
||||
boost::archive::add_facet(
|
||||
std::locale::classic(),
|
||||
new codecvt_null<Elem>
|
||||
)
|
||||
);
|
||||
//m_sb.pubimbue(* archive_locale);
|
||||
m_sb.pubimbue(* archive_locale);
|
||||
}
|
||||
}
|
||||
#else
|
||||
@@ -198,12 +198,11 @@ BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
|
||||
basic_binary_iprimitive<Archive, Elem, Tr>::~basic_binary_iprimitive(){
|
||||
// push back unread characters
|
||||
//destructor can't throw !
|
||||
BOOST_TRY{
|
||||
try{
|
||||
static_cast<detail::input_streambuf_access<Elem, Tr> &>(m_sb).sync();
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
catch(...){
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
|
@@ -12,7 +12,7 @@
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::memcpy;
|
||||
|
@@ -31,8 +31,6 @@ namespace std{ using ::wcslen; }
|
||||
|
||||
#include <boost/archive/add_facet.hpp>
|
||||
#include <boost/archive/codecvt_null.hpp>
|
||||
#include <boost/archive/basic_binary_oprimitive.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
@@ -104,6 +102,7 @@ basic_binary_oprimitive<Archive, Elem, Tr>::basic_binary_oprimitive(
|
||||
) :
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
m_sb(sb),
|
||||
archive_locale(NULL),
|
||||
locale_saver(m_sb)
|
||||
{
|
||||
if(! no_codecvt){
|
||||
@@ -113,7 +112,7 @@ basic_binary_oprimitive<Archive, Elem, Tr>::basic_binary_oprimitive(
|
||||
new codecvt_null<Elem>
|
||||
)
|
||||
);
|
||||
//m_sb.pubimbue(* archive_locale);
|
||||
m_sb.pubimbue(* archive_locale);
|
||||
}
|
||||
}
|
||||
#else
|
||||
@@ -150,12 +149,11 @@ BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
|
||||
basic_binary_oprimitive<Archive, Elem, Tr>::~basic_binary_oprimitive(){
|
||||
// flush buffer
|
||||
//destructor can't throw
|
||||
BOOST_TRY{
|
||||
try{
|
||||
static_cast<detail::output_streambuf_access<Elem, Tr> &>(m_sb).sync();
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
catch(...){
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
|
@@ -11,7 +11,7 @@
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::memcpy;
|
||||
@@ -62,7 +62,10 @@ basic_text_iarchive<Archive>::init(void){
|
||||
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205))
|
||||
this->set_library_version(input_library_version);
|
||||
#else
|
||||
detail::basic_iarchive::set_library_version(input_library_version);
|
||||
#if ! BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
|
||||
detail::
|
||||
#endif
|
||||
basic_iarchive::set_library_version(input_library_version);
|
||||
#endif
|
||||
|
||||
// extra little .t is to get around borland quirk
|
||||
|
@@ -33,22 +33,22 @@ namespace std{
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
namespace {
|
||||
template<class CharType>
|
||||
static inline bool is_whitespace(CharType c);
|
||||
bool is_whitespace(CharType c);
|
||||
|
||||
template<>
|
||||
inline bool is_whitespace(char t){
|
||||
bool is_whitespace(char t){
|
||||
return 0 != std::isspace(t);
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
template<>
|
||||
inline bool is_whitespace(wchar_t t){
|
||||
bool is_whitespace(wchar_t t){
|
||||
return 0 != std::iswspace(t);
|
||||
}
|
||||
#endif
|
||||
} // detail
|
||||
}
|
||||
|
||||
// translate base64 text into binary and copy into buffer
|
||||
// until buffer is full.
|
||||
@@ -58,7 +58,7 @@ basic_text_iprimitive<IStream>::load_binary(
|
||||
void *address,
|
||||
std::size_t count
|
||||
){
|
||||
typedef typename IStream::char_type CharType;
|
||||
typedef BOOST_DEDUCED_TYPENAME IStream::char_type CharType;
|
||||
|
||||
if(0 == count)
|
||||
return;
|
||||
@@ -73,7 +73,7 @@ basic_text_iprimitive<IStream>::load_binary(
|
||||
archive_exception(archive_exception::input_stream_error)
|
||||
);
|
||||
// convert from base64 to binary
|
||||
typedef typename
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
iterators::transform_width<
|
||||
iterators::binary_from_base64<
|
||||
iterators::remove_whitespace<
|
||||
@@ -102,11 +102,11 @@ basic_text_iprimitive<IStream>::load_binary(
|
||||
|
||||
// skip over any excess input
|
||||
for(;;){
|
||||
typename IStream::int_type r;
|
||||
BOOST_DEDUCED_TYPENAME IStream::int_type r;
|
||||
r = is.get();
|
||||
if(is.eof())
|
||||
break;
|
||||
if(detail::is_whitespace(static_cast<CharType>(r)))
|
||||
if(is_whitespace(static_cast<CharType>(r)))
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -121,16 +121,17 @@ basic_text_iprimitive<IStream>::basic_text_iprimitive(
|
||||
is(is_),
|
||||
flags_saver(is_),
|
||||
precision_saver(is_),
|
||||
archive_locale(NULL),
|
||||
locale_saver(* is_.rdbuf())
|
||||
{
|
||||
if(! no_codecvt){
|
||||
archive_locale.reset(
|
||||
add_facet(
|
||||
std::locale::classic(),
|
||||
new boost::archive::codecvt_null<typename IStream::char_type>
|
||||
new codecvt_null<BOOST_DEDUCED_TYPENAME IStream::char_type>
|
||||
)
|
||||
);
|
||||
//is.imbue(* archive_locale);
|
||||
is.imbue(* archive_locale);
|
||||
}
|
||||
is >> std::noboolalpha;
|
||||
}
|
||||
|
@@ -11,7 +11,7 @@
|
||||
#include <boost/assert.hpp>
|
||||
#include <cstring>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::memcpy;
|
||||
|
@@ -9,7 +9,6 @@
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <cstddef> // NULL
|
||||
#include <algorithm> // std::copy
|
||||
#include <boost/serialization/pfto.hpp>
|
||||
|
||||
#include <boost/archive/basic_text_oprimitive.hpp>
|
||||
@@ -31,7 +30,7 @@ basic_text_oprimitive<OStream>::save_binary(
|
||||
const void *address,
|
||||
std::size_t count
|
||||
){
|
||||
typedef typename OStream::char_type CharType;
|
||||
typedef BOOST_DEDUCED_TYPENAME OStream::char_type CharType;
|
||||
|
||||
if(0 == count)
|
||||
return;
|
||||
@@ -84,16 +83,17 @@ basic_text_oprimitive<OStream>::basic_text_oprimitive(
|
||||
os(os_),
|
||||
flags_saver(os_),
|
||||
precision_saver(os_),
|
||||
archive_locale(NULL),
|
||||
locale_saver(* os_.rdbuf())
|
||||
{
|
||||
if(! no_codecvt){
|
||||
archive_locale.reset(
|
||||
add_facet(
|
||||
std::locale::classic(),
|
||||
new boost::archive::codecvt_null<typename OStream::char_type>
|
||||
new codecvt_null<BOOST_DEDUCED_TYPENAME OStream::char_type>
|
||||
)
|
||||
);
|
||||
//os.imbue(* archive_locale);
|
||||
os.imbue(* archive_locale);
|
||||
}
|
||||
os << std::noboolalpha;
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_BASIC_XML_GRAMMAR_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -50,6 +50,11 @@
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
// supress noise
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
|
||||
# pragma warning (disable : 4786) // too long name, harmless warning
|
||||
#endif
|
||||
|
||||
#include <boost/spirit/include/classic_rule.hpp>
|
||||
#include <boost/spirit/include/classic_chset.hpp>
|
||||
|
||||
|
@@ -20,7 +20,7 @@ namespace std{
|
||||
#include <boost/archive/basic_xml_archive.hpp>
|
||||
#include <boost/archive/basic_xml_oarchive.hpp>
|
||||
#include <boost/archive/xml_archive_exception.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/detail/no_exceptions_support.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
@@ -31,7 +31,7 @@ namespace std{
|
||||
#include <boost/archive/dinkumware.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/detail/no_exceptions_support.hpp>
|
||||
|
||||
#include <boost/archive/xml_archive_exception.hpp>
|
||||
#include <boost/archive/iterators/dataflow_exception.hpp>
|
||||
@@ -98,9 +98,9 @@ xml_iarchive_impl<Archive>::load(wchar_t * ws){
|
||||
const char * end = start + s.size();
|
||||
while(start < end){
|
||||
wchar_t wc;
|
||||
int length = std::mbtowc(&wc, start, end - start);
|
||||
if(0 < length){
|
||||
start += length;
|
||||
int result = std::mbtowc(&wc, start, end - start);
|
||||
if(0 < result){
|
||||
start += result;
|
||||
*ws++ = wc;
|
||||
continue;
|
||||
}
|
||||
@@ -174,8 +174,18 @@ xml_iarchive_impl<Archive>::xml_iarchive_impl(
|
||||
basic_xml_iarchive<Archive>(flags),
|
||||
gimpl(new xml_grammar())
|
||||
{
|
||||
if(0 == (flags & no_header))
|
||||
if(0 == (flags & no_header)){
|
||||
BOOST_TRY{
|
||||
init();
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
delete gimpl;
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
throw; // re-throw
|
||||
#endif
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
}
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
@@ -188,6 +198,7 @@ xml_iarchive_impl<Archive>::~xml_iarchive_impl(){
|
||||
BOOST_CATCH(...){}
|
||||
BOOST_CATCH_END
|
||||
}
|
||||
delete gimpl;
|
||||
}
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
#include <ostream>
|
||||
#include <iomanip>
|
||||
#include <algorithm> // std::copy
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
#include <cstring> // strlen
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// xml_wiarchive_impl.ipp:
|
||||
// xml_wiprimitive.cpp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME
|
||||
|
||||
#include <cstring>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
@@ -19,7 +21,7 @@ namespace std{
|
||||
#ifndef BOOST_NO_STD_WSTREAMBUF
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <algorithm> // std::copy
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/detail/workaround.hpp> // Dinkumware and RogueWave
|
||||
#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
|
||||
@@ -27,18 +29,19 @@ namespace std{
|
||||
#endif
|
||||
|
||||
#include <boost/io/ios_state.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/detail/no_exceptions_support.hpp>
|
||||
#include <boost/serialization/pfto.hpp>
|
||||
|
||||
#include <boost/serialization/string.hpp>
|
||||
#include <boost/archive/add_facet.hpp>
|
||||
#include <boost/archive/xml_archive_exception.hpp>
|
||||
#include <boost/archive/detail/utf8_codecvt_facet.hpp>
|
||||
|
||||
#include <boost/archive/iterators/mb_from_wchar.hpp>
|
||||
|
||||
#include <boost/archive/basic_xml_archive.hpp>
|
||||
#include <boost/archive/xml_wiarchive.hpp>
|
||||
|
||||
#include <boost/archive/add_facet.hpp>
|
||||
|
||||
#include <boost/archive/xml_archive_exception.hpp>
|
||||
#include <boost/archive/iterators/mb_from_wchar.hpp>
|
||||
|
||||
#include "basic_xml_grammar.hpp"
|
||||
|
||||
namespace boost {
|
||||
@@ -162,18 +165,26 @@ xml_wiarchive_impl<Archive>::xml_wiarchive_impl(
|
||||
gimpl(new xml_wgrammar())
|
||||
{
|
||||
if(0 == (flags & no_codecvt)){
|
||||
// note usage of argument "1" so that the locale isn't
|
||||
// automatically delete the facet
|
||||
archive_locale.reset(
|
||||
add_facet(
|
||||
is_.getloc(),
|
||||
std::locale::classic(),
|
||||
new boost::archive::detail::utf8_codecvt_facet
|
||||
)
|
||||
);
|
||||
//is.imbue(* archive_locale);
|
||||
is.imbue(* archive_locale);
|
||||
}
|
||||
if(0 == (flags & no_header)){
|
||||
BOOST_TRY{
|
||||
this->init();
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
delete gimpl;
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
throw; // re-throw
|
||||
#endif
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
}
|
||||
if(0 == (flags & no_header))
|
||||
init();
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
@@ -186,6 +197,7 @@ xml_wiarchive_impl<Archive>::~xml_wiarchive_impl(){
|
||||
BOOST_CATCH(...){}
|
||||
BOOST_CATCH_END
|
||||
}
|
||||
delete gimpl;
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
|
@@ -11,14 +11,15 @@
|
||||
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <algorithm> // std::copy
|
||||
#include <algorithm>
|
||||
#include <locale>
|
||||
|
||||
#include <boost/config.hpp> // msvc 6.0 needs this to suppress warnings
|
||||
// for BOOST_DEDUCED_TYPENAME
|
||||
#include <cstring> // strlen
|
||||
#include <cstdlib> // mbtowc
|
||||
#include <cwchar> // wcslen
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::strlen;
|
||||
@@ -29,8 +30,8 @@ namespace std{
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/archive/xml_woarchive.hpp>
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
#include <boost/serialization/pfto.hpp>
|
||||
|
||||
#include <boost/archive/iterators/xml_escape.hpp>
|
||||
#include <boost/archive/iterators/wchar_from_mb.hpp>
|
||||
@@ -38,6 +39,7 @@ namespace std{
|
||||
#include <boost/archive/iterators/dataflow_exception.hpp>
|
||||
|
||||
#include <boost/archive/add_facet.hpp>
|
||||
#include <boost/archive/detail/utf8_codecvt_facet.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
@@ -126,25 +128,32 @@ xml_woarchive_impl<Archive>::xml_woarchive_impl(
|
||||
// a) before output is invoked or
|
||||
// b) after flush has been called. This prevents one-to-many
|
||||
// transforms (such as one to many transforms from getting
|
||||
// mixed up.
|
||||
// mixed up. Unfortunately, STLPort doesn't respect b) above
|
||||
// so the restoration of the original archive locale done by
|
||||
// the locale_saver doesn't get processed,
|
||||
// before the current one is destroyed.
|
||||
// so the codecvt doesn't get replaced with the orginal
|
||||
// so closing the stream invokes codecvt::do_unshift
|
||||
// so it crashes because the corresponding locale that contained
|
||||
// the codecvt isn't around any more.
|
||||
// we can hack around this by using a static codecvt that never
|
||||
// gets destroyed.
|
||||
if(0 == (flags & no_codecvt)){
|
||||
archive_locale.reset(
|
||||
add_facet(
|
||||
os_.getloc(),
|
||||
new boost::archive::detail::utf8_codecvt_facet
|
||||
)
|
||||
);
|
||||
//os.imbue(* archive_locale);
|
||||
boost::archive::detail::utf8_codecvt_facet *pfacet;
|
||||
#if defined(__SGI_STL_PORT)
|
||||
static boost::archive::detail::utf8_codecvt_facet
|
||||
facet(static_cast<size_t>(1));
|
||||
pfacet = & facet;
|
||||
#else
|
||||
pfacet = new boost::archive::detail::utf8_codecvt_facet;
|
||||
#endif
|
||||
archive_locale.reset(add_facet(std::locale::classic(), pfacet));
|
||||
os.imbue(* archive_locale);
|
||||
}
|
||||
if(0 == (flags & no_header))
|
||||
this->init();
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY())
|
||||
xml_woarchive_impl<Archive>::~xml_woarchive_impl(){
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_ITERATORS_BASE64_FROM_BINARY_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <cstddef> // size_t
|
||||
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::size_t;
|
||||
@@ -56,7 +57,7 @@ struct from_6_bit {
|
||||
} // namespace detail
|
||||
|
||||
// note: what we would like to do is
|
||||
// template<class Base, class CharType = typename Base::value_type>
|
||||
// template<class Base, class CharType = BOOST_DEDUCED_TYPENAME Base::value_type>
|
||||
// typedef transform_iterator<
|
||||
// from_6_bit<CharType>,
|
||||
// transform_width<Base, 6, sizeof(Base::value_type) * 8, CharType>
|
||||
@@ -68,10 +69,10 @@ struct from_6_bit {
|
||||
// a templated constructor. This makes it incompatible with the dataflow
|
||||
// ideal. This is also addressed here.
|
||||
|
||||
//template<class Base, class CharType = typename Base::value_type>
|
||||
//template<class Base, class CharType = BOOST_DEDUCED_TYPENAME Base::value_type>
|
||||
template<
|
||||
class Base,
|
||||
class CharType = typename boost::iterator_value<Base>::type
|
||||
class CharType = BOOST_DEDUCED_TYPENAME boost::iterator_value<Base>::type
|
||||
>
|
||||
class base64_from_binary :
|
||||
public transform_iterator<
|
||||
@@ -81,7 +82,7 @@ class base64_from_binary :
|
||||
{
|
||||
friend class boost::iterator_core_access;
|
||||
typedef transform_iterator<
|
||||
typename detail::from_6_bit<CharType>,
|
||||
BOOST_DEDUCED_TYPENAME detail::from_6_bit<CharType>,
|
||||
Base
|
||||
> super_t;
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_ITERATORS_BINARY_FROM_BASE64_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
#include <boost/serialization/pfto.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
@@ -66,7 +67,7 @@ struct to_6_bit {
|
||||
} // namespace detail
|
||||
|
||||
// note: what we would like to do is
|
||||
// template<class Base, class CharType = typename Base::value_type>
|
||||
// template<class Base, class CharType = BOOST_DEDUCED_TYPENAME Base::value_type>
|
||||
// typedef transform_iterator<
|
||||
// from_6_bit<CharType>,
|
||||
// transform_width<Base, 6, sizeof(Base::value_type) * 8, CharType>
|
||||
@@ -80,7 +81,7 @@ struct to_6_bit {
|
||||
|
||||
template<
|
||||
class Base,
|
||||
class CharType = typename boost::iterator_value<Base>::type
|
||||
class CharType = BOOST_DEDUCED_TYPENAME boost::iterator_value<Base>::type
|
||||
>
|
||||
class binary_from_base64 : public
|
||||
transform_iterator<
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_ITERATORS_DATAFLOW_EXCEPTION_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_ITERATORS_ESCAPE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <boost/assert.hpp>
|
||||
#include <cstddef> // NULL
|
||||
|
||||
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#include <boost/iterator/iterator_traits.hpp>
|
||||
|
||||
@@ -34,16 +35,16 @@ class escape :
|
||||
public boost::iterator_adaptor<
|
||||
Derived,
|
||||
Base,
|
||||
typename boost::iterator_value<Base>::type,
|
||||
BOOST_DEDUCED_TYPENAME boost::iterator_value<Base>::type,
|
||||
single_pass_traversal_tag,
|
||||
typename boost::iterator_value<Base>::type
|
||||
BOOST_DEDUCED_TYPENAME boost::iterator_value<Base>::type
|
||||
>
|
||||
{
|
||||
typedef typename boost::iterator_value<Base>::type base_value_type;
|
||||
typedef typename boost::iterator_reference<Base>::type reference_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::iterator_value<Base>::type base_value_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::iterator_reference<Base>::type reference_type;
|
||||
friend class boost::iterator_core_access;
|
||||
|
||||
typedef typename boost::iterator_adaptor<
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::iterator_adaptor<
|
||||
Derived,
|
||||
Base,
|
||||
base_value_type,
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_ITERATORS_INSERT_LINEBREAKS_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{ using ::memcpy; }
|
||||
#endif
|
||||
@@ -37,7 +37,7 @@ namespace iterators {
|
||||
template<
|
||||
class Base,
|
||||
int N,
|
||||
class CharType = typename boost::iterator_value<Base>::type
|
||||
class CharType = BOOST_DEDUCED_TYPENAME boost::iterator_value<Base>::type
|
||||
>
|
||||
class insert_linebreaks :
|
||||
public iterator_adaptor<
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_ITERATORS_ISTREAM_ITERATOR_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -41,13 +41,13 @@ class istream_iterator :
|
||||
{
|
||||
friend class boost::iterator_core_access;
|
||||
typedef istream_iterator this_t ;
|
||||
typedef typename boost::iterator_facade<
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::iterator_facade<
|
||||
istream_iterator<Elem>,
|
||||
Elem,
|
||||
std::input_iterator_tag,
|
||||
Elem
|
||||
> super_t;
|
||||
typedef typename std::basic_istream<Elem> istream_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME std::basic_istream<Elem> istream_type;
|
||||
|
||||
bool equal(const this_t & rhs) const {
|
||||
// note: only works for comparison against end of stream
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_ITERATORS_MB_FROM_WCHAR_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <cstddef> // size_t
|
||||
#include <cstdlib> // for wctomb()
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::size_t;
|
||||
@@ -50,7 +50,7 @@ class mb_from_wchar
|
||||
{
|
||||
friend class boost::iterator_core_access;
|
||||
|
||||
typedef typename boost::iterator_adaptor<
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::iterator_adaptor<
|
||||
mb_from_wchar<Base>,
|
||||
Base,
|
||||
wchar_t,
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_ITERATORS_OSTREAM_ITERATOR_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_ITERATORS_REMOVE_WHITESPACE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -18,12 +18,17 @@
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME
|
||||
|
||||
#include <boost/serialization/pfto.hpp>
|
||||
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#include <boost/iterator/filter_iterator.hpp>
|
||||
#include <boost/iterator/iterator_traits.hpp>
|
||||
|
||||
//#include <boost/detail/workaround.hpp>
|
||||
//#if ! BOOST_WORKAROUND(BOOST_MSVC, <=1300)
|
||||
|
||||
// here is the default standard implementation of the functor used
|
||||
// by the filter iterator to remove spaces. Unfortunately usage
|
||||
// of this implementation in combination with spirit trips a bug
|
||||
@@ -48,6 +53,8 @@ namespace std{ using ::isspace; }
|
||||
#undef iswspace
|
||||
#endif
|
||||
|
||||
//#endif // BOOST_WORKAROUND
|
||||
|
||||
namespace { // anonymous
|
||||
|
||||
template<class CharType>
|
||||
@@ -93,14 +100,14 @@ class filter_iterator
|
||||
>
|
||||
{
|
||||
friend class boost::iterator_core_access;
|
||||
typedef typename boost::iterator_adaptor<
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::iterator_adaptor<
|
||||
filter_iterator<Predicate, Base>,
|
||||
Base,
|
||||
use_default,
|
||||
single_pass_traversal_tag
|
||||
> super_t;
|
||||
typedef filter_iterator<Predicate, Base> this_t;
|
||||
typedef typename super_t::reference reference_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME super_t::reference reference_type;
|
||||
|
||||
reference_type dereference_impl(){
|
||||
if(! m_full){
|
||||
@@ -135,8 +142,8 @@ template<class Base>
|
||||
class remove_whitespace :
|
||||
public filter_iterator<
|
||||
remove_whitespace_predicate<
|
||||
typename boost::iterator_value<Base>::type
|
||||
//typename Base::value_type
|
||||
BOOST_DEDUCED_TYPENAME boost::iterator_value<Base>::type
|
||||
//BOOST_DEDUCED_TYPENAME Base::value_type
|
||||
>,
|
||||
Base
|
||||
>
|
||||
@@ -144,8 +151,8 @@ class remove_whitespace :
|
||||
friend class boost::iterator_core_access;
|
||||
typedef filter_iterator<
|
||||
remove_whitespace_predicate<
|
||||
typename boost::iterator_value<Base>::type
|
||||
//typename Base::value_type
|
||||
BOOST_DEDUCED_TYPENAME boost::iterator_value<Base>::type
|
||||
//BOOST_DEDUCED_TYPENAME Base::value_type
|
||||
>,
|
||||
Base
|
||||
> super_t;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_ITERATORS_TRANSFORM_WIDTH_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -24,13 +24,12 @@
|
||||
// character and 8 bit bytes. Lowest common multiple is 24 => 4 6 bit characters
|
||||
// or 3 8 bit characters
|
||||
|
||||
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME & PTFO
|
||||
#include <boost/serialization/pfto.hpp>
|
||||
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#include <boost/iterator/iterator_traits.hpp>
|
||||
|
||||
#include <algorithm> // std::min
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
namespace iterators {
|
||||
@@ -42,7 +41,7 @@ template<
|
||||
class Base,
|
||||
int BitsOut,
|
||||
int BitsIn,
|
||||
class CharType = typename boost::iterator_value<Base>::type // output character
|
||||
class CharType = BOOST_DEDUCED_TYPENAME boost::iterator_value<Base>::type // output character
|
||||
>
|
||||
class transform_width :
|
||||
public boost::iterator_adaptor<
|
||||
@@ -54,7 +53,7 @@ class transform_width :
|
||||
>
|
||||
{
|
||||
friend class boost::iterator_core_access;
|
||||
typedef typename boost::iterator_adaptor<
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::iterator_adaptor<
|
||||
transform_width<Base, BitsOut, BitsIn, CharType>,
|
||||
Base,
|
||||
CharType,
|
||||
@@ -63,7 +62,7 @@ class transform_width :
|
||||
> super_t;
|
||||
|
||||
typedef transform_width<Base, BitsOut, BitsIn, CharType> this_t;
|
||||
typedef typename iterator_value<Base>::type base_value_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME iterator_value<Base>::type base_value_type;
|
||||
|
||||
void fill();
|
||||
|
||||
@@ -113,10 +112,6 @@ public:
|
||||
transform_width(BOOST_PFTO_WRAPPER(T) start) :
|
||||
super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast< T >(start)))),
|
||||
m_buffer_out_full(false),
|
||||
// To disable GCC warning, but not truly necessary
|
||||
//(m_buffer_in will be initialized later before being
|
||||
//used because m_remaining_bits == 0)
|
||||
m_buffer_in(0),
|
||||
m_remaining_bits(0),
|
||||
m_end_of_sequence(false)
|
||||
{}
|
||||
@@ -124,9 +119,8 @@ public:
|
||||
transform_width(const transform_width & rhs) :
|
||||
super_t(rhs.base_reference()),
|
||||
m_buffer_out_full(rhs.m_buffer_out_full),
|
||||
m_buffer_out(rhs.m_buffer_out),
|
||||
m_buffer_in(rhs.m_buffer_in),
|
||||
m_remaining_bits(rhs.m_remaining_bits),
|
||||
m_buffer_in(rhs.m_buffer_in),
|
||||
m_end_of_sequence(false)
|
||||
{}
|
||||
};
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_ITERATORS_UNESCAPE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -18,7 +18,9 @@
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
//#include <boost/iterator/iterator_traits.hpp>
|
||||
#include <boost/pointee.hpp>
|
||||
|
||||
namespace boost {
|
||||
@@ -33,24 +35,24 @@ class unescape
|
||||
: public boost::iterator_adaptor<
|
||||
unescape<Derived, Base>,
|
||||
Base,
|
||||
typename pointee<Base>::type,
|
||||
BOOST_DEDUCED_TYPENAME pointee<Base>::type,
|
||||
single_pass_traversal_tag,
|
||||
typename pointee<Base>::type
|
||||
BOOST_DEDUCED_TYPENAME pointee<Base>::type
|
||||
>
|
||||
{
|
||||
friend class boost::iterator_core_access;
|
||||
typedef typename boost::iterator_adaptor<
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::iterator_adaptor<
|
||||
unescape<Derived, Base>,
|
||||
Base,
|
||||
typename pointee<Base>::type,
|
||||
BOOST_DEDUCED_TYPENAME pointee<Base>::type,
|
||||
single_pass_traversal_tag,
|
||||
typename pointee<Base>::type
|
||||
BOOST_DEDUCED_TYPENAME pointee<Base>::type
|
||||
> super_t;
|
||||
|
||||
typedef unescape<Derived, Base> this_t;
|
||||
public:
|
||||
typedef typename this_t::value_type value_type;
|
||||
typedef typename this_t::reference reference;
|
||||
typedef BOOST_DEDUCED_TYPENAME this_t::value_type value_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME this_t::reference reference;
|
||||
private:
|
||||
value_type dereference_impl() {
|
||||
if(! m_full){
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_ITERATORS_WCHAR_FROM_MB_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <cstddef> // size_t
|
||||
#include <cstdlib> // mblen
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::mblen;
|
||||
@@ -53,7 +53,7 @@ class wchar_from_mb
|
||||
>
|
||||
{
|
||||
friend class boost::iterator_core_access;
|
||||
typedef typename boost::iterator_adaptor<
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::iterator_adaptor<
|
||||
wchar_from_mb<Base>,
|
||||
Base,
|
||||
wchar_t,
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_ITERATORS_XML_ESCAPE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -17,7 +17,10 @@
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME
|
||||
#include <boost/serialization/pfto.hpp>
|
||||
|
||||
#include <boost/archive/iterators/escape.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_ITERATORS_XML_UNESCAPE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME
|
||||
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
#include <boost/serialization/pfto.hpp>
|
||||
|
||||
@@ -37,7 +39,7 @@ class xml_unescape
|
||||
friend class boost::iterator_core_access;
|
||||
typedef xml_unescape<Base> this_t;
|
||||
typedef unescape<this_t, Base> super_t;
|
||||
typedef typename boost::iterator_reference<this_t> reference_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::iterator_reference<this_t> reference_type;
|
||||
|
||||
reference_type dereference() const {
|
||||
return unescape<xml_unescape<Base>, Base>::dereference();
|
||||
@@ -47,7 +49,7 @@ public:
|
||||
#if defined(BOOST_MSVC)
|
||||
typedef int value_type;
|
||||
#else
|
||||
typedef typename this_t::value_type value_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME this_t::value_type value_type;
|
||||
#endif
|
||||
|
||||
void drain_residue(const char *literal);
|
||||
@@ -81,7 +83,7 @@ void xml_unescape<Base>::drain_residue(const char * literal){
|
||||
// iterator refenence which would make subsequent iterator comparisons
|
||||
// incorrect and thereby break the composiblity of iterators.
|
||||
template<class Base>
|
||||
typename xml_unescape<Base>::value_type
|
||||
BOOST_DEDUCED_TYPENAME xml_unescape<Base>::value_type
|
||||
//int
|
||||
xml_unescape<Base>::drain(){
|
||||
value_type retval = * this->base_reference();
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_POLYMORPHIC_IARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -39,6 +39,8 @@ namespace std{
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
namespace boost {
|
||||
template<class T>
|
||||
class shared_ptr;
|
||||
namespace serialization {
|
||||
class extended_type_info;
|
||||
} // namespace serialization
|
||||
@@ -153,11 +155,18 @@ public:
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
// note special treatment of shared_ptr. This type needs a special
|
||||
// structure associated with every archive. We created a "mix-in"
|
||||
// class to provide this functionality. Since shared_ptr holds a
|
||||
// special esteem in the boost library - we included it here by default.
|
||||
#include <boost/archive/shared_ptr_helper.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
class polymorphic_iarchive :
|
||||
public polymorphic_iarchive_impl
|
||||
public polymorphic_iarchive_impl,
|
||||
public detail::shared_ptr_helper
|
||||
{
|
||||
public:
|
||||
virtual ~polymorphic_iarchive(){};
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_POLYMORPHIC_OARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -38,6 +38,8 @@ namespace std{
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
namespace boost {
|
||||
template<class T>
|
||||
class shared_ptr;
|
||||
namespace serialization {
|
||||
class extended_type_info;
|
||||
} // namespace serialization
|
||||
|
219
python/external/boost/boost/archive/shared_ptr_helper.hpp
vendored
Normal file
219
python/external/boost/boost/archive/shared_ptr_helper.hpp
vendored
Normal file
@@ -0,0 +1,219 @@
|
||||
#ifndef BOOST_ARCHIVE_SHARED_PTR_HELPER_HPP
|
||||
#define BOOST_ARCHIVE_SHARED_PTR_HELPER_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// shared_ptr_helper.hpp: serialization for boost shared pointern
|
||||
|
||||
// (C) Copyright 2004-2009 Robert Ramey, Martin Ecker and Takatoshi Kondo
|
||||
// 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 <set>
|
||||
#include <list>
|
||||
#include <utility>
|
||||
#include <cstddef> // NULL
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <boost/type_traits/is_polymorphic.hpp>
|
||||
#include <boost/serialization/type_info_implementation.hpp>
|
||||
#include <boost/serialization/shared_ptr_132.hpp>
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/archive/detail/decl.hpp>
|
||||
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last headern
|
||||
|
||||
namespace boost_132 {
|
||||
template<class T> class shared_ptr;
|
||||
}
|
||||
namespace boost {
|
||||
template<class T> class shared_ptr;
|
||||
namespace serialization {
|
||||
class extended_type_info;
|
||||
template<class Archive, class T>
|
||||
inline void load(
|
||||
Archive & ar,
|
||||
boost::shared_ptr< T > &t,
|
||||
const unsigned int file_version
|
||||
);
|
||||
}
|
||||
namespace archive{
|
||||
namespace detail {
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// a common class for holding various types of shared pointers
|
||||
|
||||
class shared_ptr_helper {
|
||||
struct collection_type_compare {
|
||||
bool operator()(
|
||||
const shared_ptr<const void> &lhs,
|
||||
const shared_ptr<const void> &rhs
|
||||
)const{
|
||||
return lhs.get() < rhs.get();
|
||||
}
|
||||
};
|
||||
typedef std::set<
|
||||
boost::shared_ptr<const void>,
|
||||
collection_type_compare
|
||||
> collection_type;
|
||||
typedef collection_type::const_iterator iterator_type;
|
||||
// list of shared_pointers create accessable by raw pointer. This
|
||||
// is used to "match up" shared pointers loaded at different
|
||||
// points in the archive. Note, we delay construction until
|
||||
// it is actually used since this is by default included as
|
||||
// a "mix-in" even if shared_ptr isn't used.
|
||||
collection_type * m_pointers;
|
||||
|
||||
struct null_deleter {
|
||||
void operator()(void const *) const {}
|
||||
};
|
||||
|
||||
struct void_deleter {
|
||||
const boost::serialization::extended_type_info * m_eti;
|
||||
void_deleter(const boost::serialization::extended_type_info *eti) :
|
||||
m_eti(eti)
|
||||
{}
|
||||
void operator()(void *vp) const {
|
||||
m_eti->destroy(vp);
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
public:
|
||||
#else
|
||||
template<class Archive, class T>
|
||||
friend inline void boost::serialization::load(
|
||||
Archive & ar,
|
||||
boost::shared_ptr< T > &t,
|
||||
const unsigned int file_version
|
||||
);
|
||||
#endif
|
||||
|
||||
// #ifdef BOOST_SERIALIZATION_SHARED_PTR_132_HPP
|
||||
// list of loaded pointers. This is used to be sure that the pointers
|
||||
// stay around long enough to be "matched" with other pointers loaded
|
||||
// by the same archive. These are created with a "null_deleter" so that
|
||||
// when this list is destroyed - the underlaying raw pointers are not
|
||||
// destroyed. This has to be done because the pointers are also held by
|
||||
// new system which is disjoint from this set. This is implemented
|
||||
// by a change in load_construct_data below. It makes this file suitable
|
||||
// only for loading pointers into a 1.33 or later boost system.
|
||||
std::list<boost_132::shared_ptr<const void> > * m_pointers_132;
|
||||
// #endif
|
||||
|
||||
// returns pointer to object and an indicator whether this is a
|
||||
// new entry (true) or a previous one (false)
|
||||
BOOST_ARCHIVE_DECL(shared_ptr<void>)
|
||||
get_od(
|
||||
const void * od,
|
||||
const boost::serialization::extended_type_info * true_type,
|
||||
const boost::serialization::extended_type_info * this_type
|
||||
);
|
||||
|
||||
BOOST_ARCHIVE_DECL(void)
|
||||
append(const boost::shared_ptr<const void> &);
|
||||
|
||||
template<class T>
|
||||
struct non_polymorphic {
|
||||
static const boost::serialization::extended_type_info *
|
||||
get_object_identifier(T &){
|
||||
return & boost::serialization::singleton<
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
boost::serialization::type_info_implementation< T >::type
|
||||
>::get_const_instance();
|
||||
}
|
||||
};
|
||||
template<class T>
|
||||
struct polymorphic {
|
||||
static const boost::serialization::extended_type_info *
|
||||
get_object_identifier(T & t){
|
||||
return boost::serialization::singleton<
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
boost::serialization::type_info_implementation< T >::type
|
||||
>::get_const_instance().get_derived_extended_type_info(t);
|
||||
}
|
||||
};
|
||||
public:
|
||||
template<class T>
|
||||
void reset(shared_ptr< T > & s, T * t){
|
||||
if(NULL == t){
|
||||
s.reset();
|
||||
return;
|
||||
}
|
||||
const boost::serialization::extended_type_info * this_type
|
||||
= & boost::serialization::type_info_implementation< T >::type
|
||||
::get_const_instance();
|
||||
|
||||
// get pointer to the most derived object. This is effectively
|
||||
// the object identifern
|
||||
typedef BOOST_DEDUCED_TYPENAME mpl::eval_if<
|
||||
is_polymorphic< T >,
|
||||
mpl::identity<polymorphic< T > >,
|
||||
mpl::identity<non_polymorphic< T > >
|
||||
>::type type;
|
||||
|
||||
const boost::serialization::extended_type_info * true_type
|
||||
= type::get_object_identifier(*t);
|
||||
|
||||
// note:if this exception is thrown, be sure that derived pointern
|
||||
// is either registered or exported.
|
||||
if(NULL == true_type)
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(
|
||||
archive_exception::unregistered_class,
|
||||
this_type->get_debug_info()
|
||||
)
|
||||
);
|
||||
shared_ptr<void> r =
|
||||
get_od(
|
||||
static_cast<const void *>(t),
|
||||
true_type,
|
||||
this_type
|
||||
);
|
||||
if(!r){
|
||||
s.reset(t);
|
||||
const void * od = void_downcast(
|
||||
*true_type,
|
||||
*this_type,
|
||||
static_cast<const void *>(t)
|
||||
);
|
||||
shared_ptr<const void> sp(s, od);
|
||||
append(sp);
|
||||
}
|
||||
else{
|
||||
s = shared_ptr< T >(
|
||||
r,
|
||||
static_cast<T *>(r.get())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// #ifdef BOOST_SERIALIZATION_SHARED_PTR_132_HPP
|
||||
BOOST_ARCHIVE_DECL(void)
|
||||
append(const boost_132::shared_ptr<const void> & t);
|
||||
// #endif
|
||||
public:
|
||||
BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
|
||||
shared_ptr_helper();
|
||||
BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
|
||||
~shared_ptr_helper();
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#endif // BOOST_ARCHIVE_SHARED_PTR_HELPER_HPP
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_TEXT_IARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -35,10 +35,6 @@
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
template<class Archive> class interface_iarchive;
|
||||
} // namespace detail
|
||||
|
||||
template<class Archive>
|
||||
class text_iarchive_impl :
|
||||
public basic_text_iprimitive<std::istream>,
|
||||
@@ -47,16 +43,10 @@ class text_iarchive_impl :
|
||||
#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>;
|
||||
friend load_access;
|
||||
#else
|
||||
friend class detail::interface_iarchive<Archive>;
|
||||
friend class basic_text_iarchive<Archive>;
|
||||
friend class load_access;
|
||||
#endif
|
||||
protected:
|
||||
#endif
|
||||
template<class T>
|
||||
void load(T & t){
|
||||
@@ -102,6 +92,22 @@ protected:
|
||||
~text_iarchive_impl(){};
|
||||
};
|
||||
|
||||
// do not derive from the classes below. If you want to extend this functionality
|
||||
// via inhertance, derived from text_iarchive_impl instead. This will
|
||||
// preserve correct static polymorphism.
|
||||
|
||||
// same as text_iarchive below - without the shared_ptr_helper
|
||||
class naked_text_iarchive :
|
||||
public text_iarchive_impl<naked_text_iarchive>
|
||||
{
|
||||
public:
|
||||
naked_text_iarchive(std::istream & is_, unsigned int flags = 0) :
|
||||
// note: added _ to suppress useless gcc warning
|
||||
text_iarchive_impl<naked_text_iarchive>(is_, flags)
|
||||
{}
|
||||
~naked_text_iarchive(){}
|
||||
};
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
@@ -111,6 +117,12 @@ protected:
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
// note special treatment of shared_ptr. This type needs a special
|
||||
// structure associated with every archive. We created a "mix-in"
|
||||
// class to provide this functionality. Since shared_ptr holds a
|
||||
// special esteem in the boost library - we included it here by default.
|
||||
#include <boost/archive/shared_ptr_helper.hpp>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
@@ -120,7 +132,9 @@ namespace boost {
|
||||
namespace archive {
|
||||
|
||||
class text_iarchive :
|
||||
public text_iarchive_impl<text_iarchive>{
|
||||
public text_iarchive_impl<text_iarchive>,
|
||||
public detail::shared_ptr_helper
|
||||
{
|
||||
public:
|
||||
text_iarchive(std::istream & is_, unsigned int flags = 0) :
|
||||
// note: added _ to suppress useless gcc warning
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_TEXT_OARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -42,10 +42,6 @@ namespace std{
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
template<class Archive> class interface_oarchive;
|
||||
} // namespace detail
|
||||
|
||||
template<class Archive>
|
||||
class text_oarchive_impl :
|
||||
/* protected ? */ public basic_text_oprimitive<std::ostream>,
|
||||
@@ -54,18 +50,10 @@ class text_oarchive_impl :
|
||||
#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_oarchive<Archive>;
|
||||
friend basic_text_oarchive<Archive>;
|
||||
friend save_access;
|
||||
#else
|
||||
friend class detail::interface_oarchive<Archive>;
|
||||
friend class basic_text_oarchive<Archive>;
|
||||
friend class save_access;
|
||||
#endif
|
||||
protected:
|
||||
#endif
|
||||
template<class T>
|
||||
void save(const T & t){
|
||||
@@ -114,6 +102,8 @@ public:
|
||||
~text_oarchive(){}
|
||||
};
|
||||
|
||||
typedef text_oarchive naked_text_oarchive;
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_TEXT_WIARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -39,10 +39,6 @@
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
template<class Archive> class interface_iarchive;
|
||||
} // namespace detail
|
||||
|
||||
template<class Archive>
|
||||
class text_wiarchive_impl :
|
||||
public basic_text_iprimitive<std::wistream>,
|
||||
@@ -51,16 +47,10 @@ class text_wiarchive_impl :
|
||||
#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>;
|
||||
friend load_access;
|
||||
#else
|
||||
friend class detail::interface_iarchive<Archive>;
|
||||
friend class basic_text_iarchive<Archive>;
|
||||
friend class load_access;
|
||||
#endif
|
||||
protected:
|
||||
#endif
|
||||
template<class T>
|
||||
void load(T & t){
|
||||
@@ -99,6 +89,21 @@ protected:
|
||||
~text_wiarchive_impl(){};
|
||||
};
|
||||
|
||||
// do not derive from the classes below. If you want to extend this functionality
|
||||
// via inhertance, derived from text_iarchive_impl instead. This will
|
||||
// preserve correct static polymorphism.
|
||||
|
||||
// same as text_wiarchive below - without the shared_ptr_helper
|
||||
class naked_text_wiarchive :
|
||||
public text_wiarchive_impl<naked_text_wiarchive>
|
||||
{
|
||||
public:
|
||||
naked_text_wiarchive(std::wistream & is, unsigned int flags = 0) :
|
||||
text_wiarchive_impl<naked_text_wiarchive>(is, flags)
|
||||
{}
|
||||
~naked_text_wiarchive(){}
|
||||
};
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
@@ -108,6 +113,12 @@ protected:
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
// note special treatment of shared_ptr. This type needs a special
|
||||
// structure associated with every archive. We created a "mix-in"
|
||||
// class to provide this functionality. Since shared_ptr holds a
|
||||
// special esteem in the boost library - we included it here by default.
|
||||
#include <boost/archive/shared_ptr_helper.hpp>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
@@ -117,7 +128,9 @@ namespace boost {
|
||||
namespace archive {
|
||||
|
||||
class text_wiarchive :
|
||||
public text_wiarchive_impl<text_wiarchive>{
|
||||
public text_wiarchive_impl<text_wiarchive>,
|
||||
public detail::shared_ptr_helper
|
||||
{
|
||||
public:
|
||||
text_wiarchive(std::wistream & is, unsigned int flags = 0) :
|
||||
text_wiarchive_impl<text_wiarchive>(is, flags)
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_TEXT_WOARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -47,10 +47,6 @@ namespace std{
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
template<class Archive> class interface_oarchive;
|
||||
} // namespace detail
|
||||
|
||||
template<class Archive>
|
||||
class text_woarchive_impl :
|
||||
public basic_text_oprimitive<std::wostream>,
|
||||
@@ -59,18 +55,10 @@ class text_woarchive_impl :
|
||||
#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_oarchive<Archive>;
|
||||
friend basic_text_oarchive<Archive>;
|
||||
friend save_access;
|
||||
#else
|
||||
friend class detail::interface_oarchive<Archive>;
|
||||
friend class basic_text_oarchive<Archive>;
|
||||
friend class save_access;
|
||||
#endif
|
||||
protected:
|
||||
#endif
|
||||
template<class T>
|
||||
void save(const T & t){
|
||||
@@ -139,6 +127,8 @@ public:
|
||||
~text_woarchive(){}
|
||||
};
|
||||
|
||||
typedef text_woarchive naked_text_woarchive;
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_WCSLEN_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_XML_ARCHIVE_EXCEPTION_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_XML_IARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#include <istream>
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
//#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
#include <boost/archive/basic_text_iprimitive.hpp>
|
||||
#include <boost/archive/basic_xml_iarchive.hpp>
|
||||
@@ -35,10 +35,6 @@
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
template<class Archive> class interface_iarchive;
|
||||
} // namespace detail
|
||||
|
||||
template<class CharType>
|
||||
class basic_xml_grammar;
|
||||
typedef basic_xml_grammar<char> xml_grammar;
|
||||
@@ -51,21 +47,15 @@ class xml_iarchive_impl :
|
||||
#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>;
|
||||
friend basic_xml_iarchive<Archive>;
|
||||
friend load_access;
|
||||
#else
|
||||
friend class detail::interface_iarchive<Archive>;
|
||||
friend class basic_xml_iarchive<Archive>;
|
||||
friend class load_access;
|
||||
#endif
|
||||
protected:
|
||||
#endif
|
||||
// use boost:scoped_ptr to implement automatic deletion;
|
||||
boost::scoped_ptr<xml_grammar> gimpl;
|
||||
// instances of micro xml parser to parse start preambles
|
||||
// scoped_ptr doesn't play nice with borland - so use a naked pointer
|
||||
// scoped_ptr<xml_grammar> gimpl;
|
||||
xml_grammar *gimpl;
|
||||
|
||||
std::istream & get_is(){
|
||||
return is;
|
||||
@@ -112,6 +102,21 @@ protected:
|
||||
~xml_iarchive_impl();
|
||||
};
|
||||
|
||||
// do not derive from the classes below. If you want to extend this functionality
|
||||
// via inhertance, derived from text_iarchive_impl instead. This will
|
||||
// preserve correct static polymorphism.
|
||||
|
||||
// same as xml_iarchive below - without the shared_ptr_helper
|
||||
class naked_xml_iarchive :
|
||||
public xml_iarchive_impl<naked_xml_iarchive>
|
||||
{
|
||||
public:
|
||||
naked_xml_iarchive(std::istream & is, unsigned int flags = 0) :
|
||||
xml_iarchive_impl<naked_xml_iarchive>(is, flags)
|
||||
{}
|
||||
~naked_xml_iarchive(){}
|
||||
};
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
@@ -120,6 +125,13 @@ protected:
|
||||
#endif
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
// note special treatment of shared_ptr. This type needs a special
|
||||
// structure associated with every archive. We created a "mix-in"
|
||||
// class to provide this functionality. Since shared_ptr holds a
|
||||
// special esteem in the boost library - we included it here by default.
|
||||
#include <boost/archive/shared_ptr_helper.hpp>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
@@ -129,7 +141,9 @@ namespace boost {
|
||||
namespace archive {
|
||||
|
||||
class xml_iarchive :
|
||||
public xml_iarchive_impl<xml_iarchive>{
|
||||
public xml_iarchive_impl<xml_iarchive>,
|
||||
public detail::shared_ptr_helper
|
||||
{
|
||||
public:
|
||||
xml_iarchive(std::istream & is, unsigned int flags = 0) :
|
||||
xml_iarchive_impl<xml_iarchive>(is, flags)
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_XML_OARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -42,10 +42,6 @@ namespace std{
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
template<class Archive> class interface_oarchive;
|
||||
} // namespace detail
|
||||
|
||||
template<class Archive>
|
||||
class xml_oarchive_impl :
|
||||
public basic_text_oprimitive<std::ostream>,
|
||||
@@ -54,18 +50,10 @@ class xml_oarchive_impl :
|
||||
#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_oarchive<Archive>;
|
||||
friend basic_xml_oarchive<Archive>;
|
||||
friend save_access;
|
||||
#else
|
||||
friend class detail::interface_oarchive<Archive>;
|
||||
friend class basic_xml_oarchive<Archive>;
|
||||
friend class save_access;
|
||||
#endif
|
||||
protected:
|
||||
#endif
|
||||
//void end_preamble(){
|
||||
// basic_xml_oarchive<Archive>::end_preamble();
|
||||
@@ -128,6 +116,8 @@ public:
|
||||
~xml_oarchive(){}
|
||||
};
|
||||
|
||||
typedef xml_oarchive naked_xml_oarchive;
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_XML_WIARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -23,22 +23,13 @@
|
||||
|
||||
#include <istream>
|
||||
|
||||
#include <boost/smart_ptr/scoped_ptr.hpp>
|
||||
//#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/archive/detail/auto_link_warchive.hpp>
|
||||
#include <boost/archive/basic_text_iprimitive.hpp>
|
||||
#include <boost/archive/basic_xml_iarchive.hpp>
|
||||
#include <boost/archive/detail/register_archive.hpp>
|
||||
#include <boost/serialization/item_version_type.hpp>
|
||||
|
||||
#ifdef BOOST_NO_CXX11_HDR_CODECVT
|
||||
#include <boost/archive/detail/utf8_codecvt_facet.hpp>
|
||||
#else
|
||||
#include <codecvt>
|
||||
namespace boost { namespace archive { namespace detail {
|
||||
typedef std::codecvt_utf8<wchar_t> utf8_codecvt_facet;
|
||||
} } }
|
||||
#endif
|
||||
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
@@ -49,10 +40,6 @@
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
template<class Archive> class interface_iarchive;
|
||||
} // namespace detail
|
||||
|
||||
template<class CharType>
|
||||
class basic_xml_grammar;
|
||||
typedef basic_xml_grammar<wchar_t> xml_wgrammar;
|
||||
@@ -65,20 +52,15 @@ class xml_wiarchive_impl :
|
||||
#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>;
|
||||
friend basic_xml_iarchive<Archive>;
|
||||
friend load_access;
|
||||
#else
|
||||
friend class detail::interface_iarchive<Archive>;
|
||||
friend class basic_xml_iarchive<Archive>;
|
||||
friend class load_access;
|
||||
#endif
|
||||
protected:
|
||||
#endif
|
||||
boost::scoped_ptr<xml_wgrammar> gimpl;
|
||||
// instances of micro xml parser to parse start preambles
|
||||
// scoped_ptr doesn't play nice with borland - so use a naked pointer
|
||||
// scoped_ptr<xml_wgrammar> gimpl;
|
||||
xml_wgrammar *gimpl;
|
||||
std::wistream & get_is(){
|
||||
return is;
|
||||
}
|
||||
@@ -125,6 +107,21 @@ protected:
|
||||
~xml_wiarchive_impl();
|
||||
};
|
||||
|
||||
// do not derive from the classes below. If you want to extend this functionality
|
||||
// via inhertance, derived from xml_wiarchive_impl instead. This will
|
||||
// preserve correct static polymorphism.
|
||||
|
||||
// same as xml_wiarchive below - without the shared_ptr_helper
|
||||
class naked_xml_wiarchive :
|
||||
public xml_wiarchive_impl<naked_xml_wiarchive>
|
||||
{
|
||||
public:
|
||||
naked_xml_wiarchive(std::wistream & is, unsigned int flags = 0) :
|
||||
xml_wiarchive_impl<naked_xml_wiarchive>(is, flags)
|
||||
{}
|
||||
~naked_xml_wiarchive(){}
|
||||
};
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
@@ -134,6 +131,12 @@ protected:
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
// note special treatment of shared_ptr. This type needs a special
|
||||
// structure associated with every archive. We created a "mix-in"
|
||||
// class to provide this functionality. Since shared_ptr holds a
|
||||
// special esteem in the boost library - we included it here by default.
|
||||
#include <boost/archive/shared_ptr_helper.hpp>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
@@ -143,7 +146,9 @@ namespace boost {
|
||||
namespace archive {
|
||||
|
||||
class xml_wiarchive :
|
||||
public xml_wiarchive_impl<xml_wiarchive>{
|
||||
public xml_wiarchive_impl<xml_wiarchive>,
|
||||
public detail::shared_ptr_helper
|
||||
{
|
||||
public:
|
||||
xml_wiarchive(std::wistream & is, unsigned int flags = 0) :
|
||||
xml_wiarchive_impl<xml_wiarchive>(is, flags)
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define BOOST_ARCHIVE_XML_WOARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -30,22 +30,12 @@ namespace std{
|
||||
|
||||
#include <ostream>
|
||||
|
||||
#include <boost/smart_ptr/scoped_ptr.hpp>
|
||||
#include <boost/archive/detail/auto_link_warchive.hpp>
|
||||
#include <boost/archive/basic_text_oprimitive.hpp>
|
||||
#include <boost/archive/basic_xml_oarchive.hpp>
|
||||
#include <boost/archive/detail/register_archive.hpp>
|
||||
#include <boost/serialization/item_version_type.hpp>
|
||||
|
||||
#ifdef BOOST_NO_CXX11_HDR_CODECVT
|
||||
#include <boost/archive/detail/utf8_codecvt_facet.hpp>
|
||||
#else
|
||||
#include <codecvt>
|
||||
namespace boost { namespace archive { namespace detail {
|
||||
typedef std::codecvt_utf8<wchar_t> utf8_codecvt_facet;
|
||||
} } }
|
||||
#endif
|
||||
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
@@ -56,10 +46,6 @@ namespace std{
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
template<class Archive> class interface_oarchive;
|
||||
} // namespace detail
|
||||
|
||||
template<class Archive>
|
||||
class xml_woarchive_impl :
|
||||
public basic_text_oprimitive<std::wostream>,
|
||||
@@ -68,18 +54,10 @@ class xml_woarchive_impl :
|
||||
#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_oarchive<Archive>;
|
||||
friend basic_xml_oarchive<Archive>;
|
||||
friend save_access;
|
||||
#else
|
||||
friend class detail::interface_oarchive<Archive>;
|
||||
friend class basic_xml_oarchive<Archive>;
|
||||
friend class save_access;
|
||||
#endif
|
||||
protected:
|
||||
#endif
|
||||
//void end_preamble(){
|
||||
// basic_xml_oarchive<Archive>::end_preamble();
|
||||
@@ -111,8 +89,7 @@ protected:
|
||||
#endif
|
||||
BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY())
|
||||
xml_woarchive_impl(std::wostream & os, unsigned int flags);
|
||||
BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY())
|
||||
~xml_woarchive_impl();
|
||||
~xml_woarchive_impl(){}
|
||||
public:
|
||||
void
|
||||
save_binary(const void *address, std::size_t count){
|
||||
@@ -145,6 +122,8 @@ public:
|
||||
~xml_woarchive(){}
|
||||
};
|
||||
|
||||
typedef xml_woarchive naked_xml_woarchive;
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
|
119
python/external/boost/boost/assert.hpp
vendored
119
python/external/boost/boost/assert.hpp
vendored
@@ -2,19 +2,18 @@
|
||||
// boost/assert.hpp - BOOST_ASSERT(expr)
|
||||
// BOOST_ASSERT_MSG(expr, msg)
|
||||
// BOOST_VERIFY(expr)
|
||||
// BOOST_VERIFY_MSG(expr, msg)
|
||||
//
|
||||
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
|
||||
// Copyright (c) 2007, 2014 Peter Dimov
|
||||
// Copyright (c) 2007 Peter Dimov
|
||||
// Copyright (c) Beman Dawes 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
|
||||
// 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)
|
||||
//
|
||||
// Note: There are no include guards. This is intentional.
|
||||
//
|
||||
// See http://www.boost.org/libs/assert/assert.html for documentation.
|
||||
// See http://www.boost.org/libs/utility/assert.html for documentation.
|
||||
//
|
||||
|
||||
//
|
||||
@@ -23,56 +22,120 @@
|
||||
// boostinspect:naassert_macro
|
||||
//
|
||||
|
||||
//
|
||||
// BOOST_ASSERT, BOOST_ASSERT_MSG
|
||||
//
|
||||
//--------------------------------------------------------------------------------------//
|
||||
// BOOST_ASSERT //
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
#undef BOOST_ASSERT
|
||||
#undef BOOST_ASSERT_MSG
|
||||
|
||||
#if defined(BOOST_DISABLE_ASSERTS) || ( defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && defined(NDEBUG) )
|
||||
#if defined(BOOST_DISABLE_ASSERTS)
|
||||
|
||||
# define BOOST_ASSERT(expr) ((void)0)
|
||||
# define BOOST_ASSERT_MSG(expr, msg) ((void)0)
|
||||
|
||||
#elif defined(BOOST_ENABLE_ASSERT_HANDLER) || ( defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && !defined(NDEBUG) )
|
||||
#elif defined(BOOST_ENABLE_ASSERT_HANDLER)
|
||||
|
||||
#include <boost/config.hpp> // for BOOST_LIKELY
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/current_function.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
void assertion_failed(char const * expr, char const * function, char const * file, long line); // user defined
|
||||
void assertion_failed_msg(char const * expr, char const * msg, char const * function, char const * file, long line); // user defined
|
||||
void assertion_failed(char const * expr,
|
||||
char const * function, char const * file, long line); // user defined
|
||||
} // namespace boost
|
||||
|
||||
#define BOOST_ASSERT(expr) (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
|
||||
#define BOOST_ASSERT_MSG(expr, msg) (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed_msg(#expr, msg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
|
||||
#define BOOST_ASSERT(expr) (BOOST_LIKELY(!!(expr)) \
|
||||
? ((void)0) \
|
||||
: ::boost::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
|
||||
|
||||
#else
|
||||
|
||||
# include <assert.h> // .h to support old libraries w/o <cassert> - effect is the same
|
||||
|
||||
# define BOOST_ASSERT(expr) assert(expr)
|
||||
# define BOOST_ASSERT_MSG(expr, msg) assert((expr)&&(msg))
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// BOOST_VERIFY, BOOST_VERIFY_MSG
|
||||
//
|
||||
//--------------------------------------------------------------------------------------//
|
||||
// BOOST_ASSERT_MSG //
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
# undef BOOST_ASSERT_MSG
|
||||
|
||||
#if defined(BOOST_DISABLE_ASSERTS) || defined(NDEBUG)
|
||||
|
||||
#define BOOST_ASSERT_MSG(expr, msg) ((void)0)
|
||||
|
||||
#elif defined(BOOST_ENABLE_ASSERT_HANDLER)
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/current_function.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
void assertion_failed_msg(char const * expr, char const * msg,
|
||||
char const * function, char const * file, long line); // user defined
|
||||
} // namespace boost
|
||||
|
||||
#define BOOST_ASSERT_MSG(expr, msg) (BOOST_LIKELY(!!(expr)) \
|
||||
? ((void)0) \
|
||||
: ::boost::assertion_failed_msg(#expr, msg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
|
||||
|
||||
#else
|
||||
#ifndef BOOST_ASSERT_HPP
|
||||
#define BOOST_ASSERT_HPP
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/current_function.hpp>
|
||||
|
||||
// IDE's like Visual Studio perform better if output goes to std::cout or
|
||||
// some other stream, so allow user to configure output stream:
|
||||
#ifndef BOOST_ASSERT_MSG_OSTREAM
|
||||
# define BOOST_ASSERT_MSG_OSTREAM std::cerr
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace assertion
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
// Note: The template is needed to make the function non-inline and avoid linking errors
|
||||
template< typename CharT >
|
||||
BOOST_NOINLINE void assertion_failed_msg(CharT const * expr, char const * msg, char const * function,
|
||||
char const * file, long line)
|
||||
{
|
||||
BOOST_ASSERT_MSG_OSTREAM
|
||||
<< "***** Internal Program Error - assertion (" << expr << ") failed in "
|
||||
<< function << ":\n"
|
||||
<< file << '(' << line << "): " << msg << std::endl;
|
||||
#ifdef UNDER_CE
|
||||
// The Windows CE CRT library does not have abort() so use exit(-1) instead.
|
||||
std::exit(-1);
|
||||
#else
|
||||
std::abort();
|
||||
#endif
|
||||
}
|
||||
} // detail
|
||||
} // assertion
|
||||
} // detail
|
||||
#endif
|
||||
|
||||
#define BOOST_ASSERT_MSG(expr, msg) (BOOST_LIKELY(!!(expr)) \
|
||||
? ((void)0) \
|
||||
: ::boost::assertion::detail::assertion_failed_msg(#expr, msg, \
|
||||
BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
// BOOST_VERIFY //
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
#undef BOOST_VERIFY
|
||||
#undef BOOST_VERIFY_MSG
|
||||
|
||||
#if defined(BOOST_DISABLE_ASSERTS) || ( !defined(BOOST_ENABLE_ASSERT_HANDLER) && defined(NDEBUG) )
|
||||
|
||||
# define BOOST_VERIFY(expr) ((void)(expr))
|
||||
# define BOOST_VERIFY_MSG(expr, msg) ((void)(expr))
|
||||
|
||||
#else
|
||||
|
||||
# define BOOST_VERIFY(expr) BOOST_ASSERT(expr)
|
||||
# define BOOST_VERIFY_MSG(expr, msg) BOOST_ASSERT_MSG(expr,msg)
|
||||
|
||||
#endif
|
||||
|
18
python/external/boost/boost/atomic.hpp
vendored
Normal file
18
python/external/boost/boost/atomic.hpp
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef BOOST_ATOMIC_HPP
|
||||
#define BOOST_ATOMIC_HPP
|
||||
|
||||
// Copyright (c) 2011 Helge Bahmann
|
||||
//
|
||||
// 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)
|
||||
|
||||
// This header includes all Boost.Atomic public headers
|
||||
|
||||
#include <boost/atomic/atomic.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#endif
|
232
python/external/boost/boost/atomic/atomic.hpp
vendored
Normal file
232
python/external/boost/boost/atomic/atomic.hpp
vendored
Normal file
@@ -0,0 +1,232 @@
|
||||
#ifndef BOOST_ATOMIC_ATOMIC_HPP
|
||||
#define BOOST_ATOMIC_ATOMIC_HPP
|
||||
|
||||
// Copyright (c) 2011 Helge Bahmann
|
||||
// Copyright (c) 2013 Tim Blechmann
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <cstddef>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#include <boost/memory_order.hpp>
|
||||
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#include <boost/atomic/detail/platform.hpp>
|
||||
#include <boost/atomic/detail/type-classification.hpp>
|
||||
#include <boost/type_traits/is_signed.hpp>
|
||||
#if defined(BOOST_MSVC) && BOOST_MSVC < 1400
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
#ifndef BOOST_ATOMIC_CHAR_LOCK_FREE
|
||||
#define BOOST_ATOMIC_CHAR_LOCK_FREE 0
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_CHAR16_T_LOCK_FREE
|
||||
#define BOOST_ATOMIC_CHAR16_T_LOCK_FREE 0
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_CHAR32_T_LOCK_FREE
|
||||
#define BOOST_ATOMIC_CHAR32_T_LOCK_FREE 0
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_WCHAR_T_LOCK_FREE
|
||||
#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE 0
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_SHORT_LOCK_FREE
|
||||
#define BOOST_ATOMIC_SHORT_LOCK_FREE 0
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_INT_LOCK_FREE
|
||||
#define BOOST_ATOMIC_INT_LOCK_FREE 0
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_LONG_LOCK_FREE
|
||||
#define BOOST_ATOMIC_LONG_LOCK_FREE 0
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_LLONG_LOCK_FREE
|
||||
#define BOOST_ATOMIC_LLONG_LOCK_FREE 0
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_INT128_LOCK_FREE
|
||||
#define BOOST_ATOMIC_INT128_LOCK_FREE 0
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_POINTER_LOCK_FREE
|
||||
#define BOOST_ATOMIC_POINTER_LOCK_FREE 0
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_ADDRESS_LOCK_FREE BOOST_ATOMIC_POINTER_LOCK_FREE
|
||||
|
||||
#ifndef BOOST_ATOMIC_BOOL_LOCK_FREE
|
||||
#define BOOST_ATOMIC_BOOL_LOCK_FREE 0
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_THREAD_FENCE
|
||||
#define BOOST_ATOMIC_THREAD_FENCE 0
|
||||
inline void atomic_thread_fence(memory_order)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_SIGNAL_FENCE
|
||||
#define BOOST_ATOMIC_SIGNAL_FENCE 0
|
||||
inline void atomic_signal_fence(memory_order order)
|
||||
{
|
||||
atomic_thread_fence(order);
|
||||
}
|
||||
#endif
|
||||
|
||||
template<typename T>
|
||||
class atomic :
|
||||
public atomics::detail::base_atomic<
|
||||
T,
|
||||
typename atomics::detail::classify<T>::type,
|
||||
atomics::detail::storage_size_of<T>::value,
|
||||
#if !defined(BOOST_MSVC) || BOOST_MSVC >= 1400
|
||||
boost::is_signed<T>::value
|
||||
#else
|
||||
// MSVC 2003 has problems instantiating is_signed on non-integral types
|
||||
mpl::and_< boost::is_integral<T>, boost::is_signed<T> >::value
|
||||
#endif
|
||||
>
|
||||
{
|
||||
private:
|
||||
typedef T value_type;
|
||||
typedef atomics::detail::base_atomic<
|
||||
T,
|
||||
typename atomics::detail::classify<T>::type,
|
||||
atomics::detail::storage_size_of<T>::value,
|
||||
#if !defined(BOOST_MSVC) || BOOST_MSVC >= 1400
|
||||
boost::is_signed<T>::value
|
||||
#else
|
||||
// MSVC 2003 has problems instantiating is_signed on non-itegral types
|
||||
mpl::and_< boost::is_integral<T>, boost::is_signed<T> >::value
|
||||
#endif
|
||||
> super;
|
||||
typedef typename super::value_arg_type value_arg_type;
|
||||
|
||||
public:
|
||||
BOOST_DEFAULTED_FUNCTION(atomic(void), BOOST_NOEXCEPT {})
|
||||
|
||||
// NOTE: The constructor is made explicit because gcc 4.7 complains that
|
||||
// operator=(value_arg_type) is considered ambiguous with operator=(atomic const&)
|
||||
// in assignment expressions, even though conversion to atomic<> is less preferred
|
||||
// than conversion to value_arg_type.
|
||||
explicit BOOST_CONSTEXPR atomic(value_arg_type v) BOOST_NOEXCEPT : super(v) {}
|
||||
|
||||
value_type operator=(value_arg_type v) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
this->store(v);
|
||||
return v;
|
||||
}
|
||||
|
||||
operator value_type(void) volatile const BOOST_NOEXCEPT
|
||||
{
|
||||
return this->load();
|
||||
}
|
||||
|
||||
BOOST_DELETED_FUNCTION(atomic(atomic const&))
|
||||
BOOST_DELETED_FUNCTION(atomic& operator=(atomic const&) volatile)
|
||||
};
|
||||
|
||||
typedef atomic<char> atomic_char;
|
||||
typedef atomic<unsigned char> atomic_uchar;
|
||||
typedef atomic<signed char> atomic_schar;
|
||||
typedef atomic<uint8_t> atomic_uint8_t;
|
||||
typedef atomic<int8_t> atomic_int8_t;
|
||||
typedef atomic<unsigned short> atomic_ushort;
|
||||
typedef atomic<short> atomic_short;
|
||||
typedef atomic<uint16_t> atomic_uint16_t;
|
||||
typedef atomic<int16_t> atomic_int16_t;
|
||||
typedef atomic<unsigned int> atomic_uint;
|
||||
typedef atomic<int> atomic_int;
|
||||
typedef atomic<uint32_t> atomic_uint32_t;
|
||||
typedef atomic<int32_t> atomic_int32_t;
|
||||
typedef atomic<unsigned long> atomic_ulong;
|
||||
typedef atomic<long> atomic_long;
|
||||
typedef atomic<uint64_t> atomic_uint64_t;
|
||||
typedef atomic<int64_t> atomic_int64_t;
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
typedef atomic<boost::ulong_long_type> atomic_ullong;
|
||||
typedef atomic<boost::long_long_type> atomic_llong;
|
||||
#endif
|
||||
typedef atomic<void*> atomic_address;
|
||||
typedef atomic<bool> atomic_bool;
|
||||
typedef atomic<wchar_t> atomic_wchar_t;
|
||||
#if !defined(BOOST_NO_CXX11_CHAR16_T)
|
||||
typedef atomic<char16_t> atomic_char16_t;
|
||||
#endif
|
||||
#if !defined(BOOST_NO_CXX11_CHAR32_T)
|
||||
typedef atomic<char32_t> atomic_char32_t;
|
||||
#endif
|
||||
|
||||
typedef atomic<int_least8_t> atomic_int_least8_t;
|
||||
typedef atomic<uint_least8_t> atomic_uint_least8_t;
|
||||
typedef atomic<int_least16_t> atomic_int_least16_t;
|
||||
typedef atomic<uint_least16_t> atomic_uint_least16_t;
|
||||
typedef atomic<int_least32_t> atomic_int_least32_t;
|
||||
typedef atomic<uint_least32_t> atomic_uint_least32_t;
|
||||
typedef atomic<int_least64_t> atomic_int_least64_t;
|
||||
typedef atomic<uint_least64_t> atomic_uint_least64_t;
|
||||
typedef atomic<int_fast8_t> atomic_int_fast8_t;
|
||||
typedef atomic<uint_fast8_t> atomic_uint_fast8_t;
|
||||
typedef atomic<int_fast16_t> atomic_int_fast16_t;
|
||||
typedef atomic<uint_fast16_t> atomic_uint_fast16_t;
|
||||
typedef atomic<int_fast32_t> atomic_int_fast32_t;
|
||||
typedef atomic<uint_fast32_t> atomic_uint_fast32_t;
|
||||
typedef atomic<int_fast64_t> atomic_int_fast64_t;
|
||||
typedef atomic<uint_fast64_t> atomic_uint_fast64_t;
|
||||
typedef atomic<intmax_t> atomic_intmax_t;
|
||||
typedef atomic<uintmax_t> atomic_uintmax_t;
|
||||
|
||||
typedef atomic<std::size_t> atomic_size_t;
|
||||
typedef atomic<std::ptrdiff_t> atomic_ptrdiff_t;
|
||||
|
||||
#if defined(BOOST_HAS_INTPTR_T)
|
||||
typedef atomic<intptr_t> atomic_intptr_t;
|
||||
typedef atomic<uintptr_t> atomic_uintptr_t;
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ATOMIC_FLAG_LOCK_FREE
|
||||
#define BOOST_ATOMIC_FLAG_LOCK_FREE 0
|
||||
class atomic_flag
|
||||
{
|
||||
public:
|
||||
BOOST_CONSTEXPR atomic_flag(void) BOOST_NOEXCEPT : v_(false) {}
|
||||
|
||||
bool
|
||||
test_and_set(memory_order order = memory_order_seq_cst) BOOST_NOEXCEPT
|
||||
{
|
||||
return v_.exchange(true, order);
|
||||
}
|
||||
|
||||
void
|
||||
clear(memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
v_.store(false, order);
|
||||
}
|
||||
|
||||
BOOST_DELETED_FUNCTION(atomic_flag(atomic_flag const&))
|
||||
BOOST_DELETED_FUNCTION(atomic_flag& operator=(atomic_flag const&))
|
||||
|
||||
private:
|
||||
atomic<bool> v_;
|
||||
};
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif
|
605
python/external/boost/boost/atomic/detail/base.hpp
vendored
Normal file
605
python/external/boost/boost/atomic/detail/base.hpp
vendored
Normal file
@@ -0,0 +1,605 @@
|
||||
#ifndef BOOST_ATOMIC_DETAIL_BASE_HPP
|
||||
#define BOOST_ATOMIC_DETAIL_BASE_HPP
|
||||
|
||||
// Copyright (c) 2009 Helge Bahmann
|
||||
// Copyright (c) 2013 Tim Blechmann
|
||||
//
|
||||
// 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)
|
||||
|
||||
// Base class definition and fallback implementation.
|
||||
// To be overridden (through partial specialization) by
|
||||
// platform implementations.
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#include <boost/atomic/detail/lockpool.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#define BOOST_ATOMIC_DECLARE_BASE_OPERATORS \
|
||||
bool \
|
||||
compare_exchange_strong( \
|
||||
value_type & expected, \
|
||||
value_type desired, \
|
||||
memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT \
|
||||
{ \
|
||||
return compare_exchange_strong(expected, desired, order, calculate_failure_order(order)); \
|
||||
} \
|
||||
\
|
||||
bool \
|
||||
compare_exchange_weak( \
|
||||
value_type & expected, \
|
||||
value_type desired, \
|
||||
memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT \
|
||||
{ \
|
||||
return compare_exchange_weak(expected, desired, order, calculate_failure_order(order)); \
|
||||
} \
|
||||
|
||||
#define BOOST_ATOMIC_DECLARE_ADDITIVE_OPERATORS \
|
||||
value_type \
|
||||
operator++(int) volatile BOOST_NOEXCEPT \
|
||||
{ \
|
||||
return fetch_add(1); \
|
||||
} \
|
||||
\
|
||||
value_type \
|
||||
operator++(void) volatile BOOST_NOEXCEPT \
|
||||
{ \
|
||||
return fetch_add(1) + 1; \
|
||||
} \
|
||||
\
|
||||
value_type \
|
||||
operator--(int) volatile BOOST_NOEXCEPT \
|
||||
{ \
|
||||
return fetch_sub(1); \
|
||||
} \
|
||||
\
|
||||
value_type \
|
||||
operator--(void) volatile BOOST_NOEXCEPT \
|
||||
{ \
|
||||
return fetch_sub(1) - 1; \
|
||||
} \
|
||||
\
|
||||
value_type \
|
||||
operator+=(difference_type v) volatile BOOST_NOEXCEPT \
|
||||
{ \
|
||||
return fetch_add(v) + v; \
|
||||
} \
|
||||
\
|
||||
value_type \
|
||||
operator-=(difference_type v) volatile BOOST_NOEXCEPT \
|
||||
{ \
|
||||
return fetch_sub(v) - v; \
|
||||
} \
|
||||
|
||||
#define BOOST_ATOMIC_DECLARE_VOID_POINTER_ADDITIVE_OPERATORS \
|
||||
value_type \
|
||||
operator++(int) volatile BOOST_NOEXCEPT \
|
||||
{ \
|
||||
return fetch_add(1); \
|
||||
} \
|
||||
\
|
||||
value_type \
|
||||
operator++(void) volatile BOOST_NOEXCEPT \
|
||||
{ \
|
||||
return (char*)fetch_add(1) + 1; \
|
||||
} \
|
||||
\
|
||||
value_type \
|
||||
operator--(int) volatile BOOST_NOEXCEPT \
|
||||
{ \
|
||||
return fetch_sub(1); \
|
||||
} \
|
||||
\
|
||||
value_type \
|
||||
operator--(void) volatile BOOST_NOEXCEPT \
|
||||
{ \
|
||||
return (char*)fetch_sub(1) - 1; \
|
||||
} \
|
||||
\
|
||||
value_type \
|
||||
operator+=(difference_type v) volatile BOOST_NOEXCEPT \
|
||||
{ \
|
||||
return (char*)fetch_add(v) + v; \
|
||||
} \
|
||||
\
|
||||
value_type \
|
||||
operator-=(difference_type v) volatile BOOST_NOEXCEPT \
|
||||
{ \
|
||||
return (char*)fetch_sub(v) - v; \
|
||||
} \
|
||||
|
||||
#define BOOST_ATOMIC_DECLARE_BIT_OPERATORS \
|
||||
value_type \
|
||||
operator&=(difference_type v) volatile BOOST_NOEXCEPT \
|
||||
{ \
|
||||
return fetch_and(v) & v; \
|
||||
} \
|
||||
\
|
||||
value_type \
|
||||
operator|=(difference_type v) volatile BOOST_NOEXCEPT \
|
||||
{ \
|
||||
return fetch_or(v) | v; \
|
||||
} \
|
||||
\
|
||||
value_type \
|
||||
operator^=(difference_type v) volatile BOOST_NOEXCEPT\
|
||||
{ \
|
||||
return fetch_xor(v) ^ v; \
|
||||
} \
|
||||
|
||||
#define BOOST_ATOMIC_DECLARE_POINTER_OPERATORS \
|
||||
BOOST_ATOMIC_DECLARE_BASE_OPERATORS \
|
||||
BOOST_ATOMIC_DECLARE_ADDITIVE_OPERATORS \
|
||||
|
||||
#define BOOST_ATOMIC_DECLARE_VOID_POINTER_OPERATORS \
|
||||
BOOST_ATOMIC_DECLARE_BASE_OPERATORS \
|
||||
BOOST_ATOMIC_DECLARE_VOID_POINTER_ADDITIVE_OPERATORS \
|
||||
|
||||
#define BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS \
|
||||
BOOST_ATOMIC_DECLARE_BASE_OPERATORS \
|
||||
BOOST_ATOMIC_DECLARE_ADDITIVE_OPERATORS \
|
||||
BOOST_ATOMIC_DECLARE_BIT_OPERATORS \
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
inline memory_order
|
||||
calculate_failure_order(memory_order order)
|
||||
{
|
||||
switch(order)
|
||||
{
|
||||
case memory_order_acq_rel:
|
||||
return memory_order_acquire;
|
||||
case memory_order_release:
|
||||
return memory_order_relaxed;
|
||||
default:
|
||||
return order;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, typename C, unsigned int Size, bool Sign>
|
||||
class base_atomic
|
||||
{
|
||||
private:
|
||||
typedef base_atomic this_type;
|
||||
typedef T value_type;
|
||||
typedef lockpool::scoped_lock guard_type;
|
||||
|
||||
protected:
|
||||
typedef value_type const& value_arg_type;
|
||||
|
||||
public:
|
||||
BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
|
||||
BOOST_CONSTEXPR explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(v)
|
||||
{}
|
||||
|
||||
void
|
||||
store(value_type const& v, memory_order /*order*/ = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
char * storage = storage_ptr();
|
||||
guard_type guard(storage);
|
||||
|
||||
memcpy(storage, &v, sizeof(value_type));
|
||||
}
|
||||
|
||||
value_type
|
||||
load(memory_order /*order*/ = memory_order_seq_cst) volatile const BOOST_NOEXCEPT
|
||||
{
|
||||
char * storage = storage_ptr();
|
||||
guard_type guard(storage);
|
||||
|
||||
value_type v;
|
||||
memcpy(&v, storage, sizeof(value_type));
|
||||
return v;
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_strong(
|
||||
value_type & expected,
|
||||
value_type const& desired,
|
||||
memory_order /*success_order*/,
|
||||
memory_order /*failure_order*/) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
char * storage = storage_ptr();
|
||||
guard_type guard(storage);
|
||||
|
||||
if (memcmp(storage, &expected, sizeof(value_type)) == 0) {
|
||||
memcpy(storage, &desired, sizeof(value_type));
|
||||
return true;
|
||||
} else {
|
||||
memcpy(&expected, storage, sizeof(value_type));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_weak(
|
||||
value_type & expected,
|
||||
value_type const& desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_strong(expected, desired, success_order, failure_order);
|
||||
}
|
||||
|
||||
value_type
|
||||
exchange(value_type const& v, memory_order /*order*/=memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
char * storage = storage_ptr();
|
||||
guard_type guard(storage);
|
||||
|
||||
value_type tmp;
|
||||
memcpy(&tmp, storage, sizeof(value_type));
|
||||
|
||||
memcpy(storage, &v, sizeof(value_type));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
bool
|
||||
is_lock_free(void) const volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOST_ATOMIC_DECLARE_BASE_OPERATORS
|
||||
|
||||
BOOST_DELETED_FUNCTION(base_atomic(base_atomic const&))
|
||||
BOOST_DELETED_FUNCTION(base_atomic& operator=(base_atomic const&))
|
||||
|
||||
private:
|
||||
char * storage_ptr() volatile const BOOST_NOEXCEPT
|
||||
{
|
||||
return const_cast<char *>(&reinterpret_cast<char const volatile &>(v_));
|
||||
}
|
||||
|
||||
T v_;
|
||||
};
|
||||
|
||||
template<typename T, unsigned int Size, bool Sign>
|
||||
class base_atomic<T, int, Size, Sign>
|
||||
{
|
||||
private:
|
||||
typedef base_atomic this_type;
|
||||
typedef T value_type;
|
||||
typedef T difference_type;
|
||||
typedef lockpool::scoped_lock guard_type;
|
||||
|
||||
protected:
|
||||
typedef value_type value_arg_type;
|
||||
|
||||
public:
|
||||
BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
|
||||
BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
|
||||
|
||||
void
|
||||
store(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
guard_type guard(const_cast<value_type *>(&v_));
|
||||
|
||||
v_ = v;
|
||||
}
|
||||
|
||||
value_type
|
||||
load(memory_order /*order*/ = memory_order_seq_cst) const volatile BOOST_NOEXCEPT
|
||||
{
|
||||
guard_type guard(const_cast<value_type *>(&v_));
|
||||
|
||||
value_type v = const_cast<const volatile value_type &>(v_);
|
||||
return v;
|
||||
}
|
||||
|
||||
value_type
|
||||
exchange(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
guard_type guard(const_cast<value_type *>(&v_));
|
||||
|
||||
value_type old = v_;
|
||||
v_ = v;
|
||||
return old;
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_strong(value_type & expected, value_type desired,
|
||||
memory_order /*success_order*/,
|
||||
memory_order /*failure_order*/) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
guard_type guard(const_cast<value_type *>(&v_));
|
||||
|
||||
if (v_ == expected) {
|
||||
v_ = desired;
|
||||
return true;
|
||||
} else {
|
||||
expected = v_;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_weak(value_type & expected, value_type desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_strong(expected, desired, success_order, failure_order);
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_add(difference_type v, memory_order /*order*/ = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
guard_type guard(const_cast<value_type *>(&v_));
|
||||
|
||||
value_type old = v_;
|
||||
v_ += v;
|
||||
return old;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_sub(difference_type v, memory_order /*order*/ = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
guard_type guard(const_cast<value_type *>(&v_));
|
||||
|
||||
value_type old = v_;
|
||||
v_ -= v;
|
||||
return old;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_and(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
guard_type guard(const_cast<value_type *>(&v_));
|
||||
|
||||
value_type old = v_;
|
||||
v_ &= v;
|
||||
return old;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_or(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
guard_type guard(const_cast<value_type *>(&v_));
|
||||
|
||||
value_type old = v_;
|
||||
v_ |= v;
|
||||
return old;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_xor(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
guard_type guard(const_cast<value_type *>(&v_));
|
||||
|
||||
value_type old = v_;
|
||||
v_ ^= v;
|
||||
return old;
|
||||
}
|
||||
|
||||
bool
|
||||
is_lock_free(void) const volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS
|
||||
|
||||
BOOST_DELETED_FUNCTION(base_atomic(base_atomic const&))
|
||||
BOOST_DELETED_FUNCTION(base_atomic& operator=(base_atomic const&))
|
||||
|
||||
private:
|
||||
value_type v_;
|
||||
};
|
||||
|
||||
template<typename T, unsigned int Size, bool Sign>
|
||||
class base_atomic<T *, void *, Size, Sign>
|
||||
{
|
||||
private:
|
||||
typedef base_atomic this_type;
|
||||
typedef T * value_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef lockpool::scoped_lock guard_type;
|
||||
|
||||
protected:
|
||||
typedef value_type value_arg_type;
|
||||
|
||||
public:
|
||||
BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
|
||||
BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
|
||||
|
||||
void
|
||||
store(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
guard_type guard(const_cast<value_type *>(&v_));
|
||||
v_ = v;
|
||||
}
|
||||
|
||||
value_type
|
||||
load(memory_order /*order*/ = memory_order_seq_cst) const volatile BOOST_NOEXCEPT
|
||||
{
|
||||
guard_type guard(const_cast<value_type *>(&v_));
|
||||
|
||||
value_type v = const_cast<const volatile value_type &>(v_);
|
||||
return v;
|
||||
}
|
||||
|
||||
value_type
|
||||
exchange(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
guard_type guard(const_cast<value_type *>(&v_));
|
||||
|
||||
value_type old = v_;
|
||||
v_ = v;
|
||||
return old;
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_strong(value_type & expected, value_type desired,
|
||||
memory_order /*success_order*/,
|
||||
memory_order /*failure_order*/) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
guard_type guard(const_cast<value_type *>(&v_));
|
||||
|
||||
if (v_ == expected) {
|
||||
v_ = desired;
|
||||
return true;
|
||||
} else {
|
||||
expected = v_;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_weak(value_type & expected, value_type desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_strong(expected, desired, success_order, failure_order);
|
||||
}
|
||||
|
||||
value_type fetch_add(difference_type v, memory_order /*order*/ = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
guard_type guard(const_cast<value_type *>(&v_));
|
||||
|
||||
value_type old = v_;
|
||||
v_ += v;
|
||||
return old;
|
||||
}
|
||||
|
||||
value_type fetch_sub(difference_type v, memory_order /*order*/ = memory_order_seq_cst) volatile
|
||||
{
|
||||
guard_type guard(const_cast<value_type *>(&v_));
|
||||
|
||||
value_type old = v_;
|
||||
v_ -= v;
|
||||
return old;
|
||||
}
|
||||
|
||||
bool
|
||||
is_lock_free(void) const volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOST_ATOMIC_DECLARE_POINTER_OPERATORS
|
||||
|
||||
BOOST_DELETED_FUNCTION(base_atomic(base_atomic const&))
|
||||
BOOST_DELETED_FUNCTION(base_atomic& operator=(base_atomic const&))
|
||||
|
||||
private:
|
||||
value_type v_;
|
||||
};
|
||||
|
||||
template<unsigned int Size, bool Sign>
|
||||
class base_atomic<void *, void *, Size, Sign>
|
||||
{
|
||||
private:
|
||||
typedef base_atomic this_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef void * value_type;
|
||||
typedef lockpool::scoped_lock guard_type;
|
||||
|
||||
protected:
|
||||
typedef value_type value_arg_type;
|
||||
|
||||
public:
|
||||
BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
|
||||
BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
|
||||
|
||||
void
|
||||
store(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
guard_type guard(const_cast<value_type *>(&v_));
|
||||
v_ = v;
|
||||
}
|
||||
|
||||
value_type
|
||||
load(memory_order /*order*/ = memory_order_seq_cst) const volatile BOOST_NOEXCEPT
|
||||
{
|
||||
guard_type guard(const_cast<value_type *>(&v_));
|
||||
|
||||
value_type v = const_cast<const volatile value_type &>(v_);
|
||||
return v;
|
||||
}
|
||||
|
||||
value_type
|
||||
exchange(value_type v, memory_order /*order*/ = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
guard_type guard(const_cast<value_type *>(&v_));
|
||||
|
||||
value_type old = v_;
|
||||
v_ = v;
|
||||
return old;
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_strong(value_type & expected, value_type desired,
|
||||
memory_order /*success_order*/,
|
||||
memory_order /*failure_order*/) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
guard_type guard(const_cast<value_type *>(&v_));
|
||||
|
||||
if (v_ == expected) {
|
||||
v_ = desired;
|
||||
return true;
|
||||
} else {
|
||||
expected = v_;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_weak(value_type & expected, value_type desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_strong(expected, desired, success_order, failure_order);
|
||||
}
|
||||
|
||||
bool
|
||||
is_lock_free(void) const volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
value_type fetch_add(difference_type v, memory_order /*order*/ = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
guard_type guard(const_cast<value_type *>(&v_));
|
||||
|
||||
value_type old = v_;
|
||||
char * cv = reinterpret_cast<char*>(old);
|
||||
cv += v;
|
||||
v_ = cv;
|
||||
return old;
|
||||
}
|
||||
|
||||
value_type fetch_sub(difference_type v, memory_order /*order*/ = memory_order_seq_cst) volatile
|
||||
{
|
||||
guard_type guard(const_cast<value_type *>(&v_));
|
||||
|
||||
value_type old = v_;
|
||||
char * cv = reinterpret_cast<char*>(old);
|
||||
cv -= v;
|
||||
v_ = cv;
|
||||
return old;
|
||||
}
|
||||
|
||||
BOOST_ATOMIC_DECLARE_VOID_POINTER_OPERATORS
|
||||
|
||||
BOOST_DELETED_FUNCTION(base_atomic(base_atomic const&))
|
||||
BOOST_DELETED_FUNCTION(base_atomic& operator=(base_atomic const&))
|
||||
|
||||
private:
|
||||
value_type v_;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
290
python/external/boost/boost/atomic/detail/cas128strong.hpp
vendored
Normal file
290
python/external/boost/boost/atomic/detail/cas128strong.hpp
vendored
Normal file
@@ -0,0 +1,290 @@
|
||||
#ifndef BOOST_ATOMIC_DETAIL_CAS128STRONG_HPP
|
||||
#define BOOST_ATOMIC_DETAIL_CAS128STRONG_HPP
|
||||
|
||||
// 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)
|
||||
//
|
||||
// Copyright (c) 2011 Helge Bahmann
|
||||
// Copyright (c) 2013 Tim Blechmann, Andrey Semashev
|
||||
|
||||
// Build 128-bit atomic operation on integers/UDTs from platform_cmpxchg128_strong
|
||||
// primitive. It is assumed that 128-bit loads/stores are not
|
||||
// atomic, so they are implemented through platform_load128/platform_store128.
|
||||
|
||||
#include <string.h>
|
||||
#include <cstddef>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/memory_order.hpp>
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#include <boost/atomic/detail/base.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
/* integral types */
|
||||
|
||||
template<typename T, bool Sign>
|
||||
class base_atomic<T, int, 16, Sign>
|
||||
{
|
||||
private:
|
||||
typedef base_atomic this_type;
|
||||
typedef T value_type;
|
||||
typedef T difference_type;
|
||||
|
||||
protected:
|
||||
typedef value_type value_arg_type;
|
||||
|
||||
public:
|
||||
BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
|
||||
BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
|
||||
|
||||
void
|
||||
store(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
platform_fence_before_store(order);
|
||||
platform_store128(v, &v_);
|
||||
platform_fence_after_store(order);
|
||||
}
|
||||
|
||||
value_type
|
||||
load(memory_order order = memory_order_seq_cst) const volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type v = platform_load128(&v_);
|
||||
platform_fence_after_load(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
value_type
|
||||
exchange(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_weak(
|
||||
value_type & expected,
|
||||
value_type desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_strong(expected, desired, success_order, failure_order);
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_strong(
|
||||
value_type & expected,
|
||||
value_type desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
platform_fence_before(success_order);
|
||||
|
||||
bool success = platform_cmpxchg128_strong(expected, desired, &v_);
|
||||
|
||||
if (success) {
|
||||
platform_fence_after(success_order);
|
||||
} else {
|
||||
platform_fence_after(failure_order);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, original & v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, original | v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, original ^ v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
bool
|
||||
is_lock_free(void) const volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS
|
||||
|
||||
BOOST_DELETED_FUNCTION(base_atomic(base_atomic const&))
|
||||
BOOST_DELETED_FUNCTION(base_atomic& operator=(base_atomic const&))
|
||||
|
||||
private:
|
||||
value_type v_;
|
||||
};
|
||||
|
||||
/* generic types */
|
||||
|
||||
#if defined(BOOST_HAS_INT128)
|
||||
|
||||
typedef boost::uint128_type storage128_type;
|
||||
|
||||
#else // defined(BOOST_HAS_INT128)
|
||||
|
||||
struct BOOST_ALIGNMENT(16) storage128_type
|
||||
{
|
||||
uint64_t data[2];
|
||||
};
|
||||
|
||||
inline bool operator== (storage128_type const& left, storage128_type const& right)
|
||||
{
|
||||
return left.data[0] == right.data[0] && left.data[1] == right.data[1];
|
||||
}
|
||||
inline bool operator!= (storage128_type const& left, storage128_type const& right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
#endif // defined(BOOST_HAS_INT128)
|
||||
|
||||
template<typename T, bool Sign>
|
||||
class base_atomic<T, void, 16, Sign>
|
||||
{
|
||||
private:
|
||||
typedef base_atomic this_type;
|
||||
typedef T value_type;
|
||||
typedef storage128_type storage_type;
|
||||
|
||||
protected:
|
||||
typedef value_type const& value_arg_type;
|
||||
|
||||
public:
|
||||
BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
|
||||
explicit base_atomic(value_type const& v) BOOST_NOEXCEPT
|
||||
{
|
||||
memset(&v_, 0, sizeof(v_));
|
||||
memcpy(&v_, &v, sizeof(value_type));
|
||||
}
|
||||
|
||||
void
|
||||
store(value_type const& value, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type value_s;
|
||||
memset(&value_s, 0, sizeof(value_s));
|
||||
memcpy(&value_s, &value, sizeof(value_type));
|
||||
platform_fence_before_store(order);
|
||||
platform_store128(value_s, &v_);
|
||||
platform_fence_after_store(order);
|
||||
}
|
||||
|
||||
value_type
|
||||
load(memory_order order = memory_order_seq_cst) const volatile BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type value_s = platform_load128(&v_);
|
||||
platform_fence_after_load(order);
|
||||
value_type value;
|
||||
memcpy(&value, &value_s, sizeof(value_type));
|
||||
return value;
|
||||
}
|
||||
|
||||
value_type
|
||||
exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_weak(
|
||||
value_type & expected,
|
||||
value_type const& desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_strong(expected, desired, success_order, failure_order);
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_strong(
|
||||
value_type & expected,
|
||||
value_type const& desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type expected_s, desired_s;
|
||||
memset(&expected_s, 0, sizeof(expected_s));
|
||||
memset(&desired_s, 0, sizeof(desired_s));
|
||||
memcpy(&expected_s, &expected, sizeof(value_type));
|
||||
memcpy(&desired_s, &desired, sizeof(value_type));
|
||||
|
||||
platform_fence_before(success_order);
|
||||
bool success = platform_cmpxchg128_strong(expected_s, desired_s, &v_);
|
||||
|
||||
if (success) {
|
||||
platform_fence_after(success_order);
|
||||
} else {
|
||||
platform_fence_after(failure_order);
|
||||
memcpy(&expected, &expected_s, sizeof(value_type));
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
bool
|
||||
is_lock_free(void) const volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOST_ATOMIC_DECLARE_BASE_OPERATORS
|
||||
|
||||
BOOST_DELETED_FUNCTION(base_atomic(base_atomic const&))
|
||||
BOOST_DELETED_FUNCTION(base_atomic& operator=(base_atomic const&))
|
||||
|
||||
private:
|
||||
storage_type v_;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
939
python/external/boost/boost/atomic/detail/cas32strong.hpp
vendored
Normal file
939
python/external/boost/boost/atomic/detail/cas32strong.hpp
vendored
Normal file
@@ -0,0 +1,939 @@
|
||||
#ifndef BOOST_ATOMIC_DETAIL_CAS32STRONG_HPP
|
||||
#define BOOST_ATOMIC_DETAIL_CAS32STRONG_HPP
|
||||
|
||||
// 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)
|
||||
//
|
||||
// Copyright (c) 2011 Helge Bahmann
|
||||
// Copyright (c) 2013 Tim Blechmann
|
||||
|
||||
|
||||
// Build 8-, 16- and 32-bit atomic operations from
|
||||
// a platform_cmpxchg32_strong primitive.
|
||||
|
||||
#include <string.h>
|
||||
#include <cstddef>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/memory_order.hpp>
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#include <boost/atomic/detail/base.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
/* integral types */
|
||||
|
||||
template<typename T, bool Sign>
|
||||
class base_atomic<T, int, 1, Sign>
|
||||
{
|
||||
private:
|
||||
typedef base_atomic this_type;
|
||||
typedef T value_type;
|
||||
typedef T difference_type;
|
||||
typedef uint32_t storage_type;
|
||||
|
||||
protected:
|
||||
typedef value_type value_arg_type;
|
||||
|
||||
public:
|
||||
BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
|
||||
BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
|
||||
|
||||
void
|
||||
store(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
platform_fence_before_store(order);
|
||||
const_cast<volatile storage_type &>(v_) = v;
|
||||
platform_fence_after_store(order);
|
||||
}
|
||||
|
||||
value_type
|
||||
load(memory_order order = memory_order_seq_cst) const volatile
|
||||
{
|
||||
value_type v = const_cast<const volatile storage_type &>(v_);
|
||||
platform_fence_after_load(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
value_type
|
||||
exchange(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_weak(
|
||||
value_type & expected,
|
||||
value_type desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_strong(expected, desired, success_order, failure_order);
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_strong(
|
||||
value_type & expected,
|
||||
value_type desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
platform_fence_before(success_order);
|
||||
|
||||
storage_type expected_s = (storage_type) expected;
|
||||
storage_type desired_s = (storage_type) desired;
|
||||
|
||||
bool success = platform_cmpxchg32_strong(expected_s, desired_s, &v_);
|
||||
|
||||
if (success) {
|
||||
platform_fence_after(success_order);
|
||||
} else {
|
||||
platform_fence_after(failure_order);
|
||||
expected = (value_type) expected_s;
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, original & v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, original | v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, original ^ v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
bool
|
||||
is_lock_free(void) const volatile
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS
|
||||
|
||||
BOOST_DELETED_FUNCTION(base_atomic(base_atomic const&))
|
||||
BOOST_DELETED_FUNCTION(base_atomic& operator=(base_atomic const&))
|
||||
|
||||
private:
|
||||
storage_type v_;
|
||||
};
|
||||
|
||||
template<typename T, bool Sign>
|
||||
class base_atomic<T, int, 2, Sign>
|
||||
{
|
||||
private:
|
||||
typedef base_atomic this_type;
|
||||
typedef T value_type;
|
||||
typedef T difference_type;
|
||||
typedef uint32_t storage_type;
|
||||
|
||||
protected:
|
||||
typedef value_type value_arg_type;
|
||||
|
||||
public:
|
||||
BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
|
||||
BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
|
||||
|
||||
void
|
||||
store(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
platform_fence_before_store(order);
|
||||
const_cast<volatile storage_type &>(v_) = v;
|
||||
platform_fence_after_store(order);
|
||||
}
|
||||
|
||||
value_type
|
||||
load(memory_order order = memory_order_seq_cst) const volatile
|
||||
{
|
||||
value_type v = const_cast<const volatile storage_type &>(v_);
|
||||
platform_fence_after_load(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
value_type
|
||||
exchange(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_weak(
|
||||
value_type & expected,
|
||||
value_type desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_strong(expected, desired, success_order, failure_order);
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_strong(
|
||||
value_type & expected,
|
||||
value_type desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
platform_fence_before(success_order);
|
||||
|
||||
storage_type expected_s = (storage_type) expected;
|
||||
storage_type desired_s = (storage_type) desired;
|
||||
|
||||
bool success = platform_cmpxchg32_strong(expected_s, desired_s, &v_);
|
||||
|
||||
if (success) {
|
||||
platform_fence_after(success_order);
|
||||
} else {
|
||||
platform_fence_after(failure_order);
|
||||
expected = (value_type) expected_s;
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, original & v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, original | v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, original ^ v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
bool
|
||||
is_lock_free(void) const volatile
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS
|
||||
|
||||
BOOST_DELETED_FUNCTION(base_atomic(base_atomic const&))
|
||||
BOOST_DELETED_FUNCTION(base_atomic& operator=(base_atomic const&))
|
||||
|
||||
private:
|
||||
storage_type v_;
|
||||
};
|
||||
|
||||
template<typename T, bool Sign>
|
||||
class base_atomic<T, int, 4, Sign>
|
||||
{
|
||||
private:
|
||||
typedef base_atomic this_type;
|
||||
typedef T value_type;
|
||||
typedef T difference_type;
|
||||
|
||||
protected:
|
||||
typedef value_type value_arg_type;
|
||||
|
||||
public:
|
||||
BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
|
||||
BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
|
||||
|
||||
void
|
||||
store(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
platform_fence_before_store(order);
|
||||
const_cast<volatile value_type &>(v_) = v;
|
||||
platform_fence_after_store(order);
|
||||
}
|
||||
|
||||
value_type
|
||||
load(memory_order order = memory_order_seq_cst) const volatile
|
||||
{
|
||||
value_type v = const_cast<const volatile value_type &>(v_);
|
||||
platform_fence_after_load(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
value_type
|
||||
exchange(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_weak(
|
||||
value_type & expected,
|
||||
value_type desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_strong(expected, desired, success_order, failure_order);
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_strong(
|
||||
value_type & expected,
|
||||
value_type desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
platform_fence_before(success_order);
|
||||
|
||||
bool success = platform_cmpxchg32_strong(expected, desired, &v_);
|
||||
|
||||
if (success) {
|
||||
platform_fence_after(success_order);
|
||||
} else {
|
||||
platform_fence_after(failure_order);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, original & v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, original | v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, original ^ v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
bool
|
||||
is_lock_free(void) const volatile
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS
|
||||
|
||||
BOOST_DELETED_FUNCTION(base_atomic(base_atomic const&))
|
||||
BOOST_DELETED_FUNCTION(base_atomic& operator=(base_atomic const&))
|
||||
|
||||
private:
|
||||
value_type v_;
|
||||
};
|
||||
|
||||
/* pointer types */
|
||||
|
||||
template<bool Sign>
|
||||
class base_atomic<void *, void *, 4, Sign>
|
||||
{
|
||||
private:
|
||||
typedef base_atomic this_type;
|
||||
typedef void * value_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
|
||||
protected:
|
||||
typedef value_type value_arg_type;
|
||||
|
||||
public:
|
||||
BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
|
||||
BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
|
||||
|
||||
void
|
||||
store(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
platform_fence_before_store(order);
|
||||
const_cast<volatile value_type &>(v_) = v;
|
||||
platform_fence_after_store(order);
|
||||
}
|
||||
|
||||
value_type
|
||||
load(memory_order order = memory_order_seq_cst) const volatile
|
||||
{
|
||||
value_type v = const_cast<const volatile value_type &>(v_);
|
||||
platform_fence_after_load(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
value_type
|
||||
exchange(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_weak(
|
||||
value_type & expected,
|
||||
value_type desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_strong(expected, desired, success_order, failure_order);
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_strong(
|
||||
value_type & expected,
|
||||
value_type desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
platform_fence_before(success_order);
|
||||
|
||||
bool success = platform_cmpxchg32_strong(expected, desired, &v_);
|
||||
|
||||
if (success) {
|
||||
platform_fence_after(success_order);
|
||||
} else {
|
||||
platform_fence_after(failure_order);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, (char*)original + v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, (char*)original - v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
bool
|
||||
is_lock_free(void) const volatile
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOST_ATOMIC_DECLARE_VOID_POINTER_OPERATORS
|
||||
|
||||
BOOST_DELETED_FUNCTION(base_atomic(base_atomic const&))
|
||||
BOOST_DELETED_FUNCTION(base_atomic& operator=(base_atomic const&))
|
||||
|
||||
private:
|
||||
value_type v_;
|
||||
};
|
||||
|
||||
template<typename T, bool Sign>
|
||||
class base_atomic<T *, void *, 4, Sign>
|
||||
{
|
||||
private:
|
||||
typedef base_atomic this_type;
|
||||
typedef T * value_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
|
||||
protected:
|
||||
typedef value_type value_arg_type;
|
||||
|
||||
public:
|
||||
BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
|
||||
BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
|
||||
|
||||
void
|
||||
store(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
platform_fence_before_store(order);
|
||||
const_cast<volatile value_type &>(v_) = v;
|
||||
platform_fence_after_store(order);
|
||||
}
|
||||
|
||||
value_type
|
||||
load(memory_order order = memory_order_seq_cst) const volatile
|
||||
{
|
||||
value_type v = const_cast<const volatile value_type &>(v_);
|
||||
platform_fence_after_load(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
value_type
|
||||
exchange(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_weak(
|
||||
value_type & expected,
|
||||
value_type desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_strong(expected, desired, success_order, failure_order);
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_strong(
|
||||
value_type & expected,
|
||||
value_type desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
platform_fence_before(success_order);
|
||||
|
||||
bool success = platform_cmpxchg32_strong(expected, desired, &v_);
|
||||
|
||||
if (success) {
|
||||
platform_fence_after(success_order);
|
||||
} else {
|
||||
platform_fence_after(failure_order);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
bool
|
||||
is_lock_free(void) const volatile
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOST_ATOMIC_DECLARE_POINTER_OPERATORS
|
||||
|
||||
BOOST_DELETED_FUNCTION(base_atomic(base_atomic const&))
|
||||
BOOST_DELETED_FUNCTION(base_atomic& operator=(base_atomic const&))
|
||||
|
||||
private:
|
||||
value_type v_;
|
||||
};
|
||||
|
||||
/* generic types */
|
||||
|
||||
template<typename T, bool Sign>
|
||||
class base_atomic<T, void, 1, Sign>
|
||||
{
|
||||
private:
|
||||
typedef base_atomic this_type;
|
||||
typedef T value_type;
|
||||
typedef uint32_t storage_type;
|
||||
|
||||
protected:
|
||||
typedef value_type const& value_arg_type;
|
||||
|
||||
public:
|
||||
BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
|
||||
explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
|
||||
{
|
||||
memcpy(&v_, &v, sizeof(value_type));
|
||||
}
|
||||
|
||||
void
|
||||
store(value_type const& v, memory_order order = memory_order_seq_cst) ) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type tmp = 0;
|
||||
memcpy(&tmp, &v, sizeof(value_type));
|
||||
platform_fence_before_store(order);
|
||||
const_cast<volatile storage_type &>(v_) = tmp;
|
||||
platform_fence_after_store(order);
|
||||
}
|
||||
|
||||
value_type
|
||||
load(memory_order order = memory_order_seq_cst) const volatile
|
||||
{
|
||||
storage_type tmp = const_cast<const volatile storage_type &>(v_);
|
||||
platform_fence_after_load(order);
|
||||
|
||||
value_type v;
|
||||
memcpy(&v, &tmp, sizeof(value_type));
|
||||
return v;
|
||||
}
|
||||
|
||||
value_type
|
||||
exchange(value_type const& v, memory_order order = memory_order_seq_cst) ) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_weak(
|
||||
value_type & expected,
|
||||
value_type const& desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) ) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_strong(expected, desired, success_order, failure_order);
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_strong(
|
||||
value_type & expected,
|
||||
value_type const& desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) ) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type expected_s = 0, desired_s = 0;
|
||||
memcpy(&expected_s, &expected, sizeof(value_type));
|
||||
memcpy(&desired_s, &desired, sizeof(value_type));
|
||||
|
||||
platform_fence_before(success_order);
|
||||
bool success = platform_cmpxchg32_strong(expected_s, desired_s, &v_);
|
||||
|
||||
if (success) {
|
||||
platform_fence_after(success_order);
|
||||
} else {
|
||||
platform_fence_after(failure_order);
|
||||
memcpy(&expected, &expected_s, sizeof(value_type));
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
bool
|
||||
is_lock_free(void) const volatile
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOST_ATOMIC_DECLARE_BASE_OPERATORS
|
||||
|
||||
BOOST_DELETED_FUNCTION(base_atomic(base_atomic const&))
|
||||
BOOST_DELETED_FUNCTION(base_atomic& operator=(base_atomic const&))
|
||||
|
||||
private:
|
||||
storage_type v_;
|
||||
};
|
||||
|
||||
template<typename T, bool Sign>
|
||||
class base_atomic<T, void, 2, Sign>
|
||||
{
|
||||
private:
|
||||
typedef base_atomic this_type;
|
||||
typedef T value_type;
|
||||
typedef uint32_t storage_type;
|
||||
|
||||
protected:
|
||||
typedef value_type const& value_arg_type;
|
||||
|
||||
public:
|
||||
BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
|
||||
explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
|
||||
{
|
||||
memcpy(&v_, &v, sizeof(value_type));
|
||||
}
|
||||
|
||||
void
|
||||
store(value_type const& v, memory_order order = memory_order_seq_cst) ) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type tmp = 0;
|
||||
memcpy(&tmp, &v, sizeof(value_type));
|
||||
platform_fence_before_store(order);
|
||||
const_cast<volatile storage_type &>(v_) = tmp;
|
||||
platform_fence_after_store(order);
|
||||
}
|
||||
|
||||
value_type
|
||||
load(memory_order order = memory_order_seq_cst) const volatile
|
||||
{
|
||||
storage_type tmp = const_cast<const volatile storage_type &>(v_);
|
||||
platform_fence_after_load(order);
|
||||
|
||||
value_type v;
|
||||
memcpy(&v, &tmp, sizeof(value_type));
|
||||
return v;
|
||||
}
|
||||
|
||||
value_type
|
||||
exchange(value_type const& v, memory_order order = memory_order_seq_cst) ) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_weak(
|
||||
value_type & expected,
|
||||
value_type const& desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_strong(expected, desired, success_order, failure_order);
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_strong(
|
||||
value_type & expected,
|
||||
value_type const& desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
|
||||
storage_type expected_s = 0, desired_s = 0;
|
||||
memcpy(&expected_s, &expected, sizeof(value_type));
|
||||
memcpy(&desired_s, &desired, sizeof(value_type));
|
||||
|
||||
platform_fence_before(success_order);
|
||||
bool success = platform_cmpxchg32_strong(expected_s, desired_s, &v_);
|
||||
|
||||
if (success) {
|
||||
platform_fence_after(success_order);
|
||||
} else {
|
||||
platform_fence_after(failure_order);
|
||||
memcpy(&expected, &expected_s, sizeof(value_type));
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
bool
|
||||
is_lock_free(void) const volatile
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOST_ATOMIC_DECLARE_BASE_OPERATORS
|
||||
|
||||
BOOST_DELETED_FUNCTION(base_atomic(base_atomic const&))
|
||||
BOOST_DELETED_FUNCTION(base_atomic& operator=(base_atomic const&))
|
||||
|
||||
private:
|
||||
storage_type v_;
|
||||
};
|
||||
|
||||
template<typename T, bool Sign>
|
||||
class base_atomic<T, void, 4, Sign>
|
||||
{
|
||||
private:
|
||||
typedef base_atomic this_type;
|
||||
typedef T value_type;
|
||||
typedef uint32_t storage_type;
|
||||
|
||||
protected:
|
||||
typedef value_type const& value_arg_type;
|
||||
|
||||
public:
|
||||
BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
|
||||
explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
|
||||
{
|
||||
memcpy(&v_, &v, sizeof(value_type));
|
||||
}
|
||||
|
||||
void
|
||||
store(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type tmp = 0;
|
||||
memcpy(&tmp, &v, sizeof(value_type));
|
||||
platform_fence_before_store(order);
|
||||
const_cast<volatile storage_type &>(v_) = tmp;
|
||||
platform_fence_after_store(order);
|
||||
}
|
||||
|
||||
value_type
|
||||
load(memory_order order = memory_order_seq_cst) const volatile
|
||||
{
|
||||
storage_type tmp = const_cast<const volatile storage_type &>(v_);
|
||||
platform_fence_after_load(order);
|
||||
|
||||
value_type v;
|
||||
memcpy(&v, &tmp, sizeof(value_type));
|
||||
return v;
|
||||
}
|
||||
|
||||
value_type
|
||||
exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_weak(
|
||||
value_type & expected,
|
||||
value_type const& desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_strong(expected, desired, success_order, failure_order);
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_strong(
|
||||
value_type & expected,
|
||||
value_type const& desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
|
||||
storage_type expected_s = 0, desired_s = 0;
|
||||
memcpy(&expected_s, &expected, sizeof(value_type));
|
||||
memcpy(&desired_s, &desired, sizeof(value_type));
|
||||
|
||||
platform_fence_before(success_order);
|
||||
bool success = platform_cmpxchg32_strong(expected_s, desired_s, &v_);
|
||||
|
||||
if (success) {
|
||||
platform_fence_after(success_order);
|
||||
} else {
|
||||
platform_fence_after(failure_order);
|
||||
memcpy(&expected, &expected_s, sizeof(value_type));
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
bool
|
||||
is_lock_free(void) const volatile
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOST_ATOMIC_DECLARE_BASE_OPERATORS
|
||||
|
||||
BOOST_DELETED_FUNCTION(base_atomic(base_atomic const&))
|
||||
BOOST_DELETED_FUNCTION(base_atomic& operator=(base_atomic const&))
|
||||
|
||||
private:
|
||||
storage_type v_;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
1017
python/external/boost/boost/atomic/detail/cas32weak.hpp
vendored
Normal file
1017
python/external/boost/boost/atomic/detail/cas32weak.hpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
264
python/external/boost/boost/atomic/detail/cas64strong.hpp
vendored
Normal file
264
python/external/boost/boost/atomic/detail/cas64strong.hpp
vendored
Normal file
@@ -0,0 +1,264 @@
|
||||
#ifndef BOOST_ATOMIC_DETAIL_CAS64STRONG_HPP
|
||||
#define BOOST_ATOMIC_DETAIL_CAS64STRONG_HPP
|
||||
|
||||
// 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)
|
||||
//
|
||||
// Copyright (c) 2011 Helge Bahmann
|
||||
// Copyright (c) 2013 Tim Blechmann
|
||||
|
||||
// Build 64-bit atomic operation on integers/UDTs from platform_cmpxchg64_strong
|
||||
// primitive. It is assumed that 64-bit loads/stores are not
|
||||
// atomic, so they are implemented through platform_load64/platform_store64.
|
||||
|
||||
#include <string.h>
|
||||
#include <cstddef>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/memory_order.hpp>
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#include <boost/atomic/detail/base.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
/* integral types */
|
||||
|
||||
template<typename T, bool Sign>
|
||||
class base_atomic<T, int, 8, Sign>
|
||||
{
|
||||
private:
|
||||
typedef base_atomic this_type;
|
||||
typedef T value_type;
|
||||
typedef T difference_type;
|
||||
|
||||
protected:
|
||||
typedef value_type value_arg_type;
|
||||
|
||||
public:
|
||||
BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
|
||||
BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
|
||||
|
||||
void
|
||||
store(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
platform_fence_before_store(order);
|
||||
platform_store64(v, &v_);
|
||||
platform_fence_after_store(order);
|
||||
}
|
||||
|
||||
value_type
|
||||
load(memory_order order = memory_order_seq_cst) const volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type v = platform_load64(&v_);
|
||||
platform_fence_after_load(order);
|
||||
return v;
|
||||
}
|
||||
|
||||
value_type
|
||||
exchange(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_weak(
|
||||
value_type & expected,
|
||||
value_type desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_strong(expected, desired, success_order, failure_order);
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_strong(
|
||||
value_type & expected,
|
||||
value_type desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
platform_fence_before(success_order);
|
||||
|
||||
bool success = platform_cmpxchg64_strong(expected, desired, &v_);
|
||||
|
||||
if (success) {
|
||||
platform_fence_after(success_order);
|
||||
} else {
|
||||
platform_fence_after(failure_order);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_add(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, original + v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_sub(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, original - v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, original & v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, original | v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
value_type
|
||||
fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, original ^ v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
bool
|
||||
is_lock_free(void) const volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOST_ATOMIC_DECLARE_INTEGRAL_OPERATORS
|
||||
|
||||
BOOST_DELETED_FUNCTION(base_atomic(base_atomic const&))
|
||||
BOOST_DELETED_FUNCTION(base_atomic& operator=(base_atomic const&))
|
||||
|
||||
private:
|
||||
value_type v_;
|
||||
};
|
||||
|
||||
/* generic types */
|
||||
|
||||
template<typename T, bool Sign>
|
||||
class base_atomic<T, void, 8, Sign>
|
||||
{
|
||||
private:
|
||||
typedef base_atomic this_type;
|
||||
typedef T value_type;
|
||||
typedef uint64_t storage_type;
|
||||
|
||||
protected:
|
||||
typedef value_type const& value_arg_type;
|
||||
|
||||
public:
|
||||
BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
|
||||
explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
|
||||
{
|
||||
memcpy(&v_, &v, sizeof(value_type));
|
||||
}
|
||||
|
||||
void
|
||||
store(value_type const& value, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type value_s = 0;
|
||||
memcpy(&value_s, &value, sizeof(value_type));
|
||||
platform_fence_before_store(order);
|
||||
platform_store64(value_s, &v_);
|
||||
platform_fence_after_store(order);
|
||||
}
|
||||
|
||||
value_type
|
||||
load(memory_order order = memory_order_seq_cst) const volatile BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type value_s = platform_load64(&v_);
|
||||
platform_fence_after_load(order);
|
||||
value_type value;
|
||||
memcpy(&value, &value_s, sizeof(value_type));
|
||||
return value;
|
||||
}
|
||||
|
||||
value_type
|
||||
exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
value_type original = load(memory_order_relaxed);
|
||||
do {
|
||||
} while (!compare_exchange_weak(original, v, order, memory_order_relaxed));
|
||||
return original;
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_weak(
|
||||
value_type & expected,
|
||||
value_type const& desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return compare_exchange_strong(expected, desired, success_order, failure_order);
|
||||
}
|
||||
|
||||
bool
|
||||
compare_exchange_strong(
|
||||
value_type & expected,
|
||||
value_type const& desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
storage_type expected_s = 0, desired_s = 0;
|
||||
memcpy(&expected_s, &expected, sizeof(value_type));
|
||||
memcpy(&desired_s, &desired, sizeof(value_type));
|
||||
|
||||
platform_fence_before(success_order);
|
||||
bool success = platform_cmpxchg64_strong(expected_s, desired_s, &v_);
|
||||
|
||||
if (success) {
|
||||
platform_fence_after(success_order);
|
||||
} else {
|
||||
platform_fence_after(failure_order);
|
||||
memcpy(&expected, &expected_s, sizeof(value_type));
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
bool
|
||||
is_lock_free(void) const volatile BOOST_NOEXCEPT
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOST_ATOMIC_DECLARE_BASE_OPERATORS
|
||||
|
||||
BOOST_DELETED_FUNCTION(base_atomic(base_atomic const&))
|
||||
BOOST_DELETED_FUNCTION(base_atomic& operator=(base_atomic const&))
|
||||
|
||||
private:
|
||||
storage_type v_;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
16
python/external/boost/boost/atomic/detail/config.hpp
vendored
Normal file
16
python/external/boost/boost/atomic/detail/config.hpp
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef BOOST_ATOMIC_DETAIL_CONFIG_HPP
|
||||
#define BOOST_ATOMIC_DETAIL_CONFIG_HPP
|
||||
|
||||
// Copyright (c) 2012 Hartmut Kaiser
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#endif
|
368
python/external/boost/boost/atomic/detail/gcc-alpha.hpp
vendored
Normal file
368
python/external/boost/boost/atomic/detail/gcc-alpha.hpp
vendored
Normal file
@@ -0,0 +1,368 @@
|
||||
#ifndef BOOST_ATOMIC_DETAIL_GCC_ALPHA_HPP
|
||||
#define BOOST_ATOMIC_DETAIL_GCC_ALPHA_HPP
|
||||
|
||||
// Copyright (c) 2009 Helge Bahmann
|
||||
// Copyright (c) 2013 Tim Blechmann
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
#include <boost/atomic/detail/base.hpp>
|
||||
#include <boost/atomic/detail/builder.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*
|
||||
Refer to http://h71000.www7.hp.com/doc/82final/5601/5601pro_004.html
|
||||
(HP OpenVMS systems documentation) and the alpha reference manual.
|
||||
*/
|
||||
|
||||
/*
|
||||
NB: The most natural thing would be to write the increment/decrement
|
||||
operators along the following lines:
|
||||
|
||||
__asm__ __volatile__(
|
||||
"1: ldl_l %0,%1 \n"
|
||||
"addl %0,1,%0 \n"
|
||||
"stl_c %0,%1 \n"
|
||||
"beq %0,1b\n"
|
||||
: "=&b" (tmp)
|
||||
: "m" (value)
|
||||
: "cc"
|
||||
);
|
||||
|
||||
However according to the comments on the HP website and matching
|
||||
comments in the Linux kernel sources this defies branch prediction,
|
||||
as the cpu assumes that backward branches are always taken; so
|
||||
instead copy the trick from the Linux kernel, introduce a forward
|
||||
branch and back again.
|
||||
|
||||
I have, however, had a hard time measuring the difference between
|
||||
the two versions in microbenchmarks -- I am leaving it in nevertheless
|
||||
as it apparently does not hurt either.
|
||||
*/
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
inline void fence_before(memory_order order)
|
||||
{
|
||||
switch(order) {
|
||||
case memory_order_consume:
|
||||
case memory_order_release:
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
__asm__ __volatile__ ("mb" ::: "memory");
|
||||
default:;
|
||||
}
|
||||
}
|
||||
|
||||
inline void fence_after(memory_order order)
|
||||
{
|
||||
switch(order) {
|
||||
case memory_order_acquire:
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
__asm__ __volatile__ ("mb" ::: "memory");
|
||||
default:;
|
||||
}
|
||||
}
|
||||
|
||||
template<>
|
||||
inline void platform_atomic_thread_fence(memory_order order)
|
||||
{
|
||||
switch(order) {
|
||||
case memory_order_acquire:
|
||||
case memory_order_consume:
|
||||
case memory_order_release:
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
__asm__ __volatile__ ("mb" ::: "memory");
|
||||
default:;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
class atomic_alpha_32
|
||||
{
|
||||
public:
|
||||
typedef T integral_type;
|
||||
BOOST_CONSTEXPR atomic_alpha_32(T v) BOOST_NOEXCEPT: i(v) {}
|
||||
atomic_alpha_32() {}
|
||||
T load(memory_order order=memory_order_seq_cst) const volatile BOOST_NOEXCEPT
|
||||
{
|
||||
T v=*reinterpret_cast<volatile const int *>(&i);
|
||||
fence_after(order);
|
||||
return v;
|
||||
}
|
||||
void store(T v, memory_order order=memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
*reinterpret_cast<volatile int *>(&i)=(int)v;
|
||||
}
|
||||
bool compare_exchange_weak(
|
||||
T &expected,
|
||||
T desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(success_order);
|
||||
int current, success;
|
||||
__asm__ __volatile__(
|
||||
"1: ldl_l %2, %4\n"
|
||||
"cmpeq %2, %0, %3\n"
|
||||
"mov %2, %0\n"
|
||||
"beq %3, 3f\n"
|
||||
"stl_c %1, %4\n"
|
||||
"2:\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"3: mov %3, %1\n"
|
||||
"br 2b\n"
|
||||
".previous\n"
|
||||
|
||||
: "+&r" (expected), "+&r" (desired), "=&r"(current), "=&r"(success)
|
||||
: "m" (i)
|
||||
:
|
||||
);
|
||||
if (desired) fence_after(success_order);
|
||||
else fence_after(failure_order);
|
||||
return desired;
|
||||
}
|
||||
|
||||
bool is_lock_free(void) const volatile BOOST_NOEXCEPT {return true;}
|
||||
protected:
|
||||
inline T fetch_add_var(T c, memory_order order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
T original, modified;
|
||||
__asm__ __volatile__(
|
||||
"1: ldl_l %0, %2\n"
|
||||
"addl %0, %3, %1\n"
|
||||
"stl_c %1, %2\n"
|
||||
"beq %1, 2f\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"2: br 1b\n"
|
||||
".previous\n"
|
||||
|
||||
: "=&r" (original), "=&r" (modified)
|
||||
: "m" (i), "r" (c)
|
||||
:
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
inline T fetch_inc(memory_order order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
int original, modified;
|
||||
__asm__ __volatile__(
|
||||
"1: ldl_l %0, %2\n"
|
||||
"addl %0, 1, %1\n"
|
||||
"stl_c %1, %2\n"
|
||||
"beq %1, 2f\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"2: br 1b\n"
|
||||
".previous\n"
|
||||
|
||||
: "=&r" (original), "=&r" (modified)
|
||||
: "m" (i)
|
||||
:
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
inline T fetch_dec(memory_order order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
int original, modified;
|
||||
__asm__ __volatile__(
|
||||
"1: ldl_l %0, %2\n"
|
||||
"subl %0, 1, %1\n"
|
||||
"stl_c %1, %2\n"
|
||||
"beq %1, 2f\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"2: br 1b\n"
|
||||
".previous\n"
|
||||
|
||||
: "=&r" (original), "=&r" (modified)
|
||||
: "m" (i)
|
||||
:
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
private:
|
||||
T i;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class atomic_alpha_64
|
||||
{
|
||||
public:
|
||||
typedef T integral_type;
|
||||
BOOST_CONSTEXPR atomic_alpha_64(T v) BOOST_NOEXCEPT: i(v) {}
|
||||
atomic_alpha_64() {}
|
||||
T load(memory_order order=memory_order_seq_cst) const volatile
|
||||
{
|
||||
T v=*reinterpret_cast<volatile const T *>(&i);
|
||||
fence_after(order);
|
||||
return v;
|
||||
}
|
||||
void store(T v, memory_order order=memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
*reinterpret_cast<volatile T *>(&i)=v;
|
||||
}
|
||||
bool compare_exchange_weak(
|
||||
T &expected,
|
||||
T desired,
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(success_order);
|
||||
int current, success;
|
||||
__asm__ __volatile__(
|
||||
"1: ldq_l %2, %4\n"
|
||||
"cmpeq %2, %0, %3\n"
|
||||
"mov %2, %0\n"
|
||||
"beq %3, 3f\n"
|
||||
"stq_c %1, %4\n"
|
||||
"2:\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"3: mov %3, %1\n"
|
||||
"br 2b\n"
|
||||
".previous\n"
|
||||
|
||||
: "+&r" (expected), "+&r" (desired), "=&r"(current), "=&r"(success)
|
||||
: "m" (i)
|
||||
:
|
||||
);
|
||||
if (desired) fence_after(success_order);
|
||||
else fence_after(failure_order);
|
||||
return desired;
|
||||
}
|
||||
|
||||
bool is_lock_free(void) const volatile BOOST_NOEXCEPT {return true;}
|
||||
protected:
|
||||
inline T fetch_add_var(T c, memory_order order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
T original, modified;
|
||||
__asm__ __volatile__(
|
||||
"1: ldq_l %0, %2\n"
|
||||
"addq %0, %3, %1\n"
|
||||
"stq_c %1, %2\n"
|
||||
"beq %1, 2f\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"2: br 1b\n"
|
||||
".previous\n"
|
||||
|
||||
: "=&r" (original), "=&r" (modified)
|
||||
: "m" (i), "r" (c)
|
||||
:
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
inline T fetch_inc(memory_order order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
T original, modified;
|
||||
__asm__ __volatile__(
|
||||
"1: ldq_l %0, %2\n"
|
||||
"addq %0, 1, %1\n"
|
||||
"stq_c %1, %2\n"
|
||||
"beq %1, 2f\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"2: br 1b\n"
|
||||
".previous\n"
|
||||
|
||||
: "=&r" (original), "=&r" (modified)
|
||||
: "m" (i)
|
||||
:
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
inline T fetch_dec(memory_order order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
fence_before(order);
|
||||
T original, modified;
|
||||
__asm__ __volatile__(
|
||||
"1: ldq_l %0, %2\n"
|
||||
"subq %0, 1, %1\n"
|
||||
"stq_c %1, %2\n"
|
||||
"beq %1, 2f\n"
|
||||
|
||||
".subsection 2\n"
|
||||
"2: br 1b\n"
|
||||
".previous\n"
|
||||
|
||||
: "=&r" (original), "=&r" (modified)
|
||||
: "m" (i)
|
||||
:
|
||||
);
|
||||
fence_after(order);
|
||||
return original;
|
||||
}
|
||||
private:
|
||||
T i;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class platform_atomic_integral<T, 4> :
|
||||
public build_atomic_from_typical<build_exchange<atomic_alpha_32<T> > >
|
||||
{
|
||||
public:
|
||||
typedef build_atomic_from_typical<build_exchange<atomic_alpha_32<T> > > super;
|
||||
BOOST_CONSTEXPR platform_atomic_integral(T v) BOOST_NOEXCEPT: super(v) {}
|
||||
platform_atomic_integral(void) {}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class platform_atomic_integral<T, 8> :
|
||||
public build_atomic_from_typical<build_exchange<atomic_alpha_64<T> > >
|
||||
{
|
||||
public:
|
||||
typedef build_atomic_from_typical<build_exchange<atomic_alpha_64<T> > > super;
|
||||
BOOST_CONSTEXPR platform_atomic_integral(T v) BOOST_NOEXCEPT: super(v) {}
|
||||
platform_atomic_integral(void) {}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class platform_atomic_integral<T, 1> :
|
||||
public build_atomic_from_larger_type<atomic_alpha_32<uint32_t>, T>
|
||||
{
|
||||
public:
|
||||
typedef build_atomic_from_larger_type<atomic_alpha_32<uint32_t>, T> super;
|
||||
BOOST_CONSTEXPR platform_atomic_integral(T v) BOOST_NOEXCEPT: super(v) {}
|
||||
platform_atomic_integral(void) {}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class platform_atomic_integral<T, 2> :
|
||||
public build_atomic_from_larger_type<atomic_alpha_32<uint32_t>, T>
|
||||
{
|
||||
public:
|
||||
typedef build_atomic_from_larger_type<atomic_alpha_32<uint32_t>, T> super;
|
||||
BOOST_CONSTEXPR platform_atomic_integral(T v) BOOST_NOEXCEPT: super(v) {}
|
||||
platform_atomic_integral(void) {}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
255
python/external/boost/boost/atomic/detail/gcc-armv6plus.hpp
vendored
Normal file
255
python/external/boost/boost/atomic/detail/gcc-armv6plus.hpp
vendored
Normal file
@@ -0,0 +1,255 @@
|
||||
#ifndef BOOST_ATOMIC_DETAIL_GCC_ARMV6PLUS_HPP
|
||||
#define BOOST_ATOMIC_DETAIL_GCC_ARMV6PLUS_HPP
|
||||
|
||||
// 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)
|
||||
//
|
||||
// Copyright (c) 2009 Helge Bahmann
|
||||
// Copyright (c) 2009 Phil Endecott
|
||||
// Copyright (c) 2013 Tim Blechmann
|
||||
// ARM Code by Phil Endecott, based on other architectures.
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
// From the ARM Architecture Reference Manual for architecture v6:
|
||||
//
|
||||
// LDREX{<cond>} <Rd>, [<Rn>]
|
||||
// <Rd> Specifies the destination register for the memory word addressed by <Rd>
|
||||
// <Rn> Specifies the register containing the address.
|
||||
//
|
||||
// STREX{<cond>} <Rd>, <Rm>, [<Rn>]
|
||||
// <Rd> Specifies the destination register for the returned status value.
|
||||
// 0 if the operation updates memory
|
||||
// 1 if the operation fails to update memory
|
||||
// <Rm> Specifies the register containing the word to be stored to memory.
|
||||
// <Rn> Specifies the register containing the address.
|
||||
// Rd must not be the same register as Rm or Rn.
|
||||
//
|
||||
// ARM v7 is like ARM v6 plus:
|
||||
// There are half-word and byte versions of the LDREX and STREX instructions,
|
||||
// LDREXH, LDREXB, STREXH and STREXB.
|
||||
// There are also double-word versions, LDREXD and STREXD.
|
||||
// (Actually it looks like these are available from version 6k onwards.)
|
||||
// FIXME these are not yet used; should be mostly a matter of copy-and-paste.
|
||||
// I think you can supply an immediate offset to the address.
|
||||
//
|
||||
// A memory barrier is effected using a "co-processor 15" instruction,
|
||||
// though a separate assembler mnemonic is available for it in v7.
|
||||
|
||||
namespace boost {
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
// "Thumb 1" is a subset of the ARM instruction set that uses a 16-bit encoding. It
|
||||
// doesn't include all instructions and in particular it doesn't include the co-processor
|
||||
// instruction used for the memory barrier or the load-locked/store-conditional
|
||||
// instructions. So, if we're compiling in "Thumb 1" mode, we need to wrap all of our
|
||||
// asm blocks with code to temporarily change to ARM mode.
|
||||
//
|
||||
// You can only change between ARM and Thumb modes when branching using the bx instruction.
|
||||
// bx takes an address specified in a register. The least significant bit of the address
|
||||
// indicates the mode, so 1 is added to indicate that the destination code is Thumb.
|
||||
// A temporary register is needed for the address and is passed as an argument to these
|
||||
// macros. It must be one of the "low" registers accessible to Thumb code, specified
|
||||
// using the "l" attribute in the asm symbolic_expressionexpression.
|
||||
//
|
||||
// Architecture v7 introduces "Thumb 2", which does include (almost?) all of the ARM
|
||||
// instruction set. So in v7 we don't need to change to ARM mode; we can write "universal
|
||||
// assembler" which will assemble to Thumb 2 or ARM code as appropriate. The only thing
|
||||
// we need to do to make this "universal" assembler mode work is to insert "IT" instructions
|
||||
// to annotate the conditional instructions. These are ignored in other modes (e.g. v6),
|
||||
// so they can always be present.
|
||||
|
||||
#if defined(__thumb__) && !defined(__thumb2__)
|
||||
#define BOOST_ATOMIC_ARM_ASM_START(TMPREG) "adr " #TMPREG ", 1f\n" "bx " #TMPREG "\n" ".arm\n" ".align 4\n" "1: "
|
||||
#define BOOST_ATOMIC_ARM_ASM_END(TMPREG) "adr " #TMPREG ", 1f + 1\n" "bx " #TMPREG "\n" ".thumb\n" ".align 2\n" "1: "
|
||||
#else
|
||||
// The tmpreg is wasted in this case, which is non-optimal.
|
||||
#define BOOST_ATOMIC_ARM_ASM_START(TMPREG)
|
||||
#define BOOST_ATOMIC_ARM_ASM_END(TMPREG)
|
||||
#endif
|
||||
|
||||
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7S__)
|
||||
#define BOOST_ATOMIC_ARM_DMB "dmb\n"
|
||||
#else
|
||||
#define BOOST_ATOMIC_ARM_DMB "mcr\tp15, 0, r0, c7, c10, 5\n"
|
||||
#endif
|
||||
|
||||
inline void
|
||||
arm_barrier(void) BOOST_NOEXCEPT
|
||||
{
|
||||
int brtmp;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
BOOST_ATOMIC_ARM_ASM_START(%0)
|
||||
BOOST_ATOMIC_ARM_DMB
|
||||
BOOST_ATOMIC_ARM_ASM_END(%0)
|
||||
: "=&l" (brtmp) :: "memory"
|
||||
);
|
||||
}
|
||||
|
||||
inline void
|
||||
platform_fence_before(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
switch(order)
|
||||
{
|
||||
case memory_order_release:
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
arm_barrier();
|
||||
case memory_order_consume:
|
||||
default:;
|
||||
}
|
||||
}
|
||||
|
||||
inline void
|
||||
platform_fence_after(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
switch(order)
|
||||
{
|
||||
case memory_order_acquire:
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
arm_barrier();
|
||||
default:;
|
||||
}
|
||||
}
|
||||
|
||||
inline void
|
||||
platform_fence_before_store(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
platform_fence_before(order);
|
||||
}
|
||||
|
||||
inline void
|
||||
platform_fence_after_store(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
if (order == memory_order_seq_cst)
|
||||
arm_barrier();
|
||||
}
|
||||
|
||||
inline void
|
||||
platform_fence_after_load(memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
platform_fence_after(order);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline bool
|
||||
platform_cmpxchg32(T & expected, T desired, volatile T * ptr) BOOST_NOEXCEPT
|
||||
{
|
||||
int success;
|
||||
int tmp;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
BOOST_ATOMIC_ARM_ASM_START(%2)
|
||||
"mov %1, #0\n" // success = 0
|
||||
"ldrex %0, %3\n" // expected' = *(&i)
|
||||
"teq %0, %4\n" // flags = expected'==expected
|
||||
"ittt eq\n"
|
||||
"strexeq %2, %5, %3\n" // if (flags.equal) *(&i) = desired, tmp = !OK
|
||||
"teqeq %2, #0\n" // if (flags.equal) flags = tmp==0
|
||||
"moveq %1, #1\n" // if (flags.equal) success = 1
|
||||
BOOST_ATOMIC_ARM_ASM_END(%2)
|
||||
: "=&r" (expected), // %0
|
||||
"=&r" (success), // %1
|
||||
"=&l" (tmp), // %2
|
||||
"+Q" (*ptr) // %3
|
||||
: "r" (expected), // %4
|
||||
"r" (desired) // %5
|
||||
: "cc"
|
||||
);
|
||||
return success;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#define BOOST_ATOMIC_THREAD_FENCE 2
|
||||
inline void
|
||||
atomic_thread_fence(memory_order order)
|
||||
{
|
||||
switch(order)
|
||||
{
|
||||
case memory_order_acquire:
|
||||
case memory_order_release:
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
atomics::detail::arm_barrier();
|
||||
default:;
|
||||
}
|
||||
}
|
||||
|
||||
#define BOOST_ATOMIC_SIGNAL_FENCE 2
|
||||
inline void
|
||||
atomic_signal_fence(memory_order)
|
||||
{
|
||||
__asm__ __volatile__ ("" ::: "memory");
|
||||
}
|
||||
|
||||
class atomic_flag
|
||||
{
|
||||
private:
|
||||
uint32_t v_;
|
||||
|
||||
public:
|
||||
BOOST_CONSTEXPR atomic_flag(void) BOOST_NOEXCEPT : v_(0) {}
|
||||
|
||||
void
|
||||
clear(memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
atomics::detail::platform_fence_before_store(order);
|
||||
const_cast<volatile uint32_t &>(v_) = 0;
|
||||
atomics::detail::platform_fence_after_store(order);
|
||||
}
|
||||
|
||||
bool
|
||||
test_and_set(memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
atomics::detail::platform_fence_before(order);
|
||||
uint32_t expected = v_;
|
||||
do {
|
||||
if (expected == 1)
|
||||
break;
|
||||
} while (!atomics::detail::platform_cmpxchg32(expected, (uint32_t)1, &v_));
|
||||
atomics::detail::platform_fence_after(order);
|
||||
return expected;
|
||||
}
|
||||
|
||||
BOOST_DELETED_FUNCTION(atomic_flag(const atomic_flag &))
|
||||
BOOST_DELETED_FUNCTION(atomic_flag& operator=(const atomic_flag &))
|
||||
};
|
||||
|
||||
#define BOOST_ATOMIC_FLAG_LOCK_FREE 2
|
||||
|
||||
}
|
||||
|
||||
#undef BOOST_ATOMIC_ARM_ASM_START
|
||||
#undef BOOST_ATOMIC_ARM_ASM_END
|
||||
|
||||
#include <boost/atomic/detail/base.hpp>
|
||||
|
||||
#if !defined(BOOST_ATOMIC_FORCE_FALLBACK)
|
||||
|
||||
#define BOOST_ATOMIC_CHAR_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_CHAR16_T_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_CHAR32_T_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_WCHAR_T_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_SHORT_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_INT_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_LONG_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_LLONG_LOCK_FREE 0
|
||||
#define BOOST_ATOMIC_POINTER_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_BOOL_LOCK_FREE 2
|
||||
|
||||
#include <boost/atomic/detail/cas32weak.hpp>
|
||||
|
||||
#endif /* !defined(BOOST_ATOMIC_FORCE_FALLBACK) */
|
||||
|
||||
#endif
|
1211
python/external/boost/boost/atomic/detail/gcc-atomic.hpp
vendored
Normal file
1211
python/external/boost/boost/atomic/detail/gcc-atomic.hpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
160
python/external/boost/boost/atomic/detail/gcc-cas.hpp
vendored
Normal file
160
python/external/boost/boost/atomic/detail/gcc-cas.hpp
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
// Copyright (c) 2011 Helge Bahmann
|
||||
// Copyright (c) 2013 Tim Blechmann
|
||||
//
|
||||
// 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)
|
||||
|
||||
// Use the gnu builtin __sync_val_compare_and_swap to build
|
||||
// atomic operations for 32 bit and smaller.
|
||||
|
||||
#ifndef BOOST_ATOMIC_DETAIL_GENERIC_CAS_HPP
|
||||
#define BOOST_ATOMIC_DETAIL_GENERIC_CAS_HPP
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/atomic/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
#define BOOST_ATOMIC_THREAD_FENCE 2
|
||||
inline void
|
||||
atomic_thread_fence(memory_order order)
|
||||
{
|
||||
switch(order)
|
||||
{
|
||||
case memory_order_relaxed:
|
||||
break;
|
||||
case memory_order_release:
|
||||
case memory_order_consume:
|
||||
case memory_order_acquire:
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
__sync_synchronize();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
namespace atomics {
|
||||
namespace detail {
|
||||
|
||||
inline void
|
||||
platform_fence_before(memory_order)
|
||||
{
|
||||
/* empty, as compare_and_swap is synchronizing already */
|
||||
}
|
||||
|
||||
inline void
|
||||
platform_fence_after(memory_order)
|
||||
{
|
||||
/* empty, as compare_and_swap is synchronizing already */
|
||||
}
|
||||
|
||||
inline void
|
||||
platform_fence_before_store(memory_order order)
|
||||
{
|
||||
switch(order)
|
||||
{
|
||||
case memory_order_relaxed:
|
||||
case memory_order_acquire:
|
||||
case memory_order_consume:
|
||||
break;
|
||||
case memory_order_release:
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
__sync_synchronize();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
inline void
|
||||
platform_fence_after_store(memory_order order)
|
||||
{
|
||||
if (order == memory_order_seq_cst)
|
||||
__sync_synchronize();
|
||||
}
|
||||
|
||||
inline void
|
||||
platform_fence_after_load(memory_order order)
|
||||
{
|
||||
switch(order)
|
||||
{
|
||||
case memory_order_relaxed:
|
||||
case memory_order_release:
|
||||
break;
|
||||
case memory_order_consume:
|
||||
case memory_order_acquire:
|
||||
case memory_order_acq_rel:
|
||||
case memory_order_seq_cst:
|
||||
__sync_synchronize();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline bool
|
||||
platform_cmpxchg32_strong(T & expected, T desired, volatile T * ptr)
|
||||
{
|
||||
T found = __sync_val_compare_and_swap(ptr, expected, desired);
|
||||
bool success = (found == expected);
|
||||
expected = found;
|
||||
return success;
|
||||
}
|
||||
|
||||
class atomic_flag
|
||||
{
|
||||
private:
|
||||
atomic_flag(const atomic_flag &) /* = delete */ ;
|
||||
atomic_flag & operator=(const atomic_flag &) /* = delete */ ;
|
||||
uint32_t v_;
|
||||
public:
|
||||
BOOST_CONSTEXPR atomic_flag(void) BOOST_NOEXCEPT : v_(0) {}
|
||||
|
||||
void
|
||||
clear(memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
atomics::detail::platform_fence_before_store(order);
|
||||
const_cast<volatile uint32_t &>(v_) = 0;
|
||||
atomics::detail::platform_fence_after_store(order);
|
||||
}
|
||||
|
||||
bool
|
||||
test_and_set(memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
atomics::detail::platform_fence_before(order);
|
||||
uint32_t expected = v_;
|
||||
do {
|
||||
if (expected == 1)
|
||||
break;
|
||||
} while (!atomics::detail::platform_cmpxchg32(expected, (uint32_t)1, &v_));
|
||||
atomics::detail::platform_fence_after(order);
|
||||
return expected;
|
||||
}
|
||||
};
|
||||
|
||||
#define BOOST_ATOMIC_FLAG_LOCK_FREE 2
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include <boost/atomic/detail/base.hpp>
|
||||
|
||||
#if !defined(BOOST_ATOMIC_FORCE_FALLBACK)
|
||||
|
||||
#define BOOST_ATOMIC_CHAR_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_SHORT_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_INT_LOCK_FREE 2
|
||||
#define BOOST_ATOMIC_LONG_LOCK_FREE (sizeof(long) <= 4 ? 2 : 0)
|
||||
#define BOOST_ATOMIC_LLONG_LOCK_FREE (sizeof(long long) <= 4 ? 2 : 0)
|
||||
#define BOOST_ATOMIC_POINTER_LOCK_FREE (sizeof(void *) <= 4 ? 2 : 0)
|
||||
#define BOOST_ATOMIC_BOOL_LOCK_FREE 2
|
||||
|
||||
#include <boost/atomic/detail/cas32strong.hpp>
|
||||
|
||||
#endif /* !defined(BOOST_ATOMIC_FORCE_FALLBACK) */
|
||||
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user