Boost logo

Boost-Commit :

From: ramey_at_[hidden]
Date: 2007-10-29 15:32:24


Author: ramey
Date: 2007-10-29 15:32:22 EDT (Mon, 29 Oct 2007)
New Revision: 40559
URL: http://svn.boost.org/trac/boost/changeset/40559

Log:
First implementation of thread safe lock free serialization
Added:
   branches/serialization_next_release/boost/boost/archive/array/
   branches/serialization_next_release/boost/boost/archive/array/iarchive.hpp (contents, props changed)
   branches/serialization_next_release/boost/boost/archive/array/oarchive.hpp (contents, props changed)
   branches/serialization_next_release/boost/boost/archive/array/xoarchive.hpp (contents, props changed)
   branches/serialization_next_release/boost/boost/archive/detail/polymorphic_iarchive_route.hpp (contents, props changed)
   branches/serialization_next_release/boost/boost/archive/detail/polymorphic_oarchive_route.hpp (contents, props changed)
   branches/serialization_next_release/boost/boost/archive/detail/register_archive.hpp (contents, props changed)
Text files modified:
   branches/serialization_next_release/boost/boost/archive/detail/basic_iserializer.hpp | 13 +++---
   branches/serialization_next_release/boost/boost/archive/detail/basic_oserializer.hpp | 10 ++--
   branches/serialization_next_release/boost/boost/archive/detail/basic_serializer.hpp | 7 +++
   branches/serialization_next_release/boost/boost/archive/detail/basic_serializer_map.hpp | 28 ++++----------
   branches/serialization_next_release/boost/boost/archive/detail/interface_iarchive.hpp | 7 +++
   branches/serialization_next_release/boost/boost/archive/detail/interface_oarchive.hpp | 6 ++
   branches/serialization_next_release/boost/boost/archive/detail/iserializer.hpp | 54 +++++++++++++++-------------
   branches/serialization_next_release/boost/boost/archive/detail/oserializer.hpp | 75 ++++++++++++++++++++++-----------------
   branches/serialization_next_release/boost/boost/archive/impl/archive_pointer_iserializer.ipp | 42 +++++++++++++--------
   branches/serialization_next_release/boost/boost/archive/impl/archive_pointer_oserializer.ipp | 43 ++++++++++++++--------
   branches/serialization_next_release/boost/boost/archive/polymorphic_binary_iarchive.hpp | 6 +-
   branches/serialization_next_release/boost/boost/archive/polymorphic_binary_oarchive.hpp | 4 +-
   branches/serialization_next_release/boost/boost/archive/polymorphic_text_iarchive.hpp | 6 +-
   branches/serialization_next_release/boost/boost/archive/polymorphic_text_oarchive.hpp | 4 +-
   branches/serialization_next_release/boost/boost/archive/polymorphic_text_wiarchive.hpp | 4 +-
   branches/serialization_next_release/boost/boost/archive/polymorphic_text_woarchive.hpp | 4 +-
   branches/serialization_next_release/boost/boost/archive/polymorphic_xml_iarchive.hpp | 6 +-
   branches/serialization_next_release/boost/boost/archive/polymorphic_xml_oarchive.hpp | 4 +-
   branches/serialization_next_release/boost/boost/archive/polymorphic_xml_wiarchive.hpp | 4 +-
   branches/serialization_next_release/boost/boost/archive/polymorphic_xml_woarchive.hpp | 4 +-
   branches/serialization_next_release/boost/boost/archive/shared_ptr_helper.hpp | 11 +++--
   21 files changed, 192 insertions(+), 150 deletions(-)

Added: branches/serialization_next_release/boost/boost/archive/array/iarchive.hpp
==============================================================================
--- (empty file)
+++ branches/serialization_next_release/boost/boost/archive/array/iarchive.hpp 2007-10-29 15:32:22 EDT (Mon, 29 Oct 2007)
@@ -0,0 +1,126 @@
+#ifndef BOOST_ARCHIVE_ARRAY_IARCHIVE_HPP
+#define BOOST_ARCHIVE_ARRAY_IARCHIVE_HPP
+
+// (C) Copyright 2005 Matthias Troyer and Dave Abrahams
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+#include <boost/archive/basic_archive.hpp>
+#include <boost/archive/detail/common_iarchive.hpp>
+#include <boost/serialization/array.hpp>
+#include <boost/serialization/collection_size_type.hpp>
+#include <boost/serialization/nvp.hpp>
+#include <boost/serialization/detail/get_data.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/mpl/apply.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/pfto.hpp>
+//#include <boost/archive/archive_exception.hpp>
+
+namespace boost { namespace archive { namespace array {
+
+ // To conveniently array-optimize an input archive X:
+ //
+ // * Derive it from iarchive<X, Impl>, where Impl is an
+ // archive implementation base class from
+ // Boost.Serialization
+ //
+ // * add a member function template that implements the
+ // procedure for serializing arrays of T (for appropriate T)
+ //
+ // template <class T>
+ // load_array(serialization::array<T> &, unsigned int)
+ //
+ // * add a unary MPL lambda expression member called
+ // use_array_optimization whose result is convertible to
+ // mpl::true_ iff array elements of type T can be serialized
+ // with the load_array member function, and to mpl::false_ if
+ // the unoptimized procedure must be used.
+
+template <class Archive>
+class iarchive
+ : public archive::detail::common_iarchive<Archive>
+{
+ typedef archive::detail::common_iarchive<Archive> Base;
+public:
+ iarchive(unsigned int flags)
+ : archive::detail::common_iarchive<Archive>(flags)
+ {}
+
+
+ // load_override for std::vector and serialization::array dispatches to
+ // load_optimized with an additional argument.
+ //
+ // If that argument is of type mpl::true_, an optimized serialization is provided
+ // If it is false, we just forward to the default serialization in the base class
+
+ //the default version dispatches to the base class
+ template<class T>
+ void load_optimized(T &t, unsigned int version, mpl::false_)
+ {
+ Base::load_override(t, version);
+ }
+
+ // the optimized implementation for vector uses serialization::array
+ template<class ValueType, class Allocator>
+ void load_optimized(
+ std::vector<ValueType, Allocator> &t, unsigned int version, mpl::true_)
+ {
+ t.clear();
+ // retrieve number of elements
+ serialization::collection_size_type count;
+ *this->This() >> BOOST_SERIALIZATION_NVP(count);
+ t.resize(count);
+ if (!t.empty())
+ * this->This() >> serialization::make_array(serialization::detail::get_data(t),t.size());
+ }
+
+ // the optimized implementation for serialization::array uses save_array
+ template<class ValueType>
+ void load_optimized(
+ serialization::array<ValueType> &t, unsigned int version, mpl::true_)
+ {
+ this->This()->load_array(t,version);
+ }
+
+ // to load a vector:
+ // if the value type is trivially constructable or an optimized array save exists,
+ // then we can use the optimized version
+
+ template<class ValueType, class Allocator>
+ void load_override(std::vector<ValueType,Allocator> &x, unsigned int version)
+ {
+ typedef typename mpl::and_<
+ mpl::not_<is_same<ValueType,bool> >,
+ mpl::apply1<
+ BOOST_DEDUCED_TYPENAME Archive::use_array_optimization
+ , ValueType>
+ >::type use_optimized;
+ load_optimized(x,version, use_optimized() );
+ }
+
+ // dispatch loading of arrays to the optimized version where supported
+ template<class ValueType>
+ void load_override(serialization::array<ValueType> const& x, unsigned int version)
+ {
+ typedef typename mpl::apply1<
+ BOOST_DEDUCED_TYPENAME Archive::use_array_optimization
+ , ValueType
+ >::type use_optimized;
+ load_optimized(const_cast<serialization::array<ValueType>&>(x),version,use_optimized());
+ }
+
+ // Load everything else in the usual way, forwarding on to the base class
+ template<class T>
+ void load_override(T & x, unsigned BOOST_PFTO int version)
+ {
+ Base::load_override(x, static_cast<unsigned int>(version));
+ }
+};
+
+} } } // end namespace boost::archive::array
+
+#endif // BOOST_ARCHIVE_ARRAY_OARCHIVE_HPP
+

