|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r62358 - in trunk/boost: archive archive/detail archive/impl serialization
From: ramey_at_[hidden]
Date: 2010-05-31 17:17:25
Author: ramey
Date: 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
New Revision: 62358
URL: http://svn.boost.org/trac/boost/changeset/62358
Log:
Separate version types into library_version_type, version_type (classes) and item_version_type.
Added:
trunk/boost/serialization/item_version_type.hpp (contents, props changed)
Text files modified:
trunk/boost/archive/basic_archive.hpp | 109 +++++++++++++++++++++++++++++++++++++--
trunk/boost/archive/basic_binary_iarchive.hpp | 91 +++++++++++++++-----------------
trunk/boost/archive/basic_binary_oarchive.hpp | 76 ++++++++++++---------------
trunk/boost/archive/basic_text_iarchive.hpp | 6 +-
trunk/boost/archive/basic_text_iprimitive.hpp | 67 +++++++++++------------
trunk/boost/archive/basic_text_oarchive.hpp | 2
trunk/boost/archive/basic_xml_oarchive.hpp | 2
trunk/boost/archive/detail/basic_iarchive.hpp | 4
trunk/boost/archive/detail/basic_oarchive.hpp | 2
trunk/boost/archive/detail/common_iarchive.hpp | 2
trunk/boost/archive/detail/polymorphic_iarchive_route.hpp | 4
trunk/boost/archive/detail/polymorphic_oarchive_route.hpp | 2
trunk/boost/archive/impl/basic_binary_iarchive.ipp | 2
trunk/boost/archive/impl/basic_binary_oarchive.ipp | 2
trunk/boost/archive/impl/basic_text_iarchive.ipp | 13 ++++
trunk/boost/archive/impl/basic_text_oarchive.ipp | 2
trunk/boost/archive/impl/basic_xml_oarchive.ipp | 2
trunk/boost/archive/impl/xml_iarchive_impl.ipp | 2
trunk/boost/archive/impl/xml_wiarchive_impl.ipp | 2
trunk/boost/archive/polymorphic_iarchive.hpp | 4
trunk/boost/archive/polymorphic_oarchive.hpp | 2
trunk/boost/archive/text_wiarchive.hpp | 7 ++
trunk/boost/archive/xml_iarchive.hpp | 7 ++
trunk/boost/archive/xml_wiarchive.hpp | 7 ++
trunk/boost/serialization/collection_size_type.hpp | 9 ++
trunk/boost/serialization/collections_load_imp.hpp | 19 ++++--
trunk/boost/serialization/collections_save_imp.hpp | 42 ++++++++------
trunk/boost/serialization/force_include.hpp | 2
trunk/boost/serialization/hash_collections_load_imp.hpp | 19 ++++--
trunk/boost/serialization/hash_collections_save_imp.hpp | 34 +++++++++---
trunk/boost/serialization/optional.hpp | 28 +++++++--
trunk/boost/serialization/serialization.hpp | 6 -
trunk/boost/serialization/shared_ptr.hpp | 4
trunk/boost/serialization/slist.hpp | 16 +++--
trunk/boost/serialization/vector.hpp | 2
trunk/boost/serialization/version.hpp | 18 +++---
trunk/boost/serialization/void_cast.hpp | 7 ++
37 files changed, 393 insertions(+), 232 deletions(-)
Modified: trunk/boost/archive/basic_archive.hpp
==============================================================================
--- trunk/boost/archive/basic_archive.hpp (original)
+++ trunk/boost/archive/basic_archive.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -16,8 +16,9 @@
// See http://www.boost.org for updates, documentation, and revision history.
+#include <cassert>
#include <boost/config.hpp>
-#include <boost/cstdint.hpp>
+#include <boost/cstdint.hpp> // size_t
#include <boost/noncopyable.hpp>
#include <boost/integer_traits.hpp>
#include <boost/serialization/strong_typedef.hpp>
@@ -37,8 +38,23 @@
} /* boost */ \
/**/
-BOOST_ARCHIVE_STRONG_TYPEDEF(uint_least16_t, version_type)
-BOOST_ARCHIVE_STRONG_TYPEDEF(int_least16_t, class_id_type)
+/* NOTE : Warning : Warning : Warning : Warning : Warning
+ * Don't ever changes this. If you do, they previously created
+ * binary archives won't be readable !!!
+ */
+BOOST_ARCHIVE_STRONG_TYPEDEF(uint_least16_t, library_version_type)
+
+/* NOTE : Warning : Warning : Warning : Warning : Warning
+ * If any of these are changed to different sized types,
+ * binary_iarchive won't be able to read older archives
+ * unless you rev the library version and include conditional
+ * code based on the library version. There is nothing
+ * inherently wrong in doing this - but you have to be super
+ * careful because it's easy to get wrong and start breaking
+ * old archives !!!
+ */
+//BOOST_ARCHIVE_STRONG_TYPEDEF(uint_least8_t, version_type)
+//BOOST_ARCHIVE_STRONG_TYPEDEF(int_least16_t, class_id_type)
BOOST_ARCHIVE_STRONG_TYPEDEF(int_least16_t, class_id_optional_type)
BOOST_ARCHIVE_STRONG_TYPEDEF(int_least16_t, class_id_reference_type)
BOOST_ARCHIVE_STRONG_TYPEDEF(uint_least32_t, object_id_type)
@@ -47,8 +63,81 @@
namespace boost {
namespace archive {
+#if defined(_MSC_VER)
+#pragma warning( push )
+#pragma warning( disable : 4244 4267 )
+#endif
+
+struct version_type
+ : boost::totally_ordered1< version_type
+ , boost::totally_ordered2< version_type, uint_least8_t
+ > >
+{
+ typedef uint_least8_t base_type;
+ base_type t;
+ version_type(){};
+ explicit version_type(const version_type & t_) : t(t_.t){}
+ version_type(const unsigned int & t_) : t(t_){
+ assert(t_ <= boost::integer_traits<base_type>::const_max);
+ }
+ version_type & operator=(const version_type & rhs){
+ t = rhs.t;
+ return *this;
+ }
+ operator const base_type () const {
+ return t;
+ }
+ operator base_type & (){
+ return t;
+ }
+ bool operator==(const version_type & rhs) const {
+ return t == rhs.t;
+ }
+ bool operator<(const version_type & rhs) const {
+ return t < rhs.t;
+ }
+};
+
+struct class_id_type
+ : boost::totally_ordered1< class_id_type
+ , boost::totally_ordered2< class_id_type, int_least16_t
+ > >
+{
+ typedef int_least16_t base_type;
+ base_type t;
+ class_id_type(){};
+ class_id_type(const class_id_type & t_) : t(t_.t){}
+ explicit class_id_type(const std::size_t & t_) : t(t_){
+ //assert(t_ <= boost::integer_traits<base_type>::const_max);
+ }
+ explicit class_id_type(const int & t_) : t(t_){}
+ class_id_type & operator=(const class_id_type & rhs){
+ t = rhs.t;
+ return *this;
+ }
+
+ // used for standard i/o
+ operator const base_type () const {
+ return t;
+ }
+ operator base_type & (){
+ return t;
+ }
+ bool operator==(const class_id_type & rhs) const {
+ return t == rhs.t;
+ }
+ bool operator<(const class_id_type & rhs) const {
+ return t < rhs.t;
+ }
+};
+
+#define NULL_POINTER_TAG boost::archive::class_id_type(-1)
+
+#if defined(_MSC_VER)
+#pragma warning( pop )
+#endif
+
struct tracking_type {
-// typedef bool value_type;
bool t;
explicit tracking_type(const bool t_ = false)
: t(t_)
@@ -106,12 +195,10 @@
flags_last = 8
};
-#define NULL_POINTER_TAG class_id_type(-1)
-
BOOST_ARCHIVE_DECL(const char *)
BOOST_ARCHIVE_SIGNATURE();
-BOOST_ARCHIVE_DECL(version_type)
+BOOST_ARCHIVE_DECL(library_version_type)
BOOST_ARCHIVE_VERSION();
}// namespace archive
@@ -119,11 +206,19 @@
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
+namespace boost {
+template<>
+class integer_traits<boost::archive::class_id_type> :
+ public integer_traits<boost::archive::class_id_type::base_type>
+{};
+} // namespace boost
+
#include <boost/serialization/level.hpp>
// set implementation level to primitive for all types
// used internally by the serialization library
+BOOST_CLASS_IMPLEMENTATION(boost::archive::library_version_type, primitive_type)
BOOST_CLASS_IMPLEMENTATION(boost::archive::version_type, primitive_type)
BOOST_CLASS_IMPLEMENTATION(boost::archive::class_id_type, primitive_type)
BOOST_CLASS_IMPLEMENTATION(boost::archive::class_id_reference_type, primitive_type)
Modified: trunk/boost/archive/basic_binary_iarchive.hpp
==============================================================================
--- trunk/boost/archive/basic_binary_iarchive.hpp (original)
+++ trunk/boost/archive/basic_binary_iarchive.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -27,9 +27,11 @@
#include <boost/detail/workaround.hpp>
#include <boost/serialization/pfto.hpp>
+#include <boost/archive/basic_archive.hpp>
#include <boost/archive/detail/common_iarchive.hpp>
#include <boost/serialization/collection_size_type.hpp>
#include <boost/serialization/string.hpp>
+#include <boost/serialization/item_version_type.hpp>
#ifdef BOOST_MSVC
# pragma warning(push)
@@ -66,57 +68,50 @@
void load_override(T & t, BOOST_PFTO int version){
this->detail_common_iarchive::load_override(t, static_cast<int>(version));
}
+
+ // include these to trap a change in binary format which
+ // isn't specifically handled
+ BOOST_STATIC_ASSERT(sizeof(tracking_type) == sizeof(char));
+ // upto 32K classes
+ BOOST_STATIC_ASSERT(sizeof(class_id_type) == sizeof(int_least16_t));
+ BOOST_STATIC_ASSERT(sizeof(class_id_reference_type) == sizeof(int_least16_t));
+ // upto 2G objects
+ BOOST_STATIC_ASSERT(sizeof(object_id_type) == sizeof(uint_least32_t));
+ BOOST_STATIC_ASSERT(sizeof(object_reference_type) == sizeof(uint_least32_t));
+
// binary files don't include the optional information
void load_override(class_id_optional_type & /* t */, int){}
- // the following have been overridden to provide specific sizes
- // for these pseudo prmitive types.
- void load_override(version_type & t, int){
- // upto 255 versions
- unsigned char x=0;
- * this->This() >> x;
- t = version_type(x);
- }
- void load_override(class_id_type & t, int){
- // upto 32K classes
- int_least16_t x=0;
- * this->This() >> x;
- t = class_id_type(x);
- }
- void load_override(class_id_reference_type & t, int){
- // upto 32K classes
- int_least16_t x=0;
- * this->This() >> x;
- t = class_id_reference_type(x);
- }
- void load_override(object_id_type & t, int){
- // upto 2G objects
- uint_least32_t x=0;
- * this->This() >> x;
- t = object_id_type(x);
- }
- void load_override(object_reference_type & t, int){
- // upto 2G objects
- uint_least32_t x=0;
- * this->This() >> x;
- t = object_reference_type(x);
- }
- void load_override(tracking_type & t, int){
- char x=0;
- * this->This() >> x;
- t = (0 != x);
- }
- void load_override(serialization::collection_size_type & t, int){
- if (this->get_library_version() < 6) {
- unsigned int x=0;
- * this->This() >> x;
- t = serialization::collection_size_type(x);
- }
- else {
- std::size_t x=0;
- * this->This() >> x;
- t = serialization::collection_size_type(x);
- }
+ void load_override(boost::serialization::item_version_type & t, int version){
+ if(library_version_type(6) < this->get_library_version()){
+ this->detail_common_iarchive::load_override(t, version);
+ }
+ else{
+ unsigned int x=0;
+ * this->This() >> x;
+ t = boost::serialization::item_version_type(x);
+ }
+ }
+ void load_override(serialization::collection_size_type & t, int version){
+ if(boost::archive::library_version_type(6) < this->get_library_version()){
+ this->detail_common_iarchive::load_override(t, version);
+ }
+ else{
+ unsigned int x=0;
+ * this->This() >> x;
+ t = serialization::collection_size_type(x);
+ }
+ }
+
+ void load_override(version_type & t, int version){
+ if(boost::archive::library_version_type(6) < this->get_library_version()){
+ this->detail_common_iarchive::load_override(t, version);
+ }
+ else{
+ unsigned int x=0;
+ * this->This() >> x;
+ t = boost::archive::version_type(x);
+ }
}
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
Modified: trunk/boost/archive/basic_binary_oarchive.hpp
==============================================================================
--- trunk/boost/archive/basic_binary_oarchive.hpp (original)
+++ trunk/boost/archive/basic_binary_oarchive.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -24,13 +24,13 @@
// ON PLATFORM APART FROM THE ONE THEY ARE CREATE ON
#include <cassert>
-#include <boost/integer.hpp>
-#include <boost/integer_traits.hpp>
-
#include <boost/config.hpp>
+#include <boost/detail/workaround.hpp>
#include <boost/serialization/pfto.hpp>
-#include <boost/detail/workaround.hpp>
+#include <boost/integer.hpp>
+#include <boost/integer_traits.hpp>
+
#include <boost/archive/detail/common_oarchive.hpp>
#include <boost/serialization/string.hpp>
#include <boost/serialization/collection_size_type.hpp>
@@ -74,44 +74,28 @@
this->detail_common_oarchive::save_override(t, static_cast<int>(version));
}
+ // include these to trap a change in binary format which
+ // isn't specifically handled
+ BOOST_STATIC_ASSERT(sizeof(tracking_type) == sizeof(char));
+ // upto 32K classes
+ BOOST_STATIC_ASSERT(sizeof(class_id_type) == sizeof(int_least16_t));
+ BOOST_STATIC_ASSERT(sizeof(class_id_reference_type) == sizeof(int_least16_t));
+ // upto 2G objects
+ BOOST_STATIC_ASSERT(sizeof(object_id_type) == sizeof(uint_least32_t));
+ BOOST_STATIC_ASSERT(sizeof(object_reference_type) == sizeof(uint_least32_t));
+
// binary files don't include the optional information
void save_override(const class_id_optional_type & /* t */, int){}
- void save_override(const version_type & t, int){
- // upto 255 versions
- // note:t.t resolves borland ambguity
- assert(t.t < boost::integer_traits<unsigned char>::const_max);
- const unsigned char x = static_cast<const unsigned char>(t.t);
- * this->This() << x;
- }
- void save_override(const class_id_type & t, int){
- // upto 32K classes
- assert(t.t < boost::integer_traits<boost::int_least16_t>::const_max);
- const boost::int_least16_t x = static_cast<const boost::int_least16_t>(t.t);
- * this->This() << x;
- }
- void save_override(const class_id_reference_type & t, int){
- // upto 32K classes
- assert(t.t < boost::integer_traits<boost::int_least16_t>::const_max);
- const boost::int_least16_t x = t.t;
- * this->This() << x;
- }
- void save_override(const object_id_type & t, int){
- // upto 2G objects
- assert(t.t < boost::integer_traits<boost::uint_least32_t>::const_max);
- const boost::uint_least32_t x = t.t;
- * this->This() << x;
- }
- void save_override(const object_reference_type & t, int){
- // upto 2G objects
- assert(t.t < boost::integer_traits<boost::uint_least32_t>::const_max);
- const boost::uint_least32_t x = t.t;
- * this->This() << x;
- }
- void save_override(const tracking_type & t, int){
- const char x = t.t;
- * this->This() << x;
+ #if 0
+ void save_override(const boost::archive::version_type & t, int version){
+ if(this->get_library_version() < boost::archive::library_version_type(7)){
+ * this->This() << static_cast<int_least16_t >(t);
+ }
+ else
+ this->detail_common_oarchive::save_override(t, version);
}
+ #endif
// explicitly convert to char * to avoid compile ambiguities
void save_override(const class_name_type & t, int){
@@ -119,12 +103,18 @@
* this->This() << s;
}
+ #if 0
void save_override(const serialization::collection_size_type & t, int){
- // for backward compatibility, 64 bit integer or variable length integer would be preferred
- std::size_t x = t.t;
- * this->This() << x;
- }
-
+ if (get_library_version() < boost::archive::library_version_type(6)){
+ unsigned int x=0;
+ * this->This() >> x;
+ t = serialization::collection_size_type(x);
+ }
+ else{
+ * this->This() >> t;
+ }
+ }
+ #endif
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
init();
Modified: trunk/boost/archive/basic_text_iarchive.hpp
==============================================================================
--- trunk/boost/archive/basic_text_iarchive.hpp (original)
+++ trunk/boost/archive/basic_text_iarchive.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -29,7 +29,6 @@
#include <boost/detail/workaround.hpp>
#include <boost/archive/detail/common_iarchive.hpp>
-#include <boost/serialization/string.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
@@ -62,14 +61,15 @@
// template ordering
typedef detail::common_iarchive<Archive> detail_common_iarchive;
template<class T>
- void load_override(T & t, BOOST_PFTO int)
- {
+ void load_override(T & t, BOOST_PFTO int){
this->detail_common_iarchive::load_override(t, 0);
}
// text file don't include the optional information
void load_override(class_id_optional_type & /*t*/, int){}
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
+ load_override(version_type & t, int);
+ BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
load_override(class_name_type & t, int);
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
Modified: trunk/boost/archive/basic_text_iprimitive.hpp
==============================================================================
--- trunk/boost/archive/basic_text_iprimitive.hpp (original)
+++ trunk/boost/archive/basic_text_iprimitive.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -58,6 +58,11 @@
/////////////////////////////////////////////////////////////////////////
// class basic_text_iarchive - load serialized objects from a input text stream
+#if defined(_MSC_VER)
+#pragma warning( push )
+#pragma warning( disable : 4244 4267 )
+#endif
+
template<class IStream>
class basic_text_iprimitive
{
@@ -81,52 +86,40 @@
template<class T>
void load(T & t)
{
- if(is.fail())
- boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
- );
- is >> t;
+ if(! is.fail()){
+ is >> t;
+ return;
+ }
+ boost::serialization::throw_exception(
+ archive_exception(archive_exception::stream_error)
+ );
}
- void load(unsigned char & t)
+
+ void load(char & t)
{
- if(is.fail())
- boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
- );
- unsigned short int i;
- is >> i;
- t = static_cast<unsigned char>(i);
+ short int i;
+ load(i);
+ t = i;
}
void load(signed char & t)
{
- if(is.fail())
- boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
- );
- signed short int i;
- is >> i;
- t = static_cast<signed char>(i);
+ short int i;
+ load(i);
+ t = i;
}
- void load(char & t)
+ void load(unsigned char & t)
{
- if(is.fail())
- boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
- );
- short int i;
- is >> i;
- t = static_cast<char>(i);
+ unsigned short int i;
+ load(i);
+ t = i;
}
+
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
void load(wchar_t & t)
{
- if(is.fail())
- boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
- );
- unsigned i;
- is >> i;
- t = static_cast<wchar_t>(i);
+ short int i;
+ load(i);
+ t = i;
}
#endif
BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
@@ -138,6 +131,10 @@
load_binary(void *address, std::size_t count);
};
+#if defined(_MSC_VER)
+#pragma warning( pop )
+#endif
+
} // namespace archive
} // namespace boost
Modified: trunk/boost/archive/basic_text_oarchive.hpp
==============================================================================
--- trunk/boost/archive/basic_text_oarchive.hpp (original)
+++ trunk/boost/archive/basic_text_oarchive.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -102,6 +102,8 @@
const unsigned int x = t.t;
* this->This() << x;
}
+ // note the following four overrides are necessary for some borland
+ // compilers(5.51) which don't handle BOOST_STRONG_TYPE properly.
void save_override(const class_id_type & t, int){
// note:t.t resolves borland ambguity
const int x = t.t;
Modified: trunk/boost/archive/basic_xml_oarchive.hpp
==============================================================================
--- trunk/boost/archive/basic_xml_oarchive.hpp (original)
+++ trunk/boost/archive/basic_xml_oarchive.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -93,7 +93,7 @@
this->detail_common_oarchive::save_override(t, 0);
}
- // special treatment for name-value pairs.
+ // special treatment for name-value pairs.
typedef detail::common_oarchive<Archive> detail_common_oarchive;
template<class T>
void save_override(
Modified: trunk/boost/archive/detail/basic_iarchive.hpp
==============================================================================
--- trunk/boost/archive/detail/basic_iarchive.hpp (original)
+++ trunk/boost/archive/detail/basic_iarchive.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -84,8 +84,8 @@
);
// real public API starts here
void
- set_library_version(version_type archive_library_version);
- unsigned int
+ set_library_version(library_version_type archive_library_version);
+ library_version_type
get_library_version() const;
unsigned int
get_flags() const;
Modified: trunk/boost/archive/detail/basic_oarchive.hpp
==============================================================================
--- trunk/boost/archive/detail/basic_oarchive.hpp (original)
+++ trunk/boost/archive/detail/basic_oarchive.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -87,7 +87,7 @@
}
// real public interface starts here
void end_preamble(); // default implementation does nothing
- unsigned int get_library_version() const;
+ library_version_type get_library_version() const;
unsigned int get_flags() const;
};
Modified: trunk/boost/archive/detail/common_iarchive.hpp
==============================================================================
--- trunk/boost/archive/detail/common_iarchive.hpp (original)
+++ trunk/boost/archive/detail/common_iarchive.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -21,8 +21,6 @@
#include <boost/archive/detail/basic_iarchive.hpp>
#include <boost/archive/detail/basic_pointer_iserializer.hpp>
#include <boost/archive/detail/interface_iarchive.hpp>
-#include <boost/archive/detail/archive_serializer_map.hpp>
-#include <boost/serialization/singleton.hpp>
#ifdef BOOST_MSVC
# pragma warning(push)
Modified: trunk/boost/archive/detail/polymorphic_iarchive_route.hpp
==============================================================================
--- trunk/boost/archive/detail/polymorphic_iarchive_route.hpp (original)
+++ trunk/boost/archive/detail/polymorphic_iarchive_route.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -71,10 +71,10 @@
){
return ArchiveImplementation::load_pointer(t, bpis_ptr, finder);
}
- virtual void set_library_version(version_type archive_library_version){
+ virtual void set_library_version(library_version_type archive_library_version){
ArchiveImplementation::set_library_version(archive_library_version);
}
- virtual unsigned int get_library_version() const{
+ virtual library_version_type get_library_version() const{
return ArchiveImplementation::get_library_version();
}
virtual unsigned int get_flags() const {
Modified: trunk/boost/archive/detail/polymorphic_oarchive_route.hpp
==============================================================================
--- trunk/boost/archive/detail/polymorphic_oarchive_route.hpp (original)
+++ trunk/boost/archive/detail/polymorphic_oarchive_route.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -138,7 +138,7 @@
ArchiveImplementation::save(t);
}
#endif
- virtual unsigned int get_library_version() const{
+ virtual library_version_type get_library_version() const{
return ArchiveImplementation::get_library_version();
}
virtual unsigned int get_flags() const {
Modified: trunk/boost/archive/impl/basic_binary_iarchive.ipp
==============================================================================
--- trunk/boost/archive/impl/basic_binary_iarchive.ipp (original)
+++ trunk/boost/archive/impl/basic_binary_iarchive.ipp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -56,7 +56,7 @@
// make sure the version of the reading archive library can
// support the format of the archive being read
- version_type input_library_version;
+ library_version_type input_library_version;
* this->This() >> input_library_version;
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205))
Modified: trunk/boost/archive/impl/basic_binary_oarchive.ipp
==============================================================================
--- trunk/boost/archive/impl/basic_binary_oarchive.ipp (original)
+++ trunk/boost/archive/impl/basic_binary_oarchive.ipp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -38,7 +38,7 @@
const std::string file_signature(BOOST_ARCHIVE_SIGNATURE());
* this->This() << file_signature;
// write library version
- const version_type v(BOOST_ARCHIVE_VERSION());
+ const library_version_type v(BOOST_ARCHIVE_VERSION());
* this->This() << v;
}
Modified: trunk/boost/archive/impl/basic_text_iarchive.ipp
==============================================================================
--- trunk/boost/archive/impl/basic_text_iarchive.ipp (original)
+++ trunk/boost/archive/impl/basic_text_iarchive.ipp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -19,7 +19,7 @@
#endif
#include <boost/detail/workaround.hpp>
-
+#include <boost/serialization/string.hpp>
#include <boost/archive/basic_text_iarchive.hpp>
namespace boost {
@@ -27,6 +27,15 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// implementation of text_text_archive
+
+template<class Archive>
+BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
+basic_text_iarchive<Archive>::load_override(version_type & t, int){
+ unsigned int v;
+ load_override(v, 0);
+ t = v;
+}
+
template<class Archive>
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
basic_text_iarchive<Archive>::load_override(class_name_type & t, int){
@@ -55,7 +64,7 @@
// make sure the version of the reading archive library can
// support the format of the archive being read
- version_type input_library_version;
+ library_version_type input_library_version;
* this->This() >> input_library_version;
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205))
Modified: trunk/boost/archive/impl/basic_text_oarchive.ipp
==============================================================================
--- trunk/boost/archive/impl/basic_text_oarchive.ipp (original)
+++ trunk/boost/archive/impl/basic_text_oarchive.ipp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -54,7 +54,7 @@
const std::string file_signature(BOOST_ARCHIVE_SIGNATURE());
* this->This() << file_signature;
// write library version
- const version_type v(BOOST_ARCHIVE_VERSION());
+ const library_version_type v(BOOST_ARCHIVE_VERSION());
* this->This() << v;
}
Modified: trunk/boost/archive/impl/basic_xml_oarchive.ipp
==============================================================================
--- trunk/boost/archive/impl/basic_xml_oarchive.ipp (original)
+++ trunk/boost/archive/impl/basic_xml_oarchive.ipp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -168,7 +168,7 @@
basic_xml_oarchive<Archive>::save_override(const version_type & t, int)
{
int i = t.t; // extra .t is for borland
- write_attribute(VBOOST_ARCHIVE_XML_ERSION(), i);
+ write_attribute(BOOST_ARCHIVE_XML_VERSION(), i);
}
#endif
Modified: trunk/boost/archive/impl/xml_iarchive_impl.ipp
==============================================================================
--- trunk/boost/archive/impl/xml_iarchive_impl.ipp (original)
+++ trunk/boost/archive/impl/xml_iarchive_impl.ipp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -157,7 +157,7 @@
xml_iarchive_impl<Archive>::init(){
gimpl->init(is);
this->set_library_version(
- version_type(gimpl->rv.version)
+ library_version_type(gimpl->rv.version)
);
}
Modified: trunk/boost/archive/impl/xml_wiarchive_impl.ipp
==============================================================================
--- trunk/boost/archive/impl/xml_wiarchive_impl.ipp (original)
+++ trunk/boost/archive/impl/xml_wiarchive_impl.ipp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -147,7 +147,7 @@
xml_wiarchive_impl<Archive>::init(){
gimpl->init(is);
this->set_library_version(
- version_type(gimpl->rv.version)
+ library_version_type(gimpl->rv.version)
);
}
Modified: trunk/boost/archive/polymorphic_iarchive.hpp
==============================================================================
--- trunk/boost/archive/polymorphic_iarchive.hpp (original)
+++ trunk/boost/archive/polymorphic_iarchive.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -125,8 +125,8 @@
virtual ~polymorphic_iarchive_impl(){};
public:
// utility function implemented by all legal archives
- virtual void set_library_version(version_type archive_library_version) = 0;
- virtual unsigned int get_library_version() const = 0;
+ virtual void set_library_version(library_version_type archive_library_version) = 0;
+ virtual library_version_type get_library_version() const = 0;
virtual unsigned int get_flags() const = 0;
virtual void delete_created_pointers() = 0;
virtual void reset_object_address(
Modified: trunk/boost/archive/polymorphic_oarchive.hpp
==============================================================================
--- trunk/boost/archive/polymorphic_oarchive.hpp (original)
+++ trunk/boost/archive/polymorphic_oarchive.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -127,7 +127,7 @@
public:
// utility functions implemented by all legal archives
virtual unsigned int get_flags() const = 0;
- virtual unsigned int get_library_version() const = 0;
+ virtual library_version_type get_library_version() const = 0;
virtual void save_binary(const void * t, std::size_t size) = 0;
virtual void save_object(
Modified: trunk/boost/archive/text_wiarchive.hpp
==============================================================================
--- trunk/boost/archive/text_wiarchive.hpp (original)
+++ trunk/boost/archive/text_wiarchive.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -28,6 +28,8 @@
#include <boost/archive/basic_text_iarchive.hpp>
#include <boost/archive/detail/register_archive.hpp>
+#include <boost/serialization/item_version_type.hpp>
+
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
#ifdef BOOST_MSVC
@@ -55,6 +57,11 @@
void load(T & t){
basic_text_iprimitive<std::wistream>::load(t);
}
+ void load(boost::serialization::item_version_type & t){
+ unsigned int x;
+ basic_text_iprimitive<std::wistream>::load(x);
+ t = x;
+ }
BOOST_WARCHIVE_DECL(void)
load(char * t);
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
Modified: trunk/boost/archive/xml_iarchive.hpp
==============================================================================
--- trunk/boost/archive/xml_iarchive.hpp (original)
+++ trunk/boost/archive/xml_iarchive.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -63,6 +63,13 @@
void load(T & t){
basic_text_iprimitive<std::istream>::load(t);
}
+ #if 0 // only if implementing back versioning
+ void load(boost::serialization::item_version_type & t){
+ unsigned int x;
+ basic_text_iprimitive<std::istream>::load(x);
+ t = boost::serialization::item_version_type(x);
+ }
+ #endif
BOOST_ARCHIVE_DECL(void)
load(char * t);
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
Modified: trunk/boost/archive/xml_wiarchive.hpp
==============================================================================
--- trunk/boost/archive/xml_wiarchive.hpp (original)
+++ trunk/boost/archive/xml_wiarchive.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -29,6 +29,8 @@
#include <boost/archive/basic_xml_iarchive.hpp>
#include <boost/archive/detail/register_archive.hpp>
+#include <boost/serialization/item_version_type.hpp>
+
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
#ifdef BOOST_MSVC
@@ -67,6 +69,11 @@
void load(T & t){
basic_text_iprimitive<std::wistream>::load(t);
}
+ void load(boost::serialization::item_version_type & t){
+ unsigned int x;
+ basic_text_iprimitive<std::wistream>::load(x);
+ t = x;
+ }
BOOST_WARCHIVE_DECL(void)
load(char * t);
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
Modified: trunk/boost/serialization/collection_size_type.hpp
==============================================================================
--- trunk/boost/serialization/collection_size_type.hpp (original)
+++ trunk/boost/serialization/collection_size_type.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -6,15 +6,20 @@
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
+#include <cstddef> // size_t
#include <boost/serialization/strong_typedef.hpp>
#include <boost/serialization/level.hpp>
+#include <boost/serialization/split_free.hpp>
-namespace boost { namespace serialization {
+namespace boost {
+namespace serialization {
BOOST_STRONG_TYPEDEF(std::size_t, collection_size_type)
} } // end namespace boost::serialization
-BOOST_CLASS_IMPLEMENTATION(boost::serialization::collection_size_type, primitive_type)
+BOOST_SERIALIZATION_SPLIT_FREE(collection_size_type)
+
+BOOST_CLASS_IMPLEMENTATION(collection_size_type, primitive_type)
#endif //BOOST_SERIALIZATION_COLLECTION_SIZE_TYPE_HPP
Modified: trunk/boost/serialization/collections_load_imp.hpp
==============================================================================
--- trunk/boost/serialization/collections_load_imp.hpp (original)
+++ trunk/boost/serialization/collections_load_imp.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -32,11 +32,12 @@
#endif
#include <boost/detail/workaround.hpp>
+#include <boost/archive/detail/basic_iarchive.hpp>
#include <boost/serialization/access.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/detail/stack_constructor.hpp>
#include <boost/serialization/collection_size_type.hpp>
-
+#include <boost/serialization/item_version_type.hpp>
namespace boost{
namespace serialization {
@@ -137,21 +138,23 @@
inline void load_collection(Archive & ar, Container &s)
{
s.clear();
- // retrieve number of elements
collection_size_type count;
- unsigned int item_version;
+ item_version_type item_version;
+ const boost::archive::library_version_type library_version(
+ ar.get_library_version()
+ );
+ // retrieve number of elements
ar >> BOOST_SERIALIZATION_NVP(count);
- if(3 < ar.get_library_version())
+ if(boost::archive::library_version_type(3) < library_version){
ar >> BOOST_SERIALIZATION_NVP(item_version);
- else
- item_version = 0;
+ }
+
R rx;
rx(s, count);
- std::size_t c = count;
InputFunction ifunc;
BOOST_DEDUCED_TYPENAME Container::iterator hint;
hint = s.begin();
- while(c-- > 0){
+ while(count-- > 0){
hint = ifunc(ar, s, item_version, hint);
}
}
Modified: trunk/boost/serialization/collections_save_imp.hpp
==============================================================================
--- trunk/boost/serialization/collections_save_imp.hpp (original)
+++ trunk/boost/serialization/collections_save_imp.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -23,6 +23,7 @@
#include <boost/serialization/serialization.hpp>
#include <boost/serialization/version.hpp>
#include <boost/serialization/collection_size_type.hpp>
+#include <boost/serialization/item_version_type.hpp>
namespace boost{
namespace serialization {
@@ -36,27 +37,30 @@
inline void save_collection(Archive & ar, const Container &s)
{
// record number of elements
- collection_size_type const count(s.size());
- ar << BOOST_SERIALIZATION_NVP(count);
- // make sure the target type is registered so we can retrieve
- // the version when we load
- if(3 < ar.get_library_version()){
- const unsigned int item_version = version<
- BOOST_DEDUCED_TYPENAME Container::value_type
- >::value;
+ collection_size_type count(s.size());
+ const item_version_type item_version(
+ version<BOOST_DEDUCED_TYPENAME Container::value_type>::value
+ );
+ ar << BOOST_SERIALIZATION_NVP(count);
+ #if 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);
+ }
+ #else
ar << BOOST_SERIALIZATION_NVP(item_version);
- }
+ #endif
+
BOOST_DEDUCED_TYPENAME Container::const_iterator it = s.begin();
- collection_size_type c=count;
- while(c-- > 0){
- // note borland emits a no-op without the explicit namespace
- boost::serialization::save_construct_data_adl(
- ar,
- &(*it),
- boost::serialization::version<
- BOOST_DEDUCED_TYPENAME Container::value_type
- >::value
- );
+ while(count-- > 0){
+ // note borland emits a no-op without the explicit namespace
+ boost::serialization::save_construct_data_adl(
+ ar,
+ &(*it),
+ item_version
+ );
ar << boost::serialization::make_nvp("item", *it++);
}
}
Modified: trunk/boost/serialization/force_include.hpp
==============================================================================
--- trunk/boost/serialization/force_include.hpp (original)
+++ trunk/boost/serialization/force_include.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -41,6 +41,8 @@
# define BOOST_DLLEXPORT __declspec(dllexport)
# elif defined(__GNUC__) && (__GNUC__ >= 3)
# define BOOST_USED __attribute__ ((used))
+# elif defined(__IBMCPP__) && (__IBMCPP__ >= 1110)
+# define BOOST_USED __attribute__ ((used))
# elif defined(__INTEL_COMPILER) && (BOOST_INTEL_CXX_VERSION >= 800)
# define BOOST_USED __attribute__ ((used))
# endif
Modified: trunk/boost/serialization/hash_collections_load_imp.hpp
==============================================================================
--- trunk/boost/serialization/hash_collections_load_imp.hpp (original)
+++ trunk/boost/serialization/hash_collections_load_imp.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -19,8 +19,10 @@
// helper function templates for serialization of hashed collections
#include <boost/config.hpp>
+#include <boost/archive/detail/basic_iarchive.hpp>
#include <boost/serialization/nvp.hpp>
-//#include <boost/serialization/collections_load_imp.hpp>
+#include <boost/serialization/collection_size_type.hpp>
+#include <boost/serialization/item_version_type.hpp>
namespace boost{
namespace serialization {
@@ -33,14 +35,17 @@
inline void load_hash_collection(Archive & ar, Container &s)
{
s.clear();
+ collection_size_type count;
+ collection_size_type bucket_count;
+ boost::serialization::item_version_type item_version(0);
+ boost::archive::library_version_type library_version(
+ ar.get_library_version()
+ );
// retrieve number of elements
- unsigned int count;
- unsigned int item_version(0);
- unsigned int bucket_count;;
ar >> BOOST_SERIALIZATION_NVP(count);
- if(3 < ar.get_library_version()){
- ar >> BOOST_SERIALIZATION_NVP(bucket_count);
- ar >> BOOST_SERIALIZATION_NVP(item_version);
+ ar >> BOOST_SERIALIZATION_NVP(bucket_count);
+ if(boost::archive::library_version_type(3) < library_version){
+ ar >> BOOST_SERIALIZATION_NVP(item_version);
}
#if ! defined(__MWERKS__)
s.resize(bucket_count);
Modified: trunk/boost/serialization/hash_collections_save_imp.hpp
==============================================================================
--- trunk/boost/serialization/hash_collections_save_imp.hpp (original)
+++ trunk/boost/serialization/hash_collections_save_imp.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -22,6 +22,8 @@
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/serialization.hpp>
#include <boost/serialization/version.hpp>
+#include <boost/serialization/collection_size_type.hpp>
+#include <boost/serialization/item_version_type.hpp>
namespace boost{
namespace serialization {
@@ -34,17 +36,31 @@
template<class Archive, class Container>
inline void save_hash_collection(Archive & ar, const Container &s)
{
- // record number of elements
- unsigned int count = s.size();
- ar << BOOST_SERIALIZATION_NVP(count);
- // make sure the target type is registered so we can retrieve
- // the version when we load
- if(3 < ar.get_library_version()){
- const unsigned int bucket_count = s.bucket_count();
- ar << BOOST_SERIALIZATION_NVP(bucket_count);
- const unsigned int item_version = version<BOOST_DEDUCED_TYPENAME Container::value_type>::value;
+ collection_size_type count(s.size());
+ const collection_size_type bucket_count(s.bucket_count());
+ const item_version_type item_version(
+ version<BOOST_DEDUCED_TYPENAME Container::value_type>::value
+ );
+ ar << BOOST_SERIALIZATION_NVP(count);
+ ar << BOOST_SERIALIZATION_NVP(bucket_count);
+
+ #if 0
+ /* should only be necessary to create archives of previous versions
+ * which is not currently supported. So for now comment this out
+ */
+ boost::archive::library_version_type library_version(
+ ar.get_library_version()
+ );
+ if(boost::archive::library_version_type(3) < library_version){
+ // record number of elements
+ // make sure the target type is registered so we can retrieve
+ // the version when we load
ar << BOOST_SERIALIZATION_NVP(item_version);
}
+ #else
+ ar << BOOST_SERIALIZATION_NVP(item_version);
+ #endif
+
BOOST_DEDUCED_TYPENAME Container::const_iterator it = s.begin();
while(count-- > 0){
// note borland emits a no-op without the explicit namespace
Added: trunk/boost/serialization/item_version_type.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/serialization/item_version_type.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -0,0 +1,62 @@
+#ifndef BOOST_SERIALIZATION_ITEM_VERSION_TYPE_HPP
+#define BOOST_SERIALIZATION_ITEM_VERSION_TYPE_HPP
+
+// (C) Copyright 2010 Robert Ramey
+// 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/cstdint.hpp> // uint_least8_t
+#include <boost/operators.hpp>
+#include <boost/serialization/level.hpp>
+#include <boost/serialization/is_bitwise_serializable.hpp>
+
+namespace boost {
+namespace serialization {
+
+#if defined(_MSC_VER)
+#pragma warning( push )
+#pragma warning( disable : 4244 4267 )
+#endif
+
+struct item_version_type
+ : boost::totally_ordered1< item_version_type
+ , boost::totally_ordered2< item_version_type, uint_least8_t
+ > >
+{
+ typedef uint_least8_t base_type;
+ base_type t;
+ item_version_type(){};
+ explicit item_version_type(const item_version_type & t_) : t(t_.t){}
+ item_version_type(const unsigned int & t_) : t(t_){
+ assert(t_ <= boost::integer_traits<base_type>::const_max);
+ }
+ item_version_type & operator=(const item_version_type & rhs){
+ t = rhs.t;
+ return *this;
+ }
+ operator const base_type () const {
+ return t;
+ }
+ operator base_type & (){
+ return t;
+ }
+ bool operator==(const item_version_type & rhs) const {
+ return t == rhs.t;
+ }
+ bool operator<(const item_version_type & rhs) const {
+ return t < rhs.t;
+ }
+};
+
+#if defined(_MSC_VER)
+#pragma warning( pop )
+#endif
+
+} } // end namespace boost::serialization
+
+BOOST_IS_BITWISE_SERIALIZABLE(item_version_type)
+
+BOOST_CLASS_IMPLEMENTATION(item_version_type, primitive_type)
+
+#endif //BOOST_SERIALIZATION_ITEM_VERSION_TYPE_HPP
Modified: trunk/boost/serialization/optional.hpp
==============================================================================
--- trunk/boost/serialization/optional.hpp (original)
+++ trunk/boost/serialization/optional.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -16,7 +16,10 @@
#include <boost/config.hpp>
+#include <boost/archive/detail/basic_iarchive.hpp>
+
#include <boost/optional.hpp>
+#include <boost/serialization/item_version_type.hpp>
#include <boost/serialization/split_free.hpp>
#include <boost/serialization/level.hpp>
#include <boost/serialization/nvp.hpp>
@@ -37,10 +40,17 @@
const bool tflag = t.is_initialized();
ar << boost::serialization::make_nvp("initialized", tflag);
if (tflag){
- if(3 < ar.get_library_version()){
- const int v = version<T>::value;
- ar << boost::serialization::make_nvp("item_version", v);
+ 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);
}
}
@@ -54,11 +64,15 @@
bool tflag;
ar >> boost::serialization::make_nvp("initialized", tflag);
if (tflag){
- unsigned int v = 0;
- if(3 < ar.get_library_version()){
- ar >> boost::serialization::make_nvp("item_version", v);
+ 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){
+ // item_version is handled as an attribute so it doesnt need an NVP
+ ar >> BOOST_SERIALIZATION_NVP(item_version);
}
- detail::stack_construct<Archive, T> aux(ar, v);
+ detail::stack_construct<Archive, T> aux(ar, item_version);
ar >> boost::serialization::make_nvp("value", aux.reference());
t.reset(aux.reference());
}
Modified: trunk/boost/serialization/serialization.hpp
==============================================================================
--- trunk/boost/serialization/serialization.hpp (original)
+++ trunk/boost/serialization/serialization.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -11,13 +11,9 @@
#endif
#include <boost/config.hpp>
+#include <boost/archive/basic_archive.hpp>
#include <boost/serialization/strong_typedef.hpp>
#include <boost/serialization/pfto.hpp>
-#include <boost/serialization/throw_exception.hpp>
-#include <boost/serialization/nvp.hpp>
-
-// incremented for each "release"
-#define BOOST_SERIALIZATION_LIBRARY_VERSION 19
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// serialization.hpp: interface for serialization system.
Modified: trunk/boost/serialization/shared_ptr.hpp
==============================================================================
--- trunk/boost/serialization/shared_ptr.hpp (original)
+++ trunk/boost/serialization/shared_ptr.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -47,9 +47,9 @@
typedef mpl::int_<1> type;
#endif
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570))
- BOOST_STATIC_CONSTANT(unsigned int, value = 1);
+ BOOST_STATIC_CONSTANT(int, value = 1);
#else
- BOOST_STATIC_CONSTANT(unsigned int, value = type::value);
+ BOOST_STATIC_CONSTANT(int, value = type::value);
#endif
};
// don't track shared pointers
Modified: trunk/boost/serialization/slist.hpp
==============================================================================
--- trunk/boost/serialization/slist.hpp (original)
+++ trunk/boost/serialization/slist.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -58,19 +58,21 @@
// retrieve number of elements
collection_size_type count;
ar >> BOOST_SERIALIZATION_NVP(count);
- if(std::size_t(0) == count)
+ if(collection_size_type(0) == count)
return;
- unsigned int v;
- if(3 < ar.get_library_version()){
- ar >> boost::serialization::make_nvp("item_version", v);
+ item_version_type item_version(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);
}
- boost::serialization::detail::stack_construct<Archive, U> u(ar, v);
+ boost::serialization::detail::stack_construct<Archive, U> u(ar, item_version);
ar >> boost::serialization::make_nvp("item", u.reference());
t.push_front(u.reference());
BOOST_DEDUCED_TYPENAME BOOST_STD_EXTENSION_NAMESPACE::slist<U, Allocator>::iterator last;
last = t.begin();
- collection_size_type c = count;
- while(--c > 0){
+ while(--count > 0){
boost::serialization::detail::stack_construct<Archive, U>
u(ar, file_version);
ar >> boost::serialization::make_nvp("item", u.reference());
Modified: trunk/boost/serialization/vector.hpp
==============================================================================
--- trunk/boost/serialization/vector.hpp (original)
+++ trunk/boost/serialization/vector.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -127,7 +127,7 @@
const unsigned int file_version
){
#ifdef BOOST_SERIALIZATION_VECTOR_135_HPP
- if (ar.get_library_version()==5)
+ if (ar.get_library_version()==boost::archive::library_version_type(5))
{
load(ar,t,file_version, boost::is_arithmetic<U>());
return;
Modified: trunk/boost/serialization/version.hpp
==============================================================================
--- trunk/boost/serialization/version.hpp (original)
+++ trunk/boost/serialization/version.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -17,6 +17,7 @@
// See http://www.boost.org for updates, documentation, and revision history.
#include <boost/config.hpp>
+#include <boost/mpl/assert.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
@@ -66,19 +67,12 @@
//#include <boost/serialization/level.hpp>
//#include <boost/mpl/equal_to.hpp>
-#include <boost/mpl/assert.hpp>
#include <boost/mpl/less.hpp>
#include <boost/mpl/comparison.hpp>
// specify the current version number for the class
// version numbers limited to 8 bits !!!
#define BOOST_CLASS_VERSION(T, N) \
-BOOST_MPL_ASSERT(( \
- boost::mpl::less< \
- boost::mpl::int_<N>, \
- boost::mpl::int_<256> \
- > \
-)); \
namespace boost { \
namespace serialization { \
template<> \
@@ -86,9 +80,15 @@
{ \
typedef mpl::int_<N> type; \
typedef mpl::integral_c_tag tag; \
- BOOST_STATIC_CONSTANT(unsigned int, value = version::type::value); \
+ BOOST_STATIC_CONSTANT(int, value = version::type::value); \
+ BOOST_MPL_ASSERT(( \
+ boost::mpl::less< \
+ boost::mpl::int_<N>, \
+ boost::mpl::int_<256> \
+ > \
+ )); \
/* \
- BOOST_STATIC_ASSERT(( \
+ BOOST_MPL_ASSERT(( \
mpl::equal_to< \
:implementation_level<T >, \
mpl::int_<object_class_info> \
Modified: trunk/boost/serialization/void_cast.hpp
==============================================================================
--- trunk/boost/serialization/void_cast.hpp (original)
+++ trunk/boost/serialization/void_cast.hpp 2010-05-31 17:17:21 EDT (Mon, 31 May 2010)
@@ -108,6 +108,7 @@
protected:
void recursive_register(bool includes_virtual_base = false) const;
void recursive_unregister() const;
+ virtual bool has_virtual_base() const = 0;
public:
// Data members
const extended_type_info * m_derived;
@@ -166,6 +167,9 @@
);
return b;
}
+ virtual bool has_virtual_base() const {
+ return false;
+ }
public:
void_caster_primitive();
virtual ~void_caster_primitive();
@@ -197,6 +201,9 @@
class void_caster_virtual_base :
public void_caster
{
+ virtual bool has_virtual_base() const {
+ return true;
+ }
public:
virtual void const * downcast(void const * const t) const {
const Derived * d =
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk