mirror of
https://github.com/boostorg/serialization.git
synced 2026-07-23 13:54:08 +00:00
Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| acbd1f88f9 | |||
| aba55e6180 | |||
| 51b1df323b | |||
| 247f223d82 | |||
| 619250c93a | |||
| 66ccdc00f1 | |||
| a8bbbea4e7 | |||
| c3552e1d03 | |||
| c518afa8ad | |||
| 29593efac2 | |||
| 5986edcfd3 | |||
| d558b6da91 | |||
| 4d11c54e60 | |||
| 1fda900179 | |||
| 0c7141fb78 | |||
| 6e24d1eb48 | |||
| fceaca0a34 | |||
| b98b458293 | |||
| 26366fecb5 | |||
| 058f1fed43 | |||
| 6b33d1cd4e | |||
| ec74c5a143 | |||
| 58b4f73c70 |
+1
-1
@@ -57,7 +57,7 @@ install:
|
||||
- git submodule init libs/utility
|
||||
- git submodule init libs/variant
|
||||
- git submodule init tools/build
|
||||
- git submodule update --depth 1
|
||||
- git submodule update
|
||||
- cp -r $TRAVIS_BUILD_DIR/* libs/serialization
|
||||
- ./bootstrap.sh
|
||||
- ./b2 headers
|
||||
|
||||
+17
-2
@@ -112,6 +112,7 @@ set(Boost_DETAILED_FAILURE_MSG true)
|
||||
set(Boost_FOUND true)
|
||||
|
||||
find_package(Boost REQUIRED COMPONENTS system filesystem)
|
||||
include(CheckIncludeFileCXX)
|
||||
|
||||
message(STATUS "Boost_FOUND is ${Boost_FOUND}")
|
||||
|
||||
@@ -320,6 +321,14 @@ archive_test(test_shared_ptr_multi_base)
|
||||
archive_test(test_shared_ptr_132)
|
||||
archive_test(test_simple_class A)
|
||||
archive_test(test_simple_class_ptr A)
|
||||
CHECK_INCLUDE_FILE_CXX(slist SLIST_FOUND)
|
||||
if(SLIST_FOUND)
|
||||
message(STATUS "slist header found")
|
||||
archive_test(test_slist A)
|
||||
archive_test(test_slist_ptr A)
|
||||
else()
|
||||
message(STATUS "slist header NOT found")
|
||||
endif()
|
||||
archive_test(test_stack A)
|
||||
archive_test(test_split)
|
||||
archive_test(test_tracking)
|
||||
@@ -333,12 +342,18 @@ archive_test(test_set_boost_unordered A)
|
||||
if(COMPILER_SUPPORTS_CXX11)
|
||||
archive_test(test_set_unordered A)
|
||||
else()
|
||||
archive_test(test_set_hashed A)
|
||||
CHECK_INCLUDE_FILE_CXX(hash_set HASH_SET_FOUND)
|
||||
if(HASH_SET_FOUND)
|
||||
archive_test(test_set_hashed A)
|
||||
endif()
|
||||
endif()
|
||||
if(COMPILER_SUPPORTS_CXX11)
|
||||
archive_test(test_map_unordered A)
|
||||
else()
|
||||
archive_test(test_map_hashed A)
|
||||
CHECK_INCLUDE_FILE_CXX(hash_map HASH_MAP_FOUND)
|
||||
if(HASH_MAP_FOUND)
|
||||
archive_test(test_map_hashed A)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
polymorphic_archive_test(test_polymorphic test_polymorphic_A A)
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
# Copyright 2016 Peter Dimov
|
||||
# Copyright 2016 Robert Ramey
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
|
||||
|
||||
version: 1.0.{build}-{branch}
|
||||
|
||||
shallow_clone: true
|
||||
|
||||
branches:
|
||||
only:
|
||||
- develop
|
||||
# - master
|
||||
|
||||
install:
|
||||
- cd ..
|
||||
- git clone -b %APPVEYOR_REPO_BRANCH% https://github.com/boostorg/boost.git boost-root
|
||||
- cd boost-root
|
||||
- git submodule init libs/align
|
||||
- git submodule init libs/array
|
||||
- git submodule init libs/assert
|
||||
- git submodule init libs/bind
|
||||
- git submodule init libs/compatibility
|
||||
- git submodule init libs/concept_check
|
||||
- git submodule init libs/config
|
||||
- git submodule init libs/container
|
||||
- git submodule init libs/core
|
||||
- git submodule init libs/detail
|
||||
- git submodule init libs/filesystem
|
||||
- git submodule init libs/function
|
||||
- git submodule init libs/functional
|
||||
- git submodule init libs/integer
|
||||
- git submodule init libs/intrusive
|
||||
- git submodule init libs/io
|
||||
- git submodule init libs/iterator
|
||||
- git submodule init libs/lexical_cast
|
||||
- git submodule init libs/math
|
||||
- git submodule init libs/move
|
||||
- git submodule init libs/mpl
|
||||
- git submodule init libs/numeric/conversion
|
||||
- git submodule init libs/optional
|
||||
- git submodule init libs/predef
|
||||
- git submodule init libs/preprocessor
|
||||
- git submodule init libs/range
|
||||
- git submodule init libs/smart_ptr
|
||||
- git submodule init libs/spirit
|
||||
- git submodule init libs/static_assert
|
||||
- git submodule init libs/system
|
||||
- git submodule init libs/throw_exception
|
||||
- git submodule init libs/tuple
|
||||
- git submodule init libs/type_index
|
||||
- git submodule init libs/type_traits
|
||||
- git submodule init libs/unordered
|
||||
- git submodule init libs/utility
|
||||
- git submodule init libs/variant
|
||||
- git submodule init tools/build
|
||||
- git submodule update
|
||||
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\serialization
|
||||
- bootstrap
|
||||
- b2 headers
|
||||
|
||||
build: off
|
||||
|
||||
test_script:
|
||||
- b2 libs/serialization/test toolset=msvc-12.0 link=static,shared
|
||||
@@ -50,7 +50,7 @@ namespace std{
|
||||
|
||||
//#include <boost/mpl/placeholders.hpp>
|
||||
#include <boost/serialization/is_bitwise_serializable.hpp>
|
||||
#include <boost/serialization/array.hpp>
|
||||
#include <boost/serialization/array_wrapper.hpp>
|
||||
|
||||
#include <boost/archive/basic_streambuf_locale_saver.hpp>
|
||||
#include <boost/archive/codecvt_null.hpp>
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace std{
|
||||
|
||||
//#include <boost/mpl/placeholders.hpp>
|
||||
#include <boost/serialization/is_bitwise_serializable.hpp>
|
||||
#include <boost/serialization/array.hpp>
|
||||
#include <boost/serialization/array_wrapper.hpp>
|
||||
|
||||
#include <boost/archive/basic_streambuf_locale_saver.hpp>
|
||||
#include <boost/archive/codecvt_null.hpp>
|
||||
|
||||
@@ -89,8 +89,7 @@ protected:
|
||||
// leaving the archive in an undetermined state
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
load_override(class_id_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
load_override(class_id_optional_type & /* t */){}
|
||||
void load_override(class_id_optional_type & /* t */){}
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
load_override(object_id_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
|
||||
@@ -77,10 +77,10 @@ namespace std{
|
||||
#include <boost/serialization/type_info_implementation.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/void_cast.hpp>
|
||||
#include <boost/serialization/array.hpp>
|
||||
#include <boost/serialization/collection_size_type.hpp>
|
||||
#include <boost/serialization/singleton.hpp>
|
||||
#include <boost/serialization/wrapper.hpp>
|
||||
#include <boost/serialization/array_wrapper.hpp>
|
||||
|
||||
// the following is need only for dynamic cast of polymorphic pointers
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
|
||||
@@ -56,8 +56,9 @@
|
||||
#include <boost/serialization/type_info_implementation.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/void_cast.hpp>
|
||||
#include <boost/serialization/array.hpp>
|
||||
#include <boost/serialization/collection_size_type.hpp>
|
||||
#include <boost/serialization/array_wrapper.hpp>
|
||||
|
||||
#include <boost/serialization/singleton.hpp>
|
||||
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
|
||||
@@ -9,11 +9,14 @@
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
// std::codecvt_utf8 doesn't seem to work for msvc
|
||||
// versions prior to MSVC 14.0
|
||||
#ifdef BOOST_NO_STD_WSTREAMBUF
|
||||
#error "wide char i/o not supported on this platform"
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900 \
|
||||
|| defined( BOOST_NO_CXX11_HDR_CODECVT )
|
||||
// std::codecvt_utf8 doesn't seem to work for any versions of msvc
|
||||
|
||||
#if defined(_MSC_VER) || defined(BOOST_NO_CXX11_HDR_CODECVT)
|
||||
// use boost's utf8 codecvt facet
|
||||
#include <boost/archive/detail/decl.hpp>
|
||||
#define BOOST_UTF8_BEGIN_NAMESPACE \
|
||||
namespace boost { namespace archive { namespace detail {
|
||||
@@ -26,9 +29,11 @@
|
||||
#undef BOOST_UTF8_DECL
|
||||
#undef BOOST_UTF8_BEGIN_NAMESPACE
|
||||
#else
|
||||
// use the standard vendor supplied facet
|
||||
#include <codecvt>
|
||||
namespace boost { namespace archive { namespace detail {
|
||||
typedef std::codecvt_utf8<wchar_t> utf8_codecvt_facet;
|
||||
} } }
|
||||
#endif // BOOST_NO_CXX11_HDR_CODECVT
|
||||
#endif
|
||||
|
||||
#endif // BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace std{
|
||||
using ::mbstate_t;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/archive/detail/utf8_codecvt_facet.hpp>
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
|
||||
|
||||
@@ -6,135 +6,30 @@
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
//#include <iostream>
|
||||
// for serialization of <array>. If <array> not supported by the standard
|
||||
// library - this file becomes empty. This is to avoid breaking backward
|
||||
// compatibiliy for applications which used this header to support
|
||||
// serialization of native arrays. Code to serialize native arrays is
|
||||
// now always include by default. RR
|
||||
|
||||
#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
|
||||
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
|
||||
#include <iostream>
|
||||
#include <cstddef> // std::size_t
|
||||
namespace std{
|
||||
using ::size_t;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/split_member.hpp>
|
||||
#include <boost/serialization/wrapper.hpp>
|
||||
#include <boost/serialization/collection_size_type.hpp>
|
||||
#include <boost/mpl/always.hpp>
|
||||
#include <boost/mpl/apply.hpp>
|
||||
#include <boost/mpl/bool_fwd.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
namespace boost { namespace serialization {
|
||||
|
||||
// traits to specify whether to use an optimized array serialization
|
||||
|
||||
template <class Archive>
|
||||
struct use_array_optimization : boost::mpl::always<boost::mpl::false_> {};
|
||||
|
||||
template<class T>
|
||||
class array_wrapper :
|
||||
public wrapper_traits<const array_wrapper< T > >
|
||||
{
|
||||
private:
|
||||
array_wrapper & operator=(const array_wrapper & rhs);
|
||||
// note: I would like to make the copy constructor private but this breaks
|
||||
// make_array. So I make make_array a friend
|
||||
template<class Tx, class S>
|
||||
friend const boost::serialization::array_wrapper<Tx> make_array(Tx * t, S s);
|
||||
public:
|
||||
|
||||
array_wrapper(const array_wrapper & rhs) :
|
||||
m_t(rhs.m_t),
|
||||
m_element_count(rhs.m_element_count)
|
||||
{}
|
||||
public:
|
||||
array_wrapper(T * t, std::size_t s) :
|
||||
m_t(t),
|
||||
m_element_count(s)
|
||||
{}
|
||||
|
||||
// default implementation
|
||||
template<class Archive>
|
||||
void serialize_optimized(Archive &ar, const unsigned int, mpl::false_ ) const
|
||||
{
|
||||
// default implemention does the loop
|
||||
std::size_t c = count();
|
||||
T * t = address();
|
||||
while(0 < c--)
|
||||
ar & boost::serialization::make_nvp("item", *t++);
|
||||
}
|
||||
|
||||
// optimized implementation
|
||||
template<class Archive>
|
||||
void serialize_optimized(Archive &ar, const unsigned int version, mpl::true_ )
|
||||
{
|
||||
boost::serialization::split_member(ar, *this, version);
|
||||
}
|
||||
|
||||
// default implementation
|
||||
template<class Archive>
|
||||
void save(Archive &ar, const unsigned int version) const
|
||||
{
|
||||
ar.save_array(*this,version);
|
||||
}
|
||||
|
||||
// default implementation
|
||||
template<class Archive>
|
||||
void load(Archive &ar, const unsigned int version)
|
||||
{
|
||||
ar.load_array(*this,version);
|
||||
}
|
||||
|
||||
// default implementation
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar, const unsigned int version)
|
||||
{
|
||||
typedef typename
|
||||
boost::serialization::use_array_optimization<Archive>::template apply<
|
||||
typename remove_const< T >::type
|
||||
>::type use_optimized;
|
||||
serialize_optimized(ar,version,use_optimized());
|
||||
}
|
||||
|
||||
T * address() const
|
||||
{
|
||||
return m_t;
|
||||
}
|
||||
|
||||
std::size_t count() const
|
||||
{
|
||||
return m_element_count;
|
||||
}
|
||||
|
||||
private:
|
||||
T * const m_t;
|
||||
const std::size_t m_element_count;
|
||||
};
|
||||
|
||||
template<class T, class S>
|
||||
inline
|
||||
const array_wrapper< T > make_array(T* t, S s){
|
||||
const array_wrapper< T > a(t, s);
|
||||
return a;
|
||||
}
|
||||
|
||||
} } // end namespace boost::serialization
|
||||
|
||||
// I can't figure out why BOOST_NO_CXX11_HDR_ARRAY
|
||||
// has been set for clang-11. So just make sure
|
||||
// it's reset now. Needs further research!!!
|
||||
|
||||
#if defined(_LIBCPP_VERSION)
|
||||
#undef BOOST_NO_CXX11_HDR_ARRAY
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_CXX11_HDR_ARRAY
|
||||
|
||||
#include <array>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
|
||||
namespace boost { namespace serialization {
|
||||
// implement serialization for std::array
|
||||
|
||||
template <class Archive, class T, std::size_t N>
|
||||
void serialize(Archive& ar, std::array<T,N>& a, const unsigned int /* version */)
|
||||
{
|
||||
@@ -145,27 +40,7 @@ void serialize(Archive& ar, std::array<T,N>& a, const unsigned int /* version */
|
||||
|
||||
}
|
||||
} } // end namespace boost::serialization
|
||||
#endif
|
||||
|
||||
#include <boost/array.hpp>
|
||||
|
||||
namespace boost { namespace serialization {
|
||||
// implement serialization for boost::array
|
||||
template <class Archive, class T, std::size_t N>
|
||||
void serialize(Archive& ar, boost::array<T,N>& a, const unsigned int /* version */)
|
||||
{
|
||||
ar & boost::serialization::make_nvp("elems", a.elems);
|
||||
}
|
||||
|
||||
} } // end namespace boost::serialization
|
||||
|
||||
#define BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(Archive) \
|
||||
namespace boost { namespace serialization { \
|
||||
template <> struct use_array_optimization<Archive> { \
|
||||
template <class ValueType> \
|
||||
struct apply : boost::mpl::apply1<Archive::use_array_optimization \
|
||||
, typename boost::remove_const<ValueType>::type \
|
||||
>::type {}; \
|
||||
}; }}
|
||||
#endif // BOOST_NO_CXX11_HDR_ARRAY
|
||||
|
||||
#endif //BOOST_SERIALIZATION_ARRAY_HPP
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
#ifndef BOOST_SERIALIZATION_ARRAY_OPTIMIZATON_HPP
|
||||
#define BOOST_SERIALIZATION_ARRAY_OPTIMIZATON_HPP
|
||||
|
||||
// (C) Copyright 2005 Matthias Troyer and Dave Abrahams
|
||||
// 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)
|
||||
|
||||
#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
|
||||
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::size_t;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/mpl/always.hpp>
|
||||
#include <boost/mpl/apply.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
namespace boost { namespace serialization {
|
||||
|
||||
template <class Archive>
|
||||
struct use_array_optimization : boost::mpl::always<boost::mpl::false_> {};
|
||||
|
||||
} } // end namespace boost::serialization
|
||||
|
||||
#define BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(Archive) \
|
||||
namespace boost { namespace serialization { \
|
||||
template <> struct use_array_optimization<Archive> { \
|
||||
template <class ValueType> \
|
||||
struct apply : boost::mpl::apply1<Archive::use_array_optimization \
|
||||
, typename boost::remove_const<ValueType>::type \
|
||||
>::type {}; \
|
||||
}; }}
|
||||
|
||||
#endif //BOOST_SERIALIZATION_ARRAY_OPTIMIZATON_HPP
|
||||
@@ -0,0 +1,121 @@
|
||||
#ifndef BOOST_SERIALIZATION_ARRAY_WRAPPER_HPP
|
||||
#define BOOST_SERIALIZATION_ARRAY_WRAPPER_HPP
|
||||
|
||||
// (C) Copyright 2005 Matthias Troyer and Dave Abrahams
|
||||
// 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)
|
||||
|
||||
//#include <iostream>
|
||||
|
||||
#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
|
||||
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::size_t;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/split_member.hpp>
|
||||
#include <boost/serialization/wrapper.hpp>
|
||||
#include <boost/serialization/collection_size_type.hpp>
|
||||
#include <boost/serialization/array_optimization.hpp>
|
||||
#include <boost/mpl/always.hpp>
|
||||
#include <boost/mpl/apply.hpp>
|
||||
#include <boost/mpl/bool_fwd.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
namespace boost { namespace serialization {
|
||||
|
||||
template<class T>
|
||||
class array_wrapper :
|
||||
public wrapper_traits<const array_wrapper< T > >
|
||||
{
|
||||
private:
|
||||
array_wrapper & operator=(const array_wrapper & rhs);
|
||||
// note: I would like to make the copy constructor private but this breaks
|
||||
// make_array. So I make make_array a friend
|
||||
template<class Tx, class S>
|
||||
friend const boost::serialization::array_wrapper<Tx> make_array(Tx * t, S s);
|
||||
public:
|
||||
|
||||
array_wrapper(const array_wrapper & rhs) :
|
||||
m_t(rhs.m_t),
|
||||
m_element_count(rhs.m_element_count)
|
||||
{}
|
||||
public:
|
||||
array_wrapper(T * t, std::size_t s) :
|
||||
m_t(t),
|
||||
m_element_count(s)
|
||||
{}
|
||||
|
||||
// default implementation
|
||||
template<class Archive>
|
||||
void serialize_optimized(Archive &ar, const unsigned int, mpl::false_ ) const
|
||||
{
|
||||
// default implemention does the loop
|
||||
std::size_t c = count();
|
||||
T * t = address();
|
||||
while(0 < c--)
|
||||
ar & boost::serialization::make_nvp("item", *t++);
|
||||
}
|
||||
|
||||
// optimized implementation
|
||||
template<class Archive>
|
||||
void serialize_optimized(Archive &ar, const unsigned int version, mpl::true_ )
|
||||
{
|
||||
boost::serialization::split_member(ar, *this, version);
|
||||
}
|
||||
|
||||
// default implementation
|
||||
template<class Archive>
|
||||
void save(Archive &ar, const unsigned int version) const
|
||||
{
|
||||
ar.save_array(*this,version);
|
||||
}
|
||||
|
||||
// default implementation
|
||||
template<class Archive>
|
||||
void load(Archive &ar, const unsigned int version)
|
||||
{
|
||||
ar.load_array(*this,version);
|
||||
}
|
||||
|
||||
// default implementation
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar, const unsigned int version)
|
||||
{
|
||||
typedef typename
|
||||
boost::serialization::use_array_optimization<Archive>::template apply<
|
||||
typename remove_const< T >::type
|
||||
>::type use_optimized;
|
||||
serialize_optimized(ar,version,use_optimized());
|
||||
}
|
||||
|
||||
T * address() const
|
||||
{
|
||||
return m_t;
|
||||
}
|
||||
|
||||
std::size_t count() const
|
||||
{
|
||||
return m_element_count;
|
||||
}
|
||||
|
||||
private:
|
||||
T * const m_t;
|
||||
const std::size_t m_element_count;
|
||||
};
|
||||
|
||||
template<class T, class S>
|
||||
inline
|
||||
const array_wrapper< T > make_array(T* t, S s){
|
||||
const array_wrapper< T > a(t, s);
|
||||
return a;
|
||||
}
|
||||
|
||||
} } // end namespace boost::serialization
|
||||
|
||||
|
||||
#endif //BOOST_SERIALIZATION_ARRAY_WRAPPER_HPP
|
||||
@@ -0,0 +1,33 @@
|
||||
#ifndef BOOST_SERIALIZATION_ARRAY_HPP
|
||||
#define BOOST_SERIALIZATION_ARRAY_HPP
|
||||
|
||||
// (C) Copyright 2005 Matthias Troyer and Dave Abrahams
|
||||
// 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)
|
||||
|
||||
//#include <iostream>
|
||||
|
||||
#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
|
||||
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::size_t;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/array.hpp>
|
||||
|
||||
namespace boost { namespace serialization {
|
||||
// implement serialization for boost::array
|
||||
template <class Archive, class T, std::size_t N>
|
||||
void serialize(Archive& ar, boost::array<T,N>& a, const unsigned int /* version */)
|
||||
{
|
||||
ar & boost::serialization::make_nvp("elems", a.elems);
|
||||
}
|
||||
|
||||
} } // end namespace boost::serialization
|
||||
|
||||
|
||||
#endif //BOOST_SERIALIZATION_ARRAY_HPP
|
||||
@@ -1,59 +0,0 @@
|
||||
// (C) Copyright 2005 Matthias Troyer
|
||||
// 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.
|
||||
|
||||
#ifndef BOOST_SERIALIZATION_DETAIL_GET_DATA_HPP
|
||||
#define BOOST_SERIALIZATION_DETAIL_GET_DATA_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
|
||||
#define STD _STLP_STD
|
||||
#else
|
||||
#define STD std
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
#include <valarray>
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
namespace detail {
|
||||
|
||||
template <class T, class Allocator>
|
||||
T* get_data(STD::vector<T,Allocator>& v)
|
||||
{
|
||||
return v.empty() ? 0 : &(v[0]);
|
||||
}
|
||||
|
||||
template <class T, class Allocator>
|
||||
T* get_data(STD::vector<T,Allocator> const & v)
|
||||
{
|
||||
return get_data(const_cast<STD::vector<T,Allocator>&>(v));
|
||||
}
|
||||
|
||||
template <class T>
|
||||
T* get_data(STD::valarray<T>& v)
|
||||
{
|
||||
return v.size()==0 ? 0 : &(v[0]);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
const T* get_data(STD::valarray<T> const& v)
|
||||
{
|
||||
return get_data(const_cast<STD::valarray<T>&>(v));
|
||||
}
|
||||
|
||||
} // detail
|
||||
} // serialization
|
||||
} // boost
|
||||
|
||||
#undef STD
|
||||
|
||||
#endif // BOOST_SERIALIZATION_DETAIL_GET_DATA_HPP
|
||||
@@ -85,11 +85,19 @@ class BOOST_SYMBOL_VISIBLE singleton_module :
|
||||
public boost::noncopyable
|
||||
{
|
||||
private:
|
||||
static bool & get_lock();
|
||||
BOOST_SERIALIZATION_DECL static bool & get_lock();
|
||||
public:
|
||||
BOOST_SERIALIZATION_DECL static void lock();
|
||||
BOOST_SERIALIZATION_DECL static void unlock();
|
||||
BOOST_SERIALIZATION_DECL static bool is_locked();
|
||||
static void lock(){
|
||||
get_lock() = true;
|
||||
}
|
||||
|
||||
static void unlock(){
|
||||
get_lock() = false;
|
||||
}
|
||||
|
||||
static bool is_locked(){
|
||||
return get_lock();
|
||||
}
|
||||
};
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
@@ -18,10 +18,12 @@
|
||||
|
||||
#include <valarray>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/serialization/collections_save_imp.hpp>
|
||||
#include <boost/serialization/collections_load_imp.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/array.hpp>
|
||||
#include <boost/serialization/collection_size_type.hpp>
|
||||
#include <boost/serialization/detail/get_data.hpp>
|
||||
#include <boost/serialization/array_wrapper.hpp>
|
||||
|
||||
// function specializations must be defined in the appropriate
|
||||
// namespace - boost::serialization
|
||||
@@ -42,12 +44,13 @@ void save( Archive & ar, const STD::valarray<U> &t, const unsigned int /*file_ve
|
||||
{
|
||||
const collection_size_type count(t.size());
|
||||
ar << BOOST_SERIALIZATION_NVP(count);
|
||||
if (t.size())
|
||||
if (t.size()){
|
||||
// explict template arguments to pass intel C++ compiler
|
||||
ar << serialization::make_array<const U, collection_size_type>(
|
||||
static_cast<const U *>(&t[0]),
|
||||
count
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
template<class Archive, class U>
|
||||
@@ -56,12 +59,13 @@ void load( Archive & ar, STD::valarray<U> &t, const unsigned int /*file_version
|
||||
collection_size_type count;
|
||||
ar >> BOOST_SERIALIZATION_NVP(count);
|
||||
t.resize(count);
|
||||
if (t.size())
|
||||
if (t.size()){
|
||||
// explict template arguments to pass intel C++ compiler
|
||||
ar >> serialization::make_array<U, collection_size_type>(
|
||||
static_cast<U *>(&t[0]),
|
||||
count
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// split non-intrusive serialization function member into separate
|
||||
|
||||
@@ -31,8 +31,7 @@
|
||||
#include <boost/serialization/collections_save_imp.hpp>
|
||||
#include <boost/serialization/collections_load_imp.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/array.hpp>
|
||||
#include <boost/serialization/detail/get_data.hpp>
|
||||
#include <boost/serialization/array_wrapper.hpp>
|
||||
#include <boost/mpl/bool_fwd.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
|
||||
+4
-2
@@ -17,20 +17,22 @@
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
|
||||
bool & singleton_module::get_lock(){
|
||||
BOOST_SERIALIZATION_DECL bool & singleton_module::get_lock(){
|
||||
static bool lock = false;
|
||||
return lock;
|
||||
}
|
||||
|
||||
#if 0
|
||||
BOOST_SERIALIZATION_DECL void singleton_module::lock(){
|
||||
get_lock() = true;
|
||||
}
|
||||
BOOST_SERIALIZATION_DECL void singleton_module::unlock(){
|
||||
get_lock() = false;
|
||||
}
|
||||
BOOST_SERIALIZATION_DECL bool singleton_module::is_locked() {
|
||||
BOOST_SERIALIZATION_DECL bool singleton_module::is_locked(){
|
||||
return get_lock();
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace serialization
|
||||
} // namespace boost
|
||||
|
||||
+18
-15
@@ -4,20 +4,23 @@
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#ifdef BOOST_NO_STD_WSTREAMBUF
|
||||
#error "wide char i/o not supported on this platform"
|
||||
#else
|
||||
// #ifdef BOOST_NO_CXX11_HDR_CODECVT
|
||||
#if 1
|
||||
# define BOOST_ARCHIVE_SOURCE
|
||||
#include <boost/archive/detail/decl.hpp>
|
||||
#define BOOST_UTF8_BEGIN_NAMESPACE \
|
||||
namespace boost { namespace archive { namespace detail {
|
||||
#define BOOST_UTF8_DECL BOOST_ARCHIVE_DECL
|
||||
#define BOOST_UTF8_END_NAMESPACE }}}
|
||||
#include <boost/detail/utf8_codecvt_facet.ipp>
|
||||
#undef BOOST_UTF8_END_NAMESPACE
|
||||
#undef BOOST_UTF8_DECL
|
||||
#undef BOOST_UTF8_BEGIN_NAMESPACE
|
||||
#endif // BOOST_NO_CXX11_HDR_CODECVT
|
||||
#endif // BOOST_NO_STD_WSTREAMBUF
|
||||
#endif
|
||||
|
||||
// std::codecvt_utf8 doesn't seem to work for any versions of msvc
|
||||
#if defined(_MSC_VER) \
|
||||
|| defined( BOOST_NO_CXX11_HDR_CODECVT )
|
||||
// include boost implementation of utf8 codecvt facet
|
||||
# define BOOST_ARCHIVE_SOURCE
|
||||
#include <boost/archive/detail/decl.hpp>
|
||||
#define BOOST_UTF8_BEGIN_NAMESPACE \
|
||||
namespace boost { namespace archive { namespace detail {
|
||||
#define BOOST_UTF8_DECL BOOST_ARCHIVE_DECL
|
||||
#define BOOST_UTF8_END_NAMESPACE }}}
|
||||
#include <boost/detail/utf8_codecvt_facet.ipp>
|
||||
#undef BOOST_UTF8_END_NAMESPACE
|
||||
#undef BOOST_UTF8_DECL
|
||||
#undef BOOST_UTF8_BEGIN_NAMESPACE
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -76,8 +76,8 @@ A::operator std::size_t () const {
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(push) // Save warning settings.
|
||||
#pragma warning(disable : 4244) // Disable possible loss of data warning
|
||||
#endif
|
||||
|
||||
#endif
|
||||
A::A() :
|
||||
b(true),
|
||||
#ifndef BOOST_NO_INT64_T
|
||||
|
||||
+12
-75
@@ -20,98 +20,37 @@
|
||||
#include <cstddef> // size_t
|
||||
#include <string>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::size_t;
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#include <boost/serialization/access.hpp>
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
|
||||
#include <boost/archive/dinkumware.hpp>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
|
||||
#include <boost/preprocessor/facilities/empty.hpp>
|
||||
|
||||
#if defined(A_IMPORT)
|
||||
#define DLL_DECL BOOST_SYMBOL_IMPORT
|
||||
#define A_DLL_DECL BOOST_SYMBOL_IMPORT
|
||||
#pragma message("A imported")
|
||||
#elif defined(A_EXPORT)
|
||||
#define DLL_DECL BOOST_SYMBOL_EXPORT
|
||||
#define A_DLL_DECL BOOST_SYMBOL_EXPORT
|
||||
#pragma message ("A exported")
|
||||
#else
|
||||
#define DLL_DECL
|
||||
#define A_DLL_DECL
|
||||
#endif
|
||||
|
||||
class DLL_DECL A
|
||||
{
|
||||
class A_DLL_DECL A {
|
||||
private:
|
||||
friend class boost::serialization::access;
|
||||
// note: from an aesthetic perspective, I would much prefer to have this
|
||||
// defined out of line. Unfortunately, this trips a bug in the VC 6.0
|
||||
// compiler. So hold our nose and put it her to permit running of tests.
|
||||
// mscvc 6.0 requires template functions to be implemented. For this
|
||||
// reason we can't make abstract.
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
template<class Archive>
|
||||
void serialize(
|
||||
Archive &ar,
|
||||
const unsigned int /* file_version */
|
||||
){
|
||||
ar & BOOST_SERIALIZATION_NVP(b);
|
||||
#ifndef BOOST_NO_INT64_T
|
||||
ar & BOOST_SERIALIZATION_NVP(f);
|
||||
ar & BOOST_SERIALIZATION_NVP(g);
|
||||
#endif
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, <= 0x551 )
|
||||
int i;
|
||||
if(BOOST_DEDUCED_TYPENAME Archive::is_saving::value){
|
||||
i = l;
|
||||
ar & BOOST_SERIALIZATION_NVP(i);
|
||||
}
|
||||
else{
|
||||
ar & BOOST_SERIALIZATION_NVP(i);
|
||||
l = i;
|
||||
}
|
||||
#else
|
||||
ar & BOOST_SERIALIZATION_NVP(l);
|
||||
#endif
|
||||
ar & BOOST_SERIALIZATION_NVP(m);
|
||||
ar & BOOST_SERIALIZATION_NVP(n);
|
||||
ar & BOOST_SERIALIZATION_NVP(o);
|
||||
ar & BOOST_SERIALIZATION_NVP(p);
|
||||
ar & BOOST_SERIALIZATION_NVP(q);
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
ar & BOOST_SERIALIZATION_NVP(r);
|
||||
#endif
|
||||
ar & BOOST_SERIALIZATION_NVP(c);
|
||||
ar & BOOST_SERIALIZATION_NVP(s);
|
||||
ar & BOOST_SERIALIZATION_NVP(t);
|
||||
ar & BOOST_SERIALIZATION_NVP(u);
|
||||
ar & BOOST_SERIALIZATION_NVP(v);
|
||||
ar & BOOST_SERIALIZATION_NVP(w);
|
||||
ar & BOOST_SERIALIZATION_NVP(x);
|
||||
ar & BOOST_SERIALIZATION_NVP(y);
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
ar & BOOST_SERIALIZATION_NVP(z);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
template<class Archive>
|
||||
void serialize(
|
||||
Archive &ar,
|
||||
const unsigned int /* file_version */
|
||||
);
|
||||
#endif
|
||||
template<class Archive>
|
||||
void serialize(
|
||||
Archive &ar,
|
||||
const unsigned int /* file_version */
|
||||
);
|
||||
bool b;
|
||||
#ifndef BOOST_NO_INT64_T
|
||||
boost::int64_t f;
|
||||
@@ -152,6 +91,4 @@ public:
|
||||
friend std::ostream & operator<<(std::ostream & os, A const & a);
|
||||
};
|
||||
|
||||
#undef DLL_DECL
|
||||
|
||||
#endif // BOOST_SERIALIZATION_TEST_A_HPP
|
||||
|
||||
+1
-5
@@ -8,13 +8,11 @@
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#if ! BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
|
||||
#include <boost/archive/dinkumware.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include "A.hpp"
|
||||
|
||||
template<class Archive>
|
||||
@@ -60,5 +58,3 @@ void A::serialize(
|
||||
ar & BOOST_SERIALIZATION_NVP(z);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // workaround BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
|
||||
@@ -84,6 +84,7 @@ test-suite "serialization" :
|
||||
[ test-bsl-run_files test_list : A ]
|
||||
[ test-bsl-run_files test_list_ptrs : A ]
|
||||
[ test-bsl-run_files test_map : A ]
|
||||
[ test-bsl-run_files test_map_hashed : A : : [ requires hash ] ] # BOOST_HAS_HASH
|
||||
[ test-bsl-run_files test_map_unordered : A : : [ requires cxx11_hdr_unordered_map ] ] # BOOST_NO_CXX11_HDR_UNORDERED_MAP
|
||||
[ test-bsl-run_files test_map_boost_unordered : A ]
|
||||
[ test-bsl-run_files test_mi ]
|
||||
@@ -107,6 +108,8 @@ test-suite "serialization" :
|
||||
[ test-bsl-run_files test_set_boost_unordered : A ]
|
||||
[ test-bsl-run_files test_simple_class : A ]
|
||||
[ test-bsl-run_files test_simple_class_ptr : A ]
|
||||
[ test-bsl-run_files test_slist : A : : [ requires slist ] ] # BOOST_HAS_SLIST ]
|
||||
[ test-bsl-run_files test_slist_ptrs : A : : [ requires slist ] ] # BOOST_HAS_SLIST ] ]
|
||||
[ test-bsl-run_files test_split ]
|
||||
[ test-bsl-run_files test_stack : A ]
|
||||
[ test-bsl-run_files test_tracking ]
|
||||
|
||||
+8
-4
@@ -1,3 +1,4 @@
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// dll_a.cpp
|
||||
|
||||
@@ -20,12 +21,13 @@
|
||||
#include <boost/archive/text_iarchive.hpp>
|
||||
|
||||
template
|
||||
BOOST_SYMBOL_EXPORT void A::serialize(
|
||||
A_DLL_DECL void A::serialize(
|
||||
boost::archive::text_oarchive &ar,
|
||||
const unsigned int /* file_version */
|
||||
);
|
||||
template
|
||||
BOOST_SYMBOL_EXPORT void A::serialize(
|
||||
A_DLL_DECL
|
||||
void A::serialize(
|
||||
boost::archive::text_iarchive &ar,
|
||||
const unsigned int /* file_version */
|
||||
);
|
||||
@@ -36,12 +38,14 @@ BOOST_SYMBOL_EXPORT void A::serialize(
|
||||
#include <boost/archive/polymorphic_iarchive.hpp>
|
||||
|
||||
template
|
||||
BOOST_SYMBOL_EXPORT void A::serialize(
|
||||
A_DLL_DECL
|
||||
void A::serialize(
|
||||
boost::archive::polymorphic_oarchive &ar,
|
||||
const unsigned int /* file_version */
|
||||
);
|
||||
template
|
||||
BOOST_SYMBOL_EXPORT void A::serialize(
|
||||
A_DLL_DECL
|
||||
void A::serialize(
|
||||
boost::archive::polymorphic_iarchive &ar,
|
||||
const unsigned int /* file_version */
|
||||
);
|
||||
|
||||
@@ -10,14 +10,6 @@
|
||||
|
||||
#include <boost/serialization/export.hpp>
|
||||
|
||||
#define POLYMORPHIC_BASE_EXPORT
|
||||
#include "polymorphic_base.hpp"
|
||||
|
||||
BOOST_CLASS_EXPORT_IMPLEMENT(polymorphic_base)
|
||||
|
||||
const char * polymorphic_base::get_key() const{
|
||||
return
|
||||
boost::serialization::type_info_implementation<
|
||||
polymorphic_base
|
||||
>::type::get_const_instance().get_key();
|
||||
}
|
||||
|
||||
@@ -24,14 +24,6 @@
|
||||
#include <boost/serialization/type_info_implementation.hpp>
|
||||
#include <boost/serialization/extended_type_info_no_rtti.hpp>
|
||||
|
||||
#if defined(POLYMORPHIC_BASE_IMPORT)
|
||||
#define DLL_DECL BOOST_SYMBOL_IMPORT
|
||||
#elif defined(POLYMORPHIC_BASE_EXPORT)
|
||||
#define DLL_DECL BOOST_SYMBOL_EXPORT
|
||||
#else
|
||||
#define DLL_DECL
|
||||
#endif
|
||||
|
||||
class BOOST_SYMBOL_VISIBLE polymorphic_base
|
||||
{
|
||||
friend class boost::serialization::access;
|
||||
@@ -48,8 +40,6 @@ public:
|
||||
virtual ~polymorphic_base(){};
|
||||
};
|
||||
|
||||
#undef DLL_DECL
|
||||
|
||||
BOOST_SERIALIZATION_ASSUME_ABSTRACT(polymorphic_base)
|
||||
|
||||
// the no_rtti system requires this !!!
|
||||
|
||||
@@ -27,11 +27,15 @@ void polymorphic_derived2::serialize(
|
||||
#include <boost/archive/text_oarchive.hpp>
|
||||
#include <boost/archive/text_iarchive.hpp>
|
||||
|
||||
template BOOST_SYMBOL_EXPORT void polymorphic_derived2::serialize(
|
||||
template
|
||||
POLYMORPHIC_DERIVED2_DLL_DECL
|
||||
void polymorphic_derived2::serialize(
|
||||
boost::archive::text_oarchive & ar,
|
||||
const unsigned int version
|
||||
);
|
||||
template BOOST_SYMBOL_EXPORT void polymorphic_derived2::serialize(
|
||||
template
|
||||
POLYMORPHIC_DERIVED2_DLL_DECL
|
||||
void polymorphic_derived2::serialize(
|
||||
boost::archive::text_iarchive & ar,
|
||||
const unsigned int version
|
||||
);
|
||||
@@ -40,11 +44,15 @@ template BOOST_SYMBOL_EXPORT void polymorphic_derived2::serialize(
|
||||
#include <boost/archive/polymorphic_iarchive.hpp>
|
||||
#include <boost/archive/polymorphic_oarchive.hpp>
|
||||
|
||||
template BOOST_SYMBOL_EXPORT void polymorphic_derived2::serialize(
|
||||
template
|
||||
POLYMORPHIC_DERIVED2_DLL_DECL
|
||||
void polymorphic_derived2::serialize(
|
||||
boost::archive::polymorphic_oarchive & ar,
|
||||
const unsigned int version
|
||||
);
|
||||
template BOOST_SYMBOL_EXPORT void polymorphic_derived2::serialize(
|
||||
template
|
||||
POLYMORPHIC_DERIVED2_DLL_DECL
|
||||
void polymorphic_derived2::serialize(
|
||||
boost::archive::polymorphic_iarchive & ar,
|
||||
const unsigned int version
|
||||
);
|
||||
@@ -60,6 +68,7 @@ BOOST_CLASS_EXPORT_IMPLEMENT(polymorphic_derived2)
|
||||
BOOST_SERIALIZATION_FACTORY_0(polymorphic_derived2)
|
||||
|
||||
template
|
||||
BOOST_SYMBOL_EXPORT void polymorphic_derived2 *
|
||||
POLYMORPHIC_DERIVED2_DLL_DECL
|
||||
void polymorphic_derived2 *
|
||||
boost::serialization::factory<polymorphic_derived2, 0>(std::va_list ap);
|
||||
#endif
|
||||
|
||||
@@ -24,19 +24,19 @@
|
||||
#include <boost/serialization/type_info_implementation.hpp>
|
||||
#include <boost/serialization/extended_type_info_typeid.hpp>
|
||||
|
||||
#include <boost/preprocessor/empty.hpp>
|
||||
|
||||
#include "polymorphic_base.hpp"
|
||||
|
||||
#if defined(POLYMORPHIC_DERIVED2_IMPORT)
|
||||
#define DLL_DECL BOOST_SYMBOL_IMPORT
|
||||
#define POLYMORPHIC_DERIVED2_DLL_DECL BOOST_SYMBOL_IMPORT
|
||||
#pragma message ("polymorphic_derived2 imported")
|
||||
#elif defined(POLYMORPHIC_DERIVED2_EXPORT)
|
||||
#define DLL_DECL BOOST_SYMBOL_EXPORT
|
||||
#define POLYMORPHIC_DERIVED2_DLL_DECL BOOST_SYMBOL_EXPORT
|
||||
#pragma message ("polymorphic_derived2 exported")
|
||||
#else
|
||||
#define DLL_DECL
|
||||
#define POLYMORPHIC_DERIVED2_DLL_DECL
|
||||
#endif
|
||||
|
||||
class DLL_DECL polymorphic_derived2 :
|
||||
class POLYMORPHIC_DERIVED2_DLL_DECL polymorphic_derived2 :
|
||||
public polymorphic_base
|
||||
{
|
||||
friend class boost::serialization::access;
|
||||
@@ -63,7 +63,5 @@ BOOST_CLASS_TYPE_INFO(
|
||||
boost::serialization::extended_type_info_typeid<polymorphic_derived2>
|
||||
)
|
||||
|
||||
#undef DLL_DECL
|
||||
|
||||
#endif // POLYMORPHIC_DERIVED2_HPP
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace std{
|
||||
#include "test_tools.hpp"
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/serialization/boost_array.hpp>
|
||||
|
||||
#include "A.hpp"
|
||||
#include "A.ipp"
|
||||
|
||||
@@ -45,7 +45,6 @@ namespace std{
|
||||
#include <boost/serialization/export.hpp>
|
||||
#include <boost/serialization/access.hpp>
|
||||
|
||||
#define POLYMORPHIC_BASE_IMPORT
|
||||
#include "polymorphic_base.hpp"
|
||||
|
||||
class polymorphic_derived1 : public polymorphic_base
|
||||
@@ -67,7 +66,7 @@ BOOST_CLASS_EXPORT(polymorphic_derived1)
|
||||
// MWerks users can do this to make their code work
|
||||
BOOST_SERIALIZATION_MWERKS_BASE_AND_DERIVED(polymorphic_base, polymorphic_derived1)
|
||||
|
||||
#define POLYMORPHIC_DERIVED_IMPORT
|
||||
#define POLYMORPHIC_DERIVED2_IMPORT
|
||||
#include "polymorphic_derived2.hpp"
|
||||
|
||||
// save exported polymorphic class
|
||||
|
||||
@@ -44,89 +44,6 @@ struct ptr_equal_to {
|
||||
}
|
||||
};
|
||||
|
||||
#include <boost/serialization/list.hpp>
|
||||
void test_list(){
|
||||
const char * testfile = boost::archive::tmpnam(NULL);
|
||||
BOOST_REQUIRE(NULL != testfile);
|
||||
|
||||
std::list<A *> alist;
|
||||
{
|
||||
test_ostream os(testfile, TEST_STREAM_FLAGS);
|
||||
test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
|
||||
A * free_a_ptr = new A;
|
||||
alist.push_back(free_a_ptr);
|
||||
alist.push_back(new A);
|
||||
// verify that first element is the same as the free pointer
|
||||
BOOST_CHECK((*alist.begin()) == free_a_ptr);
|
||||
oa << boost::serialization::make_nvp("alist", alist);
|
||||
oa << boost::serialization::make_nvp("free_a_ptr", free_a_ptr);
|
||||
}
|
||||
std::list<A *> alist1;
|
||||
{
|
||||
test_istream is(testfile, TEST_STREAM_FLAGS);
|
||||
test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
|
||||
A * free_a_ptr1;
|
||||
ia >> boost::serialization::make_nvp("alist", alist1);
|
||||
ia >> boost::serialization::make_nvp("free_a_ptr", free_a_ptr1);
|
||||
BOOST_CHECK(
|
||||
alist.size() == alist1.size()
|
||||
&& std::equal(alist.begin(),alist.end(),alist1.begin(),ptr_equal_to<A *>())
|
||||
);
|
||||
// verify that first element is the same as the free pointer
|
||||
BOOST_CHECK((*alist1.begin()) == free_a_ptr1);
|
||||
}
|
||||
|
||||
std::for_each(
|
||||
alist.begin(),
|
||||
alist.end(),
|
||||
boost::checked_deleter<A>()
|
||||
);
|
||||
std::for_each(
|
||||
alist1.begin(),
|
||||
alist1.end(),
|
||||
boost::checked_deleter<A>()
|
||||
);
|
||||
std::remove(testfile);
|
||||
}
|
||||
|
||||
#ifdef BOOST_HAS_SLIST
|
||||
#include <boost/serialization/slist.hpp>
|
||||
void test_slist(){
|
||||
const char * testfile = boost::archive::tmpnam(NULL);
|
||||
BOOST_REQUIRE(NULL != testfile);
|
||||
|
||||
std::list<A *> aslist;
|
||||
{
|
||||
test_ostream os(testfile, TEST_STREAM_FLAGS);
|
||||
test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
|
||||
aslist.push_back(new A);
|
||||
aslist.push_back(new A);
|
||||
oa << boost::serialization::make_nvp("aslist", aslist);
|
||||
}
|
||||
std::list<A *> aslist1;
|
||||
{
|
||||
test_istream is(testfile, TEST_STREAM_FLAGS);
|
||||
test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
|
||||
ia >> boost::serialization::make_nvp("aslist", aslist1);
|
||||
BOOST_CHECK(aslist.size() == aslist1.size() &&
|
||||
std::equal(aslist.begin(),aslist.end(),aslist1.begin(),ptr_equal_to<A *>())
|
||||
);
|
||||
}
|
||||
std::for_each(
|
||||
aslist.begin(),
|
||||
aslist.end(),
|
||||
boost::checked_deleter<A>()
|
||||
);
|
||||
std::for_each(
|
||||
aslist1.begin(),
|
||||
aslist1.end(),
|
||||
boost::checked_deleter<A>()
|
||||
);
|
||||
std::remove(testfile);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_CXX11_HDR_FORWARD_LIST
|
||||
#include <boost/serialization/forward_list.hpp>
|
||||
void test_forward_list(){
|
||||
const char * testfile = boost::archive::tmpnam(NULL);
|
||||
@@ -146,7 +63,12 @@ void test_forward_list(){
|
||||
test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
|
||||
ia >> boost::serialization::make_nvp("aslist", aslist1);
|
||||
BOOST_CHECK(
|
||||
std::equal(aslist.begin(),aslist.end(),aslist1.begin(),ptr_equal_to<A *>())
|
||||
std::equal(
|
||||
aslist.begin(),
|
||||
aslist.end(),
|
||||
aslist1.begin(),
|
||||
ptr_equal_to<A *>()
|
||||
)
|
||||
);
|
||||
}
|
||||
std::for_each(
|
||||
@@ -161,19 +83,10 @@ void test_forward_list(){
|
||||
);
|
||||
std::remove(testfile);
|
||||
}
|
||||
#endif
|
||||
|
||||
int test_main( int /* argc */, char* /* argv */[] )
|
||||
{
|
||||
test_list();
|
||||
|
||||
#ifdef BOOST_HAS_SLIST
|
||||
test_slist();
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_CXX11_HDR_FORWARD_LIST
|
||||
test_forward_list();
|
||||
#endif
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace std{
|
||||
|
||||
struct test_dummy_out {
|
||||
template<class Archive>
|
||||
void save(Archive & ar, const unsigned int /*version*/) const {
|
||||
void save(Archive &, const unsigned int /*version*/) const {
|
||||
throw boost::archive::archive_exception(
|
||||
boost::archive::archive_exception::other_exception
|
||||
);
|
||||
|
||||
@@ -49,36 +49,9 @@ void test_list(){
|
||||
std::remove(testfile);
|
||||
}
|
||||
|
||||
#ifdef BOOST_HAS_SLIST
|
||||
#include <boost/serialization/slist.hpp>
|
||||
void test_slist(){
|
||||
const char * testfile = boost::archive::tmpnam(NULL);
|
||||
BOOST_STD_EXTENSION_NAMESPACE::slist<A> aslist;
|
||||
aslist.push_front(A());
|
||||
aslist.push_front(A());
|
||||
{
|
||||
test_ostream os(testfile, TEST_STREAM_FLAGS);
|
||||
test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
|
||||
oa << boost::serialization::make_nvp("aslist", aslist);
|
||||
}
|
||||
BOOST_STD_EXTENSION_NAMESPACE::slist<A> aslist1;{
|
||||
test_istream is(testfile, TEST_STREAM_FLAGS);
|
||||
test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
|
||||
ia >> boost::serialization::make_nvp("aslist", aslist1);
|
||||
}
|
||||
BOOST_CHECK(aslist == aslist1);
|
||||
std::remove(testfile);
|
||||
}
|
||||
#endif
|
||||
|
||||
int test_main( int /* argc */, char* /* argv */[] )
|
||||
{
|
||||
test_list();
|
||||
|
||||
#ifdef BOOST_HAS_SLIST
|
||||
test_slist();
|
||||
#endif
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -89,51 +89,9 @@ void test_list(){
|
||||
std::remove(testfile);
|
||||
}
|
||||
|
||||
#ifdef BOOST_HAS_SLIST
|
||||
#include <boost/serialization/slist.hpp>
|
||||
void test_slist(){
|
||||
const char * testfile = boost::archive::tmpnam(NULL);
|
||||
BOOST_REQUIRE(NULL != testfile);
|
||||
|
||||
std::list<A *> aslist;
|
||||
{
|
||||
test_ostream os(testfile, TEST_STREAM_FLAGS);
|
||||
test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
|
||||
aslist.push_back(new A);
|
||||
aslist.push_back(new A);
|
||||
oa << boost::serialization::make_nvp("aslist", aslist);
|
||||
}
|
||||
std::list<A *> aslist1;
|
||||
{
|
||||
test_istream is(testfile, TEST_STREAM_FLAGS);
|
||||
test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
|
||||
ia >> boost::serialization::make_nvp("aslist", aslist1);
|
||||
BOOST_CHECK(aslist.size() == aslist1.size() &&
|
||||
std::equal(aslist.begin(),aslist.end(),aslist1.begin(),ptr_equal_to<A *>())
|
||||
);
|
||||
}
|
||||
std::for_each(
|
||||
aslist.begin(),
|
||||
aslist.end(),
|
||||
boost::checked_deleter<A>()
|
||||
);
|
||||
std::for_each(
|
||||
aslist1.begin(),
|
||||
aslist1.end(),
|
||||
boost::checked_deleter<A>()
|
||||
);
|
||||
std::remove(testfile);
|
||||
}
|
||||
#endif
|
||||
|
||||
int test_main( int /* argc */, char* /* argv */[] )
|
||||
{
|
||||
test_list();
|
||||
|
||||
#ifdef BOOST_HAS_SLIST
|
||||
test_slist();
|
||||
#endif
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ namespace std{
|
||||
#include "test_tools.hpp"
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/array.hpp>
|
||||
|
||||
#include "A.hpp"
|
||||
#include "A.ipp"
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// test_list.cpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// should pass compilation and execution
|
||||
|
||||
#include <cstddef> // NULL
|
||||
#include <fstream>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <cstdio> // remove
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::remove;
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include "test_tools.hpp"
|
||||
|
||||
#include "A.hpp"
|
||||
#include "A.ipp"
|
||||
|
||||
#include <boost/serialization/slist.hpp>
|
||||
void test_slist(){
|
||||
const char * testfile = boost::archive::tmpnam(NULL);
|
||||
BOOST_STD_EXTENSION_NAMESPACE::slist<A> aslist;
|
||||
aslist.push_front(A());
|
||||
aslist.push_front(A());
|
||||
{
|
||||
test_ostream os(testfile, TEST_STREAM_FLAGS);
|
||||
test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
|
||||
oa << boost::serialization::make_nvp("aslist", aslist);
|
||||
}
|
||||
BOOST_STD_EXTENSION_NAMESPACE::slist<A> aslist1;{
|
||||
test_istream is(testfile, TEST_STREAM_FLAGS);
|
||||
test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
|
||||
ia >> boost::serialization::make_nvp("aslist", aslist1);
|
||||
}
|
||||
BOOST_CHECK(aslist == aslist1);
|
||||
std::remove(testfile);
|
||||
}
|
||||
|
||||
int test_main( int /* argc */, char* /* argv */[] )
|
||||
{
|
||||
test_slist();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
// EOF
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// test_list.cpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// should pass compilation and execution
|
||||
|
||||
#include <cstddef>
|
||||
#include <fstream>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <cstdio> // remove
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::remove;
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <boost/type_traits/is_pointer.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/checked_delete.hpp>
|
||||
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include "test_tools.hpp"
|
||||
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
|
||||
#include "A.hpp"
|
||||
#include "A.ipp"
|
||||
|
||||
template<class T>
|
||||
struct ptr_equal_to {
|
||||
BOOST_STATIC_ASSERT(::boost::is_pointer< T >::value);
|
||||
bool operator()(T const _Left, T const _Right) const
|
||||
{
|
||||
if(NULL == _Left && NULL == _Right)
|
||||
return true;
|
||||
if(typeid(*_Left) != typeid(*_Right))
|
||||
return false;
|
||||
return *_Left == *_Right;
|
||||
}
|
||||
};
|
||||
|
||||
#include <boost/serialization/slist.hpp>
|
||||
void test_slist(){
|
||||
const char * testfile = boost::archive::tmpnam(NULL);
|
||||
BOOST_REQUIRE(NULL != testfile);
|
||||
|
||||
std::list<A *> aslist;
|
||||
{
|
||||
test_ostream os(testfile, TEST_STREAM_FLAGS);
|
||||
test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
|
||||
aslist.push_back(new A);
|
||||
aslist.push_back(new A);
|
||||
oa << boost::serialization::make_nvp("aslist", aslist);
|
||||
}
|
||||
std::list<A *> aslist1;
|
||||
{
|
||||
test_istream is(testfile, TEST_STREAM_FLAGS);
|
||||
test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
|
||||
ia >> boost::serialization::make_nvp("aslist", aslist1);
|
||||
BOOST_CHECK(aslist.size() == aslist1.size() &&
|
||||
std::equal(aslist.begin(),aslist.end(),aslist1.begin(),ptr_equal_to<A *>())
|
||||
);
|
||||
}
|
||||
std::for_each(
|
||||
aslist.begin(),
|
||||
aslist.end(),
|
||||
boost::checked_deleter<A>()
|
||||
);
|
||||
std::for_each(
|
||||
aslist1.begin(),
|
||||
aslist1.end(),
|
||||
boost::checked_deleter<A>()
|
||||
);
|
||||
std::remove(testfile);
|
||||
}
|
||||
|
||||
int test_main( int /* argc */, char* /* argv */[] )
|
||||
{
|
||||
test_slist();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
// EOF
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <cstddef> // size_t
|
||||
#include <boost/config.hpp>
|
||||
#ifndef BOOST_NO_EXCEPTION_STD_NAMESPACE
|
||||
#include <exception>
|
||||
@@ -77,14 +76,12 @@ namespace boost {
|
||||
namespace archive {
|
||||
const char * test_filename(const char * dir = NULL, char *fname = NULL){
|
||||
static char ibuffer [512];
|
||||
std::size_t i;
|
||||
ibuffer[0] = '\0';
|
||||
if(NULL == dir){
|
||||
dir = boost::archive::tmpdir();
|
||||
}
|
||||
STRCPY(ibuffer, dir);
|
||||
std::strcat(ibuffer, "/");
|
||||
i = std::strlen(ibuffer);
|
||||
if(NULL == fname){
|
||||
char old_dir[256];
|
||||
_getcwd(old_dir, sizeof(old_dir) - 1);
|
||||
|
||||
Reference in New Issue
Block a user