Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54934 - in trunk/boost/archive: . detail impl
From: ramey_at_[hidden]
Date: 2009-07-13 17:37:52


Author: ramey
Date: 2009-07-13 17:37:49 EDT (Mon, 13 Jul 2009)
New Revision: 54934
URL: http://svn.boost.org/trac/boost/changeset/54934

Log:
Simplification for pointer serialization
Correct error in exported pointers for polymorphic archives
Added:
   trunk/boost/archive/detail/archive_serializer_map.hpp (contents, props changed)
Removed:
   trunk/boost/archive/detail/archive_pointer_iserializer.hpp
   trunk/boost/archive/detail/archive_pointer_oserializer.hpp
Text files modified:
   trunk/boost/archive/binary_iarchive.hpp | 1
   trunk/boost/archive/binary_oarchive.hpp | 1
   trunk/boost/archive/binary_wiarchive.hpp | 1
   trunk/boost/archive/binary_woarchive.hpp | 1
   trunk/boost/archive/detail/basic_iarchive.hpp | 16 ++++-----
   trunk/boost/archive/detail/basic_serializer_map.hpp | 40 +++++++++++++++-----------
   trunk/boost/archive/detail/common_iarchive.hpp | 17 +++++++++-
   trunk/boost/archive/detail/common_oarchive.hpp | 2 -
   trunk/boost/archive/detail/iserializer.hpp | 35 +++++++++++++++++-----
   trunk/boost/archive/detail/oserializer.hpp | 61 +++++++++++++++++++++++++--------------
   trunk/boost/archive/detail/polymorphic_iarchive_route.hpp | 7 +---
   trunk/boost/archive/impl/basic_text_iarchive.ipp | 1
   trunk/boost/archive/polymorphic_iarchive.hpp | 5 --
   trunk/boost/archive/text_iarchive.hpp | 3 +
   trunk/boost/archive/text_oarchive.hpp | 1
   trunk/boost/archive/text_wiarchive.hpp | 1
   trunk/boost/archive/text_woarchive.hpp | 1
   trunk/boost/archive/xml_iarchive.hpp | 1
   trunk/boost/archive/xml_oarchive.hpp | 1
   trunk/boost/archive/xml_wiarchive.hpp | 1
   trunk/boost/archive/xml_woarchive.hpp | 1
   21 files changed, 125 insertions(+), 73 deletions(-)

Modified: trunk/boost/archive/binary_iarchive.hpp
==============================================================================
--- trunk/boost/archive/binary_iarchive.hpp (original)
+++ trunk/boost/archive/binary_iarchive.hpp 2009-07-13 17:37:49 EDT (Mon, 13 Jul 2009)
@@ -18,6 +18,7 @@
 
 #include <istream>
 #include <boost/archive/binary_iarchive_impl.hpp>