Added: branches/serialization_next_release/boost/boost/archive/array/oarchive.hpp
==============================================================================
--- (empty file)
+++ branches/serialization_next_release/boost/boost/archive/array/oarchive.hpp 2007-10-29 15:32:22 EDT (Mon, 29 Oct 2007)
@@ -0,0 +1,124 @@
+#ifndef BOOST_ARCHIVE_ARRAY_OARCHIVE_HPP
+#define BOOST_ARCHIVE_ARRAY_OARCHIVE_HPP
+
+// (C) Copyright 2005 Matthias Troyer and Dave Abrahams
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+#include <boost/archive/basic_archive.hpp>
+#include <boost/archive/detail/common_oarchive.hpp>
+#include <boost/serialization/array.hpp>
+#include <boost/serialization/collection_size_type.hpp>
+#include <boost/serialization/nvp.hpp>
+#include <boost/serialization/detail/get_data.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/mpl/apply.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/pfto.hpp>
+#include <boost/type_traits/remove_const.hpp>
+
+namespace boost { namespace archive { namespace array {
+
+ // To conveniently array-optimize an output archive X:
+ //
+ // * Derive it from oarchive<X, Impl>, where Impl is an
+ // archive implementation base class from
+ // Boost.Serialization
+ //
+ // * add a member function template that implements the
+ // procedure for serializing arrays of T (for appropriate T)
+ //
+ // template <class T>
+ // save_array(serialization::array<T> const &, unsigned int)
+ //
+ // * add a unary MPL lambda expression member called
+ // use_array_optimization whose result is convertible to
+ // mpl::true_ iff array elements of type T can be serialized
+ // with the load_array member function, and to mpl::false_ if
+ // the unoptimized procedure must be used.
+
+template <class Archive>
+class oarchive
+ : public archive::detail::common_oarchive<Archive>
+{
+ typedef archive::detail::common_oarchive<Archive> Base;
+public:
+
+ oarchive(unsigned int flags)
+ : archive::detail::common_oarchive<Archive>(flags)
+ {}
+
+ // save_override for std::vector and serialization::array dispatches to
+ // save_optimized with an additional argument.
+ //
+ // If that argument is of type mpl::true_, an optimized serialization is provided
+ // If it is false, we just forward to the default serialization in the base class
+
+ //the default version dispatches to the base class
+ template<class T>
+ void save_optimized(T const &t, unsigned int version, mpl::false_)
+ {
+ Base::save_override(t, version);
+ }
+
+ // the optimized implementation for vector uses serialization::array
+ template<class ValueType, class Allocator>
+ void save_optimized(
+ const std::vector<ValueType, Allocator> &t, unsigned int, mpl::true_)
+ {
+ const serialization::collection_size_type count(t.size());
+ * this->This() << BOOST_SERIALIZATION_NVP(count);
+ if (!t.empty())
+ * this->This() << serialization::make_array(serialization::detail::get_data(t),t.size());
+ }
+
+ // the optimized implementation for serialization::array uses save_array
+ template<class ValueType>
+ void save_optimized(
+ const serialization::array<ValueType> &t, unsigned int version, mpl::true_)
+ {
+ this->This()->save_array(t,version);
+ }
+
+ // to save a vector:
+ // if the value type is trivially constructable or an optimized array save exists,
+ // then we can use the optimized version
+
+ template<class ValueType, class Allocator>
+ void save_override(std::vector<ValueType,Allocator> const &x, unsigned int version)
+ {
+ typedef BOOST_DEDUCED_TYPENAME remove_const<ValueType>::type value_type;
+ typedef typename mpl::and_<
+ mpl::not_<is_same<value_type,bool> >,
+ mpl::apply1<
+ BOOST_DEDUCED_TYPENAME Archive::use_array_optimization
+ , value_type>
+ >::type use_optimized;
+ save_optimized(x,version,use_optimized() );
+ }
+
+ // dispatch saving of arrays to the optimized version where supported
+ template<class ValueType>
+ void save_override(serialization::array<ValueType> const& x, unsigned int version)
+ {
+ typedef typename mpl::apply1<
+ BOOST_DEDUCED_TYPENAME Archive::use_array_optimization
+ , BOOST_DEDUCED_TYPENAME remove_const<ValueType>::type
+ >::type use_optimized;
+ save_optimized(x,version,use_optimized());
+ }
+
+ // Load everything else in the usual way, forwarding on to the
+ // Base class
+ template<class T>
+ void save_override(T const& x, unsigned BOOST_PFTO int version)
+ {
+ Base::save_override(x, static_cast<unsigned int>(version));
+ }
+};
+
+} } } // end namespace boost::archive::array
+
+#endif // BOOST_ARCHIVE_ARRAY_OARCHIVE_HPP

Added: branches/serialization_next_release/boost/boost/archive/array/xoarchive.hpp
==============================================================================
--- (empty file)
+++ branches/serialization_next_release/boost/boost/archive/array/xoarchive.hpp 2007-10-29 15:32:22 EDT (Mon, 29 Oct 2007)
@@ -0,0 +1,141 @@
+#ifndef BOOST_ARCHIVE_ARRAY_OARCHIVE_HPP
+#define BOOST_ARCHIVE_ARRAY_OARCHIVE_HPP
+
+// (C) Copyright 2005 Matthias Troyer and Dave Abrahams
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+#include <boost/archive/basic_archive.hpp>
+#include <boost/archive/detail/common_oarchive.hpp>
+#include <boost/serialization/array.hpp>
+#include <boost/serialization/collection_size_type.hpp>
+#include <boost/serialization/nvp.hpp>
+#include <boost/serialization/detail/get_data.hpp>
+#include <boost/type_traits/remove_const.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/mpl/apply.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/pfto.hpp>
+
+#include <boost/static_assert.hpp>
+
+
+namespace boost { namespace archive { namespace array {
+
+ // To conveniently array-optimize an output archive X:
+ //
+ // * Derive it from oarchive<X, Impl>, where Impl is an
+ // archive implementation base class from
+ // Boost.Serialization
+ //
+ // * add a member function template that implements the
+ // procedure for serializing arrays of T (for appropriate T)
+ //
+ // template <class T>
+ // save_array(serialization::array<T> const &, unsigned int)
+ //
+ // * add a unary MPL lambda expression member called
+ // use_array_optimization whose result is convertible to
+ // mpl::true_ iff array elements of type T can be serialized
+ // with the load_array member function, and to mpl::false_ if
+ // the unoptimized procedure must be used.
+
+template <class Archive>
+class oarchive
+ : public archive::detail::common_oarchive<Archive>
+{
+ typedef archive::detail::common_oarchive<Archive> Base;
+public:
+
+ oarchive(unsigned int flags)
+ : archive::detail::common_oarchive<Archive>(flags)
+ {}
+
+ // save_override for std::vector and serialization::array dispatches to
+ // save_optimized with an additional argument.
+ //
+ // If that argument is of type mpl::true_, an optimized serialization is provided
+ // If it is false, we just forward to the default serialization in the base class
+
+ //the default version dispatches to the base class
+ template<class T>
+ void save_optimized(T const &t, unsigned int version, mpl::false_)
+ {
+ BOOST_STATIC_ASSERT(false);
+ Base::save_override(t, version);
+ }
+
+ // the optimized implementation for vector uses serialization::array
+ template<class ValueType, class Allocator>
+ void save_optimized(
+ const std::vector<ValueType, Allocator> &t, unsigned int, mpl::true_)
+ {
+ BOOST_STATIC_ASSERT(false);
+ const serialization::collection_size_type count(t.size());
+ * this->This() << BOOST_SERIALIZATION_NVP(count);
+ if (!t.empty())
+ * this->This() << serialization::make_array(serialization::detail::get_data(t),t.size());
+ }
+
+ // the optimized implementation for serialization::array uses save_array
+ template<class ValueType>
+ void save_optimized(
+ const serialization::array<ValueType> &t, unsigned int version, mpl::true_)
+ {
+ BOOST_STATIC_ASSERT(false);
+ this->This()->save_array(t,version);
+ }
+
+ // to save a vector:
+ // if the value type is trivially constructable or an optimized array save exists,
+ // then we can use the optimized version
+
+ template<class ValueType, class Allocator>
+ void save_override(std::vector<ValueType,Allocator> const &x, unsigned int version)
+ {
+ typedef BOOST_DEDUCED_TYPENAME remove_const<ValueType>::type value_type;
+ typedef typename mpl::and_<
+ mpl::not_<is_same<value_type,bool> >,
+ mpl::apply1<
+ BOOST_DEDUCED_TYPENAME Archive::use_array_optimization
+ , value_type>
+ >::type use_optimized;
+ save_optimized(x,version,use_optimized() );
+ }
+#if 1
+ // dispatch saving of arrays to the optimized version where supported
+ template<class ValueType>
+ void save_override(serialization::array<ValueType> const& x, unsigned int version)
+ {
+ typedef typename mpl::apply1<
+ BOOST_DEDUCED_TYPENAME Archive::use_array_optimization
+ , BOOST_DEDUCED_TYPENAME remove_const<ValueType>::type
+ >::type use_optimized;
+ save_optimized(x,version,use_optimized());
+ }
+#else
+ // dispatch saving of arrays to the optimized version where supported
+ template<class ValueType>
+ void save_override(serialization::array<ValueType> const& x, unsigned int version)
+ {
+ typedef typename Archive::use_array_optimization<ValueType>::type use_optimized;
+ save_optimized(x,version, use_optimized());
+ }
+#endif
+
+ // Save everything else in the usual way, forwarding on to the
+ // Base class
+ template<class T>
+ void save_override(T const& x, unsigned BOOST_PFTO int version)
+ {
+ Base::save_override(x, static_cast<unsigned int>(version));
+ }
+};
+
+} } } // end namespace boost::archive::array
+
+
+#endif // BOOST_ARCHIVE_ARRAY_OARCHIVE_HPP
+

Modified: branches/serialization_next_release/boost/boost/archive/detail/basic_iserializer.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/detail/basic_iserializer.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/detail/basic_iserializer.hpp 2007-10-29 15:32:22 EDT (Mon, 29 Oct 2007)
@@ -16,7 +16,6 @@
 
 // See http://www.boost.org for updates, documentation, and revision history.
 
-#include <cassert>
 #include <cstdlib> // NULL
 #include <boost/config.hpp>
 
@@ -42,10 +41,10 @@
     public basic_serializer
 {
 private:
- basic_pointer_iserializer *bpis;
+ basic_pointer_iserializer *m_bpis;
 protected:
     explicit basic_iserializer(
- const boost::serialization::extended_type_info & type_
+ const boost::serialization::extended_type_info & type
     );
     // account for bogus gcc warning
     #if defined(__GNUC__)
@@ -54,13 +53,13 @@
     ~basic_iserializer();
 public:
     bool serialized_as_pointer() const {
- return bpis != NULL;
+ return m_bpis != NULL;
     }
- void set_bpis(basic_pointer_iserializer *bpis_){
- bpis = bpis_;
+ void set_bpis(basic_pointer_iserializer *bpis){
+ m_bpis = bpis;
     }
     const basic_pointer_iserializer * get_bpis_ptr() const {
- return bpis;
+ return m_bpis;
     }
     virtual void load_object_data(
         basic_iarchive & ar,

Modified: branches/serialization_next_release/boost/boost/archive/detail/basic_oserializer.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/detail/basic_oserializer.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/detail/basic_oserializer.hpp 2007-10-29 15:32:22 EDT (Mon, 29 Oct 2007)
@@ -41,7 +41,7 @@
     public basic_serializer
 {
 private:
- basic_pointer_oserializer *bpos;
+ basic_pointer_oserializer *m_bpos;
 protected:
     explicit basic_oserializer(
         const boost::serialization::extended_type_info & type_
@@ -53,13 +53,13 @@
     ~basic_oserializer();
 public:
     bool serialized_as_pointer() const {
- return bpos != NULL;
+ return m_bpos != NULL;
     }
- void set_bpos(basic_pointer_oserializer *bpos_){
- bpos = bpos_;
+ void set_bpos(basic_pointer_oserializer *bpos){
+ m_bpos = bpos;
     }
     const basic_pointer_oserializer * get_bpos() const {
- return bpos;
+ return m_bpos;
     }
     virtual void save_object_data(
         basic_oarchive & ar, const void * x

Modified: branches/serialization_next_release/boost/boost/archive/detail/basic_serializer.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/detail/basic_serializer.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/detail/basic_serializer.hpp 2007-10-29 15:32:22 EDT (Mon, 29 Oct 2007)
@@ -44,6 +44,13 @@
     }
 };
 
+class basic_serializer_arg : public basic_serializer {
+public:
+ basic_serializer_arg(const serialization::extended_type_info & eti) :
+ basic_serializer(eti)
+ {}
+};
+
 } // namespace detail
 } // namespace archive
 } // namespace boost

Modified: branches/serialization_next_release/boost/boost/archive/detail/basic_serializer_map.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/detail/basic_serializer_map.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/detail/basic_serializer_map.hpp 2007-10-29 15:32:22 EDT (Mon, 29 Oct 2007)
@@ -38,28 +38,16 @@
 {
     bool operator()(
         const basic_serializer * lhs, const basic_serializer * rhs
- ) const ;
-};
-
-class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_serializer_map : public
- boost::noncopyable
-{
- typedef std::set<const basic_serializer *, type_info_pointer_compare> map_type;
- map_type m_map;
- bool & m_deleted;
-public:
- bool insert(const basic_serializer * bs);
- const basic_serializer * tfind(
- const boost::serialization::extended_type_info & type_
- ) const;
- void erase(basic_serializer * bs);
- basic_serializer_map(bool & deleted);
- ~basic_serializer_map();
-private:
- // cw 8.3 requires this
- basic_serializer_map& operator=(basic_serializer_map const&);
+ ) const {
+ return *lhs < *rhs;
+ }
 };
 
+typedef BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) std::set<
+ const basic_serializer *,
+ type_info_pointer_compare
+> basic_serializer_map;
+
 } // namespace detail
 } // namespace archive
 } // namespace boost

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-10-29 15:32:22 EDT (Mon, 29 Oct 2007)
@@ -20,8 +20,11 @@
 #include <boost/mpl/bool.hpp>
 #include <boost/archive/detail/auto_link_archive.hpp>
 #include <boost/archive/detail/iserializer.hpp>
+#include <boost/serialization/singleton.hpp>
 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
 
+#include <boost/serialization/singleton.hpp>
+
 namespace boost {
 namespace archive {
 namespace detail {
@@ -48,7 +51,9 @@
     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();
+ boost::serialization::singleton<
+ pointer_iserializer<Archive, T>
+ >::get_const_instance();
         this->This()->register_basic_serializer(bpis.get_basic_serializer());
         return & bpis;
     }

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-10-29 15:32:22 EDT (Mon, 29 Oct 2007)
@@ -23,6 +23,8 @@
 #include <boost/archive/detail/oserializer.hpp>
 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
 
+#include <boost/serialization/singleton.hpp>
+
 namespace boost {
 namespace archive {
 namespace detail {
@@ -49,7 +51,9 @@
     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();
+ boost::serialization::singleton<
+ pointer_oserializer<Archive, T>
+ >::get_const_instance();
         this->This()->register_basic_serializer(bpos.get_basic_serializer());
         return & bpos;
     }

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-10-29 15:32:22 EDT (Mon, 29 Oct 2007)
@@ -67,7 +67,6 @@
 #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/detail/dynamically_initialized.hpp>
 
 #include <boost/serialization/force_include.hpp>
 #include <boost/serialization/serialization.hpp>
@@ -79,6 +78,8 @@
 #include <boost/serialization/void_cast.hpp>
 #include <boost/serialization/array.hpp>
 #include <boost/serialization/collection_size_type.hpp>
+#include <boost/serialization/singleton.hpp>
+
 namespace boost {
 
 namespace serialization {
@@ -108,12 +109,14 @@
     }
     // private constructor to inhibit any existence other than the
     // static one
+public:
     explicit iserializer() :
         basic_iserializer(
- * boost::serialization::type_info_implementation<T>::type::find()
+ boost::serialization::singleton<
+ boost::serialization::type_info_implementation<T>::type
+ >::get_const_instance()
         )
     {}
-public:
     virtual BOOST_DLLEXPORT void load_object_data(
         basic_iarchive & ar,
         void *x,
@@ -138,10 +141,6 @@
     virtual bool is_polymorphic() const {
         return boost::is_polymorphic<T>::value;
     }
- static iserializer & get_instance(){
- static iserializer instance;
- return instance;
- }
     virtual ~iserializer(){};
 };
 
@@ -163,11 +162,11 @@
 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>::get_instance();
+ return boost::serialization::singleton<iserializer<Archive, T> >
+ ::get_const_instance();
     }
     virtual BOOST_DLLEXPORT void load_object_ptr(
         basic_iarchive & ar,
@@ -177,18 +176,20 @@
 #if defined(__GNUC__) || ( defined(BOOST_MSVC) && (_MSC_VER <= 1300) )
 public:
 #endif
+public:
     // private constructor to inhibit any existence other than the
     // static one. Note GCC doesn't permit constructor to be private
     BOOST_DLLEXPORT pointer_iserializer() BOOST_USED;
- friend struct dynamically_initialized<pointer_iserializer<Archive,T> >;
-public:
+ //friend class serialization::singleton<pointer_iserializer<Archive,T> >;
     // at least one compiler (CW) seems to require that serialize_adl
     // be explicitly instantiated. Still under investigation.
+#if 0
     #if !defined(__BORLANDC__)
     void (* const m)(Archive &, T &, const unsigned);
     boost::serialization::extended_type_info * (* e)();
     #endif
- BOOST_DLLEXPORT static const pointer_iserializer & get_instance() BOOST_USED;
+#endif
+// BOOST_DLLEXPORT static const pointer_iserializer & get_instance() BOOST_USED;
 };
 
 // note trick to be sure that operator new is using class specific
@@ -303,23 +304,20 @@
 template<class Archive, class T>
 BOOST_DLLEXPORT pointer_iserializer<Archive, T>::pointer_iserializer() :
     archive_pointer_iserializer<Archive>(
- * boost::serialization::type_info_implementation<T>::type::find()
+ boost::serialization::singleton<
+ boost::serialization::type_info_implementation<T>::type
+ >::get_const_instance()
     )
+#if 0
 #if !defined(__BORLANDC__)
     ,
     m(boost::serialization::serialize_adl<Archive, T>),
- e(boost::serialization::type_info_implementation<T>::type::find)
+ e(boost::serialization::type_info_implementation<T>::type::get_instance)
+#endif
 #endif
 {
- 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;
+ boost::serialization::singleton<iserializer<Archive, T> >
+ ::get_mutable_instance().set_bpis(this);
 }
 
 template<class Archive, class T>
@@ -353,7 +351,11 @@
             // 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>::get_instance());
+ ar.load_object(
+ x,
+ boost::serialization::singleton<iserializer<Archive, T> >
+ ::get_const_instance()
+ );
         }
     };
 
@@ -452,7 +454,9 @@
         return static_cast<T *>(
             boost::serialization::void_upcast(
                 eti,
- * boost::serialization::type_info_implementation<T>::type::find(),
+ boost::serialization::singleton<
+ boost::serialization::type_info_implementation<T>::type
+ >::get_const_instance(),
                 t
             )
         );

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-10-29 15:32:22 EDT (Mon, 29 Oct 2007)
@@ -59,7 +59,6 @@
 #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>
@@ -71,6 +70,7 @@
 #include <boost/serialization/void_cast.hpp>
 #include <boost/serialization/array.hpp>
 #include <boost/serialization/collection_size_type.hpp>
+#include <boost/serialization/singleton.hpp>
 
 #include <boost/archive/archive_exception.hpp>
 
@@ -105,12 +105,14 @@
 private:
     // private constructor to inhibit any existence other than the
     // static one
+public:
     explicit BOOST_DLLEXPORT oserializer() :
         basic_oserializer(
- * boost::serialization::type_info_implementation<T>::type::find()
+ boost::serialization::singleton<
+ boost::serialization::type_info_implementation<T>::type
+ >::get_const_instance()
         )
     {}
-public:
     virtual BOOST_DLLEXPORT void save_object_data(
         basic_oarchive & ar,
         const void *x
@@ -132,10 +134,6 @@
     virtual bool is_polymorphic() const {
         return boost::is_polymorphic<T>::value;
     }
- static oserializer & get_instance(){
- static oserializer instance;
- return instance;
- }
     virtual ~oserializer(){}
 };
 
@@ -156,31 +154,33 @@
 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>::get_instance();
+ return boost::serialization::singleton<oserializer<Archive, T> >
+ ::get_const_instance();
     }
     virtual BOOST_DLLEXPORT void save_object_ptr(
         basic_oarchive & ar,
         const void * x
     ) const BOOST_USED ;
-#if defined(__GNUC__) || ( defined(BOOST_MSVC) && (_MSC_VER <= 1300) )
-public:
-#endif
+//#if defined(__GNUC__) || ( defined(BOOST_MSVC) && (_MSC_VER <= 1300) )
+//public:
+//#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_oserializer() BOOST_USED;
- friend struct dynamically_initialized<pointer_oserializer<Archive,T> >;
 public:
+ explicit BOOST_DLLEXPORT pointer_oserializer() BOOST_USED;
+// friend class serialization::singleton<pointer_oserializer<Archive,T> >;
+#if 0
     #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
     #endif
- BOOST_DLLEXPORT static const pointer_oserializer & get_instance() BOOST_USED;
+// BOOST_DLLEXPORT static const pointer_oserializer & get_instance() BOOST_USED;
 };
 
 template<class Archive, class T>
@@ -205,24 +205,24 @@
 template<class Archive, class T>
 BOOST_DLLEXPORT pointer_oserializer<Archive, T>::pointer_oserializer() :
     archive_pointer_oserializer<Archive>(
- * boost::serialization::type_info_implementation<T>::type::find()
+ boost::serialization::singleton<
+ boost::serialization::type_info_implementation<T>::type
+ >::get_const_instance()
     )
+#if 0
 #if !defined(__BORLANDC__)
     ,
     m(boost::serialization::serialize_adl<Archive, T>),
- e(boost::serialization::type_info_implementation<T>::type::find)
+ e(boost::serialization::singleton<
+ boost::serialization::type_info_implementation<T>::type
+ >::get_instance
+ )
+#endif
 #endif
 {
     // make sure appropriate member function is instantiated
- 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;
+ boost::serialization::singleton<oserializer<Archive, T> >
+ ::get_mutable_instance().set_bpos(this);
 }
 
 template<class Archive, class T>
@@ -250,7 +250,11 @@
     // serialization level and class version
     struct save_standard {
         static void invoke(Archive &ar, const T & t){
- ar.save_object(& t, oserializer<Archive, T>::get_instance());
+ ar.save_object(
+ & t,
+ boost::serialization::singleton<oserializer<Archive, T> >
+ ::get_const_instance()
+ );
         }
     };
 
@@ -368,13 +372,18 @@
             const T & t,
             const basic_pointer_oserializer * bpos_ptr
         ){
- const boost::serialization::extended_type_info * this_type
- = boost::serialization::type_info_implementation<T>::type::find();
+ const boost::serialization::extended_type_info * this_type
+ = & boost::serialization::singleton<
+ boost::serialization::type_info_implementation<T>::type
+ >::get_const_instance();
             // retrieve the true type of the object pointed to
             // if this assertion fails its an error in this library
             assert(NULL != this_type);
+
             const boost::serialization::extended_type_info * true_type
- = boost::serialization::type_info_implementation<T>::type::get_derived_extended_type_info(t);
+ = boost::serialization::singleton<
+ boost::serialization::type_info_implementation<T>::type
+ >::get_const_instance().get_derived_extended_type_info(t);
             // note:if this exception is thrown, be sure that derived pointer
             // is either registered or exported.
             if(NULL == true_type){
@@ -398,10 +407,12 @@
                 );
             }
 
- // sice true_type is valid, and this only gets made if the
+ // since true_type is valid, and this only gets made if the
             // pointer oserializer object has been created, this should never
             // fail
