|
Boost-Commit : |
From: ramey_at_[hidden]
Date: 2007-08-15 14:33:18
Author: ramey
Date: 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
New Revision: 38693
URL: http://svn.boost.org/trac/boost/changeset/38693
Log:
Changes made over the course of the year while 1.34 was being worked on
Text files modified:
branches/serialization_next_release/boost/boost/archive/basic_archive.hpp | 10 ---
branches/serialization_next_release/boost/boost/archive/basic_binary_iarchive.hpp | 32 ++++++-----
branches/serialization_next_release/boost/boost/archive/basic_binary_iprimitive.hpp | 18 +++++
branches/serialization_next_release/boost/boost/archive/basic_binary_oarchive.hpp | 37 ++++++++----
branches/serialization_next_release/boost/boost/archive/basic_binary_oprimitive.hpp | 14 +++++
branches/serialization_next_release/boost/boost/archive/basic_text_iarchive.hpp | 4
branches/serialization_next_release/boost/boost/archive/basic_text_oarchive.hpp | 21 ++++---
branches/serialization_next_release/boost/boost/archive/basic_text_oprimitive.hpp | 2
branches/serialization_next_release/boost/boost/archive/basic_xml_archive.hpp | 2
branches/serialization_next_release/boost/boost/archive/basic_xml_iarchive.hpp | 15 +++--
branches/serialization_next_release/boost/boost/archive/basic_xml_oarchive.hpp | 26 +++++---
branches/serialization_next_release/boost/boost/archive/binary_iarchive.hpp | 45 ++++++++++++++-
branches/serialization_next_release/boost/boost/archive/binary_iarchive_impl.hpp | 2
branches/serialization_next_release/boost/boost/archive/binary_oarchive.hpp | 7 +-
branches/serialization_next_release/boost/boost/archive/binary_oarchive_impl.hpp | 2
branches/serialization_next_release/boost/boost/archive/binary_wiarchive.hpp | 45 ++++++++++++++--
branches/serialization_next_release/boost/boost/archive/binary_woarchive.hpp | 7 +-
branches/serialization_next_release/boost/boost/archive/codecvt_null.hpp | 6 +
branches/serialization_next_release/boost/boost/archive/detail/abi_prefix.hpp | 5 +
branches/serialization_next_release/boost/boost/archive/detail/abi_suffix.hpp | 5 +
branches/serialization_next_release/boost/boost/archive/detail/basic_archive_impl.hpp | 43 ---------------
branches/serialization_next_release/boost/boost/archive/detail/basic_iarchive.hpp | 22 ++-----
branches/serialization_next_release/boost/boost/archive/detail/basic_oarchive.hpp | 19 ++----
branches/serialization_next_release/boost/boost/archive/detail/common_iarchive.hpp | 4 +
branches/serialization_next_release/boost/boost/archive/detail/common_oarchive.hpp | 5 +
branches/serialization_next_release/boost/boost/archive/detail/interface_iarchive.hpp | 24 +------
branches/serialization_next_release/boost/boost/archive/detail/interface_oarchive.hpp | 23 +------
branches/serialization_next_release/boost/boost/archive/detail/iserializer.hpp | 111 ++++++++++++++++++---------------------
branches/serialization_next_release/boost/boost/archive/detail/oserializer.hpp | 82 ++++++++++++++---------------
branches/serialization_next_release/boost/boost/archive/impl/basic_binary_iprimitive.ipp | 2
branches/serialization_next_release/boost/boost/archive/impl/basic_xml_oarchive.ipp | 32 ++++++++++
branches/serialization_next_release/boost/boost/archive/polymorphic_binary_iarchive.hpp | 21 ++++---
branches/serialization_next_release/boost/boost/archive/polymorphic_binary_oarchive.hpp | 13 ++--
branches/serialization_next_release/boost/boost/archive/polymorphic_iarchive.hpp | 41 +++++++++-----
branches/serialization_next_release/boost/boost/archive/polymorphic_oarchive.hpp | 29 +++++-----
branches/serialization_next_release/boost/boost/archive/polymorphic_text_iarchive.hpp | 19 ++++--
branches/serialization_next_release/boost/boost/archive/polymorphic_text_oarchive.hpp | 11 +--
branches/serialization_next_release/boost/boost/archive/polymorphic_text_wiarchive.hpp | 11 +--
branches/serialization_next_release/boost/boost/archive/polymorphic_text_woarchive.hpp | 11 +--
branches/serialization_next_release/boost/boost/archive/polymorphic_xml_iarchive.hpp | 19 ++++--
branches/serialization_next_release/boost/boost/archive/polymorphic_xml_oarchive.hpp | 11 +--
branches/serialization_next_release/boost/boost/archive/polymorphic_xml_wiarchive.hpp | 11 +--
branches/serialization_next_release/boost/boost/archive/polymorphic_xml_woarchive.hpp | 11 +--
branches/serialization_next_release/boost/boost/archive/text_iarchive.hpp | 36 ++++++++++--
branches/serialization_next_release/boost/boost/archive/text_oarchive.hpp | 7 +-
branches/serialization_next_release/boost/boost/archive/text_wiarchive.hpp | 36 ++++++++++--
branches/serialization_next_release/boost/boost/archive/text_woarchive.hpp | 7 +-
branches/serialization_next_release/boost/boost/archive/xml_iarchive.hpp | 39 ++++++++++---
branches/serialization_next_release/boost/boost/archive/xml_oarchive.hpp | 13 ++--
branches/serialization_next_release/boost/boost/archive/xml_wiarchive.hpp | 39 ++++++++++---
branches/serialization_next_release/boost/boost/archive/xml_woarchive.hpp | 13 ++--
51 files changed, 623 insertions(+), 447 deletions(-)
Modified: branches/serialization_next_release/boost/boost/archive/basic_archive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/basic_archive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/basic_archive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -117,14 +117,4 @@
BOOST_CLASS_IMPLEMENTATION(boost::archive::object_reference_type, primitive_type)
BOOST_CLASS_IMPLEMENTATION(boost::archive::tracking_type, primitive_type)
-/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
-// Make sure that the export.hpp header isn't included before any archive header
-// Doing so would inhibit construction of correct mpl list of known archive
-// types which in turn would inhibit instantiation of all combinations of
-// serialization/archive types.
-
-#ifdef BOOST_SERIALIZATION_EXPORT_HPP
-#error "export.hpp must not be included before any archive header"
-#endif
-
#endif //BOOST_ARCHIVE_BASIC_ARCHIVE_HPP
Modified: branches/serialization_next_release/boost/boost/archive/basic_binary_iarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/basic_binary_iarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/basic_binary_iarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -28,9 +28,9 @@
#include <boost/detail/workaround.hpp>
#include <boost/pfto.hpp>
-#include <boost/archive/detail/common_iarchive.hpp>
#include <boost/serialization/string.hpp>
-
+#include <boost/serialization/collection_size_type.hpp>
+#include <boost/archive/array/iarchive.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
@@ -40,7 +40,7 @@
// class basic_binary_iarchive - read serialized objects from a input binary stream
template<class Archive>
class basic_binary_iarchive :
- public detail::common_iarchive<Archive>
+ public array::iarchive<Archive>
{
protected:
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
@@ -56,11 +56,10 @@
// fot templates in the absence of partial function
// template ordering. If we get here pass to base class
// note extra nonsense to sneak it pass the borland compiers
- typedef detail::common_iarchive<Archive> detail_common_iarchive;
+ typedef array::iarchive<Archive> array_iarchive;
template<class T>
- void load_override(T & t, BOOST_PFTO int)
- {
- this->detail_common_iarchive::load_override(t, 0);
+ void load_override(T & t, BOOST_PFTO int){
+ this->array_iarchive::load_override(t, 0L);
}
// binary files don't include the optional information
void load_override(class_id_optional_type & /* t */, int){}
@@ -69,39 +68,44 @@
// for these pseudo prmitive types.
void load_override(version_type & t, int){
// upto 255 versions
- unsigned char x;
+ 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;
+ 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;
+ 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;
+ 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;
+ uint_least32_t x=0;
* this->This() >> x;
t = object_reference_type(x);
}
void load_override(tracking_type & t, int){
- char x;
+ char x=0;
* this->This() >> x;
t = (0 != x);
}
+ void load_override(serialization::collection_size_type & t, int){
+ unsigned int x=0;
+ * this->This() >> x;
+ t = serialization::collection_size_type(x);
+ }
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
load_override(class_name_type & t, int);
@@ -109,7 +113,7 @@
init();
basic_binary_iarchive(unsigned int flags) :
- detail::common_iarchive<Archive>(flags)
+ array_iarchive(flags)
{}
};
Modified: branches/serialization_next_release/boost/boost/archive/basic_binary_iprimitive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/basic_binary_iprimitive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/basic_binary_iprimitive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -48,6 +48,9 @@
#include <boost/archive/basic_streambuf_locale_saver.hpp>
#include <boost/archive/archive_exception.hpp>
#include <boost/archive/detail/auto_link_archive.hpp>
+#include <boost/mpl/placeholders.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
namespace boost {
@@ -86,6 +89,7 @@
load_binary(& t, sizeof(t));
int i = t;
assert(0 == i || 1 == i);
+ (void)i; // warning suppression for release builds.
}
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
load(std::string &s);
@@ -108,6 +112,16 @@
BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
~basic_binary_iprimitive();
public:
+ // we provide an optimized load for all fundamental types
+ typedef is_fundamental<mpl::_1> use_array_optimization;
+
+ // the optimized load_array dispatches to load_binary
+ template <class ValueType>
+ void load_array(serialization::array<ValueType>& a, unsigned int)
+ {
+ load_binary(a.address(),a.count()*sizeof(ValueType));
+ }
+
void
load_binary(void *address, std::size_t count);
};
@@ -146,7 +160,7 @@
static_cast<Elem *>(address),
s
);
- if(count != static_cast<std::size_t>(s))
+ if(scount != s)
boost::throw_exception(
archive_exception(archive_exception::stream_error)
);
@@ -157,7 +171,7 @@
// boost::throw_exception(archive_exception(archive_exception::stream_error));
Elem t;
scount = m_sb.sgetn(& t, 1);
- if(count != 1)
+ if(scount != 1)
boost::throw_exception(
archive_exception(archive_exception::stream_error)
);
Modified: branches/serialization_next_release/boost/boost/archive/basic_binary_oarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/basic_binary_oarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/basic_binary_oarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -27,8 +27,10 @@
#include <boost/pfto.hpp>
#include <boost/detail/workaround.hpp>
-#include <boost/archive/detail/common_oarchive.hpp>
+#include <boost/archive/array/oarchive.hpp>
#include <boost/serialization/string.hpp>
+#include <boost/serialization/collection_size_type.hpp>
+#include <boost/archive/array/oarchive.hpp>
namespace boost {
namespace archive {
@@ -41,12 +43,9 @@
// by a program built with the same tools for the same machne. This class
// does have the virtue of buiding the smalles archive in the minimum amount
// of time. So under some circumstances it may be he right choice.
-
-/////////////////////////////////////////////////////////////////////////
-// class basic_text_iarchive - read serialized objects from a input text stream
template<class Archive>
class basic_binary_oarchive :
- public detail::common_oarchive<Archive>
+ public array::oarchive<Archive>
{
protected:
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
@@ -59,33 +58,39 @@
friend class detail::interface_oarchive<Archive>;
#endif
// any datatype not specifed below will be handled by base class
- typedef detail::common_oarchive<Archive> detail_common_oarchive;
+ typedef array::oarchive<Archive> array_oarchive;
+ template<class T>
+ void save_override(const T & t, BOOST_PFTO int){
+ this->array_oarchive::save_override(t, 0L);
+ }
+ /*
template<class T>
void save_override(T & t, BOOST_PFTO int){
- this->detail_common_oarchive::save_override(t, 0);
+ this->save_override(const_cast<const T &>(t), 0L);
}
+ */
// 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
- unsigned char x = t.t;
+ const unsigned char x = t.t;
* this->This() << x;
}
void save_override(const class_id_type & t, int){
// upto 32K classes
- int_least16_t x = t.t;
+ const int_least16_t x = t.t;
* this->This() << x;
}
void save_override(const class_id_reference_type & t, int){
// upto 32K classes
- int_least16_t x = t.t;
+ const int_least16_t x = t.t;
* this->This() << x;
}
void save_override(const object_id_type & t, int){
// upto 2G objects
- uint_least32_t x = t.t;
+ const uint_least32_t x = t.t;
* this->This() << x;
}
void save_override(const object_reference_type & t, int){
@@ -94,7 +99,7 @@
* this->This() << x;
}
void save_override(const tracking_type & t, int){
- char x = t.t;
+ const char x = t.t;
* this->This() << x;
}
@@ -104,11 +109,17 @@
* this->This() << s;
}
+ void save_override(const serialization::collection_size_type & t, int){
+ // for backward compatibility, 64 bit integer or variable length integer would be preferred
+ unsigned int x = t.t;
+ * this->This() << x;
+ }
+
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
init();
basic_binary_oarchive(unsigned int flags) :
- detail::common_oarchive<Archive>(flags)
+ array_oarchive(flags)
{}
};
Modified: branches/serialization_next_release/boost/boost/archive/basic_binary_oprimitive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/basic_binary_oprimitive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/basic_binary_oprimitive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -46,6 +46,9 @@
#include <boost/archive/basic_streambuf_locale_saver.hpp>
#include <boost/archive/archive_exception.hpp>
#include <boost/archive/detail/auto_link_archive.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
namespace boost {
@@ -101,6 +104,7 @@
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
init();
+
BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
basic_binary_oprimitive(
std::basic_streambuf<Elem, Tr> & sb,
@@ -109,6 +113,16 @@
BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
~basic_binary_oprimitive();
public:
+ // we provide an optimized save for all fundamental types
+ typedef is_fundamental<mpl::_1> use_array_optimization;
+
+ // the optimized save_array dispatches to save_binary
+ template <class ValueType>
+ void save_array(serialization::array<ValueType> const& a, unsigned int)
+ {
+ save_binary(a.address(),a.count()*sizeof(ValueType));
+ }
+
void save_binary(const void *address, std::size_t count);
};
Modified: branches/serialization_next_release/boost/boost/archive/basic_text_iarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/basic_text_iarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/basic_text_iarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -61,7 +61,7 @@
{
this->detail_common_iarchive::load_override(t, 0);
}
-
+#if 0
// Borland compilers has a problem with strong type. Try to fix this here
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
void load_override(version_type & t, int){
@@ -70,7 +70,7 @@
t.t = version_type(x);
}
#endif
-
+#endif
// text file don't include the optional information
void load_override(class_id_optional_type & /*t*/, int){}
Modified: branches/serialization_next_release/boost/boost/archive/basic_text_oarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/basic_text_oarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/basic_text_oarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -78,36 +78,39 @@
// start new objects on a new line
void save_override(const object_id_type & t, int){
this->This()->newline();
- // and and invoke prmitive to underlying value
+ // note extra .t to funciton with Borland 5.51 compiler
+ // and invoke prmitive to underlying value
this->This()->save(t.t);
}
void save_override(const object_reference_type & t, int){
this->This()->newline();
- // and and invoke prmitive to underlying value
+ // note extra .t to funciton with Borland 5.51 compiler
+ // and invoke prmitive to underlying value
this->This()->save(t.t);
}
- // text file don't include the optional information
- void save_override(const class_id_optional_type & /* t */, int){}
-
// note the following four overrides are necessary for some borland
- // compilers which don't handle BOOST_STRONG_TYPE properly.
+ // compilers(5.51) which don't handle BOOST_STRONG_TYPE properly.
void save_override(const version_type & t, int){
// note:t.t resolves borland ambguity
- unsigned int x = t.t;
+ const unsigned int x = t.t;
* this->This() << x;
}
void save_override(const class_id_type & t, int){
// note:t.t resolves borland ambguity
- int x = t.t;
+ const int x = t.t;
* this->This() << x;
}
void save_override(const class_id_reference_type & t, int){
// note:t.t resolves borland ambguity
- int x = t.t;
+ const int x = t.t;
* this->This() << x;
}
+
+ // text file don't include the optional information
+ void save_override(const class_id_optional_type & /* t */, int){}
+
void save_override(const class_name_type & t, int){
const std::string s(t);
* this->This() << s;
Modified: branches/serialization_next_release/boost/boost/archive/basic_text_oprimitive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/basic_text_oprimitive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/basic_text_oprimitive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -89,10 +89,8 @@
void save(const bool t){
// trap usage of invalid uninitialized boolean which would
// otherwise crash on load.
-#ifndef NDEBUG
int i = t;
assert(0 == i || 1 == i);
-#endif
if(os.fail())
boost::throw_exception(archive_exception(archive_exception::stream_error));
os << t;
Modified: branches/serialization_next_release/boost/boost/archive/basic_xml_archive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/basic_xml_archive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/basic_xml_archive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -36,7 +36,7 @@
xml_archive_tag_mismatch,
xml_archive_tag_name_error
} exception_code;
- xml_archive_exception(exception_code /* c */)
+ xml_archive_exception(exception_code c)
{}
virtual const char *what( ) const throw( )
{
Modified: branches/serialization_next_release/boost/boost/archive/basic_xml_iarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/basic_xml_iarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/basic_xml_iarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// basic_xml_iarchive.hpp
-// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
+// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
@@ -25,6 +25,8 @@
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/string.hpp>
+#include <boost/mpl/assert.hpp>
+
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
@@ -33,7 +35,7 @@
/////////////////////////////////////////////////////////////////////////
// class xml_iarchive - read serialized objects from a input text stream
template<class Archive>
-class basic_xml_iarchive :
+class basic_xml_iarchive :
public detail::common_iarchive<Archive>
{
protected:
@@ -60,7 +62,8 @@
// If your program fails to compile here, its most likely due to
// not specifying an nvp wrapper around the variable to
// be serialized.
- BOOST_STATIC_ASSERT(0 == sizeof(T));
+ BOOST_MPL_ASSERT((serialization::is_wrapper<T>));
+ this->detail_common_iarchive::load_override(t, 0);
}
// Anything not an attribute - see below - should be a name value
@@ -71,7 +74,7 @@
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
const
#endif
- boost::serialization::nvp<T> & t,
+ boost::serialization::nvp<T> & t,
int
){
load_start(t.name());
@@ -101,9 +104,9 @@
// handle this.
// void load_override(class_name_type & t, int);
- BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
+ BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
basic_xml_iarchive(unsigned int flags);
- BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
+ BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
~basic_xml_iarchive();
};
Modified: branches/serialization_next_release/boost/boost/archive/basic_xml_oarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/basic_xml_oarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/basic_xml_oarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// basic_xml_oarchive.hpp
-// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
+// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
@@ -24,15 +24,18 @@
#include <boost/serialization/tracking.hpp>
#include <boost/serialization/string.hpp>
+#include <boost/mpl/assert.hpp>
+
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
-namespace boost {
+
+namespace boost {
namespace archive {
-
+
//////////////////////////////////////////////////////////////////////
// class basic_xml_oarchive - write serialized objects to a xml output stream
template<class Archive>
-class basic_xml_oarchive :
+class basic_xml_oarchive :
public detail::common_oarchive<Archive>
{
protected:
@@ -42,8 +45,10 @@
// for some inexplicable reason insertion of "class" generates compile erro
// on msvc 7.1
friend detail::interface_oarchive<Archive>;
+ friend class save_access;
#else
friend class detail::interface_oarchive<Archive>;
+ friend class save_access;
#endif
// special stuff for xml output
unsigned int depth;
@@ -55,13 +60,13 @@
init();
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
write_attribute(
- const char *attribute_name,
+ const char *attribute_name,
int t,
const char *conjunction = "=\""
);
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
write_attribute(
- const char *attribute_name,
+ const char *attribute_name,
const char *key
);
// helpers used below
@@ -80,7 +85,8 @@
// If your program fails to compile here, its most likely due to
// not specifying an nvp wrapper around the variable to
// be serialized.
- BOOST_STATIC_ASSERT(0 == sizeof(T));
+ BOOST_MPL_ASSERT((serialization::is_wrapper<T>));
+ this->detail_common_oarchive::save_override(t, 0);
}
// special treatment for name-value pairs.
@@ -90,7 +96,7 @@
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
const
#endif
- ::boost::serialization::nvp<T> & t,
+ ::boost::serialization::nvp<T> & t,
int
){
save_start(t.name());
@@ -117,9 +123,9 @@
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
save_override(const tracking_type & t, int);
- BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
+ BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
basic_xml_oarchive(unsigned int flags);
- BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
+ BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
~basic_xml_oarchive();
};
Modified: branches/serialization_next_release/boost/boost/archive/binary_iarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/binary_iarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/binary_iarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -22,6 +22,43 @@
namespace boost {
namespace archive {
+// do not derive from the classes below. If you want to extend this functionality
+// via inhertance, derived from text_iarchive_impl instead. This will
+// preserve correct static polymorphism.
+
+// same as binary_iarchive below - without the shared_ptr_helper
+class naked_binary_iarchive :
+ public binary_iarchive_impl<
+ boost::archive::naked_binary_iarchive,
+ std::istream::char_type,
+ std::istream::traits_type
+ >
+{
+public:
+ naked_binary_iarchive(std::istream & is, unsigned int flags = 0) :
+ binary_iarchive_impl<
+ naked_binary_iarchive, std::istream::char_type, std::istream::traits_type
+ >(is, flags)
+ {}
+ naked_binary_iarchive(std::streambuf & bsb, unsigned int flags = 0) :
+ binary_iarchive_impl<
+ naked_binary_iarchive, std::istream::char_type, std::istream::traits_type
+ >(bsb, flags)
+ {}
+};
+
+} // namespace archive
+} // namespace boost
+
+// note special treatment of shared_ptr. This type needs a special
+// structure associated with every archive. We created a "mix-in"
+// class to provide this functionality. Since shared_ptr holds a
+// special esteem in the boost library - we included it here by default.
+#include <boost/archive/shared_ptr_helper.hpp>
+
+namespace boost {
+namespace archive {
+
// do not derive from this class. If you want to extend this functionality
// via inhertance, derived from binary_iarchive_impl instead. This will
// preserve correct static polymorphism.
@@ -30,7 +67,8 @@
boost::archive::binary_iarchive,
std::istream::char_type,
std::istream::traits_type
- >
+ >,
+ public detail::shared_ptr_helper
{
public:
binary_iarchive(std::istream & is, unsigned int flags = 0) :
@@ -48,8 +86,7 @@
} // namespace archive
} // namespace boost
-// required by smart_cast for compilers not implementing
-// partial template specialization
-BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::binary_iarchive)
+// required by export
+BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::binary_iarchive)
#endif // BOOST_ARCHIVE_BINARY_IARCHIVE_HPP
Modified: branches/serialization_next_release/boost/boost/archive/binary_iarchive_impl.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/binary_iarchive_impl.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/binary_iarchive_impl.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -42,7 +42,7 @@
// make this protected so it can be called from a derived archive
template<class T>
void load_override(T & t, BOOST_PFTO int){
- basic_binary_iarchive<Archive>::load_override(t, 0);
+ this->basic_binary_iarchive<Archive>::load_override(t, 0L);
}
void init(unsigned int flags){
if(0 != (flags & no_header))
Modified: branches/serialization_next_release/boost/boost/archive/binary_oarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/binary_oarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/binary_oarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -43,11 +43,12 @@
{}
};
+typedef binary_oarchive naked_binary_oarchive;
+
} // namespace archive
} // namespace boost
-// required by smart_cast for compilers not implementing
-// partial template specialization
-BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::binary_oarchive)
+// required by export
+BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::binary_oarchive)
#endif // BOOST_ARCHIVE_BINARY_OARCHIVE_HPP
Modified: branches/serialization_next_release/boost/boost/archive/binary_oarchive_impl.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/binary_oarchive_impl.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/binary_oarchive_impl.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -42,7 +42,7 @@
// make this protected so it can be called from a derived archive
template<class T>
void save_override(T & t, BOOST_PFTO int){
- basic_binary_oarchive<Archive>::save_override(t, 0);
+ this->basic_binary_oarchive<Archive>::save_override(t, 0L);
}
void init(unsigned int flags) {
if(0 != (flags & no_header))
Modified: branches/serialization_next_release/boost/boost/archive/binary_wiarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/binary_wiarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/binary_wiarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -27,9 +27,43 @@
namespace boost {
namespace archive {
-// do not derive from this class. If you want to extend this functionality
-// via inhertance, derived from binary_iarchive_impl instead. This will
-// preserve correct static polymorphism.
+// same as binary_wiarchive below - without the shared_ptr_helper
+class naked_binary_wiarchive :
+ public binary_iarchive_impl<
+ boost::archive::naked_binary_wiarchive,
+ std::wistream::char_type,
+ std::wistream::traits_type
+ >
+{
+public:
+ naked_binary_wiarchive(std::wistream & is, unsigned int flags = 0) :
+ binary_iarchive_impl<
+ naked_binary_wiarchive,
+ std::wistream::char_type,
+ std::wistream::traits_type
+ >(is, flags)
+ {}
+ naked_binary_wiarchive(std::wstreambuf & bsb, unsigned int flags = 0) :
+ binary_iarchive_impl<
+ naked_binary_wiarchive,
+ std::wistream::char_type,
+ std::wistream::traits_type
+ >(bsb, flags)
+ {}
+};
+
+} // namespace archive
+} // namespace boost
+
+// note special treatment of shared_ptr. This type needs a special
+// structure associated with every archive. We created a "mix-in"
+// class to provide this functionality. Since shared_ptr holds a
+// special esteem in the boost library - we included it here by default.
+#include <boost/archive/shared_ptr_helper.hpp>
+
+namespace boost {
+namespace archive {
+
class binary_wiarchive :
public binary_iarchive_impl<
binary_wiarchive, std::wistream::char_type, std::wistream::traits_type
@@ -51,9 +85,8 @@
} // namespace archive
} // namespace boost
-// required by smart_cast for compilers not implementing
-// partial template specialization
-BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::binary_wiarchive)
+// required by export
+BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::binary_wiarchive)
#endif // BOOST_NO_STD_WSTREAMBUF
#endif // BOOST_ARCHIVE_BINARY_WIARCHIVE_HPP
Modified: branches/serialization_next_release/boost/boost/archive/binary_woarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/binary_woarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/binary_woarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -48,12 +48,13 @@
{}
};
+typedef binary_woarchive naked_binary_woarchive;
+
} // namespace archive
} // namespace boost
-// required by smart_cast for compilers not implementing
-// partial template specialization
-BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::binary_woarchive)
+// required by export
+BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::binary_woarchive)
#endif // BOOST_NO_STD_WSTREAMBUF
#endif // BOOST_ARCHIVE_BINARY_WOARCHIVE_HPP
Modified: branches/serialization_next_release/boost/boost/archive/codecvt_null.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/codecvt_null.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/codecvt_null.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -25,14 +25,16 @@
#if defined(__LIBCOMO__)
using ::mbstate_t;
#elif defined(__QNXNTO__)
- using std::mbstate_t;
+ //using std::mbstate_t;
#elif defined(BOOST_DINKUMWARE_STDLIB) && BOOST_DINKUMWARE_STDLIB == 1
using ::mbstate_t;
#elif defined(__SGI_STL_PORT)
#elif defined(BOOST_NO_STDC_NAMESPACE)
using ::codecvt;
using ::mbstate_t;
- #endif
+ #elif defined(BOOST_RWSTD_VER)
+ using ::mbstate_t;
+ #endif
} // namespace std
namespace boost {
Modified: branches/serialization_next_release/boost/boost/archive/detail/abi_prefix.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/detail/abi_prefix.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/detail/abi_prefix.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -13,3 +13,8 @@
# pragma warning(push)
# pragma warning(disable : 4251 4231 4660 4275)
#endif
+
+#if defined( __BORLANDC__ )
+#pragma nopushoptwarn
+#endif
+
Modified: branches/serialization_next_release/boost/boost/archive/detail/abi_suffix.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/detail/abi_suffix.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/detail/abi_suffix.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -12,3 +12,8 @@
#pragma warning(pop)
#endif
#include <boost/config/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
+
+#if defined( __BORLANDC__ )
+#pragma nopushoptwarn
+#endif
+
Modified: branches/serialization_next_release/boost/boost/archive/detail/basic_archive_impl.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/detail/basic_archive_impl.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/detail/basic_archive_impl.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -20,7 +20,6 @@
// #include <boost/scoped_ptr.hpp>
#include <set>
-#include <boost/shared_ptr.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
@@ -35,48 +34,6 @@
//////////////////////////////////////////////////////////////////////
class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_archive_impl
{
- //////////////////////////////////////////////////////////////////////
- // list of serialization helpers
- // at least one compiler sunpro 5.3 erroneously doesn't give access to embedded structs
- struct helper_compare;
- friend struct helper_compare;
-
- struct helper_type {
- shared_ptr<void> m_helper;
- const boost::serialization::extended_type_info * m_eti;
- helper_type(
- shared_ptr<void> h,
- const boost::serialization::extended_type_info * const eti
- ) :
- m_helper(h),
- m_eti(eti)
- {}
- };
-
- struct helper_compare {
- bool operator()(
- const helper_type & lhs,
- const helper_type & rhs
- ) const {
- return lhs.m_eti < rhs.m_eti;
- }
- };
-
- typedef std::set<helper_type, helper_compare> collection;
- typedef collection::iterator helper_iterator;
- typedef collection::const_iterator helper_const_iterator;
- collection m_helpers;
-protected:
- void
- lookup_helper(
- const boost::serialization::extended_type_info * const eti,
- shared_ptr<void> & sph
- );
- void
- insert_helper(
- const boost::serialization::extended_type_info * const eti,
- shared_ptr<void> & sph
- );
};
} // namespace detail
Modified: branches/serialization_next_release/boost/boost/archive/detail/basic_iarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/detail/basic_iarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/detail/basic_iarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -65,26 +65,20 @@
public:
// note: NOT part of the public API.
void next_object_pointer(void *t);
- void register_basic_serializer(const basic_iserializer & bis);
- void
- lookup_basic_helper(
- const boost::serialization::extended_type_info * const eti,
- shared_ptr<void> & sph
- );
- void
- insert_basic_helper(
- const boost::serialization::extended_type_info * const eti,
- shared_ptr<void> & sph
+ void register_basic_serializer(
+ const /* BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) */ basic_iserializer & bis
);
void load_object(
void *t,
- const basic_iserializer & bis
+ const /* BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) */ basic_iserializer & bis
);
- const basic_pointer_iserializer *
+ const /* BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) */ basic_pointer_iserializer *
load_pointer(
void * & t,
- const basic_pointer_iserializer * bpis_ptr,
- const basic_pointer_iserializer * (*finder)(
+ const /* BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) */
+ basic_pointer_iserializer * bpis_ptr,
+ const /* BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) */
+ basic_pointer_iserializer * (*finder)(
const boost::serialization::extended_type_info & eti
)
);
Modified: branches/serialization_next_release/boost/boost/archive/detail/basic_oarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/detail/basic_oarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/detail/basic_oarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -62,7 +62,7 @@
virtual void vsave(const class_name_type & t) = 0;
virtual void vsave(const tracking_type t) = 0;
protected:
- basic_oarchive(unsigned int flags);
+ basic_oarchive(unsigned int flags = 0);
// account for bogus gcc warning
#if defined(__GNUC__)
virtual
@@ -70,24 +70,17 @@
~basic_oarchive();
public:
// note: NOT part of the public interface
- void register_basic_serializer(const basic_oserializer & bos);
- void
- lookup_basic_helper(
- const boost::serialization::extended_type_info * const eti,
- shared_ptr<void> & sph
- );
- void
- insert_basic_helper(
- const boost::serialization::extended_type_info * const eti,
- shared_ptr<void> & sph
+ void register_basic_serializer(
+ 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);
Modified: branches/serialization_next_release/boost/boost/archive/detail/common_iarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/detail/common_iarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/detail/common_iarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -19,6 +19,7 @@
#include <boost/archive/detail/basic_iarchive.hpp>
#include <boost/archive/detail/interface_iarchive.hpp>
#include <boost/archive/detail/iserializer.hpp>
+#include <boost/archive/detail/register_archive.hpp>
#include <boost/pfto.hpp>
namespace boost {
@@ -31,6 +32,7 @@
public basic_iarchive,
public interface_iarchive<Archive>
{
+ friend class interface_iarchive<Archive>;
private:
virtual void vload(version_type & t){
* this->This() >> t;
@@ -61,7 +63,7 @@
void load_start(const char *name){}
void load_end(const char *name){}
// default archive initialization
- common_iarchive(unsigned int flags) :
+ common_iarchive(unsigned int flags = 0) :
basic_iarchive(flags),
interface_iarchive<Archive>()
{}
Modified: branches/serialization_next_release/boost/boost/archive/detail/common_oarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/detail/common_oarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/detail/common_oarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -19,6 +19,7 @@
#include <boost/archive/detail/basic_oarchive.hpp>
#include <boost/archive/detail/interface_oarchive.hpp>
#include <boost/archive/detail/oserializer.hpp>
+#include <boost/archive/detail/register_archive.hpp>
namespace boost {
namespace archive {
@@ -30,6 +31,7 @@
public basic_oarchive,
public interface_oarchive<Archive>
{
+ friend class interface_oarchive<Archive>;
private:
virtual void vsave(const version_type t){
* this->This() << t;
@@ -61,10 +63,9 @@
void save_override(T & t, BOOST_PFTO int){
archive::save(* this->This(), t);
}
-
void save_start(const char *name){}
void save_end(const char *name){}
- common_oarchive(unsigned int flags) :
+ common_oarchive(unsigned int flags = 0) :
basic_oarchive(flags),
interface_oarchive<Archive>()
{}
Modified: branches/serialization_next_release/boost/boost/archive/detail/interface_iarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/detail/interface_iarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/detail/interface_iarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -28,6 +28,7 @@
namespace serialization {
class extended_type_info;
} // namespace serialization
+
namespace archive {
namespace detail {
@@ -50,28 +51,13 @@
}
template<class T>
- const basic_pointer_iserializer * register_type(T * = NULL){
- const basic_pointer_iserializer & bpis =
- instantiate_pointer_iserializer(
- static_cast<Archive *>(NULL),
- static_cast<T *>(NULL)
- );
+ const /* BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) */ basic_pointer_iserializer *
+ register_type(T * = NULL){
+ 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;
}
- void lookup_helper(
- const boost::serialization::extended_type_info * const eti,
- boost::shared_ptr<void> & sph
- ){
- this->This()->lookup_basic_helper(eti, sph);
- }
-
- void insert_helper(
- const boost::serialization::extended_type_info * const eti,
- shared_ptr<void> & sph
- ){
- this->This()->insert_basic_helper(eti, sph);
- }
template<class T>
Archive & operator>>(T & t){
this->This()->load_override(t, 0);
Modified: branches/serialization_next_release/boost/boost/archive/detail/interface_oarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/detail/interface_oarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/detail/interface_oarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -51,29 +51,14 @@
}
template<class T>
- const basic_pointer_oserializer * register_type(const T * = NULL){
- const basic_pointer_oserializer & bpos =
- instantiate_pointer_oserializer(
- static_cast<Archive *>(NULL),
- static_cast<T *>(NULL)
- );
+ const /* BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) */ basic_pointer_oserializer *
+ register_type(const T * = NULL){
+ 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;
}
- void lookup_helper(
- const boost::serialization::extended_type_info * const eti,
- boost::shared_ptr<void> & sph
- ){
- this->This()->lookup_basic_helper(eti, sph);
- }
-
- void insert_helper(
- const boost::serialization::extended_type_info * const eti,
- shared_ptr<void> & sph
- ){
- this->This()->insert_basic_helper(eti, sph);
- }
template<class T>
Archive & operator<<(T & t){
this->This()->save_override(t, 0);
Modified: branches/serialization_next_release/boost/boost/archive/detail/iserializer.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/detail/iserializer.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/detail/iserializer.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -44,6 +44,7 @@
#include <boost/type_traits/is_enum.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/remove_const.hpp>
+#include <boost/type_traits/remove_all_extents.hpp>
#include <boost/serialization/is_abstract.hpp>
#include <boost/mpl/eval_if.hpp>
@@ -57,6 +58,7 @@
#include <boost/mpl/list.hpp>
#include <boost/mpl/empty.hpp>
#include <boost/mpl/not.hpp>
+#include <boost/mpl/bool.hpp>
#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO
#include <boost/serialization/extended_type_info_typeid.hpp>
@@ -65,7 +67,7 @@
#include <boost/archive/detail/basic_iarchive.hpp>
#include <boost/archive/detail/basic_iserializer.hpp>
#include <boost/archive/detail/archive_pointer_iserializer.hpp>
-#include <boost/archive/archive_exception.hpp>
+#include <boost/archive/detail/dynamically_initialized.hpp>
#include <boost/serialization/force_include.hpp>
#include <boost/serialization/serialization.hpp>
@@ -74,9 +76,9 @@
#include <boost/serialization/tracking.hpp>
#include <boost/serialization/type_info_implementation.hpp>
#include <boost/serialization/nvp.hpp>
-#include <boost/serialization/binary_object.hpp>
#include <boost/serialization/void_cast.hpp>
-
+#include <boost/serialization/array.hpp>
+#include <boost/serialization/collection_size_type.hpp>
namespace boost {
namespace serialization {
@@ -127,7 +129,7 @@
return boost::serialization::tracking_level<T>::value
== boost::serialization::track_always
|| boost::serialization::tracking_level<T>::value
- == boost::serialization::track_selectivly
+ == boost::serialization::track_selectively
&& serialized_as_pointer();
}
virtual unsigned int version() const {
@@ -140,7 +142,7 @@
>::type::is_polymorphic::type typex;
return typex::value;
}
- static iserializer & instantiate(){
+ static iserializer & get_instance(){
static iserializer instance;
return instance;
}
@@ -162,15 +164,14 @@
);
}
-// instantiation of this template creates a static object. Note inversion of
-// normal argument order to workaround bizarre error in MSVC 6.0 which only
-// manifests iftself during compiler time.
-template<class T, class Archive>
-class pointer_iserializer : public archive_pointer_iserializer<Archive>
+template<class Archive, class T>
+class pointer_iserializer
+ : public archive_pointer_iserializer<Archive>
+ , public dynamically_initialized<pointer_iserializer<Archive,T> >
{
private:
virtual const basic_iserializer & get_basic_serializer() const {
- return iserializer<Archive, T>::instantiate();
+ return iserializer<Archive, T>::get_instance();
}
virtual BOOST_DLLEXPORT void load_object_ptr(
basic_iarchive & ar,
@@ -182,32 +183,18 @@
#endif
// private constructor to inhibit any existence other than the
// static one. Note GCC doesn't permit constructor to be private
- explicit BOOST_DLLEXPORT pointer_iserializer() BOOST_USED;
- static const pointer_iserializer instance;
+ BOOST_DLLEXPORT pointer_iserializer() BOOST_USED;
+ friend struct dynamically_initialized<pointer_iserializer<Archive,T> >;
public:
// at least one compiler (CW) seems to require that serialize_adl
// be explicitly instantiated. Still under investigation.
- #if ! BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
+ #if !defined(__BORLANDC__)
void (* const m)(Archive &, T &, const unsigned);
boost::serialization::extended_type_info * (* e)();
#endif
- static BOOST_DLLEXPORT const pointer_iserializer & instantiate() BOOST_USED;
- virtual ~pointer_iserializer(){};
+ BOOST_DLLEXPORT static const pointer_iserializer & get_instance() BOOST_USED;
};
-template<class T, class Archive>
-BOOST_DLLEXPORT const pointer_iserializer<T, Archive> &
-pointer_iserializer<T, Archive>::instantiate() {
- return instance;
-}
-
-// note: instances of this template to be constructed before the main
-// is called in order for things to be initialized properly. For this
-// reason, hiding the instance in a static function as was done above
-// won't work here so we created a free instance here.
-template<class T, class Archive>
-const pointer_iserializer<T, Archive> pointer_iserializer<T, Archive>::instance;
-
// note trick to be sure that operator new is using class specific
// version if such exists. Due to Peter Dimov.
// note: the following fails if T has no default constructor.
@@ -278,19 +265,15 @@
T* m_p;
};
-template<class T, class Archive>
-BOOST_DLLEXPORT void pointer_iserializer<T, Archive>::load_object_ptr(
+template<class Archive, class T>
+BOOST_DLLEXPORT void pointer_iserializer<Archive, T>::load_object_ptr(
basic_iarchive & ar,
void * & x,
const unsigned int file_version
-) const {
+) const
+{
Archive & ar_impl = boost::smart_cast_reference<Archive &>(ar);
-// if(0 != (ar.get_flags() & no_object_creation)){
-// ar_impl >> boost::serialization::make_nvp(NULL, * static_cast<T *>(x));
-// return;
-// }
-
auto_ptr_with_deleter<T> ap(heap_allocator<T>::invoke());
if(NULL == ap.get())
boost::throw_exception(std::bad_alloc()) ;
@@ -312,6 +295,7 @@
);
}
BOOST_CATCH(...){
+ ap.release();
BOOST_RETHROW;
}
BOOST_CATCH_END
@@ -320,26 +304,33 @@
ap.release();
}
-template<class T, class Archive>
-#if ! BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
-BOOST_DLLEXPORT pointer_iserializer<T, Archive>::pointer_iserializer() :
+template<class Archive, class T>
+#if !defined(__BORLANDC__)
+BOOST_DLLEXPORT pointer_iserializer<Archive, T>::pointer_iserializer() :
archive_pointer_iserializer<Archive>(
* boost::serialization::type_info_implementation<T>::type::get_instance()
),
m(boost::serialization::serialize_adl<Archive, T>),
e(boost::serialization::type_info_implementation<T>::type::get_instance)
#else
-BOOST_DLLEXPORT pointer_iserializer<T, Archive>::pointer_iserializer() :
+BOOST_DLLEXPORT pointer_iserializer<Archive, T>::pointer_iserializer() :
archive_pointer_iserializer<Archive>(
* boost::serialization::type_info_implementation<T>::type::get_instance()
)
#endif
{
- iserializer<Archive, T> & bis = iserializer<Archive, T>::instantiate();
+ iserializer<Archive, T> & bis = iserializer<Archive, T>::get_instance();
bis.set_bpis(this);
}
template<class Archive, class T>
+BOOST_DLLEXPORT const pointer_iserializer<Archive, T> &
+pointer_iserializer<Archive, T>::get_instance() {
+ // note: comeau complains without full qualification
+ return dynamically_initialized<pointer_iserializer<Archive,T> >::instance;
+}
+
+template<class Archive, class T>
struct load_non_pointer_type {
// note this bounces the call right back to the archive
// with no runtime overhead
@@ -370,7 +361,7 @@
// its not called that way - so fix it her
typedef BOOST_DEDUCED_TYPENAME boost::remove_const<T>::type typex;
void * x = & const_cast<typex &>(t);
- ar.load_object(x, iserializer<Archive, T>::instantiate());
+ ar.load_object(x, iserializer<Archive, T>::get_instance());
}
};
@@ -506,6 +497,8 @@
template<class Archive, class T>
struct load_array_type {
static void invoke(Archive &ar, T &t){
+ typedef typename remove_all_extents<T>::type value_type;
+
// convert integers to correct enum to load
int current_count = sizeof(t) / (
static_cast<char *>(static_cast<void *>(&t[1]))
@@ -517,12 +510,11 @@
boost::throw_exception(archive::archive_exception(
boost::archive::archive_exception::array_size_too_short
));
- int i;
- for(i = 0; i < count; ++i)
- ar >> boost::serialization::make_nvp("item", t[i]);
+ ar >> serialization::make_array(static_cast<value_type*>(&t[0]),count);
}
};
+#if 0
// note bogus arguments to workaround msvc 6 silent runtime failure
template<class Archive, class T>
BOOST_DLLEXPORT
@@ -539,10 +531,9 @@
Archive * /* ar = NULL */,
T * /* t = NULL */
){
- // note: reversal of order of arguments to work around msvc 6.0 bug
- // that manifests itself while trying to link.
- return pointer_iserializer<T, Archive>::instantiate();
+ return pointer_iserializer<Archive,T>::instance;
}
+#endif
} // detail
@@ -572,7 +563,7 @@
// BORLAND
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x560))
-// borland has a couple fo problems
+// borland has a couple of problems
// a) if function is partiall specialized - see below
// const paramters are transformed to non-const ones
// b) implementation of base_object can't be made to work
@@ -585,21 +576,19 @@
}
#endif
-// let wrappers through. (Someday implement is_wrapper)
+// let wrappers through.
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
template<class Archive, class T>
-inline void load(Archive &ar, const serialization::nvp<T> &t){
- boost::archive::load(ar, const_cast<serialization::nvp<T> &>(t));
-}
-template<class Archive>
-inline void load(Archive &ar, const serialization::binary_object &t){
- boost::archive::load(ar, const_cast<serialization::binary_object &>(t));
+inline void load_wrapper(Archive &ar, const T&t, mpl::true_){
+ boost::archive::load(ar, const_cast<T&>(t));
}
-//template<class Archive, class T>
-//inline void load(Archive &ar, const serialization::binary_object &t){
-// load(ar, const_cast<binary_object &>(t));
-//}
+#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x560))
+template<class Archive, class T>
+inline void load(Archive &ar, const T&t){
+ load_wrapper(ar,t,serialization::is_wrapper<T>());
+}
+#endif
#endif
} // namespace archive
Modified: branches/serialization_next_release/boost/boost/archive/detail/oserializer.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/detail/oserializer.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/detail/oserializer.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -37,6 +37,7 @@
#include <boost/type_traits/is_volatile.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/remove_all_extents.hpp>
#include <boost/serialization/is_abstract.hpp>
#include <boost/mpl/eval_if.hpp>
@@ -57,6 +58,7 @@
#include <boost/archive/detail/basic_oarchive.hpp>
#include <boost/archive/detail/basic_oserializer.hpp>
#include <boost/archive/detail/archive_pointer_oserializer.hpp>
+#include <boost/archive/detail/dynamically_initialized.hpp>
#include <boost/serialization/force_include.hpp>
#include <boost/serialization/serialization.hpp>
@@ -66,6 +68,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/archive/archive_exception.hpp>
@@ -100,7 +104,7 @@
private:
// private constructor to inhibit any existence other than the
// static one
- explicit oserializer() :
+ explicit BOOST_DLLEXPORT oserializer() :
basic_oserializer(
* boost::serialization::type_info_implementation<T>::type::get_instance()
)
@@ -118,7 +122,7 @@
// if(0 != (flags & no_tracking))
// return false;
return boost::serialization::tracking_level<T>::value == boost::serialization::track_always
- || boost::serialization::tracking_level<T>::value == boost::serialization::track_selectivly
+ || boost::serialization::tracking_level<T>::value == boost::serialization::track_selectively
&& serialized_as_pointer();
}
virtual unsigned int version() const {
@@ -130,7 +134,7 @@
>::type::is_polymorphic::type typex;
return typex::value;
}
- static oserializer & instantiate(){
+ static oserializer & get_instance(){
static oserializer instance;
return instance;
}
@@ -151,15 +155,14 @@
);
}
-// instantiation of this template creates a static object. Note inversion of
-// normal argument order to workaround bizarre error in MSVC 6.0 which only
-// manifests iftself during compiler time.
-template<class T, class Archive>
-class pointer_oserializer : public archive_pointer_oserializer<Archive>
+template<class Archive, class T>
+class pointer_oserializer
+ : public archive_pointer_oserializer<Archive>
+ , public dynamically_initialized<pointer_oserializer<Archive,T> >
{
private:
virtual const basic_oserializer & get_basic_serializer() const {
- return oserializer<Archive, T>::instantiate();
+ return oserializer<Archive, T>::get_instance();
}
virtual BOOST_DLLEXPORT void save_object_ptr(
basic_oarchive & ar,
@@ -171,33 +174,19 @@
// private constructor to inhibit any existence other than the
// static one. Note GCC doesn't permit constructor to be private
explicit BOOST_DLLEXPORT pointer_oserializer() BOOST_USED;
- static const pointer_oserializer instance;
+ friend struct dynamically_initialized<pointer_oserializer<Archive,T> >;
public:
- #if ! BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
+ #if !defined(__BORLANDC__)
// at least one compiler (CW) seems to require that serialize_adl
// be explicitly instantiated. Still under investigation.
void (* const m)(Archive &, T &, const unsigned);
boost::serialization::extended_type_info * (* e)();
#endif
- static BOOST_DLLEXPORT const pointer_oserializer & instantiate() BOOST_USED;
- virtual ~pointer_oserializer(){}
+ BOOST_DLLEXPORT static const pointer_oserializer & get_instance() BOOST_USED;
};
-template<class T, class Archive>
-BOOST_DLLEXPORT const pointer_oserializer<T, Archive> &
-pointer_oserializer<T, Archive>::instantiate(){
- return instance;
-}
-
-// note: instances of this template to be constructed before the main
-// is called in order for things to be initialized properly. For this
-// reason, hiding the instance in a static function as was done above
-// won't work here so we created a free instance here.
-template<class T, class Archive>
-const pointer_oserializer<T, Archive> pointer_oserializer<T, Archive>::instance;
-
-template<class T, class Archive>
-BOOST_DLLEXPORT void pointer_oserializer<T, Archive>::save_object_ptr(
+template<class Archive, class T>
+BOOST_DLLEXPORT void pointer_oserializer<Archive, T>::save_object_ptr(
basic_oarchive & ar,
const void * x
) const {
@@ -215,27 +204,34 @@
ar_impl << boost::serialization::make_nvp(NULL, * t);
}
-template<class T, class Archive>
-#if ! BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
-BOOST_DLLEXPORT pointer_oserializer<T, Archive>::pointer_oserializer() :
+template<class Archive, class T>
+#if !defined(__BORLANDC__)
+BOOST_DLLEXPORT pointer_oserializer<Archive, T>::pointer_oserializer() :
archive_pointer_oserializer<Archive>(
* boost::serialization::type_info_implementation<T>::type::get_instance()
),
m(boost::serialization::serialize_adl<Archive, T>),
e(boost::serialization::type_info_implementation<T>::type::get_instance)
#else
-BOOST_DLLEXPORT pointer_oserializer<T, Archive>::pointer_oserializer() :
+BOOST_DLLEXPORT pointer_oserializer<Archive, T>::pointer_oserializer() :
archive_pointer_oserializer<Archive>(
* boost::serialization::type_info_implementation<T>::type::get_instance()
)
#endif
{
// make sure appropriate member function is instantiated
- oserializer<Archive, T> & bos = oserializer<Archive, T>::instantiate();
+ oserializer<Archive, T> & bos = oserializer<Archive, T>::get_instance();
bos.set_bpos(this);
}
template<class Archive, class T>
+BOOST_DLLEXPORT const pointer_oserializer<Archive, T> &
+pointer_oserializer<Archive, T>::get_instance() {
+ // note: comeau complains without full qualification
+ return dynamically_initialized<pointer_oserializer<Archive,T> >::instance;
+}
+
+template<class Archive, class T>
struct save_non_pointer_type {
// note this bounces the call right back to the archive
// with no runtime overhead
@@ -260,7 +256,7 @@
// serialization level and class version
struct save_standard {
static void invoke(Archive &ar, const T & t){
- ar.save_object(& t, oserializer<Archive, T>::instantiate());
+ ar.save_object(& t, oserializer<Archive, T>::get_instance());
}
};
@@ -481,6 +477,8 @@
struct save_array_type
{
static void invoke(Archive &ar, const T &t){
+ typedef typename remove_all_extents<T>::type value_type;
+
save_access::end_preamble(ar);
// consider alignment
int count = sizeof(t) / (
@@ -488,12 +486,12 @@
- static_cast<const char *>(static_cast<const void *>(&t[0]))
);
ar << BOOST_SERIALIZATION_NVP(count);
- int i;
- for(i = 0; i < count; ++i)
- ar << boost::serialization::make_nvp("item", t[i]);
+ ar << serialization::make_array(static_cast<value_type const*>(&t[0]),count);
}
};
+
+#if 0
// note bogus arguments to workaround msvc 6 silent runtime failure
// declaration to satisfy gcc
template<class Archive, class T>
@@ -509,10 +507,9 @@
Archive * /* ar = NULL */,
T * /* t = NULL */
){
- // note: reversal of order of arguments to work around msvc 6.0 bug
- // that manifests itself while trying to link.
- return pointer_oserializer<T, Archive>::instantiate();
+ return pointer_oserializer<Archive, T>::instance;
}
+#endif
} // detail
@@ -557,12 +554,13 @@
template<class Archive, class T>
inline void save(Archive & ar, T &t){
- // if your program traps here, it indicates taht your doing one of the following:
+ // if your program traps here, it indicates that your doing one of the following:
// a) serializing an object of a type marked "track_never" through a pointer.
// b) saving an non-const object of a type not markd "track_never)
// Either of these conditions may be an indicator of an error usage of the
// serialization library and should be double checked. See documentation on
- // object tracking.
+ // object tracking. Also, see the "rationale" section of the documenation
+ // for motivation for this checking.
BOOST_STATIC_ASSERT(check_tracking<T>::value);
save(ar, const_cast<const T &>(t));
}
Modified: branches/serialization_next_release/boost/boost/archive/impl/basic_binary_iprimitive.ipp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/impl/basic_binary_iprimitive.ipp (original)
+++ branches/serialization_next_release/boost/boost/archive/impl/basic_binary_iprimitive.ipp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -79,7 +79,7 @@
{
std::size_t l;
this->This()->load(l);
- load_binary(ws, l);
+ load_binary(ws, l * sizeof(wchar_t) / sizeof(char));
ws[l / sizeof(wchar_t)] = L'\0';
}
Modified: branches/serialization_next_release/boost/boost/archive/impl/basic_xml_oarchive.ipp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/impl/basic_xml_oarchive.ipp (original)
+++ branches/serialization_next_release/boost/boost/archive/impl/basic_xml_oarchive.ipp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -144,7 +144,7 @@
pending_preamble = false;
}
}
-
+#if 0
template<class Archive>
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
basic_xml_oarchive<Archive>::save_override(const object_id_type & t, int)
@@ -168,6 +168,33 @@
int i = t.t; // extra .t is for borland
write_attribute(VERSION(), i);
}
+#endif
+
+template<class Archive>
+BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
+basic_xml_oarchive<Archive>::save_override(const object_id_type & t, int)
+{
+ // borland doesn't do conversion of STRONG_TYPEDEFs very well
+ const unsigned int i = t;
+ write_attribute(OBJECT_ID(), i, "=\"_");
+}
+template<class Archive>
+BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
+basic_xml_oarchive<Archive>::save_override(
+ const object_reference_type & t,
+ int
+){
+ const unsigned int i = t;
+ write_attribute(OBJECT_REFERENCE(), i, "=\"_");
+}
+template<class Archive>
+BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
+basic_xml_oarchive<Archive>::save_override(const version_type & t, int)
+{
+ const unsigned int i = t;
+ write_attribute(VERSION(), i);
+}
+
template<class Archive>
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
basic_xml_oarchive<Archive>::save_override(const class_id_type & t, int)
@@ -199,11 +226,12 @@
return;
write_attribute(CLASS_NAME(), key);
}
+
template<class Archive>
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
basic_xml_oarchive<Archive>::save_override(const tracking_type & t, int)
{
- write_attribute(TRACKING(), t.t); // extra .t is for borland
+ write_attribute(TRACKING(), t.t);
}
template<class Archive>
Modified: branches/serialization_next_release/boost/boost/archive/polymorphic_binary_iarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/polymorphic_binary_iarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/polymorphic_binary_iarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -18,23 +18,26 @@
#include <boost/config.hpp>
#include <boost/archive/binary_iarchive.hpp>
-#include <boost/archive/detail/polymorphic_iarchive_impl.hpp>
+#include <boost/archive/detail/polymorphic_iarchive_dispatch.hpp>
namespace boost {
namespace archive {
-typedef detail::polymorphic_iarchive_impl<
- binary_iarchive_impl<
- binary_iarchive, std::istream::char_type, std::istream::traits_type
- >
-> polymorphic_binary_iarchive;
+class polymorphic_binary_iarchive :
+ public detail::polymorphic_iarchive_dispatch<naked_binary_iarchive>
+{
+public:
+ polymorphic_binary_iarchive(std::istream & is, unsigned int flags = 0) :
+ detail::polymorphic_iarchive_dispatch<naked_binary_iarchive>(is, flags)
+ {}
+ ~polymorphic_binary_iarchive(){}
+};
} // namespace archive
} // namespace boost
-// required by smart_cast for compilers not implementing
-// partial template specialization
-BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(
+// required by export
+BOOST_SERIALIZATION_REGISTER_ARCHIVE(
boost::archive::polymorphic_binary_iarchive
)
Modified: branches/serialization_next_release/boost/boost/archive/polymorphic_binary_oarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/polymorphic_binary_oarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/polymorphic_binary_oarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -18,23 +18,24 @@
#include <boost/config.hpp>
#include <boost/archive/binary_oarchive.hpp>
-#include <boost/archive/detail/polymorphic_oarchive_impl.hpp>
+#include <boost/archive/detail/polymorphic_oarchive_dispatch.hpp>
namespace boost {
namespace archive {
-typedef detail::polymorphic_oarchive_impl<
+typedef detail::polymorphic_oarchive_dispatch<
binary_oarchive_impl<
- binary_oarchive, std::ostream::char_type, std::ostream::traits_type
+ naked_binary_oarchive,
+ std::ostream::char_type,
+ std::ostream::traits_type
>
> polymorphic_binary_oarchive;
} // namespace archive
} // namespace boost
-// required by smart_cast for compilers not implementing
-// partial template specialization
-BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(
+// required by export
+BOOST_SERIALIZATION_REGISTER_ARCHIVE(
boost::archive::polymorphic_binary_oarchive
)
Modified: branches/serialization_next_release/boost/boost/archive/polymorphic_iarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/polymorphic_iarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/polymorphic_iarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -32,6 +32,7 @@
#include <boost/archive/detail/iserializer.hpp>
#include <boost/archive/detail/interface_iarchive.hpp>
#include <boost/serialization/nvp.hpp>
+#include <boost/archive/detail/register_archive.hpp>
// determine if its necessary to handle (u)int64_t specifically
// i.e. that its not a synonym for (unsigned) long
@@ -54,7 +55,9 @@
class basic_iserializer;
}
-class polymorphic_iarchive :
+class polymorphic_iarchive;
+
+class polymorphic_iarchive_impl :
public detail::interface_iarchive<polymorphic_iarchive>
{
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
@@ -98,21 +101,13 @@
virtual void load_start(const char * name) = 0;
virtual void load_end(const char * name) = 0;
virtual void register_basic_serializer(const detail::basic_iserializer & bis) = 0;
- virtual void lookup_basic_helper(
- const boost::serialization::extended_type_info * const eti,
- boost::shared_ptr<void> & sph
- ) = 0;
- virtual void insert_basic_helper(
- const boost::serialization::extended_type_info * const eti,
- boost::shared_ptr<void> & sph
- ) = 0;
// msvc and borland won't automatically pass these to the base class so
// make it explicit here
template<class T>
void load_override(T & t, BOOST_PFTO int)
{
- archive::load(* this, t);
+ archive::load(* this->This(), t);
}
// special treatment for name-value pairs.
template<class T>
@@ -124,9 +119,11 @@
int
){
load_start(t.name());
- archive::load(* this, t.value());
+ archive::load(* this->This(), t.value());
load_end(t.name());
}
+protected:
+ virtual ~polymorphic_iarchive_impl(){}
public:
// utility function implemented by all legal archives
virtual void set_library_version(unsigned int archive_library_version) = 0;
@@ -157,8 +154,24 @@
} // namespace archive
} // namespace boost
-// required by smart_cast for compilers not implementing
-// partial template specialization
-BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::polymorphic_iarchive)
+// note special treatment of shared_ptr. This type needs a special
+// structure associated with every archive. We created a "mix-in"
+// class to provide this functionality. Since shared_ptr holds a
+// special esteem in the boost library - we included it here by default.
+#include <boost/archive/shared_ptr_helper.hpp>
+
+namespace boost {
+namespace archive {
+
+class polymorphic_iarchive :
+ public polymorphic_iarchive_impl,
+ public detail::shared_ptr_helper
+{};
+
+} // namespace archive
+} // namespace boost
+
+// required by export
+BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::polymorphic_iarchive)
#endif // BOOST_ARCHIVE_POLYMORPHIC_IARCHIVE_HPP
Modified: branches/serialization_next_release/boost/boost/archive/polymorphic_oarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/polymorphic_oarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/polymorphic_oarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -31,6 +31,7 @@
#include <boost/archive/detail/oserializer.hpp>
#include <boost/archive/detail/interface_oarchive.hpp>
#include <boost/serialization/nvp.hpp>
+#include <boost/archive/detail/register_archive.hpp>
// determine if its necessary to handle (u)int64_t specifically
// i.e. that its not a synonym for (unsigned) long
@@ -53,7 +54,9 @@
class basic_oserializer;
}
-class polymorphic_oarchive :
+class polymorphic_oarchive;
+
+class polymorphic_oarchive_impl :
public detail::interface_oarchive<polymorphic_oarchive>
{
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
@@ -97,14 +100,6 @@
virtual void save_start(const char * name) = 0;
virtual void save_end(const char * name) = 0;
virtual void register_basic_serializer(const detail::basic_oserializer & bos) = 0;
- virtual void lookup_basic_helper(
- const boost::serialization::extended_type_info * const eti,
- boost::shared_ptr<void> & sph
- ) = 0;
- virtual void insert_basic_helper(
- const boost::serialization::extended_type_info * const eti,
- shared_ptr<void> & sph
- ) = 0;
virtual void end_preamble() = 0;
@@ -113,7 +108,7 @@
template<class T>
void save_override(T & t, BOOST_PFTO int)
{
- archive::save(* this, t);
+ archive::save(* this->This(), t);
}
// special treatment for name-value pairs.
template<class T>
@@ -124,9 +119,11 @@
::boost::serialization::nvp<T> & t, int
){
save_start(t.name());
- archive::save(* this, t.const_value());
+ archive::save(* this->This(), t.const_value());
save_end(t.name());
}
+protected:
+ virtual ~polymorphic_oarchive_impl(){}
public:
// utility functions implemented by all legal archives
virtual unsigned int get_flags() const = 0;
@@ -143,11 +140,15 @@
) = 0;
};
+// note: preserve naming symmetry
+class polymorphic_oarchive :
+ public polymorphic_oarchive_impl
+{};
+
} // namespace archive
} // namespace boost
-// required by smart_cast for compilers not implementing
-// partial template specialization
-BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::polymorphic_oarchive)
+// required by export
+BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::polymorphic_oarchive)
#endif // BOOST_ARCHIVE_POLYMORPHIC_OARCHIVE_HPP
Modified: branches/serialization_next_release/boost/boost/archive/polymorphic_text_iarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/polymorphic_text_iarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/polymorphic_text_iarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -18,21 +18,26 @@
#include <boost/config.hpp>
#include <boost/archive/text_iarchive.hpp>
-#include <boost/archive/detail/polymorphic_iarchive_impl.hpp>
+#include <boost/archive/detail/polymorphic_iarchive_dispatch.hpp>
namespace boost {
namespace archive {
-typedef detail::polymorphic_iarchive_impl<
- text_iarchive_impl<text_iarchive>
-> polymorphic_text_iarchive;
+class polymorphic_text_iarchive :
+ public detail::polymorphic_iarchive_dispatch<naked_text_iarchive>
+{
+public:
+ polymorphic_text_iarchive(std::istream & is, unsigned int flags = 0) :
+ detail::polymorphic_iarchive_dispatch<naked_text_iarchive>(is, flags)
+ {}
+ ~polymorphic_text_iarchive(){}
+};
} // namespace archive
} // namespace boost
-// required by smart_cast for compilers not implementing
-// partial template specialization
-BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(
+// required by export
+BOOST_SERIALIZATION_REGISTER_ARCHIVE(
boost::archive::polymorphic_text_iarchive
)
Modified: branches/serialization_next_release/boost/boost/archive/polymorphic_text_oarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/polymorphic_text_oarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/polymorphic_text_oarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -18,21 +18,20 @@
#include <boost/config.hpp>
#include <boost/archive/text_oarchive.hpp>
-#include <boost/archive/detail/polymorphic_oarchive_impl.hpp>
+#include <boost/archive/detail/polymorphic_oarchive_dispatch.hpp>
namespace boost {
namespace archive {
-typedef detail::polymorphic_oarchive_impl<
- text_oarchive_impl<text_oarchive>
+typedef detail::polymorphic_oarchive_dispatch<
+ text_oarchive_impl<naked_text_oarchive>
> polymorphic_text_oarchive;
} // namespace archive
} // namespace boost
-// required by smart_cast for compilers not implementing
-// partial template specialization
-BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(
+// required by export
+BOOST_SERIALIZATION_REGISTER_ARCHIVE(
boost::archive::polymorphic_text_oarchive
)
Modified: branches/serialization_next_release/boost/boost/archive/polymorphic_text_wiarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/polymorphic_text_wiarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/polymorphic_text_wiarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -22,21 +22,20 @@
#else
#include <boost/archive/text_wiarchive.hpp>
-#include <boost/archive/detail/polymorphic_iarchive_impl.hpp>
+#include <boost/archive/detail/polymorphic_iarchive_dispatch.hpp>
namespace boost {
namespace archive {
-typedef detail::polymorphic_iarchive_impl<
- text_wiarchive_impl<text_wiarchive>
+typedef detail::polymorphic_iarchive_dispatch<
+ text_wiarchive_impl<naked_text_wiarchive>
> polymorphic_text_wiarchive;
} // namespace archive
} // namespace boost
-// required by smart_cast for compilers not implementing
-// partial template specialization
-BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(
+// required by export
+BOOST_SERIALIZATION_REGISTER_ARCHIVE(
boost::archive::polymorphic_text_wiarchive
)
Modified: branches/serialization_next_release/boost/boost/archive/polymorphic_text_woarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/polymorphic_text_woarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/polymorphic_text_woarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -22,21 +22,20 @@
#else
#include <boost/archive/text_woarchive.hpp>
-#include <boost/archive/detail/polymorphic_oarchive_impl.hpp>
+#include <boost/archive/detail/polymorphic_oarchive_dispatch.hpp>
namespace boost {
namespace archive {
-typedef detail::polymorphic_oarchive_impl<
- text_woarchive_impl<text_woarchive>
+typedef detail::polymorphic_oarchive_dispatch<
+ text_woarchive_impl<naked_text_woarchive>
> polymorphic_text_woarchive;
} // namespace archive
} // namespace boost
-// required by smart_cast for compilers not implementing
-// partial template specialization
-BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(
+// required by export
+BOOST_SERIALIZATION_REGISTER_ARCHIVE(
boost::archive::polymorphic_text_woarchive
)
Modified: branches/serialization_next_release/boost/boost/archive/polymorphic_xml_iarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/polymorphic_xml_iarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/polymorphic_xml_iarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -18,21 +18,26 @@
#include <boost/config.hpp>
#include <boost/archive/xml_iarchive.hpp>
-#include <boost/archive/detail/polymorphic_iarchive_impl.hpp>
+#include <boost/archive/detail/polymorphic_iarchive_dispatch.hpp>
namespace boost {
namespace archive {
-typedef detail::polymorphic_iarchive_impl<
- xml_iarchive_impl<xml_iarchive>
-> polymorphic_xml_iarchive;
+class polymorphic_xml_iarchive :
+ public detail::polymorphic_iarchive_dispatch<naked_xml_iarchive>
+{
+public:
+ polymorphic_xml_iarchive(std::istream & is, unsigned int flags = 0) :
+ detail::polymorphic_iarchive_dispatch<naked_xml_iarchive>(is, flags)
+ {}
+ ~polymorphic_xml_iarchive(){}
+};
} // namespace archive
} // namespace boost
-// required by smart_cast for compilers not implementing
-// partial template specialization
-BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(
+// required by export
+BOOST_SERIALIZATION_REGISTER_ARCHIVE(
boost::archive::polymorphic_xml_iarchive
)
Modified: branches/serialization_next_release/boost/boost/archive/polymorphic_xml_oarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/polymorphic_xml_oarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/polymorphic_xml_oarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -18,21 +18,20 @@
#include <boost/config.hpp>
#include <boost/archive/xml_oarchive.hpp>
-#include <boost/archive/detail/polymorphic_oarchive_impl.hpp>
+#include <boost/archive/detail/polymorphic_oarchive_dispatch.hpp>
namespace boost {
namespace archive {
-typedef detail::polymorphic_oarchive_impl<
- xml_oarchive_impl<xml_oarchive>
+typedef detail::polymorphic_oarchive_dispatch<
+ xml_oarchive_impl<naked_xml_oarchive>
> polymorphic_xml_oarchive;
} // namespace archive
} // namespace boost
-// required by smart_cast for compilers not implementing
-// partial template specialization
-BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(
+// required by export
+BOOST_SERIALIZATION_REGISTER_ARCHIVE(
boost::archive::polymorphic_xml_oarchive
)
Modified: branches/serialization_next_release/boost/boost/archive/polymorphic_xml_wiarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/polymorphic_xml_wiarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/polymorphic_xml_wiarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -22,21 +22,20 @@
#else
#include <boost/archive/xml_wiarchive.hpp>
-#include <boost/archive/detail/polymorphic_iarchive_impl.hpp>
+#include <boost/archive/detail/polymorphic_iarchive_dispatch.hpp>
namespace boost {
namespace archive {
-typedef detail::polymorphic_iarchive_impl<
- xml_wiarchive_impl<xml_wiarchive>
+typedef detail::polymorphic_iarchive_dispatch<
+ xml_wiarchive_impl<naked_xml_wiarchive>
> polymorphic_xml_wiarchive;
} // namespace archive
} // namespace boost
-// required by smart_cast for compilers not implementing
-// partial template specialization
-BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(
+// required by export
+BOOST_SERIALIZATION_REGISTER_ARCHIVE(
boost::archive::polymorphic_xml_wiarchive
)
Modified: branches/serialization_next_release/boost/boost/archive/polymorphic_xml_woarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/polymorphic_xml_woarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/polymorphic_xml_woarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -22,21 +22,20 @@
#else
#include <boost/archive/xml_woarchive.hpp>
-#include <boost/archive/detail/polymorphic_oarchive_impl.hpp>
+#include <boost/archive/detail/polymorphic_oarchive_dispatch.hpp>
namespace boost {
namespace archive {
-typedef detail::polymorphic_oarchive_impl<
- xml_woarchive_impl<xml_woarchive>
+typedef detail::polymorphic_oarchive_dispatch<
+ xml_woarchive_impl<naked_xml_woarchive>
> polymorphic_xml_woarchive;
} // namespace archive
} // namespace boost
-// required by smart_cast for compilers not implementing
-// partial template specialization
-BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(
+// required by export
+BOOST_SERIALIZATION_REGISTER_ARCHIVE(
boost::archive::polymorphic_xml_woarchive
)
Modified: branches/serialization_next_release/boost/boost/archive/text_iarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/text_iarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/text_iarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -21,6 +21,7 @@
#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/archive/basic_text_iprimitive.hpp>
#include <boost/archive/basic_text_iarchive.hpp>
+#include <boost/config.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
@@ -73,14 +74,38 @@
~text_iarchive_impl(){};
};
-// do not derive from this class. If you want to extend this functionality
+// do not derive from the classes below. If you want to extend this functionality
// via inhertance, derived from text_iarchive_impl instead. This will
// preserve correct static polymorphism.
+
+// same as text_iarchive below - without the shared_ptr_helper
+class naked_text_iarchive :
+ public text_iarchive_impl<naked_text_iarchive>
+{
+public:
+ naked_text_iarchive(std::istream & is, unsigned int flags = 0) :
+ text_iarchive_impl<naked_text_iarchive>(is, flags)
+ {}
+ ~naked_text_iarchive(){}
+};
+
+} // namespace archive
+} // namespace boost
+
+// note special treatment of shared_ptr. This type needs a special
+// structure associated with every archive. We created a "mix-in"
+// class to provide this functionality. Since shared_ptr holds a
+// special esteem in the boost library - we included it here by default.
+#include <boost/archive/shared_ptr_helper.hpp>
+
+namespace boost {
+namespace archive {
+
class text_iarchive :
- public text_iarchive_impl<text_iarchive>
+ public text_iarchive_impl<text_iarchive>,
+ public detail::shared_ptr_helper
{
public:
-
text_iarchive(std::istream & is, unsigned int flags = 0) :
text_iarchive_impl<text_iarchive>(is, flags)
{}
@@ -90,9 +115,8 @@
} // namespace archive
} // namespace boost
-// required by smart_cast for compilers not implementing
-// partial template specialization
-BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::text_iarchive)
+// required by export
+BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_iarchive)
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
Modified: branches/serialization_next_release/boost/boost/archive/text_oarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/text_oarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/text_oarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -88,12 +88,13 @@
~text_oarchive(){}
};
+typedef text_oarchive naked_text_oarchive;
+
} // namespace archive
} // namespace boost
-// required by smart_cast for compilers not implementing
-// partial template specialization
-BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::text_oarchive)
+// required by export
+BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_oarchive)
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
Modified: branches/serialization_next_release/boost/boost/archive/text_wiarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/text_wiarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/text_wiarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -72,11 +72,36 @@
~text_wiarchive_impl(){};
};
-// do not derive from this class. If you want to extend this functionality
-// via inhertance, derived from text_wiarchive_impl instead. This will
+// do not derive from the classes below. If you want to extend this functionality
+// via inhertance, derived from text_iarchive_impl instead. This will
// preserve correct static polymorphism.
+
+// same as text_wiarchive below - without the shared_ptr_helper
+class naked_text_wiarchive :
+ public text_wiarchive_impl<naked_text_wiarchive>
+{
+public:
+ naked_text_wiarchive(std::wistream & is, unsigned int flags = 0) :
+ text_wiarchive_impl<naked_text_wiarchive>(is, flags)
+ {}
+ ~naked_text_wiarchive(){}
+};
+
+} // namespace archive
+} // namespace boost
+
+// note special treatment of shared_ptr. This type needs a special
+// structure associated with every archive. We created a "mix-in"
+// class to provide this functionality. Since shared_ptr holds a
+// special esteem in the boost library - we included it here by default.
+#include <boost/archive/shared_ptr_helper.hpp>
+
+namespace boost {
+namespace archive {
+
class text_wiarchive :
- public text_wiarchive_impl<text_wiarchive>
+ public text_wiarchive_impl<text_wiarchive>,
+ public detail::shared_ptr_helper
{
public:
text_wiarchive(std::wistream & is, unsigned int flags = 0) :
@@ -88,9 +113,8 @@
} // namespace archive
} // namespace boost
-// required by smart_cast for compilers not implementing
-// partial template specialization
-BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::text_wiarchive)
+// required by export
+BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_wiarchive)
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
Modified: branches/serialization_next_release/boost/boost/archive/text_woarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/text_woarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/text_woarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -114,12 +114,13 @@
~text_woarchive(){}
};
+typedef text_woarchive naked_text_woarchive;
+
} // namespace archive
} // namespace boost
-// required by smart_cast for compilers not implementing
-// partial template specialization
-BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::text_woarchive)
+// required by export
+BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_woarchive)
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
Modified: branches/serialization_next_release/boost/boost/archive/xml_iarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/xml_iarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/xml_iarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -83,14 +83,36 @@
~xml_iarchive_impl();
};
-// we use the following because we can't use
-// typedef xml_iarchive_impl<xml_iarchive_impl<...> > xml_iarchive;
-
-// do not derive from this class. If you want to extend this functionality
-// via inhertance, derived from xml_iarchive_impl instead. This will
+// do not derive from the classes below. If you want to extend this functionality
+// via inhertance, derived from text_iarchive_impl instead. This will
// preserve correct static polymorphism.
+
+// same as xml_iarchive below - without the shared_ptr_helper
+class naked_xml_iarchive :
+ public xml_iarchive_impl<naked_xml_iarchive>
+{
+public:
+ naked_xml_iarchive(std::istream & is, unsigned int flags = 0) :
+ xml_iarchive_impl<naked_xml_iarchive>(is, flags)
+ {}
+ ~naked_xml_iarchive(){}
+};
+
+} // namespace archive
+} // namespace boost
+
+// note special treatment of shared_ptr. This type needs a special
+// structure associated with every archive. We created a "mix-in"
+// class to provide this functionality. Since shared_ptr holds a
+// special esteem in the boost library - we included it here by default.
+#include <boost/archive/shared_ptr_helper.hpp>
+
+namespace boost {
+namespace archive {
+
class xml_iarchive :
- public xml_iarchive_impl<xml_iarchive>
+ public xml_iarchive_impl<xml_iarchive>,
+ public detail::shared_ptr_helper
{
public:
xml_iarchive(std::istream & is, unsigned int flags = 0) :
@@ -102,9 +124,8 @@
} // namespace archive
} // namespace boost
-// required by smart_cast for compilers not implementing
-// partial template specialization
-BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::xml_iarchive)
+// required by export
+BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_iarchive)
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
Modified: branches/serialization_next_release/boost/boost/archive/xml_oarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/xml_oarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/xml_oarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -48,9 +48,9 @@
friend class save_access;
protected:
#endif
- void end_preamble(){
- basic_xml_oarchive<Archive>::end_preamble();
- }
+ //void end_preamble(){
+ // basic_xml_oarchive<Archive>::end_preamble();
+ //}
template<class T>
void save(const T & t){
basic_text_oprimitive<std::ostream>::save(t);
@@ -101,12 +101,13 @@
~xml_oarchive(){}
};
+typedef xml_oarchive naked_xml_oarchive;
+
} // namespace archive
} // namespace boost
-// required by smart_cast for compilers not implementing
-// partial template specialization
-BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::xml_oarchive)
+// required by export
+BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_oarchive)
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
Modified: branches/serialization_next_release/boost/boost/archive/xml_wiarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/xml_wiarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/xml_wiarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -87,14 +87,36 @@
~xml_wiarchive_impl();
};
-// we use the following because we can't use
-// typedef xml_wiarchive_impl<xml_wiarchive_impl<...> > xml_wiarchive;
-
-// do not derive from this class. If you want to extend this functionality
-// via inhertance, derived from xml_wiarchive_impl instead. This will
+// do not derive from the classes below. If you want to extend this functionality
+// via inhertance, derived from text_iarchive_impl instead. This will
// preserve correct static polymorphism.
+
+// same as xml_wiarchive below - without the shared_ptr_helper
+class naked_xml_wiarchive :
+ public xml_wiarchive_impl<naked_xml_wiarchive>
+{
+public:
+ naked_xml_wiarchive(std::wistream & is, unsigned int flags = 0) :
+ xml_wiarchive_impl<naked_xml_wiarchive>(is, flags)
+ {}
+ ~naked_xml_wiarchive(){}
+};
+
+} // namespace archive
+} // namespace boost
+
+// note special treatment of shared_ptr. This type needs a special
+// structure associated with every archive. We created a "mix-in"
+// class to provide this functionality. Since shared_ptr holds a
+// special esteem in the boost library - we included it here by default.
+#include <boost/archive/shared_ptr_helper.hpp>
+
+namespace boost {
+namespace archive {
+
class xml_wiarchive :
- public xml_wiarchive_impl<xml_wiarchive>
+ public xml_wiarchive_impl<xml_wiarchive>,
+ public detail::shared_ptr_helper
{
public:
xml_wiarchive(std::wistream & is, unsigned int flags = 0) :
@@ -106,9 +128,8 @@
} // namespace archive
} // namespace boost
-// required by smart_cast for compilers not implementing
-// partial template specialization
-BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::xml_wiarchive)
+// required by export
+BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_wiarchive)
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
Modified: branches/serialization_next_release/boost/boost/archive/xml_woarchive.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/xml_woarchive.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/xml_woarchive.hpp 2007-08-15 14:33:11 EDT (Wed, 15 Aug 2007)
@@ -58,9 +58,9 @@
friend class save_access;
protected:
#endif
- void end_preamble(){
- basic_xml_oarchive<Archive>::end_preamble();
- }
+ //void end_preamble(){
+ // basic_xml_oarchive<Archive>::end_preamble();
+ //}
template<class T>
void
save(const T & t){
@@ -113,12 +113,13 @@
~xml_woarchive(){}
};
+typedef xml_woarchive naked_xml_woarchive;
+
} // namespace archive
} // namespace boost
-// required by smart_cast for compilers not implementing
-// partial template specialization
-BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::xml_woarchive)
+// required by export
+BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_woarchive)
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
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