+#include <boost/archive/detail/register_archive.hpp>
 
 namespace boost {
 namespace archive {

Modified: trunk/boost/archive/binary_oarchive.hpp
==============================================================================
--- trunk/boost/archive/binary_oarchive.hpp (original)
+++ trunk/boost/archive/binary_oarchive.hpp 2009-07-13 17:37:49 EDT (Mon, 13 Jul 2009)
@@ -18,6 +18,7 @@
 
 #include <ostream>
 #include <boost/archive/binary_oarchive_impl.hpp>
+#include <boost/archive/detail/register_archive.hpp>
 
 namespace boost {
 namespace archive {

Modified: trunk/boost/archive/binary_wiarchive.hpp
==============================================================================
--- trunk/boost/archive/binary_wiarchive.hpp (original)
+++ trunk/boost/archive/binary_wiarchive.hpp 2009-07-13 17:37:49 EDT (Mon, 13 Jul 2009)
@@ -23,6 +23,7 @@
 
 #include <istream> // wistream
 #include <boost/archive/binary_iarchive_impl.hpp>
+#include <boost/archive/detail/register_archive.hpp>
 
 namespace boost {
 namespace archive {

Modified: trunk/boost/archive/binary_woarchive.hpp
==============================================================================
--- trunk/boost/archive/binary_woarchive.hpp (original)
+++ trunk/boost/archive/binary_woarchive.hpp 2009-07-13 17:37:49 EDT (Mon, 13 Jul 2009)
@@ -23,6 +23,7 @@
 
 #include <ostream>
 #include <boost/archive/binary_oarchive_impl.hpp>
+#include <boost/archive/detail/register_archive.hpp>
 
 namespace boost {
 namespace archive {

Deleted: trunk/boost/archive/detail/archive_pointer_iserializer.hpp
==============================================================================
--- trunk/boost/archive/detail/archive_pointer_iserializer.hpp 2009-07-13 17:37:49 EDT (Mon, 13 Jul 2009)
+++ (empty file)
@@ -1,95 +0,0 @@
-#ifndef BOOST_ARCHIVE_ARCHIVE_POINTER_ISERIALIZER_POINTER_HPP
-#define BOOST_ARCHIVE_ARCHIVE_POINTER_ISERIALIZER_POINTER_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
-// archive_pointer_iserializer.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 <cassert>
-#include <cstddef> // NULL
-#include <boost/config.hpp>
-#include <boost/detail/workaround.hpp>
-
-#include <boost/archive/detail/basic_serializer.hpp>
-#include <boost/archive/detail/basic_pointer_iserializer.hpp>
-#include <boost/archive/detail/basic_serializer_map.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_iarchive;
-
-template<class Archive>
-class archive_pointer_iserializer :
- public basic_pointer_iserializer {
- static basic_serializer_map m_map;
-protected:
- explicit BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
- archive_pointer_iserializer(
- const boost::serialization::extended_type_info & eti
- );
- BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
- // account for bogus gcc warning
- #if defined(__GNUC__)
- virtual
- #endif
- ~archive_pointer_iserializer();
-public:
- virtual const basic_iserializer & get_basic_serializer() const
- // mscvc 6.0 requires template functions to be implemented. For this
- // reason we can't make abstract.
- #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) || defined(__MWERKS__)
- {
- assert(false);
- return *static_cast<const basic_iserializer *>(NULL);
- }
- #else
- = 0;
- #endif
- virtual void load_object_ptr(
- basic_iarchive & ar,
- void * & x,
- const unsigned int file_version
- ) const
- #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) || defined(__MWERKS__)
- {
- assert(false);
- }
- #else
- = 0;
- #endif
- // return the type_extended load pointer corresponding to a given
- // type_info. returns NULL if there is no such instance. This
- // would indicate that the no object of the specified type was loaded
- // any where in the code.
- static BOOST_ARCHIVE_OR_WARCHIVE_DECL(const basic_pointer_iserializer *)
- find(
- const boost::serialization::extended_type_info & eti
- );
-};
-
-} // namespace detail
-} // namespace archive
-} // namespace boost
-
-#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
-
-#endif // BOOST_ARCHIVE_ARCHIVE_POINTER_ISERIALIZER_POINTER_HPP

Deleted: trunk/boost/archive/detail/archive_pointer_oserializer.hpp
==============================================================================
--- trunk/boost/archive/detail/archive_pointer_oserializer.hpp 2009-07-13 17:37:49 EDT (Mon, 13 Jul 2009)
+++ (empty file)
@@ -1,68 +0,0 @@
-#ifndef BOOST_ARCHIVE_ARCHIVE_POINTER_OSERIALIZER_POINTER_HPP
-#define BOOST_ARCHIVE_ARCHIVE_POINTER_OSERIALIZER_POINTER_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
-// archive_pointer_oserializer.hpp: extenstion of type_info required for
-// serialization.
-
-// (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 <boost/config.hpp>
-#include <boost/archive/detail/basic_serializer.hpp>
-#include <boost/archive/detail/basic_pointer_oserializer.hpp>
-#include <boost/archive/detail/basic_serializer_map.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 {
-
-template<class Archive>
-class archive_pointer_oserializer :
- public basic_pointer_oserializer {
- static basic_serializer_map m_map;
-protected:
- explicit BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
- archive_pointer_oserializer(
- const boost::serialization::extended_type_info & eti
- );
- BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
- // account for bogus gcc warning
- #if defined(__GNUC__)
- virtual
- #endif
- ~archive_pointer_oserializer();
-public:
- // return the type_extended save pointer corresponding to a give
- // type_info. returns NULL, if there is no such instance. This
- // would indicate that the no object of the specified type was saved
- // any where in the code.
- static BOOST_ARCHIVE_OR_WARCHIVE_DECL(const basic_pointer_oserializer *)
- find(
- const boost::serialization::extended_type_info & eti
- );
-};
-
-} // namespace detail
-} // namespace archive
-} // namespace boost
-
-#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
-
-#endif // BOOST_ARCHIVE_ARCHIVE_POINTER_OSERIALIZER_POINTER_HPP

Added: trunk/boost/archive/detail/archive_serializer_map.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/archive/detail/archive_serializer_map.hpp 2009-07-13 17:37:49 EDT (Mon, 13 Jul 2009)
@@ -0,0 +1,46 @@
+#ifndef BOOST_ARCHIVE_SERIALIZER_MAP_HPP
+#define BOOST_ARCHIVE_SERIALIZER_MAP_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
+// archive_pointer_oserializer.hpp: extenstion of type_info required for
+// serialization.
+
+// (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.
+
+// note: this is nothing more than the thinest of wrappers around
+// basic_serializer_map so we can have a one map / archive type.
+
+#include <boost/config.hpp>
+#include <boost/archive/detail/basic_serializer_map.hpp>
+
+namespace boost {
+
+namespace serialization {
+ class extended_type_info;
+} // namespace serialization
+
+namespace archive {
+namespace detail {
+
+class basic_serializer;
+
+template<class Archive>
+class archive_serializer_map :
+ public basic_serializer_map
+{};
+
+} // namespace detail
+} // namespace archive
+} // namespace boost
+
+#endif //BOOST_ARCHIVE_SERIALIZER_MAP_HPP

Modified: trunk/boost/archive/detail/basic_iarchive.hpp
==============================================================================
--- trunk/boost/archive/detail/basic_iarchive.hpp (original)
+++ trunk/boost/archive/detail/basic_iarchive.hpp 2009-07-13 17:37:49 EDT (Mon, 13 Jul 2009)
@@ -53,6 +53,9 @@
     virtual void vload(class_id_optional_type &t) = 0;
     virtual void vload(class_name_type &t) = 0;
     virtual void vload(tracking_type &t) = 0;
+
+ virtual const basic_pointer_iserializer *
+ find(const boost::serialization::extended_type_info & eti) const = 0;
 protected:
     basic_iarchive(unsigned int flags);
     // account for bogus gcc warning
@@ -64,21 +67,16 @@
     // note: NOT part of the public API.
     void next_object_pointer(void *t);
     void register_basic_serializer(
- const /* BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) */ basic_iserializer & bis
+ const basic_iserializer & bis
     );
     void load_object(
         void *t,
- const /* BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) */ basic_iserializer & bis
+ const basic_iserializer & bis
     );
- const /* BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) */ basic_pointer_iserializer *
+ const basic_pointer_iserializer *
     load_pointer(
         void * & t,
- 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
- )
+ const basic_pointer_iserializer * bpis_ptr
     );
     // real public API starts here
     void

Modified: trunk/boost/archive/detail/basic_serializer_map.hpp
==============================================================================
--- trunk/boost/archive/detail/basic_serializer_map.hpp (original)
+++ trunk/boost/archive/detail/basic_serializer_map.hpp 2009-07-13 17:37:49 EDT (Mon, 13 Jul 2009)
@@ -1,5 +1,5 @@
-#ifndef BOOST_TYPEINFO_EXTENDED_MAP_HPP
-#define BOOST_TYPEINFO_EXTENDED_MAP_HPP
+#ifndef BOOST_SERIALIZER_MAP_HPP
+#define BOOST_SERIALIZER_MAP_HPP
 
 // MS compatible compilers support #pragma once
 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
@@ -30,30 +30,36 @@
 }
 
 namespace archive {
-namespace detail {
+namespace detail {
 
 class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_serializer;
 
-bool operator<(const basic_serializer & lhs, const basic_serializer & rhs);
-
-struct BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) type_info_pointer_compare
+class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_serializer_map : public
+ boost::noncopyable
 {
- bool operator()(
- const basic_serializer * lhs, const basic_serializer * rhs
- ) const {
- return *lhs < *rhs;
- }
+ struct type_info_pointer_compare
+ {
+ bool operator()(
+ const basic_serializer * lhs, const basic_serializer * rhs
+ ) const ;
+ };
+ typedef std::set<const basic_serializer *, type_info_pointer_compare> map_type;
+ map_type m_map;
+public:
+ bool insert(const basic_serializer * bs);
+ const basic_serializer * find(
+ const boost::serialization::extended_type_info & type_
+ ) const;
+ void erase(basic_serializer * bs);
+private:
+ // cw 8.3 requires this
+ basic_serializer_map& operator=(basic_serializer_map const&);
 };
 
-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
 
 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
 
-#endif // BOOST_TYPEINFO_EXTENDED_MAP_HPP
+#endif // BOOST_SERIALIZER_MAP_HPP

Modified: trunk/boost/archive/detail/common_iarchive.hpp
==============================================================================
--- trunk/boost/archive/detail/common_iarchive.hpp (original)
+++ trunk/boost/archive/detail/common_iarchive.hpp 2009-07-13 17:37:49 EDT (Mon, 13 Jul 2009)
@@ -17,15 +17,17 @@
 // See http://www.boost.org for updates, documentation, and revision history.
 
 #include <boost/archive/detail/basic_iarchive.hpp>
+#include <boost/archive/detail/basic_pointer_iserializer.hpp>
 #include <boost/archive/detail/interface_iarchive.hpp>
-#include <boost/archive/detail/iserializer.hpp>
-#include <boost/archive/detail/register_archive.hpp>
-#include <boost/serialization/pfto.hpp>
+#include <boost/archive/detail/archive_serializer_map.hpp>
+#include <boost/serialization/singleton.hpp>
 
 namespace boost {
 namespace archive {
 namespace detail {
 
+class extended_type_info;
+
 // note: referred to as Curiously Recurring Template Patter (CRTP)
 template<class Archive>
 class common_iarchive :
@@ -67,6 +69,15 @@
         basic_iarchive(flags),
         interface_iarchive<Archive>()
     {}
+public:
+ virtual const basic_pointer_iserializer *
+ find(const boost::serialization::extended_type_info & eti) const {
+ return static_cast<const basic_pointer_iserializer *>(
+ boost::serialization::singleton<
+ archive_serializer_map<Archive>
+ >::get_const_instance().find(eti)
+ );
+ }
 };
 
 } // namespace detail

Modified: trunk/boost/archive/detail/common_oarchive.hpp
==============================================================================
--- trunk/boost/archive/detail/common_oarchive.hpp (original)
+++ trunk/boost/archive/detail/common_oarchive.hpp 2009-07-13 17:37:49 EDT (Mon, 13 Jul 2009)
@@ -18,8 +18,6 @@
 
 #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 {

Modified: trunk/boost/archive/detail/iserializer.hpp
==============================================================================
--- trunk/boost/archive/detail/iserializer.hpp (original)
+++ trunk/boost/archive/detail/iserializer.hpp 2009-07-13 17:37:49 EDT (Mon, 13 Jul 2009)
@@ -71,13 +71,14 @@
 #include <boost/mpl/not.hpp>
 #include <boost/mpl/bool.hpp>
 
- #ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO
- #include <boost/serialization/extended_type_info_typeid.hpp>
- #endif
+#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO
+ #include <boost/serialization/extended_type_info_typeid.hpp>
+#endif
 // the following is need only for dynamic cast of polymorphic pointers
 #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/basic_pointer_iserializer.hpp>
+#include <boost/archive/detail/archive_serializer_map.hpp>
 #include <boost/archive/archive_exception.hpp>
 
 #include <boost/serialization/serialization.hpp>
@@ -174,8 +175,8 @@
 }
 
 template<class Archive, class T>
-class pointer_iserializer
- : public archive_pointer_iserializer<Archive>
+class pointer_iserializer :
+ public basic_pointer_iserializer
 {
 private:
     virtual const basic_iserializer & get_basic_serializer() const {
@@ -191,6 +192,7 @@
 protected:
     // this should alway be a singleton so make the constructor protected
     pointer_iserializer();
+ ~pointer_iserializer();
 };
 
 // note trick to be sure that operator new is using class specific
@@ -261,6 +263,8 @@
     T* m_p;
 };
 
+// note: BOOST_DLLEXPORT is so that code for polymorphic class
+// serialized only through base class won't get optimized out
 template<class Archive, class T>
 BOOST_DLLEXPORT void pointer_iserializer<Archive, T>::load_object_ptr(
     basic_iarchive & ar,
@@ -303,7 +307,7 @@
 
 template<class Archive, class T>
 pointer_iserializer<Archive, T>::pointer_iserializer() :
- archive_pointer_iserializer<Archive>(
+ basic_pointer_iserializer(
         boost::serialization::type_info_implementation<T>::type
             ::get_const_instance()
     )
@@ -311,6 +315,20 @@
     boost::serialization::singleton<
         iserializer<Archive, T>
>::get_mutable_instance().set_bpis(this);
+ boost::serialization::singleton<
+ archive_serializer_map<Archive>
+ >::get_mutable_instance().insert(this);
+}
+
+template<class Archive, class T>
+pointer_iserializer<Archive, T>::~pointer_iserializer(){
+ if(boost::serialization::singleton<
+ archive_serializer_map<Archive>
+ >::is_destroyed())
+ return;
+ boost::serialization::singleton<
+ archive_serializer_map<Archive>
+ >::get_mutable_instance().erase(this);
 }
 
 template<class Archive, class T>
@@ -464,8 +482,7 @@
         const basic_pointer_iserializer * bpis_ptr = register_type(ar, *t);
         const basic_pointer_iserializer * newbpis_ptr = ar.load_pointer(
             * reinterpret_cast<void **>(&t),
- bpis_ptr,
- archive_pointer_iserializer<Archive>::find
+ bpis_ptr
         );
         // if the pointer isn't that of the base class
         if(newbpis_ptr != bpis_ptr){

Modified: trunk/boost/archive/detail/oserializer.hpp
==============================================================================
--- trunk/boost/archive/detail/oserializer.hpp (original)
+++ trunk/boost/archive/detail/oserializer.hpp 2009-07-13 17:37:49 EDT (Mon, 13 Jul 2009)
@@ -47,13 +47,16 @@
 #include <boost/mpl/identity.hpp>
 #include <boost/mpl/not.hpp>
 
- #ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO
- #include <boost/serialization/extended_type_info_typeid.hpp>
- #endif
+#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO
+ #include <boost/serialization/extended_type_info_typeid.hpp>
+#endif
+
 // the following is need only for dynamic cast of polymorphic pointers
 #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/basic_pointer_oserializer.hpp>
+#include <boost/archive/detail/archive_serializer_map.hpp>
+#include <boost/archive/archive_exception.hpp>
 
 #include <boost/serialization/serialization.hpp>
 #include <boost/serialization/version.hpp>
@@ -66,8 +69,6 @@
 #include <boost/serialization/collection_size_type.hpp>
 #include <boost/serialization/singleton.hpp>
 
-#include <boost/archive/archive_exception.hpp>
-
 namespace boost {
 
 namespace serialization {
@@ -144,28 +145,26 @@
 }
 
 template<class Archive, class T>
-class pointer_oserializer
- : public archive_pointer_oserializer<Archive>
+class pointer_oserializer :
+ public basic_pointer_oserializer
 {
- const basic_oserializer & get_basic_serializer() const;
 private:
+ const basic_oserializer &
+ get_basic_serializer() const {
+ 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;
 public:
- explicit BOOST_DLLEXPORT pointer_oserializer() BOOST_USED;
+ pointer_oserializer();
+ ~pointer_oserializer();
 };
 
 template<class Archive, class T>
-const basic_oserializer &
-pointer_oserializer<Archive, T>::get_basic_serializer() const {
- return boost::serialization::singleton<
- oserializer<Archive, T>
- >::get_const_instance();
-}
-
-template<class Archive, class T>
 BOOST_DLLEXPORT void pointer_oserializer<Archive, T>::save_object_ptr(
     basic_oarchive & ar,
     const void * x
@@ -186,8 +185,8 @@
 }
 
 template<class Archive, class T>
-BOOST_DLLEXPORT pointer_oserializer<Archive, T>::pointer_oserializer() :
- archive_pointer_oserializer<Archive>(
+pointer_oserializer<Archive, T>::pointer_oserializer() :
+ basic_pointer_oserializer(
         boost::serialization::type_info_implementation<T>::type
             ::get_const_instance()
     )
@@ -196,6 +195,20 @@
     boost::serialization::singleton<
         oserializer<Archive, T>
>::get_mutable_instance().set_bpos(this);
+ boost::serialization::singleton<
+ archive_serializer_map<Archive>
+ >::get_mutable_instance().insert(this);
+}
+
+template<class Archive, class T>
+pointer_oserializer<Archive, T>::~pointer_oserializer(){
+ if(boost::serialization::singleton<
+ archive_serializer_map<Archive>
+ >::is_destroyed())
+ return;
+ boost::serialization::singleton<
+ archive_serializer_map<Archive>
+ >::get_mutable_instance().erase(this);
 }
 
 template<class Archive, class T>
@@ -393,8 +406,12 @@
             // since true_type is valid, and this only gets made if the
             // pointer oserializer object has been created, this should never
             // fail
- const basic_pointer_oserializer * bpos
- = archive_pointer_oserializer<Archive>::find(* true_type);
+ const basic_pointer_oserializer * bpos
+ = static_cast<const basic_pointer_oserializer *>(
+ boost::serialization::singleton<
+ archive_serializer_map<Archive>
+ >::get_const_instance().find(*true_type)
+ );
             assert(NULL != bpos);
             if(NULL == bpos)
                 boost::serialization::throw_exception(

Modified: trunk/boost/archive/detail/polymorphic_iarchive_route.hpp
==============================================================================
--- trunk/boost/archive/detail/polymorphic_iarchive_route.hpp (original)
+++ trunk/boost/archive/detail/polymorphic_iarchive_route.hpp 2009-07-13 17:37:49 EDT (Mon, 13 Jul 2009)
@@ -60,12 +60,9 @@
     }
     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
- )
+ const basic_pointer_iserializer * bpis_ptr
     ){
- return ArchiveImplementation::load_pointer(t, bpis_ptr, finder);
+ return ArchiveImplementation::load_pointer(t, bpis_ptr);
     }
     virtual void set_library_version(unsigned int archive_library_version){
         ArchiveImplementation::set_library_version(archive_library_version);

Modified: trunk/boost/archive/impl/basic_text_iarchive.ipp
==============================================================================
--- trunk/boost/archive/impl/basic_text_iarchive.ipp (original)
+++ trunk/boost/archive/impl/basic_text_iarchive.ipp 2009-07-13 17:37:49 EDT (Mon, 13 Jul 2009)
@@ -8,7 +8,6 @@
 
 // See http://www.boost.org for updates, documentation, and revision history.
 #include <string>
-#include <cassert>
 #include <algorithm>
 #include <cstring>
 

Modified: trunk/boost/archive/polymorphic_iarchive.hpp
==============================================================================
--- trunk/boost/archive/polymorphic_iarchive.hpp (original)
+++ trunk/boost/archive/polymorphic_iarchive.hpp 2009-07-13 17:37:49 EDT (Mon, 13 Jul 2009)
@@ -159,10 +159,7 @@
     ) = 0;
     virtual const detail::basic_pointer_iserializer * load_pointer(
         void * & t,
- const detail::basic_pointer_iserializer * bpis_ptr,
- const detail::basic_pointer_iserializer * (*finder)(
- const boost::serialization::extended_type_info & type
- )
+ const detail::basic_pointer_iserializer * bpis_ptr
     ) = 0;
 };
 

Modified: trunk/boost/archive/text_iarchive.hpp
==============================================================================
--- trunk/boost/archive/text_iarchive.hpp (original)
+++ trunk/boost/archive/text_iarchive.hpp 2009-07-13 17:37:49 EDT (Mon, 13 Jul 2009)
@@ -18,10 +18,11 @@
 
 #include <istream>
 
+#include <boost/config.hpp>
 #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/register_archive.hpp>
 
 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
 

Modified: trunk/boost/archive/text_oarchive.hpp
==============================================================================
--- trunk/boost/archive/text_oarchive.hpp (original)
+++ trunk/boost/archive/text_oarchive.hpp 2009-07-13 17:37:49 EDT (Mon, 13 Jul 2009)
@@ -29,6 +29,7 @@
 #include <boost/archive/detail/auto_link_archive.hpp>
 #include <boost/archive/basic_text_oprimitive.hpp>
 #include <boost/archive/basic_text_oarchive.hpp>
+#include <boost/archive/detail/register_archive.hpp>
 
 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
 

Modified: trunk/boost/archive/text_wiarchive.hpp
==============================================================================
--- trunk/boost/archive/text_wiarchive.hpp (original)
+++ trunk/boost/archive/text_wiarchive.hpp 2009-07-13 17:37:49 EDT (Mon, 13 Jul 2009)
@@ -26,6 +26,7 @@
 #include <boost/archive/detail/auto_link_warchive.hpp>
 #include <boost/archive/basic_text_iprimitive.hpp>
 #include <boost/archive/basic_text_iarchive.hpp>
+#include <boost/archive/detail/register_archive.hpp>
 
 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
 

Modified: trunk/boost/archive/text_woarchive.hpp
==============================================================================
--- trunk/boost/archive/text_woarchive.hpp (original)
+++ trunk/boost/archive/text_woarchive.hpp 2009-07-13 17:37:49 EDT (Mon, 13 Jul 2009)
@@ -34,6 +34,7 @@
 #include <boost/archive/detail/auto_link_warchive.hpp>
 #include <boost/archive/basic_text_oprimitive.hpp>
 #include <boost/archive/basic_text_oarchive.hpp>
+#include <boost/archive/detail/register_archive.hpp>
 
 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
 

Modified: trunk/boost/archive/xml_iarchive.hpp
==============================================================================
--- trunk/boost/archive/xml_iarchive.hpp (original)
+++ trunk/boost/archive/xml_iarchive.hpp 2009-07-13 17:37:49 EDT (Mon, 13 Jul 2009)
@@ -22,6 +22,7 @@
 #include <boost/archive/detail/auto_link_archive.hpp>
 #include <boost/archive/basic_text_iprimitive.hpp>
 #include <boost/archive/basic_xml_iarchive.hpp>
+#include <boost/archive/detail/register_archive.hpp>
 
 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
 

Modified: trunk/boost/archive/xml_oarchive.hpp
==============================================================================
--- trunk/boost/archive/xml_oarchive.hpp (original)
+++ trunk/boost/archive/xml_oarchive.hpp 2009-07-13 17:37:49 EDT (Mon, 13 Jul 2009)
@@ -29,6 +29,7 @@
 #include <boost/archive/detail/auto_link_archive.hpp>
 #include <boost/archive/basic_text_oprimitive.hpp>
 #include <boost/archive/basic_xml_oarchive.hpp>
+#include <boost/archive/detail/register_archive.hpp>
 
 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
 

Modified: trunk/boost/archive/xml_wiarchive.hpp
==============================================================================
--- trunk/boost/archive/xml_wiarchive.hpp (original)
+++ trunk/boost/archive/xml_wiarchive.hpp 2009-07-13 17:37:49 EDT (Mon, 13 Jul 2009)
@@ -27,6 +27,7 @@
 #include <boost/archive/detail/auto_link_warchive.hpp>
 #include <boost/archive/basic_text_iprimitive.hpp>
 #include <boost/archive/basic_xml_iarchive.hpp>
+#include <boost/archive/detail/register_archive.hpp>
 
 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
 

Modified: trunk/boost/archive/xml_woarchive.hpp
==============================================================================
--- trunk/boost/archive/xml_woarchive.hpp (original)
+++ trunk/boost/archive/xml_woarchive.hpp 2009-07-13 17:37:49 EDT (Mon, 13 Jul 2009)
@@ -33,6 +33,7 @@
 #include <boost/archive/detail/auto_link_warchive.hpp>
 #include <boost/archive/basic_text_oprimitive.hpp>
 #include <boost/archive/basic_xml_oarchive.hpp>
+#include <boost/archive/detail/register_archive.hpp>
 
 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
 


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