Compare commits

..

1 Commits

Author SHA1 Message Date
Peter Dimov 9bfcdb2106 Remove explicit check for <forward_list> 2016-11-10 14:44:08 +02:00
133 changed files with 1211 additions and 2830 deletions
+47 -78
View File
@@ -1,4 +1,4 @@
# Copyright 2016, 2017 Peter Dimov
# Copyright 2016 Peter Dimov
# 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)
@@ -6,97 +6,66 @@ language: cpp
sudo: false
cache:
ccache: true
os:
- linux
- osx
branches:
only:
- master
- develop
- /feature\/.*/
env:
matrix:
- BOGUS_JOB=true
matrix:
exclude:
- env: BOGUS_JOB=true
include:
- os: linux
compiler: g++
env: TOOLSET=gcc LINK=static,shared
- os: linux
compiler: g++-5
env: TOOLSET=gcc LINK=static,shared
addons:
apt:
packages:
- g++-5
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-6
env: TOOLSET=gcc LINK=static,shared
addons:
apt:
packages:
- g++-6
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-7
env: TOOLSET=gcc LINK=static,shared
addons:
apt:
packages:
- g++-7
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: clang++
env: TOOLSET=clang LINK=static,shared
- os: linux
compiler: clang++-libc++
env: TOOLSET=clang LINK=static,shared
addons:
apt:
packages:
- libc++-dev
- os: osx
compiler: clang++
env: TOOLSET=clang LINK=static,shared
- os: osx
osx_image: xcode10
compiler: clang++
env: TOOLSET=clang LINK=static,shared
install:
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
- cd ..
- git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost-root
- git clone -b $TRAVIS_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
- cd boost-root
- git submodule update --init tools/build
- git submodule update --init libs/config
- git submodule update --init tools/boostdep
- 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 --depth 1
- cp -r $TRAVIS_BUILD_DIR/* libs/serialization
- python tools/boostdep/depinst/depinst.py serialization
- ./bootstrap.sh
- ./b2 headers
script:
- |-
echo "using $TOOLSET : : $TRAVIS_COMPILER ;" > ~/user-config.jam
- ./b2 -j 3 libs/serialization/test toolset=$TOOLSET link=${LINK:-shared}
- TOOLSET=gcc,clang
- if [ $TRAVIS_OS_NAME == osx ]; then TOOLSET=clang; fi
- ./b2 libs/serialization/test toolset=$TOOLSET
notifications:
email:
+61 -108
View File
@@ -26,7 +26,7 @@ add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
add_definitions( -ftemplate-depth=300 )
# we use gcc to test for C++03 compatibility
add_definitions( -std=c++03 )
add_definitions( std=c++03 )
message(STATUS "compiler is g++ c++03")
set(COMPILER_SUPPORTS_CXX11 FALSE)
elseif( CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" )
@@ -35,12 +35,29 @@ elseif( CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" )
set(COMPILER_SUPPORTS_CXX11 TRUE)
elseif( CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth=300")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0" )
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O3" )
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -dead_strip")
set(COMPILER_SUPPORTS_CXX11 FALSE)
set(COMPILER_SUPPORTS_CXX11 TRUE)
endif()
#
# IDE settings
#
if( CMAKE_HOST_APPLE )
# note: it seems that bjam builds both address models in any case
# so we can defer this decision to the IDE just as we do for debug/release
# so we'll not use this now
# set(Boost_ADDRESS_MODEL 64 CACHE INTEGER "32/64 bits")
set(Boost_USE_STATIC_LIBS ON CACHE BOOL "Link to Boost static libraries")
set(Boost_USE_MULTITHREADED ON)
else()
set(Boost_ADDRESS_MODEL 64 CACHE INTEGER "32/64 bits")
set(Boost_USE_STATIC_LIBS ON CACHE BOOL "Link to Boost static libraries")
set(Boost_USE_MULTITHREADED ON)
endif()
#
@@ -90,58 +107,45 @@ endif()
# end special note for Xcode
############################
#
# IDE settings
#
set(Boost_DEBUG true)
set(Boost_ADDRESS_MODEL 64 CACHE INTEGER "32/64 bits")
set(Boost_USE_STATIC_LIBS TRUE CACHE BOOL "Use static libraries")
set(Boost_USE_MULTITHREADED ON)
set(Boost_DETAILED_FAILURE_MSG true)
set(Boost_FOUND true)
get_filename_component(BOOST_ROOT "../../.." ABSOLUTE)
string(CONCAT boost_headers ${BOOST_ROOT} "/boost")
if(NOT IS_DIRECTORY ${boost_headers})
message(FATAL_ERROR "BOOST_ROOT not found")
find_package(Boost REQUIRED COMPONENTS system filesystem)
message(STATUS "Boost_FOUND is ${Boost_FOUND}")
if(Boost_FOUND)
message(STATUS "Boost Found!")
message(STATUS "Boost is ${BOOST_ROOT}")
message(STATUS "Boost directories found at ${Boost_INCLUDE_DIRS}")
message(STATUS "Boost libraries found at ${Boost_LIBRARY_DIRS}")
message(STATUS "Boost libraries prefix is ${Boost_LIB_PREFIX}")
message(STATUS "Boost component libraries to be linked are ${Boost_LIBRARIES}")
message(STATUS "Boost version found is ${Boost_VERSION}")
#include_directories("../include" "${Boost_INCLUDE_DIRS}")
#link_directories("${Boost_LIBRARY_DIRS}")
else()
message(STATUS "BOOST_ROOT is ${BOOST_ROOT}")
message(STATUS "Boost NOT Found!")
endif()
if(Boost_USE_STATIC_LIBS)
message(STATUS "Link to Boost static libraries")
set(BUILD_SHARED_LIBS NO)
string(CONCAT boost_stage ${BOOST_ROOT} "/stage/Debug/static")
message(STATUS "Use static libraries")
set(LINK_TYPE "STATIC")
else()
message(STATUS "Link to Boost shared libraries")
set(BUILD_SHARED_LIBS YES)
message(STATUS "Building shared libraries")
set(LINK_TYPE "SHARED")
add_definitions( "-DBOOST_ALL_DYN_LINK=1")
add_definitions( "-DBOOST_ALL_NO_LIB=1")
add_definitions( "-DBOOST_LIB_DIAGNOSTICS=1")
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(VISIBILITY_INLINES_HIDDEN YES)
string(CONCAT boost_stage ${BOOST_ROOT} "/stage/Debug/shared")
set(VISIBILITY_INLINES_HIDDEN)
endif()
include(CheckIncludeFileCXX)
message(STATUS "Boost directories found at ${boost_headers}")
message(STATUS "Boost libraries found at ${boost_stage}")
set(CMAKE_LIBRARY_PATH ${boost_stage})
# list of archive names for which tests should be generated
#set(archive_list text_archive text_warchive binary_archive xml_archive xml_warchive)
set(archive_list text_archive)
# list of tests generated by each function call
set(test_list)
include_directories(BEFORE ${BOOST_ROOT})
###########################
# library builds
add_library(serialization
add_library(serialization ${LINK_TYPE}
../src/archive_exception.cpp
../src/basic_archive.cpp
../src/basic_iarchive.cpp
@@ -161,8 +165,7 @@ add_library(serialization
../src/extended_type_info.cpp
../src/polymorphic_iarchive.cpp
../src/polymorphic_oarchive.cpp
../src/polymorphic_text_iarchive.cpp
../src/polymorphic_text_oarchive.cpp
../src/singleton.cpp
../src/stl_port.cpp
../src/text_iarchive.cpp
../src/text_oarchive.cpp
@@ -175,7 +178,7 @@ add_library(serialization
../src/basic_xml_grammar.ipp # doesn't show up in "Source Files" in Xcode"'
)
add_library(wserialization
add_library(wserialization ${LINK_TYPE}
../src/codecvt_null.cpp
../src/basic_text_wiprimitive.cpp
../src/basic_text_woprimitive.cpp
@@ -187,18 +190,9 @@ add_library(wserialization
../src/basic_xml_grammar.ipp # doesn't show up in "Source Files" in Xcode"'
)
set_property(TARGET wserialization PROPERTY LINK_LIBRARIES serialization)
# end library build
###########################
add_library(filesystem SHARED IMPORTED GLOBAL ) # or STATIC instead of SHARED
set_target_properties(filesystem PROPERTIES
IMPORTED_LOCATION "${CMAKE_LIBRARY_PATH}/libboost_filesystem-clang-darwin-mt-d-x64-1_69.dylib"
)
get_property(loc TARGET filesystem PROPERTY LOCATION)
message(STATUS "filesystem library located at:${loc}")
###########################
# test targets
@@ -209,73 +203,56 @@ function( serialization_test test_name)
endforeach()
message(STATUS ${test_name})
add_executable( ${test_name} ../test/${test_name}.cpp ${arglist} )
target_link_libraries(${test_name} serialization wserialization filesystem)
target_link_libraries(${test_name} serialization wserialization ${Boost_LIBRARIES})
add_test( ${test_name} ${test_name} )
endfunction(serialization_test)
function(archive_test test_name)
set(test_list)
set(arglist)
foreach(a IN ITEMS ${ARGN} )
set(arglist ${arglist} ../test/${a}.cpp)
endforeach()
foreach(
archive-name
IN ITEMS ${archive_list}
IN ITEMS text_archive text_warchive binary_archive xml_archive xml_warchive
)
set(amended_test_name ${test_name}_${archive-name})
message(STATUS ${amended_test_name})
add_executable(${amended_test_name} ../test/${test_name}.cpp ${arglist})
set_property(
TARGET ${amended_test_name}
PROPERTY COMPILE_DEFINITIONS BOOST_ARCHIVE_TEST=${archive-name}.hpp
)
message(STATUS ${amended_test_name} " " ${arglist} " " ${archive-name})
target_link_libraries(${amended_test_name} serialization wserialization filesystem)
target_link_libraries(${amended_test_name} serialization wserialization ${Boost_LIBRARIES})
add_test(${amended_test_name} ${amended_test_name})
set(test_list ${test_list} ${amended_test_name} PARENT_SCOPE)
endforeach()
endfunction(archive_test)
function(polymorphic_archive_test test_name)
set(test_list)
set(arglist)
foreach(a IN ITEMS ${ARGN} )
set(arglist ${arglist} ../test/${a}.cpp)
endforeach()
foreach(
archive-name
IN ITEMS ${archive_list}
IN ITEMS text_archive text_warchive binary_archive xml_archive xml_warchive
)
set(amended_archive_name polymorphic_${archive-name})
set(amended_test_name ${test_name}_${amended_archive_name})
set(amended_test_name ${test_name}_polymorphic_${archive-name})
message(STATUS ${amended_test_name})
add_executable(${amended_test_name} ../test/${test_name}.cpp ${arglist})
set_property(
TARGET ${amended_test_name}
PROPERTY COMPILE_DEFINITIONS BOOST_ARCHIVE_TEST=${amended_archive_name}.hpp
PROPERTY COMPILE_DEFINITIONS BOOST_ARCHIVE_TEST=polymorphic_${archive-name}.hpp
)
message(STATUS ${amended_test_name} " " ${arglist} " " ${amended_archive_name})
target_link_libraries(${amended_test_name} serialization wserialization filesystem)
target_link_libraries(${amended_test_name} serialization wserialization ${Boost_LIBRARIES})
add_test(${amended_test_name} ${amended_test_name})
set(test_list ${test_list} ${amended_test_name} PARENT_SCOPE)
endforeach()
endfunction(polymorphic_archive_test)
enable_testing()
message(STATUS dll_a)
add_library(dll_a SHARED ../test/dll_a.cpp)
target_link_libraries(dll_a serialization)
serialization_test(test_dll_simple)
target_link_libraries(test_dll_simple dll_a serialization)
message(STATUS dll_polymorphic_base)
add_library(dll_polymorphic_base SHARED ../test/polymorphic_base.cpp)
target_link_libraries(dll_polymorphic_base serialization)
message(STATUS dll_polymorphic_derived2)
add_library(dll_polymorphic_derived2 SHARED ../test/polymorphic_derived2.cpp)
target_link_libraries(dll_polymorphic_derived2 dll_polymorphic_base serialization)
# serialization(test_dll_exported dll_polymorphic_derived2_lib)
# serialization(test_dll_simple dll_a_lib)
# compile test_dll_plugin.cpp
# Running the following test requires that the test know the directory
# in which the dll is stored. I don't know how to extract this from bjam
@@ -288,13 +265,9 @@ serialization_test(test_mult_archive_types)
serialization_test(test_iterators)
serialization_test(test_iterators_base64)
serialization_test(test_inclusion)
serialization_test(test_inclusion2)
serialization_test(test_smart_cast)
serialization_test(test_codecvt_null ../src/codecvt_null)
serialization_test(test_strong_typedef)
serialization_test(test_singleton)
serialization_test(test_singleton_inherited)
serialization_test(test_singleton_plain)
archive_test(test_native_array A)
archive_test(test_boost_array A)
@@ -314,6 +287,7 @@ archive_test(test_derived)
archive_test(test_derived_class A)
archive_test(test_diamond)
archive_test(test_diamond_complex)
archive_test(test_exported polymorphic_base)
archive_test(test_forward_list A)
archive_test(test_forward_list_ptrs A)
archive_test(test_helper_support)
@@ -325,6 +299,7 @@ archive_test(test_map_boost_unordered A)
archive_test(test_mi)
archive_test(test_multiple_ptrs A)
archive_test(test_multiple_inheritance)
archive_test(test_no_rtti polymorphic_base polymorphic_derived1)
archive_test(test_new_operator A)
archive_test(test_non_intrusive)
archive_test(test_non_default_ctor)
@@ -345,14 +320,6 @@ 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)
@@ -366,28 +333,14 @@ archive_test(test_set_boost_unordered A)
if(COMPILER_SUPPORTS_CXX11)
archive_test(test_set_unordered A)
else()
CHECK_INCLUDE_FILE_CXX(hash_set HASH_SET_FOUND)
if(HASH_SET_FOUND)
archive_test(test_set_hashed A)
endif()
archive_test(test_set_hashed A)
endif()
if(COMPILER_SUPPORTS_CXX11)
archive_test(test_map_unordered A)
else()
CHECK_INCLUDE_FILE_CXX(hash_map HASH_MAP_FOUND)
if(HASH_MAP_FOUND)
archive_test(test_map_hashed A)
endif()
archive_test(test_map_hashed A)
endif()
polymorphic_archive_test(test_dll_exported polymorphic_derived1)
foreach(test_name IN ITEMS ${test_list} )
target_link_libraries(${test_name} dll_polymorphic_derived2 dll_polymorphic_base)
message(STATUS " " target_link_libraries " " dll_polymorphic_derived2 " " dll_polymorphic_base)
endforeach()
polymorphic_archive_test(test_no_rtti polymorphic_base polymorphic_derived1 polymorphic_derived2)
polymorphic_archive_test(test_exported polymorphic_base polymorphic_derived1 polymorphic_derived2)
polymorphic_archive_test(test_polymorphic test_polymorphic_A A)
polymorphic_archive_test(test_polymorphic2 test_polymorphic2imp)
polymorphic_archive_test(test_polymorphic_helper)
@@ -398,7 +351,7 @@ polymorphic_archive_test(test_polymorphic_helper)
####################
# add headers in IDE
# for serialization
# for serialisation
file(GLOB x
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
-80
View File
@@ -1,80 +0,0 @@
# 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
environment:
matrix:
- BUILD_TOOLSET: gcc
BUILD_LINK: static
- BUILD_TOOLSET: gcc
BUILD_LINK: shared
- BUILD_TOOLSET: msvc-14.0
BUILD_LINK: static
- BUILD_TOOLSET: msvc-14.0
BUILD_LINK: shared
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/container_hash
- 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 libs/winapi
- git submodule init tools/build
- git submodule update
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\serialization
- set PATH=C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin;%CD%;%PATH%
- bootstrap gcc
- b2 headers
build: off
test_script:
- cd libs/serialization/test
- b2 -j2 toolset=%BUILD_TOOLSET% link=%BUILD_LINK%
+2 -11
View File
@@ -74,12 +74,6 @@ SOURCES =
stl_port
text_iarchive
text_oarchive
polymorphic_text_iarchive
polymorphic_text_oarchive
polymorphic_binary_iarchive
polymorphic_binary_oarchive
polymorphic_xml_iarchive
polymorphic_xml_oarchive
void_cast
archive_exception
xml_grammar
@@ -88,20 +82,17 @@ SOURCES =
xml_archive_exception
codecvt_null
utf8_codecvt_facet
;
singleton
;
WSOURCES =
basic_text_wiprimitive
basic_text_woprimitive
text_wiarchive
text_woarchive
polymorphic_text_wiarchive
polymorphic_text_woarchive
xml_wgrammar
xml_wiarchive
xml_woarchive
polymorphic_xml_wiarchive
polymorphic_xml_woarchive
;
lib boost_serialization
+1 -1
View File
@@ -267,7 +267,7 @@ EXCEPT for one special case.
To make this work, the following should be included after the archive
class definition.
<pre><code>
BOOST_SERIALIZATION_REGISTER_ARCHIVE(Archive)
#define BOOST_SERIALIZATION_REGISTER_ARCHIVE(Archive)
</code></pre>
Failure to do this will not inhibit the program from compiling, linking
and executing properly - except in one case. If an instance of a derived
+1 -1
View File
@@ -292,7 +292,7 @@ included in the code module containing the serialization code.
</code></pre>
All of these archives implement the same interface. Hence, it should suffice to describe only one
All of these archives implement the same inteface. Hence, it should suffice to describe only one
of them in detail. For this purpose we will use the text archive.
+2 -2
View File
@@ -568,10 +568,10 @@ void myclass::serialize(Archive & ar, const unsigned int version){
...
}
BOOST_CLASS_EXPORT_IMPLEMENT(my_class)
BOOST_EXPORT_CLASS_IMPLEMENT(my_class)
#include &lt;boost/archive/text_oarchive&gt;
#include &lt;boost/archive/text_iarchive&gt;
#include &lt;boost/archive/text_iarchive&lt;
template myclass::serialize(boost::archive::text_oarchive & ar, const unsigned int version);
template myclass::serialize(boost::archive::text_iarchive & ar, const unsigned int version);
... // repeat for each archive class to be used.
+5 -8
View File
@@ -127,11 +127,11 @@ public:
}
// used for text output
operator base_type () const {
operator int () const {
return t;
}
// used for text input
operator base_type &() {
operator int_least16_t &() {
return t;
}
bool operator==(const class_id_type & rhs) const {
@@ -151,10 +151,7 @@ private:
public:
object_id_type(): t(0) {};
// note: presumes that size_t >= unsigned int.
// use explicit cast to silence useless warning
explicit object_id_type(const std::size_t & t_) : t(static_cast<base_type>(t_)){
// make quadriple sure that we haven't lost any real integer
// precision
explicit object_id_type(const std::size_t & t_) : t(t_){
BOOST_ASSERT(t_ <= boost::integer_traits<base_type>::const_max);
}
object_id_type(const object_id_type & t_) :
@@ -165,11 +162,11 @@ public:
return *this;
}
// used for text output
operator base_type () const {
operator uint_least32_t () const {
return t;
}
// used for text input
operator base_type & () {
operator uint_least32_t & () {
return t;
}
bool operator==(const object_id_type & rhs) const {
@@ -102,32 +102,20 @@ protected:
}
void load_override(class_id_type & t){
library_version_type lvt = this->get_library_version();
/*
* library versions:
* boost 1.39 -> 5
* boost 1.43 -> 7
* boost 1.47 -> 9
*
*
* 1) in boost 1.43 and inferior, class_id_type is always a 16bit value, with no check on the library version
* --> this means all archives with version v <= 7 are written with a 16bit class_id_type
* 2) in boost 1.44 this load_override has disappeared (and thus boost 1.44 is not backward compatible at all !!)
* 3) recent boosts reintroduced load_override with a test on the version :
* - v > 7 : this->detail_common_iarchive::load_override(t, version)
* - v > 6 : 16bit
* - other : 32bit
* --> which is obviously incorrect, see point 1
*
* the fix here decodes class_id_type on 16bit for all v <= 7, which seems to be the correct behaviour ...
*/
if(boost::archive::library_version_type(7) < lvt){
this->detail_common_iarchive::load_override(t);
}
else{
else
if(boost::archive::library_version_type(6) < lvt){
int_least16_t x=0;
* this->This() >> x;
t = boost::archive::class_id_type(x);
}
else{
int x=0;
* this->This() >> x;
t = boost::archive::class_id_type(x);
}
}
void load_override(class_id_reference_type & t){
load_override(static_cast<class_id_type &>(t));
@@ -50,7 +50,7 @@ namespace std{
//#include <boost/mpl/placeholders.hpp>
#include <boost/serialization/is_bitwise_serializable.hpp>
#include <boost/serialization/array_wrapper.hpp>
#include <boost/serialization/array.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_wrapper.hpp>
#include <boost/serialization/array.hpp>
#include <boost/archive/basic_streambuf_locale_saver.hpp>
#include <boost/archive/codecvt_null.hpp>
@@ -21,7 +21,7 @@
//
// note the fact that on libraries without wide characters, ostream is
// is not a specialization of basic_ostream which in fact is not defined
// in such cases. So we can't use basic_istream<IStream::char_type> but rather
// in such cases. So we can't use basic_ostream<IStream::char_type> but rather
// use two template parameters
#include <boost/config.hpp>
+2 -1
View File
@@ -89,7 +89,8 @@ protected:
// leaving the archive in an undetermined state
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
load_override(class_id_type & t);
void load_override(class_id_optional_type & /* t */){}
BOOST_ARCHIVE_OR_WARCHIVE_DECL 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
+4 -8
View File
@@ -18,11 +18,8 @@
#include <locale>
#include <cstddef> // NULL, size_t
#ifndef BOOST_NO_CWCHAR
#include <cwchar> // for mbstate_t
#endif
#include <boost/config.hpp>
#include <boost/serialization/force_include.hpp>
#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
@@ -63,10 +60,9 @@ public:
};
template<>
class BOOST_WARCHIVE_DECL codecvt_null<wchar_t> :
public std::codecvt<wchar_t, char, std::mbstate_t>
class BOOST_SYMBOL_VISIBLE codecvt_null<wchar_t> : public std::codecvt<wchar_t, char, std::mbstate_t>
{
virtual std::codecvt_base::result
virtual BOOST_WARCHIVE_DECL std::codecvt_base::result
do_out(
std::mbstate_t & state,
const wchar_t * first1,
@@ -76,7 +72,7 @@ class BOOST_WARCHIVE_DECL codecvt_null<wchar_t> :
char * last2,
char * & next2
) const;
virtual std::codecvt_base::result
virtual BOOST_WARCHIVE_DECL std::codecvt_base::result
do_in(
std::mbstate_t & state,
const char * first1,
@@ -96,7 +92,7 @@ public:
explicit codecvt_null(std::size_t no_locale_manage = 0) :
std::codecvt<wchar_t, char, std::mbstate_t>(no_locale_manage)
{}
//virtual ~codecvt_null(){};
virtual ~codecvt_null(){};
};
} // namespace archive
@@ -35,12 +35,11 @@ class extended_type_info;
// note: referred to as Curiously Recurring Template Patter (CRTP)
template<class Archive>
class BOOST_SYMBOL_VISIBLE common_iarchive :
class BOOST_SYMBOL_VISIBLE common_iarchive :
public basic_iarchive,
public interface_iarchive<Archive>
{
friend class interface_iarchive<Archive>;
friend class basic_iarchive;
private:
virtual void vload(version_type & t){
* this->This() >> t;
@@ -38,7 +38,6 @@ class BOOST_SYMBOL_VISIBLE common_oarchive :
public interface_oarchive<Archive>
{
friend class interface_oarchive<Archive>;
friend class basic_oarchive;
private:
virtual void vsave(const version_type t){
* this->This() << t;
+18 -17
View File
@@ -57,10 +57,11 @@ namespace std{
#include <boost/serialization/assume_abstract.hpp>
#if !defined(BOOST_MSVC) && \
(BOOST_WORKAROUND(__IBMCPP__, < 1210) || \
defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x590))
#define DONT_USE_HAS_NEW_OPERATOR 1
#ifndef BOOST_MSVC
#define DONT_USE_HAS_NEW_OPERATOR ( \
BOOST_WORKAROUND(__IBMCPP__, < 1210) \
|| defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x590) \
)
#else
#define DONT_USE_HAS_NEW_OPERATOR 0
#endif
@@ -76,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>
@@ -89,8 +90,6 @@ namespace std{
#include <boost/archive/detail/archive_serializer_map.hpp>
#include <boost/archive/detail/check.hpp>
#include <boost/core/addressof.hpp>
namespace boost {
namespace serialization {
@@ -123,7 +122,8 @@ private:
virtual void destroy(/*const*/ void *address) const {
boost::serialization::access::destroy(static_cast<T *>(address));
}
public:
protected:
// protected constructor since it's always created by singleton
explicit iserializer() :
basic_iserializer(
boost::serialization::singleton<
@@ -132,6 +132,7 @@ public:
>::get_const_instance()
)
{}
public:
virtual BOOST_DLLEXPORT void load_object_data(
basic_iarchive & ar,
void *x,
@@ -233,7 +234,7 @@ struct heap_allocation {
// that the class might have class specific new with NO
// class specific delete at all. Patches (compatible with
// C++03) welcome!
(operator delete)(t);
delete t;
}
};
struct doesnt_have_new_operator {
@@ -242,7 +243,7 @@ struct heap_allocation {
}
static void invoke_delete(T * t) {
// Note: I'm reliance upon automatic conversion from T * to void * here
(operator delete)(t);
delete t;
}
};
static T * invoke_new() {
@@ -305,7 +306,7 @@ private:
void * x,
const unsigned int file_version
) const BOOST_USED;
public:
protected:
// this should alway be a singleton so make the constructor protected
pointer_iserializer();
~pointer_iserializer();
@@ -405,7 +406,7 @@ struct load_non_pointer_type {
struct load_standard {
template<class T>
static void invoke(Archive &ar, const T & t){
void * x = boost::addressof(const_cast<T &>(t));
void * x = & const_cast<T &>(t);
ar.load_object(
x,
boost::serialization::singleton<
@@ -483,7 +484,7 @@ struct load_pointer_type {
};
template<class T>
static const basic_pointer_iserializer * register_type(Archive &ar, const T* const /*t*/){
static const basic_pointer_iserializer * register_type(Archive &ar, const T & /*t*/){
// there should never be any need to load an abstract polymorphic
// class pointer. Inhibiting code generation for this
// permits abstract base classes to be used - note: exception
@@ -522,7 +523,7 @@ struct load_pointer_type {
}
template<class T>
static void check_load(T * const /* t */){
static void check_load(T & /* t */){
check_pointer_level< T >();
check_pointer_tracking< T >();
}
@@ -536,8 +537,8 @@ struct load_pointer_type {
template<class Tptr>
static void invoke(Archive & ar, Tptr & t){
check_load(t);
const basic_pointer_iserializer * bpis_ptr = register_type(ar, t);
check_load(*t);
const basic_pointer_iserializer * bpis_ptr = register_type(ar, *t);
const basic_pointer_iserializer * newbpis_ptr = ar.load_pointer(
// note major hack here !!!
// I tried every way to convert Tptr &t (where Tptr might
@@ -604,7 +605,7 @@ template<class Archive, class T>
inline void load(Archive & ar, T &t){
// if this assertion trips. It means we're trying to load a
// const object with a compiler that doesn't have correct
// function template ordering. On other compilers, this is
// funtion template ordering. On other compilers, this is
// handled below.
detail::check_const_loading< T >();
typedef
+5 -11
View File
@@ -26,7 +26,6 @@
#include <cstddef> // NULL
#include <boost/config.hpp>
#include <boost/static_assert.hpp>
#include <boost/detail/workaround.hpp>
@@ -57,9 +56,8 @@
#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>
@@ -69,8 +67,6 @@
#include <boost/archive/detail/archive_serializer_map.hpp>
#include <boost/archive/detail/check.hpp>
#include <boost/core/addressof.hpp>
namespace boost {
namespace serialization {
@@ -256,7 +252,7 @@ struct save_non_pointer_type {
template<class T>
static void invoke(Archive &ar, const T & t){
ar.save_object(
boost::addressof(t),
& t,
boost::serialization::singleton<
oserializer<Archive, T>
>::get_const_instance()
@@ -264,8 +260,6 @@ struct save_non_pointer_type {
}
};
// adds class information to the archive. This includes
// serialization level and class version
struct save_conditional {
@@ -343,7 +337,7 @@ struct save_pointer_type {
};
template<class T>
static const basic_pointer_oserializer * register_type(Archive &ar, T* const /*t*/){
static const basic_pointer_oserializer * register_type(Archive &ar, T & /*t*/){
// there should never be any need to save an abstract polymorphic
// class pointer. Inhibiting code generation for this
// permits abstract base classes to be used - note: exception
@@ -410,7 +404,7 @@ struct save_pointer_type {
// if its not a pointer to a more derived type
const void *vp = static_cast<const void *>(&t);
if(*this_type == *true_type){
const basic_pointer_oserializer * bpos = register_type(ar, &t);
const basic_pointer_oserializer * bpos = register_type(ar, t);
ar.save_pointer(vp, bpos);
return;
}
@@ -469,7 +463,7 @@ struct save_pointer_type {
template<class TPtr>
static void invoke(Archive &ar, const TPtr t){
register_type(ar, t);
register_type(ar, * t);
if(NULL == t){
basic_oarchive & boa
= boost::serialization::smart_cast_reference<basic_oarchive &>(ar);
@@ -9,21 +9,26 @@
#include <boost/config.hpp>
#ifdef BOOST_NO_STD_WSTREAMBUF
#error "wide char i/o not supported on this platform"
#endif
// std::codecvt_utf8 doesn't seem to work for msvc
// versions prior to MSVC 14.0
// use boost's utf8 codecvt facet
#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 }}}
#if defined(_MSC_VER) && _MSC_VER < 1900 \
|| defined( BOOST_NO_CXX11_HDR_CODECVT )
#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.hpp>
#undef BOOST_UTF8_END_NAMESPACE
#undef BOOST_UTF8_DECL
#undef BOOST_UTF8_BEGIN_NAMESPACE
#include <boost/detail/utf8_codecvt_facet.hpp>
#undef BOOST_UTF8_END_NAMESPACE
#undef BOOST_UTF8_DECL
#undef BOOST_UTF8_BEGIN_NAMESPACE
#else
#include <codecvt>
namespace boost { namespace archive { namespace detail {
typedef std::codecvt_utf8<wchar_t> utf8_codecvt_facet;
} } }
#endif // BOOST_NO_CXX11_HDR_CODECVT
#endif // BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP
@@ -47,10 +47,6 @@ archive_serializer_map<Archive>::insert(const basic_serializer * bs){
template<class Archive>
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
archive_serializer_map<Archive>::erase(const basic_serializer * bs){
// note: previously this conditional was a runtime assertion with
// BOOST_ASSERT. We've changed it because we've discovered that at
// least one platform is not guaranteed to destroy singletons in
// reverse order of distruction.
if(boost::serialization::singleton<
extra_detail::map<Archive>
>::is_destroyed())
@@ -84,8 +84,6 @@ basic_binary_iprimitive<Archive, Elem, Tr>::init()
);
}
#ifndef BOOST_NO_CWCHAR
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
template<class Archive, class Elem, class Tr>
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
basic_binary_iprimitive<Archive, Elem, Tr>::load(wchar_t * ws)
@@ -95,8 +93,6 @@ basic_binary_iprimitive<Archive, Elem, Tr>::load(wchar_t * ws)
load_binary(ws, l * sizeof(wchar_t) / sizeof(char));
ws[l] = L'\0';
}
#endif
#endif
template<class Archive, class Elem, class Tr>
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
@@ -114,6 +110,7 @@ basic_binary_iprimitive<Archive, Elem, Tr>::load(std::string & s)
load_binary(&(*s.begin()), l);
}
#ifndef BOOST_NO_CWCHAR
template<class Archive, class Elem, class Tr>
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
basic_binary_iprimitive<Archive, Elem, Tr>::load(char * s)
@@ -123,6 +120,7 @@ basic_binary_iprimitive<Archive, Elem, Tr>::load(char * s)
load_binary(s, l);
s[l] = '\0';
}
#endif
#ifndef BOOST_NO_STD_WSTRING
template<class Archive, class Elem, class Tr>
@@ -71,7 +71,6 @@ basic_binary_oprimitive<Archive, Elem, Tr>::save(const std::string &s)
}
#ifndef BOOST_NO_CWCHAR
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
template<class Archive, class Elem, class Tr>
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
basic_binary_oprimitive<Archive, Elem, Tr>::save(const wchar_t * ws)
@@ -92,7 +91,6 @@ basic_binary_oprimitive<Archive, Elem, Tr>::save(const std::wstring &ws)
save_binary(ws.data(), l * sizeof(wchar_t) / sizeof(char));
}
#endif
#endif // BOOST_NO_CWCHAR
template<class Archive, class Elem, class Tr>
BOOST_ARCHIVE_OR_WARCHIVE_DECL
@@ -64,7 +64,7 @@ namespace archive {
// XML grammar parsing
template<class CharType>
class BOOST_SYMBOL_VISIBLE basic_xml_grammar {
class basic_xml_grammar {
public:
// The following is not necessary according to DR45, but at least
// one compiler (Compaq C++ 6.5 in strict_ansi mode) chokes otherwise.
@@ -56,7 +56,7 @@ text_wiarchive_impl<Archive>::load(std::string &s)
s.resize(0);
s.reserve(size);
while(size-- > 0){
char x = is.narrow(is.get(), '\0');
int x = is.narrow(is.get(), '\0');
s += x;
}
}
@@ -161,13 +161,13 @@ xml_wiarchive_impl<Archive>::xml_wiarchive_impl(
gimpl(new xml_wgrammar())
{
if(0 == (flags & no_codecvt)){
archive_locale = std::locale(
std::locale l = std::locale(
is_.getloc(),
new boost::archive::detail::utf8_codecvt_facet
);
// libstdc++ crashes without this
is_.sync();
is_.imbue(archive_locale);
is_.imbue(l);
}
if(0 == (flags & no_header))
init();
@@ -17,9 +17,7 @@
#include <cstring> // strlen
#include <cstdlib> // mbtowc
#ifndef BOOST_NO_CWCHAR
#include <cwchar> // wcslen
#endif
#include <boost/config.hpp>
#if defined(BOOST_NO_STDC_NAMESPACE)
@@ -103,6 +101,7 @@ xml_woarchive_impl<Archive>::save(const char * s){
template<class Archive>
BOOST_WARCHIVE_DECL void
xml_woarchive_impl<Archive>::save(const wchar_t * ws){
os << ws;
typedef iterators::xml_escape<const wchar_t *> xmbtows;
std::copy(
xmbtows(ws),
@@ -125,12 +124,12 @@ xml_woarchive_impl<Archive>::xml_woarchive_impl(
basic_xml_oarchive<Archive>(flags)
{
if(0 == (flags & no_codecvt)){
archive_locale = std::locale(
std::locale l = std::locale(
os_.getloc(),
new boost::archive::detail::utf8_codecvt_facet
);
os_.flush();
os_.imbue(archive_locale);
os_.imbue(l);
}
if(0 == (flags & no_header))
this->init();
@@ -142,7 +141,7 @@ xml_woarchive_impl<Archive>::~xml_woarchive_impl(){
if(std::uncaught_exception())
return;
if(0 == (this->get_flags() & no_header)){
os << L"</boost_serialization>";
save(L"</boost_serialization>\n");
}
}
@@ -41,7 +41,7 @@ template<class CharType>
struct from_6_bit {
typedef CharType result_type;
CharType operator()(CharType t) const{
static const char * lookup_table =
const char * lookup_table =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789"
@@ -37,7 +37,7 @@ template<class CharType>
struct to_6_bit {
typedef CharType result_type;
CharType operator()(CharType t) const{
static const signed char lookup_table[] = {
const signed char lookup_table[] = {
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,
+1 -2
View File
@@ -102,8 +102,7 @@ public:
super_t(base),
m_bnext(NULL),
m_bend(NULL),
m_full(false),
m_current_value(0)
m_full(false)
{
}
};
@@ -56,7 +56,7 @@ class istream_iterator :
//Access the value referred to
Elem dereference() const {
return static_cast<Elem>(m_istream->peek());
return m_istream->peek();
}
void increment(){
@@ -75,14 +75,14 @@ public:
}
istream_iterator() :
m_istream(NULL),
m_current_value(NULL)
m_istream(NULL)
{}
istream_iterator(const istream_iterator<Elem> & rhs) :
m_istream(rhs.m_istream),
m_current_value(rhs.m_current_value)
{}
};
} // namespace iterators
@@ -18,16 +18,14 @@
#include <boost/assert.hpp>
#include <cstddef> // size_t
#ifndef BOOST_NO_CWCHAR
#include <cwchar> // mbstate_t
#endif
#include <boost/config.hpp>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::mbstate_t;
} // namespace std
#endif
#include <boost/archive/detail/utf8_codecvt_facet.hpp>
#include <boost/iterator/iterator_adaptor.hpp>
@@ -86,15 +84,12 @@ class mb_from_wchar
wchar_t value = * this->base_reference();
const wchar_t *wend;
char *bend;
BOOST_VERIFY(
m_codecvt_facet.out(
m_mbs,
& value, & value + 1, wend,
m_buffer, m_buffer + sizeof(m_buffer), bend
)
==
std::codecvt_base::ok
std::codecvt_base::result r = m_codecvt_facet.out(
m_mbs,
& value, & value + 1, wend,
m_buffer, m_buffer + sizeof(m_buffer), bend
);
BOOST_ASSERT(std::codecvt_base::ok == r);
m_bnext = 0;
m_bend = bend - m_buffer;
}
@@ -111,7 +111,6 @@ public:
transform_width(T start) :
super_t(Base(static_cast< T >(start))),
m_buffer_out_full(false),
m_buffer_out(0),
// To disable GCC warning, but not truly necessary
//(m_buffer_in will be initialized later before being
//used because m_remaining_bits == 0)
@@ -19,9 +19,7 @@
#include <boost/assert.hpp>
#include <cctype>
#include <cstddef> // size_t
#ifndef BOOST_NO_CWCHAR
#include <cwchar> // mbstate_t
#endif
#include <algorithm> // copy
#include <boost/config.hpp>
@@ -16,8 +16,6 @@
// See http://www.boost.org for updates, documentation, and revision history.
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/assert.hpp>
#include <boost/serialization/throw_exception.hpp>
@@ -44,11 +42,11 @@ class xml_unescape
return unescape<xml_unescape<Base>, Base>::dereference();
}
public:
// msvc versions prior to 14.0 crash with and ICE
#if BOOST_WORKAROUND(BOOST_MSVC, < 1900)
// workaround msvc 7.1 ICU crash
#if defined(BOOST_MSVC)
typedef int value_type;
#else
typedef typename super_t::value_type value_type;
typedef typename this_t::value_type value_type;
#endif
void drain_residue(const char *literal);
@@ -28,7 +28,7 @@
namespace boost {
namespace archive {
class BOOST_SYMBOL_VISIBLE polymorphic_binary_iarchive :
class polymorphic_binary_iarchive :
public detail::polymorphic_iarchive_route<binary_iarchive>
{
public:
@@ -23,15 +23,13 @@
namespace boost {
namespace archive {
class BOOST_SYMBOL_VISIBLE polymorphic_binary_oarchive :
public detail::polymorphic_oarchive_route<binary_oarchive>
{
public:
polymorphic_binary_oarchive(std::ostream & os, unsigned int flags = 0) :
detail::polymorphic_oarchive_route<binary_oarchive>(os, flags)
{}
~polymorphic_binary_oarchive(){}
};
typedef detail::polymorphic_oarchive_route<
binary_oarchive_impl<
binary_oarchive,
std::ostream::char_type,
std::ostream::traits_type
>
> polymorphic_binary_oarchive;
} // namespace archive
} // namespace boost
@@ -28,7 +28,7 @@
namespace boost {
namespace archive {
class BOOST_SYMBOL_VISIBLE polymorphic_text_iarchive :
class polymorphic_text_iarchive :
public detail::polymorphic_iarchive_route<text_iarchive>
{
public:
@@ -23,15 +23,9 @@
namespace boost {
namespace archive {
class BOOST_SYMBOL_VISIBLE polymorphic_text_oarchive :
public detail::polymorphic_oarchive_route<text_oarchive>
{
public:
polymorphic_text_oarchive(std::ostream & os, unsigned int flags = 0) :
detail::polymorphic_oarchive_route<text_oarchive>(os, flags)
{}
~polymorphic_text_oarchive(){}
};
typedef detail::polymorphic_oarchive_route<
text_oarchive_impl<text_oarchive>
> polymorphic_text_oarchive;
} // namespace archive
} // namespace boost
@@ -32,7 +32,7 @@
namespace boost {
namespace archive {
class BOOST_SYMBOL_VISIBLE polymorphic_text_wiarchive :
class polymorphic_text_wiarchive :
public detail::polymorphic_iarchive_route<text_wiarchive>
{
public:
@@ -27,15 +27,9 @@
namespace boost {
namespace archive {
class BOOST_SYMBOL_VISIBLE polymorphic_text_woarchive :
public detail::polymorphic_oarchive_route<text_woarchive>
{
public:
polymorphic_text_woarchive(std::wostream & os, unsigned int flags = 0) :
detail::polymorphic_oarchive_route<text_woarchive>(os, flags)
{}
~polymorphic_text_woarchive(){}
};
typedef detail::polymorphic_oarchive_route<
text_woarchive_impl<text_woarchive>
> polymorphic_text_woarchive;
} // namespace archive
} // namespace boost
@@ -28,7 +28,7 @@
namespace boost {
namespace archive {
class BOOST_SYMBOL_VISIBLE polymorphic_xml_iarchive :
class polymorphic_xml_iarchive :
public detail::polymorphic_iarchive_route<xml_iarchive>
{
public:
@@ -23,15 +23,10 @@
namespace boost {
namespace archive {
class BOOST_SYMBOL_VISIBLE polymorphic_xml_oarchive :
public detail::polymorphic_oarchive_route<xml_oarchive>
{
public:
polymorphic_xml_oarchive(std::ostream & os, unsigned int flags = 0) :
detail::polymorphic_oarchive_route<xml_oarchive>(os, flags)
{}
~polymorphic_xml_oarchive(){}
};
typedef detail::polymorphic_oarchive_route<
xml_oarchive_impl<xml_oarchive>
> polymorphic_xml_oarchive;
} // namespace archive
} // namespace boost
@@ -27,7 +27,7 @@
namespace boost {
namespace archive {
class BOOST_SYMBOL_VISIBLE polymorphic_xml_wiarchive :
class polymorphic_xml_wiarchive :
public detail::polymorphic_iarchive_route<xml_wiarchive>
{
public:
@@ -7,7 +7,7 @@
#endif
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// polymorphic_xml_woarchive.hpp
// polymorphic_xml_oarchive.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
@@ -27,15 +27,9 @@
namespace boost {
namespace archive {
class BOOST_SYMBOL_VISIBLE polymorphic_xml_woarchive :
public detail::polymorphic_oarchive_route<xml_woarchive>
{
public:
polymorphic_xml_woarchive(std::wostream & os, unsigned int flags = 0) :
detail::polymorphic_oarchive_route<xml_woarchive>(os, flags)
{}
~polymorphic_xml_woarchive(){}
};
typedef detail::polymorphic_oarchive_route<
xml_woarchive_impl<xml_woarchive>
> polymorphic_xml_woarchive;
} // namespace archive
} // namespace boost
+2 -2
View File
@@ -65,10 +65,10 @@ protected:
basic_text_oprimitive<std::ostream>::save(t);
}
void save(const version_type & t){
save(static_cast<unsigned int>(t));
save(static_cast<const unsigned int>(t));
}
void save(const boost::serialization::item_version_type & t){
save(static_cast<unsigned int>(t));
save(static_cast<const unsigned int>(t));
}
BOOST_ARCHIVE_DECL void
save(const char * t);
+2 -2
View File
@@ -78,10 +78,10 @@ protected:
basic_text_oprimitive<std::wostream>::save(t);
}
void save(const version_type & t){
save(static_cast<unsigned int>(t));
save(static_cast<const unsigned int>(t));
}
void save(const boost::serialization::item_version_type & t){
save(static_cast<unsigned int>(t));
save(static_cast<const unsigned int>(t));
}
BOOST_WARCHIVE_DECL void
save(const char * t);
-2
View File
@@ -44,9 +44,7 @@ inline std::size_t wcslen(const wchar_t * ws)
#else
#ifndef BOOST_NO_CWCHAR
#include <cwchar>
#endif
#ifdef BOOST_NO_STDC_NAMESPACE
namespace std{ using ::wcslen; }
#endif
+2 -2
View File
@@ -65,11 +65,11 @@ protected:
}
void
save(const version_type & t){
save(static_cast<unsigned int>(t));
save(static_cast<const unsigned int>(t));
}
void
save(const boost::serialization::item_version_type & t){
save(static_cast<unsigned int>(t));
save(static_cast<const unsigned int>(t));
}
BOOST_ARCHIVE_DECL void
save(const char * t);
-1
View File
@@ -62,7 +62,6 @@ protected:
friend class basic_xml_iarchive<Archive>;
friend class load_access;
#endif
std::locale archive_locale;
boost::scoped_ptr<xml_wgrammar> gimpl;
std::wistream & get_is(){
return is;
+2 -2
View File
@@ -74,11 +74,11 @@ protected:
}
void
save(const version_type & t){
save(static_cast<unsigned int>(t));
save(static_cast<const unsigned int>(t));
}
void
save(const boost::serialization::item_version_type & t){
save(static_cast<unsigned int>(t));
save(static_cast<const unsigned int>(t));
}
BOOST_WARCHIVE_DECL void
save(const char * t);
+137 -14
View File
@@ -6,32 +6,135 @@
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// 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 <iostream>
#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/array_wrapper.hpp>
#ifndef BOOST_NO_CXX11_HDR_ARRAY
#include <array>
#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>
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 */)
{
@@ -42,7 +145,27 @@ void serialize(Archive& ar, std::array<T,N>& a, const unsigned int /* version */
}
} } // end namespace boost::serialization
#endif
#endif // BOOST_NO_CXX11_HDR_ARRAY
#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_SERIALIZATION_ARRAY_HPP
@@ -1,37 +0,0 @@
#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
@@ -1,121 +0,0 @@
#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
@@ -55,7 +55,7 @@ struct binary_object :
m_size = rhs.m_size;
return *this;
}
binary_object(const void * const t, std::size_t size) :
binary_object(/* const */ void * const t, std::size_t size) :
m_t(t),
m_size(size)
{}
@@ -69,7 +69,7 @@ struct binary_object :
// wrappers follow the naming convention make_xxxxx
inline
const binary_object
make_binary_object(const void * t, std::size_t size){
make_binary_object(/* const */ void * t, std::size_t size){
return binary_object(t, size);
}
@@ -1,33 +0,0 @@
#ifndef BOOST_SERIALIZATION_BOOST_ARRAY_HPP
#define BOOST_SERIALIZATION_BOOST_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_BOOST_ARRAY_HPP
@@ -64,7 +64,7 @@ collection_load_impl(
Archive & ar,
T & t,
collection_size_type count,
item_version_type /*item_version*/
item_version_type
){
t.resize(count);
typename T::iterator hint;
@@ -19,7 +19,6 @@
// helper function templates for serialization of collections
#include <boost/config.hpp>
#include <boost/core/addressof.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/serialization.hpp>
#include <boost/serialization/version.hpp>
@@ -61,7 +60,7 @@ inline void save_collection(
// note borland emits a no-op without the explicit namespace
boost::serialization::save_construct_data_adl(
ar,
boost::addressof(*it),
&(*it),
item_version
);
ar << boost::serialization::make_nvp("item", *it++);
@@ -0,0 +1,59 @@
// (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
@@ -18,37 +18,31 @@
#include <boost/config.hpp>
#if ! defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
#if defined(_LIBCPP_VERSION) && (_LIBCPP_VERSION >= 1101) \
|| ! defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
#include <type_traits>
namespace boost{
namespace serialization {
namespace detail {
template<typename T>
struct is_default_constructible : public std::is_default_constructible<T> {};
struct is_default_constructible : std::is_default_constructible<T> {};
} // detail
} // serializaition
} // boost
#else
// we don't have standard library support for is_default_constructible
// so we fake it by using boost::has_trivial_construtor. But this is not
// actually correct because it's possible that a default constructor
// to be non trivial. So when using this, make sure you're not using your
// own definition of of T() but are using the actual default one!
#include <boost/type_traits/has_trivial_constructor.hpp>
namespace boost{
namespace serialization {
namespace detail {
template<typename T>
struct is_default_constructible : public boost::has_trivial_constructor<T> {};
struct is_default_constructible : boost::has_trivial_constructor<T> {};
} // detail
} // serializaition
} // boost
#endif
#endif // BOOST_SERIALIZATION_DETAIL_IS_DEFAULT_CONSTRUCTIBLE_HPP
+2
View File
@@ -42,6 +42,8 @@
#include <boost/archive/detail/register_archive.hpp>
#include <iostream>
namespace boost {
namespace archive {
namespace detail {
+22 -23
View File
@@ -48,33 +48,32 @@ namespace boost { \
namespace serialization { \
template<> \
T * factory<T, N>(std::va_list ap){ \
BOOST_PP_IF(BOOST_PP_GREATER(N, 0) \
, A0 a0 = va_arg(ap, A0);, BOOST_PP_EMPTY()) \
BOOST_PP_IF(BOOST_PP_GREATER(N, 1) \
, A1 a1 = va_arg(ap, A1);, BOOST_PP_EMPTY()) \
BOOST_PP_IF(BOOST_PP_GREATER(N, 2) \
, A2 a2 = va_arg(ap, A2);, BOOST_PP_EMPTY()) \
BOOST_PP_IF(BOOST_PP_GREATER(N, 3) \
, A3 a3 = va_arg(ap, A3);, BOOST_PP_EMPTY()) \
BOOST_PP_IF(BOOST_PP_GREATER(N,0) \
,A0 a0 = va_arg(ap, A0); \
,BOOST_PP_IF(BOOST_PP_GREATER(N,1) \
,A1 a1 = va_arg(ap, A1); \
,BOOST_PP_IF(BOOST_PP_GREATER(N,2) \
,A2 a2 = va_arg(ap, A2); \
,BOOST_PP_IF(BOOST_PP_GREATER(N,3) \
,A3 a3 = va_arg(ap, A3); \
,BOOST_PP_EMPTY() \
)))) \
return new T( \
BOOST_PP_IF(BOOST_PP_GREATER(N, 0) \
, a0, BOOST_PP_EMPTY()) \
BOOST_PP_IF(BOOST_PP_GREATER(N, 1)) \
, BOOST_PP_COMMA, BOOST_PP_EMPTY)() \
BOOST_PP_IF(BOOST_PP_GREATER(N, 1) \
, a1, BOOST_PP_EMPTY()) \
BOOST_PP_IF(BOOST_PP_GREATER(N, 2)) \
, BOOST_PP_COMMA, BOOST_PP_EMPTY)() \
BOOST_PP_IF(BOOST_PP_GREATER(N, 2) \
, a2, BOOST_PP_EMPTY()) \
BOOST_PP_IF(BOOST_PP_GREATER(N, 3)) \
, BOOST_PP_COMMA, BOOST_PP_EMPTY)() \
BOOST_PP_IF(BOOST_PP_GREATER(N, 3) \
, a3, BOOST_PP_EMPTY()) \
BOOST_PP_IF(BOOST_PP_GREATER(N,0) \
,a0 \
,BOOST_PP_IF(BOOST_PP_GREATER(N,1) \
,a1 \
,BOOST_PP_IF(BOOST_PP_GREATER(N,2) \
,a2 \
,BOOST_PP_IF(BOOST_PP_GREATER(N,3) \
,a3 \
,BOOST_PP_EMPTY() \
)))) \
); \
} \
} \
} /**/
} \
/**/
#define BOOST_SERIALIZATION_FACTORY_4(T, A0, A1, A2, A3) \
BOOST_SERIALIZATION_FACTORY(4, T, A0, A1, A2, A3)
+1 -3
View File
@@ -28,8 +28,6 @@
#include <boost/serialization/traits.hpp>
#include <boost/serialization/wrapper.hpp>
#include <boost/core/addressof.hpp>
namespace boost {
namespace serialization {
@@ -45,7 +43,7 @@ struct nvp :
public:
explicit nvp(const char * name_, T & t) :
// note: added _ to suppress useless gcc warning
std::pair<const char *, T *>(name_, boost::addressof(t))
std::pair<const char *, T *>(name_, & t)
{}
const char * name() const {
+30 -25
View File
@@ -29,7 +29,6 @@
#include <boost/type_traits/is_pointer.hpp>
#include <boost/serialization/detail/stack_constructor.hpp>
#include <boost/serialization/detail/is_default_constructible.hpp>
#include <boost/serialization/force_include.hpp>
// function specializations must be defined in the appropriate
// namespace - boost::serialization
@@ -47,15 +46,24 @@ void save(
// default constructor. It's possible that this could change sometime
// in the future, but for now, one will have to work around it. This can
// be done by serialization the optional<T> as optional<T *>
#if ! defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
BOOST_STATIC_ASSERT(
boost::serialization::detail::is_default_constructible<T>::value
|| boost::is_pointer<T>::value
);
#endif
BOOST_STATIC_ASSERT(
boost::serialization::detail::is_default_constructible<T>::value
|| boost::is_pointer<T>::value
);
const bool tflag = t.is_initialized();
ar << boost::serialization::make_nvp("initialized", tflag);
if (tflag){
const boost::serialization::item_version_type item_version(version< T >::value);
#if 0
const boost::archive::library_version_type library_version(
ar.get_library_version()
};
if(boost::archive::library_version_type(3) < library_version){
ar << BOOST_SERIALIZATION_NVP(item_version);
}
#else
ar << BOOST_SERIALIZATION_NVP(item_version);
#endif
ar << boost::serialization::make_nvp("value", *t);
}
}
@@ -64,7 +72,7 @@ template<class Archive, class T>
void load(
Archive & ar,
boost::optional< T > & t,
const unsigned int version
const unsigned int /*version*/
){
bool tflag;
ar >> boost::serialization::make_nvp("initialized", tflag);
@@ -73,18 +81,20 @@ void load(
return;
}
if(0 == version){
boost::serialization::item_version_type item_version(0);
boost::archive::library_version_type library_version(
ar.get_library_version()
);
if(boost::archive::library_version_type(3) < library_version){
ar >> BOOST_SERIALIZATION_NVP(item_version);
}
boost::serialization::item_version_type item_version(0);
boost::archive::library_version_type library_version(
ar.get_library_version()
);
if(boost::archive::library_version_type(3) < library_version){
ar >> BOOST_SERIALIZATION_NVP(item_version);
}
if(! t.is_initialized())
t = T();
ar >> boost::serialization::make_nvp("value", *t);
detail::stack_allocate<T> tp;
ar >> boost::serialization::make_nvp("value", tp.reference());
t.reset(boost::move(tp.reference()));
ar.reset_object_address(
t.get_ptr(),
& tp.reference()
);
}
template<class Archive, class T>
@@ -96,12 +106,7 @@ void serialize(
boost::serialization::split_free(ar, t, version);
}
template<class T>
struct version<boost::optional<T> > {
BOOST_STATIC_CONSTANT(int, value = 1);
};
} // serialization
} // boost
} // namespace boost
#endif // BOOST_SERIALIZATION_OPTIONAL_HPP_
+1 -2
View File
@@ -57,8 +57,7 @@ inline void load_set_collection(Archive & ar, Container &s)
ar >> boost::serialization::make_nvp("item", t.reference());
typename Container::iterator result =
s.insert(hint, boost::move(t.reference()));
const type * new_address = & (* result);
ar.reset_object_address(new_address, & t.reference());
ar.reset_object_address(& (* result), & t.reference());
hint = result;
}
}
+37 -97
View File
@@ -9,8 +9,6 @@
// Copyright Robert Ramey 2007. Changes made to permit
// application throughout the serialization library.
//
// Copyright Alexander Grund 2018. Corrections to singleton lifetime
//
// 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)
@@ -34,15 +32,15 @@
// MS compatible compilers support #pragma once
#if defined(_MSC_VER)
# pragma once
#endif
#endif
#include <boost/assert.hpp>
#include <boost/config.hpp>
#include <boost/noncopyable.hpp>
#include <boost/serialization/force_include.hpp>
#include <boost/serialization/config.hpp>
#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/serialization/config.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
#ifdef BOOST_MSVC
@@ -50,8 +48,8 @@
# pragma warning(disable : 4511 4512)
#endif
namespace boost {
namespace serialization {
namespace boost {
namespace serialization {
//////////////////////////////////////////////////////////////////////
// Provides a dynamically-initialized (singleton) instance of T in a
@@ -60,7 +58,7 @@ namespace serialization {
// details.
//
// Singletons created by this code are guaranteed to be unique
// singletons created by this code are guarenteed to be unique
// within the executable or shared library which creates them.
// This is sufficient and in fact ideal for the serialization library.
// The singleton is created when the module is loaded and destroyed
@@ -76,141 +74,83 @@ namespace serialization {
// Second, it provides a mechanism to detect when a non-const function
// is called after initialization.
// Make a singleton to lock/unlock all singletons for alteration.
// make a singleton to lock/unlock all singletons for alteration.
// The intent is that all singletons created/used by this code
// are to be initialized before main is called. A test program
// can lock all the singletons when main is entered. Thus any
// attempt to retrieve a mutable instance while locked will
// generate an assertion if compiled for debug.
// The singleton template can be used in 2 ways:
// 1 (Recommended): Publicly inherit your type T from singleton<T>,
// make its ctor protected and access it via T::get_const_instance()
// 2: Simply access singleton<T> without changing T. Note that this only
// provides a global instance accesible by singleton<T>::get_const_instance()
// or singleton<T>::get_mutable_instance() to prevent using multiple instances
// of T make its ctor protected
// Note on usage of BOOST_DLLEXPORT: These functions are in danger of
// being eliminated by the optimizer when building an application in
// release mode. Usage of the macro is meant to signal the compiler/linker
// to avoid dropping these functions which seem to be unreferenced.
// This usage is not related to autolinking.
// can lock all the singletons when main is entereed. This any
// attempt to retieve a mutable instances while locked will
// generate a assertion if compiled for debug.
class BOOST_SYMBOL_VISIBLE singleton_module :
public boost::noncopyable
{
private:
BOOST_DLLEXPORT bool & get_lock() BOOST_USED {
static bool lock = false;
return lock;
}
static bool & get_lock();
public:
BOOST_DLLEXPORT void lock(){
get_lock() = true;
}
BOOST_DLLEXPORT void unlock(){
get_lock() = false;
}
BOOST_DLLEXPORT bool is_locked(){
return get_lock();
}
BOOST_SERIALIZATION_DECL static void lock();
BOOST_SERIALIZATION_DECL static void unlock();
BOOST_SERIALIZATION_DECL static bool is_locked();
};
static inline singleton_module & get_singleton_module(){
static singleton_module m;
return m;
}
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
namespace detail {
// This is the class actually instantiated and hence the real singleton.
// So there will only be one instance of this class. This does not hold
// for singleton<T> as a class derived from singleton<T> could be
// instantiated multiple times.
// It also provides a flag `is_destroyed` which returns true, when the
// class was destructed. It is static and hence accesible even after
// destruction. This can be used to check, if the singleton is still
// accesible e.g. in destructors of other singletons.
template<class T>
class singleton_wrapper : public T
{
static bool & get_is_destroyed(){
// Prefer a static function member to avoid LNK1179.
// Note: As this is for a singleton (1 instance only) it must be set
// never be reset (to false)!
static bool is_destroyed_flag = false;
return is_destroyed_flag;
}
public:
singleton_wrapper(){
BOOST_ASSERT(! is_destroyed());
}
static bool m_is_destroyed;
~singleton_wrapper(){
get_is_destroyed() = true;
}
static bool is_destroyed(){
return get_is_destroyed();
m_is_destroyed = true;
}
};
template<class T>
bool detail::singleton_wrapper< T >::m_is_destroyed = false;
} // detail
// note usage of BOOST_DLLEXPORT. These functions are in danger of
// being eliminated by the optimizer when building an application in
// release mode. Usage of the macro is meant to signal the compiler/linker
// to avoid dropping these functions which seem to be unreferenced.
// This usage is not related to autolinking.
template <class T>
class singleton {
class singleton : public singleton_module
{
private:
static T * m_instance;
BOOST_DLLEXPORT static T & instance;
// include this to provoke instantiation at pre-execution time
static void use(T const &) {}
static T & get_instance() {
BOOST_ASSERT(! is_destroyed());
// use a wrapper so that types T with protected constructors can be used
// Using a static function member avoids LNK1179
static void use(T const *) {}
BOOST_DLLEXPORT static T & get_instance() {
static detail::singleton_wrapper< T > t;
// note that the following is absolutely essential.
// commenting out this statement will cause compilers to fail to
// construct the instance at pre-execution time. This would prevent
// our usage/implementation of "locking" and introduce uncertainty into
// the sequence of object initialization.
// Unfortunately, this triggers detectors of undefine behavior
// and reports an error. But I've been unable to find a different
// of guarenteeing that the the singleton is created at pre-main time.
use(* m_instance);
// refer to instance, causing it to be instantiated (and
// initialized at startup on working compilers)
BOOST_ASSERT(! detail::singleton_wrapper< T >::m_is_destroyed);
use(& instance);
return static_cast<T &>(t);
}
protected:
// Do not allow instantiation of a singleton<T>. But we want to allow
// `class T: public singleton<T>` so we can't delete this ctor
BOOST_DLLEXPORT singleton(){}
public:
BOOST_DLLEXPORT static T & get_mutable_instance(){
BOOST_ASSERT(! get_singleton_module().is_locked());
BOOST_ASSERT(! is_locked());
return get_instance();
}
BOOST_DLLEXPORT static const T & get_const_instance(){
return get_instance();
}
BOOST_DLLEXPORT static bool is_destroyed(){
return detail::singleton_wrapper< T >::is_destroyed();
return detail::singleton_wrapper< T >::m_is_destroyed;
}
};
// Assigning the instance reference to a static member forces initialization
// at startup time as described in
// https://groups.google.com/forum/#!topic/microsoft.public.vc.language/kDVNLnIsfZk
template<class T>
T * singleton< T >::m_instance = & singleton< T >::get_instance();
BOOST_DLLEXPORT T & singleton< T >::instance = singleton< T >::get_instance();
} // namespace serialization
} // namespace boost
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
+6 -11
View File
@@ -18,13 +18,10 @@
#include <valarray>
#include <boost/config.hpp>
#include <boost/core/addressof.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/array_wrapper.hpp>
#include <boost/serialization/detail/get_data.hpp>
// function specializations must be defined in the appropriate
// namespace - boost::serialization
@@ -45,13 +42,12 @@ 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 *>( boost::addressof(t[0]) ),
static_cast<const U *>(&t[0]),
count
);
}
}
template<class Archive, class U>
@@ -60,13 +56,12 @@ 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 *>( boost::addressof(t[0]) ),
static_cast<U *>(&t[0]),
count
);
}
}
// split non-intrusive serialization function member into separate
+3 -23
View File
@@ -43,8 +43,8 @@ namespace boost {
namespace serialization {
template<class Archive>
struct variant_save_visitor :
boost::static_visitor<>
struct variant_save_visitor :
boost::static_visitor<>
{
variant_save_visitor(Archive& ar) :
m_ar(ar)
@@ -100,8 +100,7 @@ struct variant_impl {
head_type value;
ar >> BOOST_SERIALIZATION_NVP(value);
v = value;
head_type * new_address = & boost::get<head_type>(v);
ar.reset_object_address(new_address, & value);
ar.reset_object_address(& boost::get<head_type>(v), & value);
return;
}
typedef typename mpl::pop_front<S>::type type;
@@ -156,23 +155,4 @@ inline void serialize(
} // namespace serialization
} // namespace boost
//template<typename T0_, BOOST_VARIANT_ENUM_SHIFTED_PARAMS(typename T)>
#include <boost/serialization/tracking.hpp>
namespace boost {
namespace serialization {
template<BOOST_VARIANT_ENUM_PARAMS(/* typename */ class T)>
struct tracking_level<
variant<BOOST_VARIANT_ENUM_PARAMS(T)>
>{
typedef mpl::integral_c_tag tag;
typedef mpl::int_< ::boost::serialization::track_always> type;
BOOST_STATIC_CONSTANT(int, value = type::value);
};
} // namespace serialization
} // namespace boost
#endif //BOOST_SERIALIZATION_VARIANT_HPP
+2 -1
View File
@@ -31,7 +31,8 @@
#include <boost/serialization/collections_save_imp.hpp>
#include <boost/serialization/collections_load_imp.hpp>
#include <boost/serialization/split_free.hpp>
#include <boost/serialization/array_wrapper.hpp>
#include <boost/serialization/array.hpp>
#include <boost/serialization/detail/get_data.hpp>
#include <boost/mpl/bool_fwd.hpp>
#include <boost/mpl/if.hpp>
+4 -5
View File
@@ -181,14 +181,13 @@ void_caster_primitive<Derived, Base>::void_caster_primitive() :
void_caster(
& type_info_implementation<Derived>::type::get_const_instance(),
& type_info_implementation<Base>::type::get_const_instance(),
/* note about displacement:
* displace 0: at least one compiler treated 0 by not shifting it at all
* displace by small value (8): caused ICE on certain mingw gcc versions */
// note:I wanted to displace from 0 here, but at least one compiler
// treated 0 by not shifting it at all.
reinterpret_cast<std::ptrdiff_t>(
static_cast<Derived *>(
reinterpret_cast<Base *>(1 << 20)
reinterpret_cast<Base *>(8)
)
) - (1 << 20)
) - 8
)
{
recursive_register();
-16
View File
@@ -77,14 +77,6 @@ archive_exception::archive_exception(
break;
case input_stream_error:
length = append(length, "input stream error");
if(NULL != e1){
length = append(length, "-");
length = append(length, e1);
}
if(NULL != e2){
length = append(length, "-");
length = append(length, e2);
}
break;
case invalid_class_name:
length = append(length, "class name too long");
@@ -113,14 +105,6 @@ archive_exception::archive_exception(
break;
case output_stream_error:
length = append(length, "output stream error");
if(NULL != e1){
length = append(length, "-");
length = append(length, e1);
}
if(NULL != e2){
length = append(length, "-");
length = append(length, e2);
}
break;
default:
BOOST_ASSERT(false);
+1 -4
View File
@@ -77,13 +77,10 @@ BOOST_ARCHIVE_SIGNATURE(){
// 13- simplified visibility, removed Borland, removed pfto
// 14- improved visibility, refactor map/set
// 15- corrections to optional and collection loading
// 16- eliminated dependency on <codecvt> which is buggy in some libraries
// and now officially deprecated in the standard
// 17- Boost 1.68 August 2018
BOOST_SYMBOL_VISIBLE library_version_type
BOOST_ARCHIVE_VERSION(){
return library_version_type(17);
return library_version_type(15);
}
} // namespace archive
+1 -7
View File
@@ -459,12 +459,6 @@ basic_iarchive_impl::load_pointer(
cobject_id & co = cobject_id_vector[i];
bpis_ptr = co.bpis_ptr;
if (bpis_ptr == NULL) {
boost::serialization::throw_exception(
archive_exception(archive_exception::unregistered_class)
);
}
load_preamble(ar, co);
// extra line to evade borland issue
@@ -493,7 +487,7 @@ basic_iarchive_impl::load_pointer(
m_pending.version = co.file_version;
// predict next object id to be created
const size_t ui = object_id_vector.size();
const unsigned int ui = object_id_vector.size();
serialization::state_saver<object_id_type> w_end(m_moveable_objects.end);
+2 -3
View File
@@ -106,9 +106,8 @@ class basic_oarchive_impl {
m_class_id(class_id),
m_initialized(false)
{}
cobject_type(const basic_oserializer & bos) :
m_bos_ptr(& bos),
m_initialized(false)
cobject_type(const basic_oserializer & bos)
: m_bos_ptr(& bos)
{}
cobject_type(
const cobject_type & rhs
+5 -12
View File
@@ -21,9 +21,6 @@
# pragma warning(disable : 4244 4511 4512)
#endif
#include <cerrno> // errno
#include <cstring> // strerror(errno)
// spirit stuff
#include <boost/spirit/include/classic_operators.hpp>
#include <boost/spirit/include/classic_actions.hpp>
@@ -34,6 +31,7 @@
#endif
// for head_iterator test
//#include <boost/bind.hpp>
#include <boost/function.hpp>
#include <boost/io/ios_state.hpp>
@@ -147,7 +145,8 @@ template<class String>
struct append_char {
String & contents;
void operator()(const unsigned int char_value) const {
contents += static_cast<typename String::value_type>(char_value);
const typename String::value_type z = char_value;
contents += z;
}
append_char(String & contents_)
: contents(contents_)
@@ -190,14 +189,8 @@ bool basic_xml_grammar<CharType>::my_parse(
for(;;){
CharType result;
is.get(result);
if(is.fail()){
boost::serialization::throw_exception(
boost::archive::archive_exception(
archive_exception::input_stream_error,
std::strerror(errno)
)
);
}
if(is.fail())
return false;
if(is.eof())
return false;
arg += result;
+2 -2
View File
@@ -18,7 +18,7 @@
namespace boost {
namespace archive {
std::codecvt_base::result
BOOST_WARCHIVE_DECL std::codecvt_base::result
codecvt_null<wchar_t>::do_out(
std::mbstate_t & /*state*/,
const wchar_t * first1,
@@ -46,7 +46,7 @@ codecvt_null<wchar_t>::do_out(
return std::codecvt_base::ok;
}
std::codecvt_base::result
BOOST_WARCHIVE_DECL std::codecvt_base::result
codecvt_null<wchar_t>::do_in(
std::mbstate_t & /*state*/,
const char * first1,
-4
View File
@@ -125,10 +125,6 @@ BOOST_SERIALIZATION_DECL void
extended_type_info::key_unregister() const{
if(NULL == get_key())
return;
// note: it's been discovered that at least one platform is not guaranteed
// to destroy singletons reverse order of construction. So we can't
// use a runtime assert here. Leave this in a reminder not to do this!
// BOOST_ASSERT(! singleton<detail::ktmap>::is_destroyed());
if(! singleton<detail::ktmap>::is_destroyed()){
detail::ktmap & x = singleton<detail::ktmap>::get_mutable_instance();
detail::ktmap::iterator start = x.lower_bound(this);
+10 -13
View File
@@ -95,22 +95,19 @@ BOOST_SERIALIZATION_DECL void
extended_type_info_typeid_0::type_unregister()
{
if(NULL != m_ti){
// note: previously this conditional was a runtime assertion with
// BOOST_ASSERT. We've changed it because we've discovered that at
// least one platform is not guaranteed to destroy singletons in
// reverse order of distruction.
// BOOST_ASSERT(! singleton<tkmap>::is_destroyed());
if(! singleton<tkmap>::is_destroyed()){
tkmap & x = singleton<tkmap>::get_mutable_instance();
tkmap::iterator start = x.lower_bound(this);
tkmap::iterator end = x.upper_bound(this);
BOOST_ASSERT(start != end);
// remove all entries in map which corresponds to this type
// make sure that we don't use any invalidated iterators
for(;;){
const tkmap::iterator & it = x.find(this);
if(it == x.end())
break;
x.erase(it);
};
// remove entry in map which corresponds to this type
do{
if(this == *start)
x.erase(start++);
else
++start;
}while(start != end);
}
}
m_ti = NULL;
-30
View File
@@ -1,30 +0,0 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// polymorphic_binary_iarchive.cpp:
// (C) Copyright 2018 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
#if (defined _MSC_VER) && (_MSC_VER == 1200)
# pragma warning (disable : 4786) // too long name, harmless warning
#endif
#define BOOST_ARCHIVE_SOURCE
#include <boost/serialization/config.hpp>
#include <boost/archive/polymorphic_binary_iarchive.hpp>
// explicitly instantiate for this type of text stream
#include <boost/archive/impl/archive_serializer_map.ipp>
namespace boost {
namespace archive {
namespace detail {
template class archive_serializer_map<polymorphic_binary_iarchive>;
} // detail
} // archive
} // boost
-30
View File
@@ -1,30 +0,0 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// polymorphic_binary_oarchive.cpp:
// (C) Copyright 2018 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
#if (defined _MSC_VER) && (_MSC_VER == 1200)
# pragma warning (disable : 4786) // too long name, harmless warning
#endif
#define BOOST_ARCHIVE_SOURCE
#include <boost/serialization/config.hpp>
#include <boost/archive/polymorphic_binary_oarchive.hpp>
// explicitly instantiate for this type of text stream
#include <boost/archive/impl/archive_serializer_map.ipp>
namespace boost {
namespace archive {
namespace detail {
template class detail::archive_serializer_map<polymorphic_binary_oarchive>;
} // detail
} // archive
} // boost
-30
View File
@@ -1,30 +0,0 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// polymorphic_text_iarchive.cpp:
// (C) Copyright 2018 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
#if (defined _MSC_VER) && (_MSC_VER == 1200)
# pragma warning (disable : 4786) // too long name, harmless warning
#endif
#define BOOST_ARCHIVE_SOURCE
#include <boost/serialization/config.hpp>
#include <boost/archive/polymorphic_text_iarchive.hpp>
// explicitly instantiate for this type of text stream
#include <boost/archive/impl/archive_serializer_map.ipp>
namespace boost {
namespace archive {
namespace detail {
template class archive_serializer_map<polymorphic_text_iarchive>;
} // detail
} // archive
} // boost
-30
View File
@@ -1,30 +0,0 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// polymorphic_text_oarchive.cpp:
// (C) Copyright 2018 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
#if (defined _MSC_VER) && (_MSC_VER == 1200)
# pragma warning (disable : 4786) // too long name, harmless warning
#endif
#define BOOST_ARCHIVE_SOURCE
#include <boost/serialization/config.hpp>
#include <boost/archive/polymorphic_text_oarchive.hpp>
// explicitly instantiate for this type of text stream
#include <boost/archive/impl/archive_serializer_map.ipp>
namespace boost {
namespace archive {
namespace detail {
template class detail::archive_serializer_map<polymorphic_text_oarchive>;
} // detail
} // archive
} // boost
-30
View File
@@ -1,30 +0,0 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// polymorphic_text_wiarchive.cpp:
// (C) Copyright 2018 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
#if (defined _MSC_VER) && (_MSC_VER == 1200)
# pragma warning (disable : 4786) // too long name, harmless warning
#endif
#define BOOST_ARCHIVE_SOURCE
#include <boost/serialization/config.hpp>
#include <boost/archive/polymorphic_text_wiarchive.hpp>
// explicitly instantiate for this type of text stream
#include <boost/archive/impl/archive_serializer_map.ipp>
namespace boost {
namespace archive {
namespace detail {
template class archive_serializer_map<polymorphic_text_wiarchive>;
} // detail
} // archive
} // boost
-30
View File
@@ -1,30 +0,0 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// polymorphic_text_woarchive.cpp:
// (C) Copyright 2018 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
#if (defined _MSC_VER) && (_MSC_VER == 1200)
# pragma warning (disable : 4786) // too long name, harmless warning
#endif
#define BOOST_ARCHIVE_SOURCE
#include <boost/serialization/config.hpp>
#include <boost/archive/polymorphic_text_woarchive.hpp>
// explicitly instantiate for this type of text stream
#include <boost/archive/impl/archive_serializer_map.ipp>
namespace boost {
namespace archive {
namespace detail {
template class detail::archive_serializer_map<polymorphic_text_woarchive>;
} // detail
} // archive
} // boost
-30
View File
@@ -1,30 +0,0 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// polymorphic_xml_iarchive.cpp:
// (C) Copyright 2018 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
#if (defined _MSC_VER) && (_MSC_VER == 1200)
# pragma warning (disable : 4786) // too long name, harmless warning
#endif
#define BOOST_ARCHIVE_SOURCE
#include <boost/serialization/config.hpp>
#include <boost/archive/polymorphic_xml_iarchive.hpp>
// explicitly instantiate for this type of text stream
#include <boost/archive/impl/archive_serializer_map.ipp>
namespace boost {
namespace archive {
namespace detail {
template class archive_serializer_map<polymorphic_xml_iarchive>;
} // detail
} // archive
} // boost
-30
View File
@@ -1,30 +0,0 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// polymorphic_xml_oarchive.cpp:
// (C) Copyright 2018 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
#if (defined _MSC_VER) && (_MSC_VER == 1200)
# pragma warning (disable : 4786) // too long name, harmless warning
#endif
#define BOOST_ARCHIVE_SOURCE
#include <boost/serialization/config.hpp>
#include <boost/archive/polymorphic_xml_oarchive.hpp>
// explicitly instantiate for this type of text stream
#include <boost/archive/impl/archive_serializer_map.ipp>
namespace boost {
namespace archive {
namespace detail {
template class detail::archive_serializer_map<polymorphic_xml_oarchive>;
} // detail
} // archive
} // boost
-30
View File
@@ -1,30 +0,0 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// polymorphic_xml_wiarchive.cpp:
// (C) Copyright 2018 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
#if (defined _MSC_VER) && (_MSC_VER == 1200)
# pragma warning (disable : 4786) // too long name, harmless warning
#endif
#define BOOST_ARCHIVE_SOURCE
#include <boost/serialization/config.hpp>
#include <boost/archive/polymorphic_xml_wiarchive.hpp>
// explicitly instantiate for this type of text stream
#include <boost/archive/impl/archive_serializer_map.ipp>
namespace boost {
namespace archive {
namespace detail {
template class archive_serializer_map<polymorphic_xml_wiarchive>;
} // detail
} // archive
} // boost
-30
View File
@@ -1,30 +0,0 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// polymorphic_xml_woarchive.cpp:
// (C) Copyright 2018 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
#if (defined _MSC_VER) && (_MSC_VER == 1200)
# pragma warning (disable : 4786) // too long name, harmless warning
#endif
#define BOOST_ARCHIVE_SOURCE
#include <boost/serialization/config.hpp>
#include <boost/archive/polymorphic_xml_woarchive.hpp>
// explicitly instantiate for this type of text stream
#include <boost/archive/impl/archive_serializer_map.ipp>
namespace boost {
namespace archive {
namespace detail {
template class detail::archive_serializer_map<polymorphic_xml_woarchive>;
} // detail
} // archive
} // boost
+36
View File
@@ -0,0 +1,36 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// singleton.cpp
//
// Copyright (c) 201 5 Robert Ramey, Indiana University (garcia@osl.iu.edu)
// 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)
//
// it marks our code with proper attributes as being exported when
// we're compiling it while marking it import when just the headers
// is being included.
#define BOOST_SERIALIZATION_SOURCE
#include <boost/serialization/config.hpp>
#include <boost/serialization/singleton.hpp>
namespace boost {
namespace serialization {
bool & singleton_module::get_lock(){
static bool lock = false;
return lock;
}
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() {
return get_lock();
}
} // namespace serialization
} // namespace boost
+15 -14
View File
@@ -4,19 +4,20 @@
// 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"
#endif
// 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
#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
-4
View File
@@ -276,10 +276,6 @@ void_caster::recursive_register(bool includes_virtual_base) const {
BOOST_SERIALIZATION_DECL void
void_caster::recursive_unregister() const {
// note: it's been discovered that at least one platform is not guaranteed
// to destroy singletons reverse order of construction. So we can't
// use a runtime assert here. Leave this in a reminder not to do this!
// BOOST_ASSERT(! void_caster_registry::is_destroyed());
if(void_caster_registry::is_destroyed())
return;
+10 -11
View File
@@ -48,7 +48,7 @@ void accumulate(std::size_t & s, const T & t){
s += *tptr++;
}
}
A_DLL_DECL
A::operator std::size_t () const {
std::size_t retval = 0;
accumulate(retval, b);
@@ -76,14 +76,13 @@ 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
A_DLL_DECL
#endif
A::A() :
b(true),
#ifndef BOOST_NO_INT64_T
f(static_cast<boost::int64_t>(std::rand()) * static_cast<boost::int64_t>(std::rand())),
g(static_cast<boost::uint64_t>(std::rand()) * static_cast<boost::uint64_t>(std::rand())),
f(std::rand() * std::rand()),
g(std::rand() * std::rand()),
#endif
l(static_cast<enum h>(std::rand() % 3)),
m(std::rand()),
@@ -112,8 +111,8 @@ A::A() :
#pragma warning(pop) // Restore warnings to previous state.
#endif
A_DLL_DECL bool
A::operator==(const A &rhs) const {
bool A::operator==(const A &rhs) const
{
if(b != rhs.b)
return false;
if(l != rhs.l)
@@ -161,13 +160,13 @@ A::operator==(const A &rhs) const {
return true;
}
A_DLL_DECL bool
A::operator!=(const A &rhs) const {
bool A::operator!=(const A &rhs) const
{
return ! (*this == rhs);
}
A_DLL_DECL bool
A::operator<(const A &rhs) const {
bool A::operator<(const A &rhs) const
{
if(b != rhs.b)
return b < rhs.b;
#ifndef BOOST_NO_INT64_T
+77 -17
View File
@@ -18,42 +18,100 @@
#include <ostream> // for friend output operators
#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>
#include <boost/serialization/string.hpp>
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK)
#if defined(A_IMPORT)
#define A_DLL_DECL BOOST_SYMBOL_IMPORT
#pragma message("A imported")
#elif defined(A_EXPORT)
#define A_DLL_DECL BOOST_SYMBOL_EXPORT
#pragma message ("A exported")
#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
#ifndef A_DLL_DECL
#define A_DLL_DECL
#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
#elif defined(A_EXPORT)
#define DLL_DECL BOOST_SYMBOL_EXPORT
#else
#define DLL_DECL
#endif
class A_DLL_DECL A {
class DLL_DECL A
{
private:
friend class boost::serialization::access;
template<class Archive>
void serialize(
Archive &ar,
const unsigned int /* file_version */
);
// 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
bool b;
#ifndef BOOST_NO_INT64_T
boost::int64_t f;
@@ -94,4 +152,6 @@ public:
friend std::ostream & operator<<(std::ostream & os, A const & a);
};
#undef DLL_DECL
#endif // BOOST_SERIALIZATION_TEST_A_HPP
+5 -1
View File
@@ -8,11 +8,13 @@
// 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>
@@ -58,3 +60,5 @@ void A::serialize(
ar & BOOST_SERIALIZATION_NVP(z);
#endif
}
#endif // workaround BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
+42 -47
View File
@@ -9,13 +9,13 @@
project libs/serialization/test
: id serialization_test
: requirements <source>/boost/filesystem
: requirements <source>/boost/system
;
# import rules for testing conditional on config file variables
import ../../config/checks/config : requires ;
# import rules from the boost serialization test
# import ../util/test : test-bsl-run-no-lib ;
import ../util/test :
run-template
run-invoke
@@ -24,33 +24,38 @@ import ../util/test :
test-bsl-run
test-bsl-run_archive
test-bsl-run_files
test-bsl-run_polymorphic_files
test-bsl-run_polymorphic_archive
;
BOOST_ARCHIVE_LIST = [ modules.peek : BOOST_ARCHIVE_LIST ] ;
lib dll_a
lib dll_a_lib
:
dll_a.cpp
../build//boost_serialization
:
<link>shared:<define>BOOST_SERIALIZATION_DYN_LINK=1
;
lib dll_polymorphic_base
:
polymorphic_base.cpp
../build//boost_serialization
:
<link>shared:<define>BOOST_SERIALIZATION_DYN_LINK=1
;
lib dll_polymorphic_derived2
:
polymorphic_derived2.cpp
dll_polymorphic_base
lib dll_base_lib
:
dll_base.cpp
../build//boost_serialization
:
;
lib dll_derived2_lib
:
dll_derived2.cpp
dll_base_lib
../build//boost_serialization
:
;
lib dll_polymorphic_derived2_lib
:
polymorphic_derived2.cpp
../build//boost_serialization
:
<link>shared:<define>BOOST_SERIALIZATION_DYN_LINK=1
;
test-suite "serialization" :
@@ -71,6 +76,7 @@ test-suite "serialization" :
[ test-bsl-run_files test_derived_class_ptr : A ]
[ test-bsl-run_files test_diamond ]
[ test-bsl-run_files test_diamond_complex ]
[ test-bsl-run_files test_exported : polymorphic_base ]
[ test-bsl-run_files test_forward_list : A : : [ requires cxx11_hdr_forward_list ] ] # BOOST_NO_CXX11_HDR_FORWARD_LIST
[ test-bsl-run_files test_forward_list_ptrs : A : : [ requires cxx11_hdr_forward_list ] ] # BOOST_NO_CXX11_HDR_FORWARD_LIST
[ test-bsl-run_files test_helper_support ]
@@ -78,12 +84,12 @@ 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 ]
[ test-bsl-run_files test_multiple_ptrs : A ]
[ test-bsl-run_files test_multiple_inheritance ]
[ test-bsl-run_files test_no_rtti : polymorphic_base polymorphic_derived1 ]
[ test-bsl-run_files test_non_intrusive ]
[ test-bsl-run_files test_non_default_ctor ]
[ test-bsl-run_files test_non_default_ctor2 ]
@@ -101,8 +107,6 @@ 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 ]
@@ -115,14 +119,10 @@ test-suite "serialization" :
[ test-bsl-run_files test_optional ]
[ test-bsl-run_files test_shared_ptr ]
[ test-bsl-run_files test_shared_ptr_multi_base ]
[ test-bsl-run_files test_shared_ptr_132 : : : [ requires auto_ptr ] ] # BOOST_NO_AUTO_PTR
[ test-bsl-run_polymorphic_files test_dll_exported : polymorphic_derived1 : dll_polymorphic_base dll_polymorphic_derived2 ]
[ test-bsl-run_polymorphic_files test_no_rtti : polymorphic_base polymorphic_derived1 polymorphic_derived2 ]
[ test-bsl-run_polymorphic_files test_exported : polymorphic_base polymorphic_derived1 polymorphic_derived2 ]
[ test-bsl-run_polymorphic_files test_polymorphic : test_polymorphic_A A ]
[ test-bsl-run_polymorphic_files test_polymorphic2 : test_polymorphic2imp ]
[ test-bsl-run_polymorphic_files test_polymorphic_helper ]
[ test-bsl-run_files test_shared_ptr_132 ]
[ test-bsl-run_polymorphic_archive test_polymorphic : test_polymorphic_A A ]
[ test-bsl-run_polymorphic_archive test_polymorphic2 : test_polymorphic2imp ]
[ test-bsl-run_polymorphic_archive test_polymorphic_helper ]
# should compile
[ compile test_strong_typedef.cpp ]
@@ -130,17 +130,13 @@ test-suite "serialization" :
if ! $(BOOST_ARCHIVE_LIST) {
test-suite "serialization2" :
[ test-bsl-run test_inclusion ]
[ test-bsl-run test_inclusion2 ]
# boost build has the feature that the building if libraries vs dll is automatic
# in that dependent libraries are built the same way - shared/static - that
# the application is. On some platforms (e.g windows) this is required to avoid
# problems of linking incompatible versions of the runtime library. So
# we suppress tests of our dlls when using static libraries
[ test-bsl-run test_dll_simple : : dll_a : ]
# [ test-bsl-run test_dll_plugin : : dll_derived2 : <link>static:<build>no <target-os>linux:<linkflags>-ldl ]
[ test-bsl-run-no-lib test_inclusion ]
[ test-bsl-run test_dll_exported : : dll_polymorphic_derived2_lib ]
[ test-bsl-run test_dll_simple : : dll_a_lib ]
[ compile test_dll_plugin.cpp ]
# Running the following test requires that the test know the directory
# in which the dll is stored. I don't know how to extract this from bjam
# [ test-bsl-run test_dll_plugin : : dll_polymorphic_derived2_lib ]
[ test-bsl-run test_private_ctor ]
[ test-bsl-run test_reset_object_address : A ]
[ test-bsl-run test_void_cast ]
@@ -148,12 +144,13 @@ if ! $(BOOST_ARCHIVE_LIST) {
[ test-bsl-run test_iterators ]
[ test-bsl-run test_iterators_base64 ]
[ test-bsl-run test_smart_cast ]
[ test-bsl-run test_codecvt_null ]
[ test-bsl-run test_singleton ]
[ test-bsl-run test_singleton_inherited ]
[ test-bsl-run test_singleton_plain ]
# [ test-bsl-run test_z ]
[ test-bsl-run test_codecvt_null
: ../src/codecvt_null
:
: [ requires std_wstreambuf ]
]
#[ test-bsl-run test_z ]
# should fail compilation
[ compile-fail test_not_serializable.cpp ]
@@ -171,7 +168,6 @@ if ! $(BOOST_ARCHIVE_LIST) {
[ compile test_const_save_warn1.cpp ]
[ compile test_const_save_warn2.cpp ]
[ compile test_const_save_warn3.cpp ]
# note - library unable to detect these errors for now
#[ compile test_const_save_warn1_nvp.cpp ]
#[ compile test_const_save_warn2_nvp.cpp ]
@@ -182,4 +178,3 @@ if ! $(BOOST_ARCHIVE_LIST) {
[ compile test_const_pass.cpp ]
;
}
+6 -7
View File
@@ -1,4 +1,3 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// dll_a.cpp
@@ -21,12 +20,12 @@
#include <boost/archive/text_iarchive.hpp>
template
A_DLL_DECL void A::serialize(
BOOST_SYMBOL_EXPORT void A::serialize(
boost::archive::text_oarchive &ar,
const unsigned int /* file_version */
);
template
A_DLL_DECL void A::serialize(
BOOST_SYMBOL_EXPORT void A::serialize(
boost::archive::text_iarchive &ar,
const unsigned int /* file_version */
);
@@ -37,13 +36,13 @@ A_DLL_DECL void A::serialize(
#include <boost/archive/polymorphic_iarchive.hpp>
template
A_DLL_DECL void A::serialize(
boost::archive::polymorphic_oarchive &,
BOOST_SYMBOL_EXPORT void A::serialize(
boost::archive::polymorphic_oarchive &ar,
const unsigned int /* file_version */
);
template
A_DLL_DECL void A::serialize(
boost::archive::polymorphic_iarchive &,
BOOST_SYMBOL_EXPORT void A::serialize(
boost::archive::polymorphic_iarchive &ar,
const unsigned int /* file_version */
);
-23
View File
@@ -1,23 +0,0 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// test_multi_shared_lib.cpp: test that implementation of extented_type_info
// works when using multiple shared libraries
// (C) Copyright 2018 Alexander Grund
// 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/archive/text_oarchive.hpp>
#include <iostream>
struct X1{
template<class Archive>
void serialize(Archive &, const unsigned int){}
};
BOOST_CLASS_IMPLEMENTATION(X1, boost::serialization::object_class_info)
BOOST_SYMBOL_EXPORT bool f(){
boost::archive::text_oarchive(std::cout) & X1();
return true;
}
-22
View File
@@ -1,22 +0,0 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// multi_shared2.cpp: library simply using extended_type_info_typeid
// (C) Copyright 2018 Alexander Grund
// 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/archive/text_oarchive.hpp>
#include <iostream>
struct X2{
template<class Archive>
void serialize(Archive &, const unsigned int){}
};
BOOST_CLASS_IMPLEMENTATION(X2, boost::serialization::object_class_info)
BOOST_SYMBOL_EXPORT bool g(){
boost::archive::text_oarchive(std::cout) & X2();
return true;
}
+7 -23
View File
@@ -13,27 +13,11 @@
#define POLYMORPHIC_BASE_EXPORT
#include "polymorphic_base.hpp"
template<class Archive>
POLYMORPHIC_BASE_DLL_DECL void polymorphic_base::serialize(
Archive &ar,
const unsigned int /* file_version */
){}
POLYMORPHIC_BASE_DLL_DECL
polymorphic_base::polymorphic_base(){}
POLYMORPHIC_BASE_DLL_DECL
polymorphic_base::~polymorphic_base(){}
#include <boost/archive/polymorphic_oarchive.hpp>
#include <boost/archive/polymorphic_iarchive.hpp>
template
POLYMORPHIC_BASE_DLL_DECL void polymorphic_base::serialize(
boost::archive::polymorphic_oarchive &,
const unsigned int /* file_version */
);
template POLYMORPHIC_BASE_DLL_DECL void polymorphic_base::serialize(
boost::archive::polymorphic_iarchive &,
const unsigned int
);
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();
}
+12 -17
View File
@@ -24,37 +24,32 @@
#include <boost/serialization/type_info_implementation.hpp>
#include <boost/serialization/extended_type_info_no_rtti.hpp>
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK)
#if defined(POLYMORPHIC_BASE_IMPORT)
#define POLYMORPHIC_BASE_DLL_DECL BOOST_SYMBOL_IMPORT
#pragma message ("polymorphic_base imported")
#elif defined(POLYMORPHIC_BASE_EXPORT)
#define POLYMORPHIC_BASE_DLL_DECL BOOST_SYMBOL_EXPORT
#pragma message ("polymorphic_base exported")
#endif
#endif
#ifndef POLYMORPHIC_BASE_DLL_DECL
#define POLYMORPHIC_BASE_DLL_DECL
#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;
template<class Archive>
POLYMORPHIC_BASE_DLL_DECL void serialize(
void serialize(
Archive & /* ar */,
const unsigned int /* file_version */
);
){}
public:
// note that since this class uses the "no_rtti"
// extended_type_info implementation, it MUST
// implement this function
virtual const char * get_key() const = 0;
POLYMORPHIC_BASE_DLL_DECL polymorphic_base();
POLYMORPHIC_BASE_DLL_DECL virtual ~polymorphic_base();
virtual ~polymorphic_base(){};
};
#undef DLL_DECL
BOOST_SERIALIZATION_ASSUME_ABSTRACT(polymorphic_base)
// the no_rtti system requires this !!!
@@ -62,7 +57,7 @@ BOOST_CLASS_EXPORT_KEY(polymorphic_base)
BOOST_CLASS_TYPE_INFO(
polymorphic_base,
extended_type_info_no_rtti<polymorphic_base>
boost::serialization::extended_type_info_no_rtti<polymorphic_base>
)
#endif // POLYMORPHIC_BASE_HPP
-14
View File
@@ -20,18 +20,4 @@ const char * polymorphic_derived1::get_key() const {
>::type::get_const_instance().get_key();
}
#include <boost/archive/polymorphic_oarchive.hpp>
#include <boost/archive/polymorphic_iarchive.hpp>
template
void polymorphic_derived1::serialize(
boost::archive::polymorphic_oarchive &,
const unsigned int /* file_version */
);
template
void polymorphic_derived1::serialize(
boost::archive::polymorphic_iarchive &,
const unsigned int
);
BOOST_CLASS_EXPORT_IMPLEMENT(polymorphic_derived1)

Some files were not shown because too many files have changed in this diff Show More