- bpos_ptr = archive_pointer_oserializer<Archive>::find(* true_type);
+ bpos_ptr = boost::serialization::singleton<
+ pointer_oserializer<Archive, T>
+ >::get_const_instance().find(* true_type);
             assert(NULL != bpos_ptr);
             if(NULL == bpos_ptr)
                 boost::throw_exception(

Added: branches/serialization_next_release/boost/boost/archive/detail/polymorphic_iarchive_route.hpp
==============================================================================
--- (empty file)
+++ branches/serialization_next_release/boost/boost/archive/detail/polymorphic_iarchive_route.hpp 2007-10-29 15:32:22 EDT (Mon, 29 Oct 2007)
@@ -0,0 +1,195 @@
+#ifndef BOOST_ARCHIVE_DETAIL_POLYMORPHIC_IARCHIVE_ROUTE_HPP
+#define BOOST_ARCHIVE_DETAIL_POLYMORPHIC_IARCHIVE_ROUTE_HPP
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// polymorphic_iarchive_forward.hpp
+
+// (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)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#include <cstddef>
+#include <string>
+#include <ostream>
+#include <boost/noncopyable.hpp>
+#include <boost/cstdint.hpp>
+
+#include <boost/config.hpp>
+#if defined(BOOST_NO_STDC_NAMESPACE)
+namespace std{
+ using ::size_t;
+} // namespace std
+#endif
+
+#include <boost/archive/polymorphic_iarchive.hpp>
+#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
+
+namespace boost {
+namespace serialization {
+ class extended_type_info;
+} // namespace serialization
+namespace archive {
+namespace detail{
+
+class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iserializer;
+class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_iserializer;
+
+template<class ArchiveImplementation>
+class polymorphic_iarchive_forward :
+ public polymorphic_iarchive,
+ // note: gcc dynamic cross cast fails if the the derivation below is
+ // not public. I think this is a mistake.
+ public /*protected*/ ArchiveImplementation,
+ private boost::noncopyable
+{
+private:
+ // these are used by the serialization library.
+ virtual void load_object(
+ void *t,
+ const basic_iserializer & bis
+ ){
+ ArchiveImplementation::load_object(t, bis);
+ }
+ virtual const basic_pointer_iserializer * load_pointer(
+ void * & t,
+ const basic_pointer_iserializer * bpis_ptr,
+ const basic_pointer_iserializer * (*finder)(
+ const boost::serialization::extended_type_info & type
+ )
+ ){
+ return ArchiveImplementation::load_pointer(t, bpis_ptr, finder);
+ }
+ virtual void set_library_version(unsigned int archive_library_version){
+ ArchiveImplementation::set_library_version(archive_library_version);
+ }
+ virtual unsigned int get_library_version() const{
+ return ArchiveImplementation::get_library_version();
+ }
+ virtual unsigned int get_flags() const {
+ return ArchiveImplementation::get_flags();
+ }
+ virtual void delete_created_pointers(){
+ ArchiveImplementation::delete_created_pointers();
+ }
+ virtual void reset_object_address(
+ const void * new_address,
+ const void * old_address
+ ){
+ ArchiveImplementation::reset_object_address(new_address, old_address);
+ }
+ virtual void load_binary(void * t, std::size_t size){
+ ArchiveImplementation::load_binary(t, size);
+ }
+ // primitive types the only ones permitted by polymorphic archives
+ virtual void load(bool & t){
+ ArchiveImplementation::load(t);
+ }
+ virtual void load(char & t){
+ ArchiveImplementation::load(t);
+ }
+ virtual void load(signed char & t){
+ ArchiveImplementation::load(t);
+ }
+ virtual void load(unsigned char & t){
+ ArchiveImplementation::load(t);
+ }
+ #ifndef BOOST_NO_CWCHAR
+ #ifndef BOOST_NO_INTRINSIC_WCHAR_T
+ virtual void load(wchar_t & t){
+ ArchiveImplementation::load(t);
+ }
+ #endif
+ #endif
+ virtual void load(short & t){
+ ArchiveImplementation::load(t);
+ }
+ virtual void load(unsigned short & t){
+ ArchiveImplementation::load(t);
+ }
+ virtual void load(int & t){
+ ArchiveImplementation::load(t);
+ }
+ virtual void load(unsigned int & t){
+ ArchiveImplementation::load(t);
+ }
+ virtual void load(long & t){
+ ArchiveImplementation::load(t);
+ }
+ virtual void load(unsigned long & t){
+ ArchiveImplementation::load(t);
+ }
+ #if !defined(BOOST_NO_INTRINSIC_INT64_T)
+ virtual void load(boost::int64_t & t){
+ ArchiveImplementation::load(t);
+ }
+ virtual void load(boost::uint64_t & t){
+ ArchiveImplementation::load(t);
+ }
+ #endif
+ virtual void load(float & t){
+ ArchiveImplementation::load(t);
+ }
+ virtual void load(double & t){
+ ArchiveImplementation::load(t);
+ }
+ virtual void load(std::string & t){
+ ArchiveImplementation::load(t);
+ }
+ #ifndef BOOST_NO_STD_WSTRING
+ virtual void load(std::wstring & t){
+ ArchiveImplementation::load(t);
+ }
+ #endif
+ // used for xml and other tagged formats default does nothing
+ virtual void load_start(const char * name){
+ ArchiveImplementation::load_start(name);
+ }
+ virtual void load_end(const char * name){
+ ArchiveImplementation::load_end(name);
+ }
+
+ virtual void register_basic_serializer(const basic_iserializer & bis){
+ ArchiveImplementation::register_basic_serializer(bis);
+ }
+public:
+ // this can't be inheriteded because they appear in mulitple
+ // parents
+ typedef mpl::bool_<true> is_loading;
+ typedef mpl::bool_<false> is_saving;
+ // the >> operator
+ template<class T>
+ polymorphic_iarchive & operator>>(T & t){
+ return polymorphic_iarchive::operator>>(t);
+ }
+
+ // the & operator
+ template<class T>
+ polymorphic_iarchive & operator&(T & t){
+ return polymorphic_iarchive::operator&(t);
+ }
+
+ // all current archives take a stream as constructor argument
+ template <class _Elem, class _Tr>
+ polymorphic_iarchive_forward(
+ std::basic_istream<_Elem, _Tr> & is,
+ unsigned int flags = 0
+ ) :
+ ArchiveImplementation(is, flags)
+ {}
+};
+
+} // namespace detail
+} // namespace archive
+} // namespace boost
+
+#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
+
+#endif // BOOST_ARCHIVE_DETAIL_POLYMORPHIC_IARCHIVE_DISPATCH_HPP

Added: branches/serialization_next_release/boost/boost/archive/detail/polymorphic_oarchive_route.hpp
==============================================================================
--- (empty file)
+++ branches/serialization_next_release/boost/boost/archive/detail/polymorphic_oarchive_route.hpp 2007-10-29 15:32:22 EDT (Mon, 29 Oct 2007)
@@ -0,0 +1,183 @@
+#ifndef BOOST_ARCHIVE_DETAIL_POLYMORPHIC_OARCHIVE_ROUTE_HPP
+#define BOOST_ARCHIVE_DETAIL_POLYMORPHIC_OARCHIVE_ROUTE_HPP
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// polymorphic_oarchive_forward.hpp
+
+// (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)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#include <string>
+#include <ostream>
+#include <boost/noncopyable.hpp>
+#include <boost/cstdint.hpp>
+#include <cstddef> // size_t
+
+#include <boost/config.hpp>
+#if defined(BOOST_NO_STDC_NAMESPACE)
+namespace std{
+ using ::size_t;
+} // namespace std
+#endif
+
+#include <boost/archive/polymorphic_oarchive.hpp>
+#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
+
+namespace boost {
+namespace serialization {
+ class extended_type_info;
+} // namespace serialization
+namespace archive {
+namespace detail{
+
+class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oserializer;
+class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_oserializer;
+
+template<class ArchiveImplementation>
+class polymorphic_oarchive_forward :
+ public polymorphic_oarchive,
+ // note: gcc dynamic cross cast fails if the the derivation below is
+ // not public. I think this is a mistake.
+ public /*protected*/ ArchiveImplementation,
+ private boost::noncopyable
+{
+private:
+ // these are used by the serialization library.
+ virtual void save_object(
+ const void *x,
+ const detail::basic_oserializer & bos
+ ){
+ ArchiveImplementation::save_object(x, bos);
+ }
+ virtual void save_pointer(
+ const void * t,
+ const detail::basic_pointer_oserializer * bpos_ptr
+ ){
+ ArchiveImplementation::save_pointer(t, bpos_ptr);
+ }
+ virtual void save_null_pointer(){
+ ArchiveImplementation::save_null_pointer();
+ }
+ // primitive types the only ones permitted by polymorphic archives
+ virtual void save(const bool t){
+ ArchiveImplementation::save(t);
+ }
+ virtual void save(const char t){
+ ArchiveImplementation::save(t);
+ }
+ virtual void save(const signed char t){
+ ArchiveImplementation::save(t);
+ }
+ virtual void save(const unsigned char t){
+ ArchiveImplementation::save(t);
+ }
+ #ifndef BOOST_NO_CWCHAR
+ #ifndef BOOST_NO_INTRINSIC_WCHAR_T
+ virtual void save(const wchar_t t){
+ ArchiveImplementation::save(t);
+ }
+ #endif
+ #endif
+ virtual void save(const short t){
+ ArchiveImplementation::save(t);
+ }
+ virtual void save(const unsigned short t){
+ ArchiveImplementation::save(t);
+ }
+ virtual void save(const int t){
+ ArchiveImplementation::save(t);
+ }
+ virtual void save(const unsigned int t){
+ ArchiveImplementation::save(t);
+ }
+ virtual void save(const long t){
+ ArchiveImplementation::save(t);
+ }
+ virtual void save(const unsigned long t){
+ ArchiveImplementation::save(t);
+ }
+ #if !defined(BOOST_NO_INTRINSIC_INT64_T)
+ virtual void save(const boost::int64_t t){
+ ArchiveImplementation::save(t);
+ }
+ virtual void save(const boost::uint64_t t){
+ ArchiveImplementation::save(t);
+ }
+ #endif
+ virtual void save(const float t){
+ ArchiveImplementation::save(t);
+ }
+ virtual void save(const double t){
+ ArchiveImplementation::save(t);
+ }
+ virtual void save(const std::string & t){
+ ArchiveImplementation::save(t);
+ }
+ #ifndef BOOST_NO_STD_WSTRING
+ virtual void save(const std::wstring & t){
+ ArchiveImplementation::save(t);
+ }
+ #endif
+ virtual unsigned int get_library_version() const{
+ return ArchiveImplementation::get_library_version();
+ }
+ virtual unsigned int get_flags() const {
+ return ArchiveImplementation::get_flags();
+ }
+ virtual void save_binary(const void * t, std::size_t size){
+ ArchiveImplementation::save_binary(t, size);
+ }
+ // used for xml and other tagged formats default does nothing
+ virtual void save_start(const char * name){
+ ArchiveImplementation::save_start(name);
+ }
+ virtual void save_end(const char * name){
+ ArchiveImplementation::save_end(name);
+ }
+ virtual void end_preamble(){
+ ArchiveImplementation::end_preamble();
+ }
+ virtual void register_basic_serializer(const detail::basic_oserializer & bos){
+ ArchiveImplementation::register_basic_serializer(bos);
+ }
+public:
+ // this can't be inheriteded because they appear in mulitple
+ // parents
+ typedef mpl::bool_<false> is_loading;
+ typedef mpl::bool_<true> is_saving;
+ // the << operator
+ template<class T>
+ polymorphic_oarchive & operator<<(T & t){
+ return polymorphic_oarchive::operator<<(t);
+ }
+ // the & operator
+ template<class T>
+ polymorphic_oarchive & operator&(T & t){
+ return polymorphic_oarchive::operator&(t);
+ }
+ // all current archives take a stream as constructor argument
+ template <class _Elem, class _Tr>
+ polymorphic_oarchive_forward(
+ std::basic_ostream<_Elem, _Tr> & os,
+ unsigned int flags = 0
+ ) :
+ ArchiveImplementation(os, flags)
+ {}
+};
+
+} // namespace detail
+} // namespace archive
+} // namespace boost
+
+#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
+
+#endif // BOOST_ARCHIVE_DETAIL_POLYMORPHIC_OARCHIVE_DISPATCH_HPP

Added: branches/serialization_next_release/boost/boost/archive/detail/register_archive.hpp
==============================================================================
--- (empty file)
+++ branches/serialization_next_release/boost/boost/archive/detail/register_archive.hpp 2007-10-29 15:32:22 EDT (Mon, 29 Oct 2007)
@@ -0,0 +1,47 @@
+// Copyright David Abrahams 2006. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+#ifndef BOOST_ARCHIVE_DETAIL_REGISTER_ARCHIVE_DWA2006521_HPP
+# define BOOST_ARCHIVE_DETAIL_REGISTER_ARCHIVE_DWA2006521_HPP
+
+//# include <boost/type_traits/add_pointer.hpp>
+
+namespace boost { namespace archive { namespace detail {
+
+template <class Archive, class Serializable>
+struct ptr_serialization_support;
+
+// We could've just used ptr_serialization_support, above, but using
+// it with only a forward declaration causes vc6/7 to complain about a
+// missing instantiate member, even if it has one. This is just a
+// friendly layer of indirection.
+template <class Archive, class Serializable>
+struct _ptr_serialization_support
+ : ptr_serialization_support<Archive,Serializable>
+{
+ typedef int type;
+};
+
+// This function gets called, but its only purpose is to participate
+// in overload resolution with the functions declared by
+// BOOST_SERIALIZATION_REGISTER_ARCHIVE, below.
+template <class Serializable>
+void instantiate_ptr_serialization(Serializable*, int) {}
+
+// The function declaration generated by this macro never actually
+// gets called, but its return type gets instantiated, and that's
+// enough to cause registration of serialization functions between
+// Archive and any exported Serializable type. See also:
+// boost/serialization/export.hpp
+# define BOOST_SERIALIZATION_REGISTER_ARCHIVE(Archive) \
+namespace boost { namespace archive { namespace detail { \
+ \
+template <class Serializable> \
+typename _ptr_serialization_support<Archive, Serializable>::type \
+instantiate_ptr_serialization( Serializable*, Archive* ); \
+ \
+}}}
+
+}}} // namespace boost::archive::detail
+
+#endif // BOOST_ARCHIVE_DETAIL_INSTANTIATE_SERIALIZE_DWA2006521_HPP

Modified: branches/serialization_next_release/boost/boost/archive/impl/archive_pointer_iserializer.ipp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/impl/archive_pointer_iserializer.ipp (original)
+++ branches/serialization_next_release/boost/boost/archive/impl/archive_pointer_iserializer.ipp 2007-10-29 15:32:22 EDT (Mon, 29 Oct 2007)
@@ -8,10 +8,12 @@
 
 // See http://www.boost.org for updates, documentation, and revision history.
 
+#include <utility>
 #include <cassert>
 
 #include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
 
+#include <boost/serialization/singleton.hpp>
 #include <boost/archive/detail/basic_serializer_map.hpp>
 #include <boost/archive/detail/archive_pointer_iserializer.hpp>
 
@@ -19,12 +21,11 @@
 namespace archive {
 namespace detail {
 
-template<class Archive>
-basic_serializer_map *
-iserializer_map(){
- static bool deleted = false;
- static basic_serializer_map map(deleted);
- return deleted ? NULL : & map;
+namespace { // anon
+ template<class Archive>
+ class serializer_map : public basic_serializer_map
+ {
+ };
 }
 
 template<class Archive>
@@ -34,9 +35,10 @@
 ) :
     basic_pointer_iserializer(eti)
 {
- basic_serializer_map *mp = iserializer_map<Archive>();
- assert(NULL != mp);
- mp->insert(this);
+ std::pair<serializer_map<Archive>::iterator, bool> result;
+ result = serialization::singleton<serializer_map<Archive> >
+ ::get_mutable_instance().insert(this);
+ assert(result.second);
 }
 
 template<class Archive>
@@ -44,9 +46,17 @@
 archive_pointer_iserializer<Archive>::find(
     const boost::serialization::extended_type_info & eti
 ){
- basic_serializer_map *mp = iserializer_map<Archive>();
- assert(NULL != mp);
- return static_cast<const basic_pointer_iserializer *>(mp->tfind(eti));
+ const basic_serializer_arg bs(eti);
+ serializer_map<Archive>::const_iterator it;
+ it = boost::serialization::singleton<serializer_map<Archive> >
+ ::get_const_instance().find(& bs);
+ assert(
+ it
+ !=
+ boost::serialization::singleton<serializer_map<Archive> >
+ ::get_const_instance().end()
+ );
+ return static_cast<const basic_pointer_iserializer *>(*it);
 }
 
 template<class Archive>
@@ -54,10 +64,10 @@
 archive_pointer_iserializer<Archive>::~archive_pointer_iserializer(){
     // note: we need to check that the map still exists as we can't depend
     // on static variables being constructed in a specific sequence
- basic_serializer_map *mp = iserializer_map<Archive>();
- if(NULL == mp)
- return;
- mp->erase(this);
+ unsigned int count;
+ count = serialization::singleton<serializer_map<Archive> >
+ ::get_mutable_instance().erase(this);
+ assert(count);
 }
 
 } // namespace detail

Modified: branches/serialization_next_release/boost/boost/archive/impl/archive_pointer_oserializer.ipp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/impl/archive_pointer_oserializer.ipp (original)
+++ branches/serialization_next_release/boost/boost/archive/impl/archive_pointer_oserializer.ipp 2007-10-29 15:32:22 EDT (Mon, 29 Oct 2007)
@@ -8,6 +8,9 @@
 
 // See http://www.boost.org for updates, documentation, and revision history.
 
+#include <utility>
+#include <cassert>
+
 #include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
 
 #include <boost/archive/detail/archive_pointer_oserializer.hpp>
@@ -17,12 +20,11 @@
 namespace archive {
 namespace detail {
 
-template<class Archive>
-basic_serializer_map *
-oserializer_map(){
- static bool deleted = false;
- static basic_serializer_map map(deleted);
- return deleted ? NULL : & map;
+namespace { // anon
+ template<class Archive>
+ class serializer_map : public basic_serializer_map
+ {
+ };
 }
 
 template<class Archive>
@@ -32,9 +34,10 @@
 ) :
     basic_pointer_oserializer(eti)
 {
- basic_serializer_map *mp = oserializer_map<Archive>();
- assert(NULL != mp);
- mp->insert(this);
+ std::pair<serializer_map<Archive>::iterator, bool> result;
+ result = serialization::singleton<serializer_map<Archive> >
+ ::get_mutable_instance().insert(this);
+ assert(result.second);
 }
 
 template<class Archive>
@@ -42,9 +45,17 @@
 archive_pointer_oserializer<Archive>::find(
     const boost::serialization::extended_type_info & eti
 ){
- basic_serializer_map *mp = oserializer_map<Archive>();
- assert(NULL != mp);
- return static_cast<const basic_pointer_oserializer *>(mp->tfind(eti));
+ const basic_serializer_arg bs(eti);
+ basic_serializer_map::const_iterator it;
+ it = boost::serialization::singleton<serializer_map<Archive> >
+ ::get_const_instance().find(& bs);
+ assert(
+ it
+ !=
+ boost::serialization::singleton<serializer_map<Archive> >
+ ::get_const_instance().end()
+ );
+ return static_cast<const basic_pointer_oserializer *>(*it);
 }
 
 template<class Archive>
@@ -52,10 +63,10 @@
 archive_pointer_oserializer<Archive>::~archive_pointer_oserializer(){
     // note: we need to check that the map still exists as we can't depend
     // on static variables being constructed in a specific sequence
- basic_serializer_map *mp = oserializer_map<Archive>();
- if(NULL == mp)
- return;
- mp->erase(this);
+ unsigned int count;
+ count = serialization::singleton<serializer_map<Archive> >
+ ::get_mutable_instance().erase(this);
+ assert(count);
 }
 
 } // namespace detail

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-10-29 15:32:22 EDT (Mon, 29 Oct 2007)
@@ -18,17 +18,17 @@
 
 #include <boost/config.hpp>
 #include <boost/archive/binary_iarchive.hpp>
-#include <boost/archive/detail/polymorphic_iarchive_dispatch.hpp>
+#include <boost/archive/detail/polymorphic_iarchive_route.hpp>
 
 namespace boost {
 namespace archive {
 
 class polymorphic_binary_iarchive :
- public detail::polymorphic_iarchive_dispatch<naked_binary_iarchive>
+ public detail::polymorphic_iarchive_route<naked_binary_iarchive>
 {
 public:
     polymorphic_binary_iarchive(std::istream & is, unsigned int flags = 0) :
- detail::polymorphic_iarchive_dispatch<naked_binary_iarchive>(is, flags)
+ detail::polymorphic_iarchive_route<naked_binary_iarchive>(is, flags)
     {}
     ~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-10-29 15:32:22 EDT (Mon, 29 Oct 2007)
@@ -18,12 +18,12 @@
 
 #include <boost/config.hpp>
 #include <boost/archive/binary_oarchive.hpp>
-#include <boost/archive/detail/polymorphic_oarchive_dispatch.hpp>
+#include <boost/archive/detail/polymorphic_oarchive_route.hpp>
 
 namespace boost {
 namespace archive {
 
-typedef detail::polymorphic_oarchive_dispatch<
+typedef detail::polymorphic_oarchive_route<
     binary_oarchive_impl<
         naked_binary_oarchive,
         std::ostream::char_type,

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-10-29 15:32:22 EDT (Mon, 29 Oct 2007)
@@ -18,17 +18,17 @@
 
 #include <boost/config.hpp>
 #include <boost/archive/text_iarchive.hpp>
-#include <boost/archive/detail/polymorphic_iarchive_dispatch.hpp>
+#include <boost/archive/detail/polymorphic_iarchive_route.hpp>
 
 namespace boost {
 namespace archive {
 
 class polymorphic_text_iarchive :
- public detail::polymorphic_iarchive_dispatch<naked_text_iarchive>
+ public detail::polymorphic_iarchive_route<naked_text_iarchive>
 {
 public:
     polymorphic_text_iarchive(std::istream & is, unsigned int flags = 0) :
- detail::polymorphic_iarchive_dispatch<naked_text_iarchive>(is, flags)
+ detail::polymorphic_iarchive_route<naked_text_iarchive>(is, flags)
     {}
     ~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-10-29 15:32:22 EDT (Mon, 29 Oct 2007)
@@ -18,12 +18,12 @@
 
 #include <boost/config.hpp>
 #include <boost/archive/text_oarchive.hpp>
-#include <boost/archive/detail/polymorphic_oarchive_dispatch.hpp>
+#include <boost/archive/detail/polymorphic_oarchive_route.hpp>
 
 namespace boost {
 namespace archive {
 
-typedef detail::polymorphic_oarchive_dispatch<
+typedef detail::polymorphic_oarchive_route<
     text_oarchive_impl<naked_text_oarchive>
> 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-10-29 15:32:22 EDT (Mon, 29 Oct 2007)
@@ -22,12 +22,12 @@
 #else
 
 #include <boost/archive/text_wiarchive.hpp>
-#include <boost/archive/detail/polymorphic_iarchive_dispatch.hpp>
+#include <boost/archive/detail/polymorphic_iarchive_route.hpp>
 
 namespace boost {
 namespace archive {
 
-typedef detail::polymorphic_iarchive_dispatch<
+typedef detail::polymorphic_iarchive_route<
         text_wiarchive_impl<naked_text_wiarchive>
> 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-10-29 15:32:22 EDT (Mon, 29 Oct 2007)
@@ -22,12 +22,12 @@
 #else
 
 #include <boost/archive/text_woarchive.hpp>
-#include <boost/archive/detail/polymorphic_oarchive_dispatch.hpp>
+#include <boost/archive/detail/polymorphic_oarchive_route.hpp>
 
 namespace boost {
 namespace archive {
 
-typedef detail::polymorphic_oarchive_dispatch<
+typedef detail::polymorphic_oarchive_route<
         text_woarchive_impl<naked_text_woarchive>
> 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-10-29 15:32:22 EDT (Mon, 29 Oct 2007)
@@ -18,17 +18,17 @@
 
 #include <boost/config.hpp>
 #include <boost/archive/xml_iarchive.hpp>
-#include <boost/archive/detail/polymorphic_iarchive_dispatch.hpp>
+#include <boost/archive/detail/polymorphic_iarchive_route.hpp>
 
 namespace boost {
 namespace archive {
 
 class polymorphic_xml_iarchive :
- public detail::polymorphic_iarchive_dispatch<naked_xml_iarchive>
+ public detail::polymorphic_iarchive_route<naked_xml_iarchive>
 {
 public:
     polymorphic_xml_iarchive(std::istream & is, unsigned int flags = 0) :
- detail::polymorphic_iarchive_dispatch<naked_xml_iarchive>(is, flags)
+ detail::polymorphic_iarchive_route<naked_xml_iarchive>(is, flags)
     {}
     ~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-10-29 15:32:22 EDT (Mon, 29 Oct 2007)
@@ -18,12 +18,12 @@
 
 #include <boost/config.hpp>
 #include <boost/archive/xml_oarchive.hpp>
-#include <boost/archive/detail/polymorphic_oarchive_dispatch.hpp>
+#include <boost/archive/detail/polymorphic_oarchive_route.hpp>
 
 namespace boost {
 namespace archive {
 
-typedef detail::polymorphic_oarchive_dispatch<
+typedef detail::polymorphic_oarchive_route<
     xml_oarchive_impl<naked_xml_oarchive>
> 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-10-29 15:32:22 EDT (Mon, 29 Oct 2007)
@@ -22,12 +22,12 @@
 #else
 
 #include <boost/archive/xml_wiarchive.hpp>
-#include <boost/archive/detail/polymorphic_iarchive_dispatch.hpp>
+#include <boost/archive/detail/polymorphic_iarchive_route.hpp>
 
 namespace boost {
 namespace archive {
 
-typedef detail::polymorphic_iarchive_dispatch<
+typedef detail::polymorphic_iarchive_route<
         xml_wiarchive_impl<naked_xml_wiarchive>
> 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-10-29 15:32:22 EDT (Mon, 29 Oct 2007)
@@ -22,12 +22,12 @@
 #else
 
 #include <boost/archive/xml_woarchive.hpp>
-#include <boost/archive/detail/polymorphic_oarchive_dispatch.hpp>
+#include <boost/archive/detail/polymorphic_oarchive_route.hpp>
 
 namespace boost {
 namespace archive {
 
-typedef detail::polymorphic_oarchive_dispatch<
+typedef detail::polymorphic_oarchive_route<
         xml_woarchive_impl<naked_xml_woarchive>
> polymorphic_xml_woarchive;
 

Modified: branches/serialization_next_release/boost/boost/archive/shared_ptr_helper.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/archive/shared_ptr_helper.hpp (original)
+++ branches/serialization_next_release/boost/boost/archive/shared_ptr_helper.hpp 2007-10-29 15:32:22 EDT (Mon, 29 Oct 2007)
@@ -7,7 +7,7 @@
 #endif
 
 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
-// shared_ptr.hpp: serialization for boost shared pointer
+// shared_ptr_helper.hpp: serialization for boost shared pointer
 
 // (C) Copyright 2004 Robert Ramey and Martin Ecker
 // Use, modification and distribution is subject to the Boost Software
@@ -87,8 +87,9 @@
     template<class T>
     void * object_identifier(T * t) const {
         const boost::serialization::extended_type_info * true_type
- = boost::serialization::type_info_implementation<T>::type
- ::get_derived_extended_type_info(*t);
+ = boost::serialization::singleton<
+ boost::serialization::type_info_implementation<T>::type
+ >::get_const_instance().get_derived_extended_type_info(*t);
         // note:if this exception is thrown, be sure that derived pointer
         // is either registered or exported.
         if(NULL == true_type)
@@ -98,7 +99,9 @@
                 )
             );
         const boost::serialization::extended_type_info * this_type
- = boost::serialization::type_info_implementation<T>::type::find();
+ = & boost::serialization::singleton<
+ boost::serialization::type_info_implementation<T>::type
+ >::get_const_instance();
         void * vp = void_downcast(*true_type, *this_type, t);
         return vp;
     }


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