mirror of
https://github.com/boostorg/serialization.git
synced 2026-07-23 13:54:08 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 96fe06322f |
@@ -85,5 +85,3 @@ lib boost_wserialization
|
||||
<link>shared:<define>BOOST_SERIALIZATION_DYN_LINK=1
|
||||
<conditional>@include-spirit
|
||||
;
|
||||
|
||||
boost-install boost_serialization boost_wserialization ;
|
||||
@@ -36,21 +36,21 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
<li>Markus Schöpflin tracked down issues with TRU64 compiler resulting in 100% passing.
|
||||
<li><a href="mailto::troy@resophonic.com"> Troy D. Straszheim</a> made the initial version of variant serialization.
|
||||
<li>Tonko Juricic helped refine and complete project files for VC 7.1 ide
|
||||
<li><a href="http://www.boost.org/people/rene_rivera.htm">Rene Rivera</a> tracked down several issues related to
|
||||
<li><a href="../../../people/rene_rivera.htm">Rene Rivera</a> tracked down several issues related to
|
||||
Code Warrior, toolset configuration and bjam and much else.
|
||||
<li>Martin Ecker detected (and fixed!) a number of sublte errors regarding cyclic
|
||||
pointers, shared pointers. He also built the library as a DLL and raised some issues
|
||||
<li>Pavel Vozenilek invested much effort in review of code and documentation
|
||||
resulting in many improvements. In addition he help a lot with porting to other
|
||||
platforms including VC 6.0, Intel, and especially Borland.
|
||||
<li><a href="http://www.boost.org/people/jens_maurer.htm">Jens Maurer</a> and
|
||||
<a href="http://www.boost.org/people/beman_dawes.html">Beman Dawes</a> who got the boost
|
||||
<li><a href="../../../people/jens_maurer.htm">Jens Maurer</a> and
|
||||
<a href="../../../people/beman_dawes.html">Beman Dawes</a> who got the boost
|
||||
serialization ball rolling. It was one or both of these two that invented
|
||||
the much beloved <code>&</code> syntax used to implement both save and
|
||||
load in one fuction specification.
|
||||
<li><a href="http://www.boost.org/people/vladimir_prus.htm">Vladimir Prus</a> for evaluating an
|
||||
<li><a href="../../../people/vladimir_prus.htm">Vladimir Prus</a> for evaluating an
|
||||
early draft and contributing the diamond inheritance example.
|
||||
<li><a href="http://www.boost.org/people/william_kempf.htm">William E. Kempf</a>
|
||||
<li><a href="../../../people/william_kempf.htm">William E. Kempf</a>
|
||||
who made the templates for this and other boost manuals. This relieved
|
||||
me of much aggravation.
|
||||
<li><a href="mailto:vahan@unicad.am">Vahan Margaryan</a> and
|
||||
|
||||
@@ -471,32 +471,6 @@ and template parameters should be assigned according to the following table:
|
||||
<tr><td><code>IsWrapper</code></td><td><code></code>is the type a wrapper?</td><td><code>mpl::false_<br>mpl::true_</code></td><td><code>mpl::false_</code></td></tr>
|
||||
</table>
|
||||
|
||||
|
||||
<h3><a name="tracking">Bitwise serialization</a></h3>
|
||||
Some simple classes could be serialized just by directly copying all bits
|
||||
of the class. This is, in particular, the case for POD data types containing
|
||||
no pointer members, and which are neither versioned nor tracked. Some archives,
|
||||
such as non-portable binary archives can make us of this information to
|
||||
substantially speed up Serialization.
|
||||
|
||||
To indicate the possibility of bitwise serialization the type trait defined
|
||||
in the header
|
||||
file <a href="../../../boost/serialization/is_bitwise_serializable.hpp" target="is_bitwise_serializable">is_bitwise_serializable.hpp</a>
|
||||
is used:
|
||||
<pre><code>
|
||||
namespace boost { namespace serialization {
|
||||
template<class T>
|
||||
struct is_bitwise_serializable
|
||||
: public is_arithmetic<T>
|
||||
{};
|
||||
} }
|
||||
</code></pre>
|
||||
is used, and can be specialized for other classes. The specialization
|
||||
is made easy by the corresponding macro:
|
||||
<pre><code>
|
||||
BOOST_IS_BITWISE_SERIALIZABLE(my_class)
|
||||
</code></pre>
|
||||
|
||||
<hr>
|
||||
<p><i>© Copyright <a href="http://www.rrsd.com">Robert Ramey</a> 2002-2004 and Matthias Troyer 2006.
|
||||
Distributed under the Boost Software License, Version 1.0. (See
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
friend class boost::archive::basic_binary_oarchive<portable_binary_oarchive>;
|
||||
friend class boost::archive::save_access;
|
||||
#endif
|
||||
void save_impl(long l){
|
||||
void save_impl(const long l){
|
||||
long ll = l;
|
||||
char size = 0;
|
||||
if(l < 0){
|
||||
|
||||
@@ -65,18 +65,18 @@ public:
|
||||
}
|
||||
|
||||
// the optimized implementation for vector uses serialization::array
|
||||
// template<class U, class Allocator>
|
||||
// void load_optimized(
|
||||
// std::vector<U, Allocator> &t, unsigned int version, mpl::true_)
|
||||
// {
|
||||
// t.clear();
|
||||
// // retrieve number of elements
|
||||
// serialization::collection_size_type count;
|
||||
// *this->This() >> BOOST_SERIALIZATION_NVP(count);
|
||||
// t.resize(count);
|
||||
// if (!t.empty())
|
||||
// * this->This() >> serialization::make_array(serialization::detail::get_data(t),t.size());
|
||||
// }
|
||||
template<class U, class Allocator>
|
||||
void load_optimized(
|
||||
std::vector<U, Allocator> &t, unsigned int version, mpl::true_)
|
||||
{
|
||||
t.clear();
|
||||
// retrieve number of elements
|
||||
serialization::collection_size_type count;
|
||||
*this->This() >> BOOST_SERIALIZATION_NVP(count);
|
||||
t.resize(count);
|
||||
if (!t.empty())
|
||||
* this->This() >> serialization::make_array(serialization::detail::get_data(t),t.size());
|
||||
}
|
||||
|
||||
// the optimized implementation for serialization::array uses save_array
|
||||
template<class ValueType>
|
||||
@@ -91,17 +91,17 @@ public:
|
||||
// if the value type is trivially constructable or an optimized array save exists,
|
||||
// then we can use the optimized version
|
||||
|
||||
// template<class ValueType, class Allocator>
|
||||
// void load_override(std::vector<ValueType,Allocator> &x, unsigned int version)
|
||||
// {
|
||||
// typedef typename mpl::and_<
|
||||
// mpl::not_<is_same<ValueType,bool> >,
|
||||
// mpl::apply1<
|
||||
// BOOST_DEDUCED_TYPENAME Archive::use_array_optimization
|
||||
// , ValueType>
|
||||
// >::type use_optimized;
|
||||
// load_optimized(x,version, use_optimized() );
|
||||
// }
|
||||
template<class ValueType, class Allocator>
|
||||
void load_override(std::vector<ValueType,Allocator> &x, unsigned int version)
|
||||
{
|
||||
typedef typename mpl::and_<
|
||||
mpl::not_<is_same<ValueType,bool> >,
|
||||
mpl::apply1<
|
||||
BOOST_DEDUCED_TYPENAME Archive::use_array_optimization
|
||||
, ValueType>
|
||||
>::type use_optimized;
|
||||
load_optimized(x,version, use_optimized() );
|
||||
}
|
||||
|
||||
|
||||
// dispatch loading of arrays to the optimized version where supported
|
||||
|
||||
@@ -65,15 +65,15 @@ public:
|
||||
|
||||
|
||||
// the optimized implementation for vector uses serialization::array
|
||||
// template<class ValueType, class Allocator>
|
||||
// void save_optimized(
|
||||
// const std::vector<ValueType, Allocator> &t, unsigned int, mpl::true_)
|
||||
// {
|
||||
// const serialization::collection_size_type count(t.size());
|
||||
// * this->This() << BOOST_SERIALIZATION_NVP(count);
|
||||
// if (!t.empty())
|
||||
// * this->This() << serialization::make_array(serialization::detail::get_data(t),t.size());
|
||||
// }
|
||||
template<class ValueType, class Allocator>
|
||||
void save_optimized(
|
||||
const std::vector<ValueType, Allocator> &t, unsigned int, mpl::true_)
|
||||
{
|
||||
const serialization::collection_size_type count(t.size());
|
||||
* this->This() << BOOST_SERIALIZATION_NVP(count);
|
||||
if (!t.empty())
|
||||
* this->This() << serialization::make_array(serialization::detail::get_data(t),t.size());
|
||||
}
|
||||
|
||||
// the optimized implementation for serialization::array uses save_array
|
||||
template<class ValueType>
|
||||
@@ -88,18 +88,18 @@ public:
|
||||
// if the value type is trivially constructable or an optimized array save exists,
|
||||
// then we can use the optimized version
|
||||
|
||||
// template<class ValueType, class Allocator>
|
||||
// void save_override(std::vector<ValueType,Allocator> const &x, unsigned int version)
|
||||
// {
|
||||
// typedef BOOST_DEDUCED_TYPENAME remove_const<ValueType>::type value_type;
|
||||
// typedef typename mpl::and_<
|
||||
// mpl::not_<is_same<value_type,bool> >,
|
||||
// mpl::apply1<
|
||||
// BOOST_DEDUCED_TYPENAME Archive::use_array_optimization
|
||||
// , value_type>
|
||||
// >::type use_optimized;
|
||||
// save_optimized(x,version,use_optimized() );
|
||||
// }
|
||||
template<class ValueType, class Allocator>
|
||||
void save_override(std::vector<ValueType,Allocator> const &x, unsigned int version)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME remove_const<ValueType>::type value_type;
|
||||
typedef typename mpl::and_<
|
||||
mpl::not_<is_same<value_type,bool> >,
|
||||
mpl::apply1<
|
||||
BOOST_DEDUCED_TYPENAME Archive::use_array_optimization
|
||||
, value_type>
|
||||
>::type use_optimized;
|
||||
save_optimized(x,version,use_optimized() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace std{
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
#include <boost/mpl/placeholders.hpp>
|
||||
#include <boost/serialization/is_bitwise_serializable.hpp>
|
||||
#include <boost/type_traits/is_fundamental.hpp>
|
||||
#include <boost/serialization/array.hpp>
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
@@ -113,12 +113,7 @@ public:
|
||||
~basic_binary_iprimitive();
|
||||
public:
|
||||
// we provide an optimized load for all fundamental types
|
||||
//typedef serialization::is_bitwise_serializable<mpl::_1>
|
||||
// use_array_optimization;
|
||||
struct use_array_optimization {
|
||||
template <class T>
|
||||
struct apply : public serialization::is_bitwise_serializable<T> {};
|
||||
};
|
||||
typedef is_fundamental<mpl::_1> use_array_optimization;
|
||||
|
||||
// the optimized load_array dispatches to load_binary
|
||||
template <class ValueType>
|
||||
@@ -165,7 +160,7 @@ basic_binary_iprimitive<Archive, Elem, Tr>::load_binary(
|
||||
static_cast<Elem *>(address),
|
||||
s
|
||||
);
|
||||
if(scount != static_cast<std::streamsize>(s))
|
||||
if(scount != static_cast<std::size_t>(s))
|
||||
boost::throw_exception(
|
||||
archive_exception(archive_exception::stream_error)
|
||||
);
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace std{
|
||||
#include <boost/archive/basic_streambuf_locale_saver.hpp>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
#include <boost/serialization/is_bitwise_serializable.hpp>
|
||||
#include <boost/type_traits/is_fundamental.hpp>
|
||||
#include <boost/mpl/placeholders.hpp>
|
||||
#include <boost/serialization/array.hpp>
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
@@ -113,16 +113,8 @@ public:
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
|
||||
~basic_binary_oprimitive();
|
||||
public:
|
||||
|
||||
// we provide an optimized save for all fundamental types
|
||||
// typedef serialization::is_bitwise_serializable<mpl::_1>
|
||||
// use_array_optimization;
|
||||
// workaround without using mpl lambdas
|
||||
struct use_array_optimization {
|
||||
template <class T>
|
||||
struct apply : public serialization::is_bitwise_serializable<T> {};
|
||||
};
|
||||
|
||||
typedef is_fundamental<mpl::_1> use_array_optimization;
|
||||
|
||||
// the optimized save_array dispatches to save_binary
|
||||
template <class ValueType>
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <cstddef>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
|
||||
namespace std{
|
||||
#if defined(__LIBCOMO__)
|
||||
@@ -59,7 +58,7 @@ public:
|
||||
template<>
|
||||
class codecvt_null<wchar_t> : public std::codecvt<wchar_t, char, std::mbstate_t>
|
||||
{
|
||||
virtual BOOST_ARCHIVE_DECL(std::codecvt_base::result)
|
||||
virtual std::codecvt_base::result
|
||||
do_out(
|
||||
std::mbstate_t & state,
|
||||
const wchar_t * first1,
|
||||
@@ -69,7 +68,7 @@ class codecvt_null<wchar_t> : public std::codecvt<wchar_t, char, std::mbstate_t>
|
||||
char * last2,
|
||||
char * & next2
|
||||
) const;
|
||||
virtual BOOST_ARCHIVE_DECL(std::codecvt_base::result)
|
||||
virtual std::codecvt_base::result
|
||||
do_in(
|
||||
std::mbstate_t & state,
|
||||
const char * first1,
|
||||
|
||||
@@ -71,15 +71,16 @@ protected:
|
||||
public:
|
||||
// note: NOT part of the public interface
|
||||
void register_basic_serializer(
|
||||
const basic_oserializer & bos
|
||||
const BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oserializer & bos
|
||||
);
|
||||
void save_object(
|
||||
const void *x,
|
||||
const basic_oserializer & bos
|
||||
const BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oserializer & bos
|
||||
);
|
||||
void save_pointer(
|
||||
const void * t,
|
||||
const basic_pointer_oserializer * bpos_ptr
|
||||
const BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
|
||||
basic_pointer_oserializer * bpos_ptr
|
||||
);
|
||||
void save_null_pointer(){
|
||||
vsave(NULL_POINTER_TAG);
|
||||
|
||||
Regular → Executable
@@ -32,7 +32,7 @@ namespace serialization {
|
||||
namespace archive {
|
||||
namespace detail {
|
||||
|
||||
class BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_iserializer;
|
||||
class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_iserializer;
|
||||
|
||||
template<class Archive>
|
||||
class interface_iarchive
|
||||
@@ -51,9 +51,9 @@ public:
|
||||
}
|
||||
|
||||
template<class T>
|
||||
const basic_pointer_iserializer *
|
||||
const BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_iserializer *
|
||||
register_type(T * = NULL){
|
||||
const basic_pointer_iserializer & bpis =
|
||||
const BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_iserializer & bpis =
|
||||
pointer_iserializer<Archive, T>::get_instance();
|
||||
this->This()->register_basic_serializer(bpis.get_basic_serializer());
|
||||
return & bpis;
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace serialization {
|
||||
namespace archive {
|
||||
namespace detail {
|
||||
|
||||
class BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_oserializer;
|
||||
class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_oserializer;
|
||||
|
||||
template<class Archive>
|
||||
class interface_oarchive
|
||||
@@ -51,9 +51,9 @@ public:
|
||||
}
|
||||
|
||||
template<class T>
|
||||
const basic_pointer_oserializer *
|
||||
const BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_oserializer *
|
||||
register_type(const T * = NULL){
|
||||
const basic_pointer_oserializer & bpos =
|
||||
const BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_oserializer & bpos =
|
||||
pointer_oserializer<Archive, T>::get_instance();
|
||||
this->This()->register_basic_serializer(bpos.get_basic_serializer());
|
||||
return & bpos;
|
||||
|
||||
Regular → Executable
@@ -1,8 +1,9 @@
|
||||
// Copyright © 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu)
|
||||
// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu).
|
||||
// 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)
|
||||
// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu). Permission to copy,
|
||||
// use, modify, sell and distribute this software is granted provided this
|
||||
// copyright notice appears in all copies. This software is provided "as is"
|
||||
// without express or implied warranty, and with no claim as to its suitability
|
||||
// for any purpose.
|
||||
|
||||
#ifndef BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP
|
||||
#define BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/libs/serialization for updates, documentation, and revision history.
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
// PFTO version is used to specify the last argument of certain functions
|
||||
// Function it is used to support compilers that fail to support correct Partial
|
||||
// Template Ordering
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
#ifndef BOOST_SERIALIZATION_COMPLEX_HPP
|
||||
#define BOOST_SERIALIZATION_COMPLEX_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// serialization/utility.hpp:
|
||||
// serialization for stl utility templates
|
||||
|
||||
// (C) Copyright 2007 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.
|
||||
|
||||
#include <complex>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/is_bitwise_serializable.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
|
||||
|
||||
template<class Archive, class T>
|
||||
inline void serialize(
|
||||
Archive & ar,
|
||||
std::complex<T> & t,
|
||||
const unsigned int file_version
|
||||
)
|
||||
{
|
||||
boost::serialization::split_free(ar, t, file_version);
|
||||
}
|
||||
|
||||
template<class Archive, class T>
|
||||
inline void save(
|
||||
Archive & ar,
|
||||
std::complex<T> const& x,
|
||||
const unsigned int /* file_version */
|
||||
)
|
||||
{
|
||||
double re=x.real();
|
||||
double im=x.imag();
|
||||
ar << boost::serialization::make_nvp("real", re);
|
||||
ar << boost::serialization::make_nvp("imag", im);
|
||||
}
|
||||
|
||||
template<class Archive, class T>
|
||||
inline void load(
|
||||
Archive & ar,
|
||||
std::complex<T>& x,
|
||||
const unsigned int /* file_version */
|
||||
)
|
||||
{
|
||||
double re;
|
||||
double im;
|
||||
ar >> boost::serialization::make_nvp("real", re);
|
||||
ar >> boost::serialization::make_nvp("imag", im);
|
||||
x = std::complex<T>(re,im);
|
||||
}
|
||||
|
||||
/// specialization of serialization traits for complex
|
||||
template <class T>
|
||||
struct is_bitwise_serializable<std::complex<T> >
|
||||
: public is_bitwise_serializable<T> {};
|
||||
|
||||
template <class T>
|
||||
struct implementation_level<std::complex<T> >
|
||||
: mpl::int_<object_serializable> {} ;
|
||||
|
||||
// treat complex just like builtin arithmetic types for tracking
|
||||
template <class T>
|
||||
struct tracking_level<std::complex<T> >
|
||||
: mpl::int_<track_never> {} ;
|
||||
|
||||
} // serialization
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_SERIALIZATION_COMPLEX_HPP
|
||||
@@ -1,46 +0,0 @@
|
||||
// (C) Copyright 2007 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)
|
||||
|
||||
// Authors: Matthias Troyer
|
||||
|
||||
/** @file is_bitwise_serializable.hpp
|
||||
*
|
||||
* This header provides a traits class for determining whether a class
|
||||
* can be serialized (in a non-portable way) just by copying the bits.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BOOST_SERIALIZATION_IS_BITWISE_SERIALIZABLE_HPP
|
||||
#define BOOST_SERIALIZATION_IS_BITWISE_SERIALIZABLE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/type_traits/is_arithmetic.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
template<class T>
|
||||
struct is_bitwise_serializable
|
||||
: public is_arithmetic<T>
|
||||
{};
|
||||
} // namespace serialization
|
||||
} // namespace boost
|
||||
|
||||
|
||||
// define a macro to make explicit designation of this more transparent
|
||||
#define BOOST_IS_BITWISE_SERIALIZABLE(T) \
|
||||
namespace boost { \
|
||||
namespace serialization { \
|
||||
template<> \
|
||||
struct is_bitwise_serializable< T > : mpl::true_ {}; \
|
||||
}} \
|
||||
/**/
|
||||
|
||||
#endif //BOOST_SERIALIZATION_IS_BITWISE_SERIALIZABLE_HPP
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/is_bitwise_serializable.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
@@ -42,13 +41,6 @@ inline void serialize(
|
||||
ar & boost::serialization::make_nvp("second", p.second);
|
||||
}
|
||||
|
||||
/// specialization of is_bitwise_serializable for pairs
|
||||
template <class T, class U>
|
||||
struct is_bitwise_serializable<std::pair<T,U> >
|
||||
: public mpl::and_<is_bitwise_serializable<T>,is_bitwise_serializable<U> >
|
||||
{
|
||||
};
|
||||
|
||||
} // serialization
|
||||
} // namespace boost
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ void save( Archive & ar, const STD::valarray<U> &t, const unsigned int file_vers
|
||||
{
|
||||
const collection_size_type count(t.size());
|
||||
ar << BOOST_SERIALIZATION_NVP(count);
|
||||
if (t.size())
|
||||
if (count)
|
||||
ar << make_array(detail::get_data(t), t.size());
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ 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 (count)
|
||||
ar >> make_array(detail::get_data(t), t.size());
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/libs/serialization for updates, documentation, and revision history.
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
// casting of pointers and references.
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/libs/serialization for updates, documentation, and revision history.
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
// Inspired by Daryle Walker's iostate_saver concept. This saves the original
|
||||
// value of a variable when a state_saver is constructed and restores
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/libs/serialization for updates, documentation, and revision history.
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
// macro used to implement a strong typedef. strong typedef
|
||||
// guarentees that two types are distinguised even though the
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/operators.hpp>
|
||||
|
||||
#if !defined(__BORLANDC__) || __BORLANDC__ >= 0x590
|
||||
#if !defined(__BORLANDC__)
|
||||
#define BOOST_STRONG_TYPEDEF(T, D) \
|
||||
struct D \
|
||||
: boost::totally_ordered1< D \
|
||||
@@ -61,6 +61,6 @@
|
||||
bool operator==(const D & rhs) const { return t == rhs.t; } \
|
||||
bool operator<(const D & rhs) const { return t < rhs.t; } \
|
||||
};
|
||||
#endif // !defined(__BORLANDC) || __BORLANDC__ >= 0x590
|
||||
#endif // !defined(__BORLANDC)
|
||||
|
||||
#endif // BOOST_STRONG_TYPEDEF_HPP
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_ARCHIVE_SOURCE
|
||||
#include <boost/archive/codecvt_null.hpp>
|
||||
|
||||
// codecvt implementation for passing wchar_t objects to char output
|
||||
|
||||
+1
-4
@@ -22,7 +22,6 @@
|
||||
#include <cstddef> // size_t
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::rand;
|
||||
@@ -134,9 +133,7 @@ public:
|
||||
friend std::istream & operator>>(std::istream & is, A & a);
|
||||
};
|
||||
|
||||
#ifdef BOOST_TEST_DONT_PRINT_LOG_VALUE
|
||||
BOOST_TEST_DONT_PRINT_LOG_VALUE(A)
|
||||
#endif
|
||||
BOOST_TEST_DONT_PRINT_LOG_VALUE(A);
|
||||
|
||||
template<class S>
|
||||
void randomize(S &x)
|
||||
|
||||
@@ -206,7 +206,6 @@ rule test-bsl-run_polymorphic_archive ( test-name : sources * ) {
|
||||
test-suite "serialization" :
|
||||
[ test-bsl-run_files test_array ]
|
||||
[ test-bsl-run_files test_binary ]
|
||||
[ test-bsl-run_files test_complex ]
|
||||
[ test-bsl-run_files test_contained_class ]
|
||||
[ test-bsl-run_files test_cyclic_ptrs ]
|
||||
[ test-bsl-run_files test_delete_pointer ]
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// test_complex.cpp
|
||||
|
||||
// (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)
|
||||
|
||||
// should pass compilation and execution
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include <cstdio> // remove
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::remove;
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "test_tools.hpp"
|
||||
#include <boost/preprocessor/stringize.hpp>
|
||||
#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST)
|
||||
|
||||
#include <boost/serialization/complex.hpp>
|
||||
|
||||
int test_main( int /* argc */, char* /* argv */[] )
|
||||
{
|
||||
const char * testfile = boost::archive::tmpnam(NULL);
|
||||
BOOST_REQUIRE(NULL != testfile);
|
||||
|
||||
// test array of objects
|
||||
std::complex<float> a(std::rand(),std::rand());
|
||||
std::complex<double> b(std::rand(),std::rand());
|
||||
{
|
||||
test_ostream os(testfile, TEST_STREAM_FLAGS);
|
||||
test_oarchive oa(os);
|
||||
oa << boost::serialization::make_nvp("afloatcomplex", a);
|
||||
oa << boost::serialization::make_nvp("adoublecomplex", b);
|
||||
}
|
||||
std::complex<float> a1;
|
||||
std::complex<double> b1;
|
||||
{
|
||||
test_istream is(testfile, TEST_STREAM_FLAGS);
|
||||
test_iarchive ia(is);
|
||||
ia >> boost::serialization::make_nvp("afloatcomplex", a1);
|
||||
ia >> boost::serialization::make_nvp("adoublecomplex", b1);
|
||||
}
|
||||
bool equal = (std::abs(a-a1) <= 2.*std::numeric_limits<float>::round_error()
|
||||
&& std::abs(b-b1) <= 2.*std::numeric_limits<double>::round_error() );
|
||||
|
||||
BOOST_CHECK(equal);
|
||||
std::remove(testfile);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
// EOF
|
||||
Reference in New Issue
Block a user