$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r58390 - in branches/release/boost/archive: . detail
From: ramey_at_[hidden]
Date: 2009-12-14 18:52:52
Author: ramey
Date: 2009-12-14 18:52:51 EST (Mon, 14 Dec 2009)
New Revision: 58390
URL: http://svn.boost.org/trac/boost/changeset/58390
Log:
Merge from trunk to release
Properties modified: 
   branches/release/boost/archive/   (props changed)
Text files modified: 
   branches/release/boost/archive/basic_binary_iprimitive.hpp           |     5 +++                                     
   branches/release/boost/archive/basic_binary_oprimitive.hpp           |     2                                         
   branches/release/boost/archive/detail/basic_iarchive.hpp             |     9 ++++---                                 
   branches/release/boost/archive/detail/common_iarchive.hpp            |     7 ------                                  
   branches/release/boost/archive/detail/iserializer.hpp                |    10 ++++++++                                
   branches/release/boost/archive/detail/polymorphic_iarchive_route.hpp |     7 ++++-                                   
   branches/release/boost/archive/polymorphic_iarchive.hpp              |     5 +++                                     
   branches/release/boost/archive/shared_ptr_helper.hpp                 |    45 +++++++++++++++++++++++++++++---------- 
   8 files changed, 61 insertions(+), 29 deletions(-)
Modified: branches/release/boost/archive/basic_binary_iprimitive.hpp
==============================================================================
--- branches/release/boost/archive/basic_binary_iprimitive.hpp	(original)
+++ branches/release/boost/archive/basic_binary_iprimitive.hpp	2009-12-14 18:52:51 EST (Mon, 14 Dec 2009)
@@ -151,7 +151,10 @@
     std::size_t count
 ){
     // note: an optimizer should eliminate the following for char files
-    assert(count / sizeof(Elem) <= boost::integer_traits<std::streamsize>::const_max);
+    assert(
+        static_cast<std::streamsize>(count / sizeof(Elem)) 
+        <= boost::integer_traits<std::streamsize>::const_max
+    );
     std::streamsize s = static_cast<std::streamsize>(count / sizeof(Elem));
     std::streamsize scount = m_sb.sgetn(
         static_cast<Elem *>(address), 
Modified: branches/release/boost/archive/basic_binary_oprimitive.hpp
==============================================================================
--- branches/release/boost/archive/basic_binary_oprimitive.hpp	(original)
+++ branches/release/boost/archive/basic_binary_oprimitive.hpp	2009-12-14 18:52:51 EST (Mon, 14 Dec 2009)
@@ -160,7 +160,7 @@
     // figure number of elements to output - round up
     count = ( count + sizeof(Elem) - 1) 
         / sizeof(Elem);
-    assert(count <= boost::integer_traits<std::streamsize>::const_max);
+    assert(count <= std::size_t(boost::integer_traits<std::streamsize>::const_max));
     std::streamsize scount = m_sb.sputn(
         static_cast<const Elem *>(address), 
         static_cast<std::streamsize>(count)
Modified: branches/release/boost/archive/detail/basic_iarchive.hpp
==============================================================================
--- branches/release/boost/archive/detail/basic_iarchive.hpp	(original)
+++ branches/release/boost/archive/detail/basic_iarchive.hpp	2009-12-14 18:52:51 EST (Mon, 14 Dec 2009)
@@ -56,9 +56,6 @@
     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
@@ -79,7 +76,11 @@
     const basic_pointer_iserializer * 
     load_pointer(
         void * & t, 
-        const basic_pointer_iserializer * bpis_ptr
+        const basic_pointer_iserializer * bpis_ptr,
+        const basic_pointer_iserializer * (*finder)(
+            const boost::serialization::extended_type_info & eti
+        )
+
     );
     // real public API starts here
     void 
Modified: branches/release/boost/archive/detail/common_iarchive.hpp
==============================================================================
--- branches/release/boost/archive/detail/common_iarchive.hpp	(original)
+++ branches/release/boost/archive/detail/common_iarchive.hpp	2009-12-14 18:52:51 EST (Mon, 14 Dec 2009)
@@ -76,13 +76,6 @@
         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 *>(
-            archive_serializer_map<Archive>::find(eti)
-        );
-    }
 };
 
 } // namespace detail
Modified: branches/release/boost/archive/detail/iserializer.hpp
==============================================================================
--- branches/release/boost/archive/detail/iserializer.hpp	(original)
+++ branches/release/boost/archive/detail/iserializer.hpp	2009-12-14 18:52:51 EST (Mon, 14 Dec 2009)
@@ -494,13 +494,21 @@
         check_pointer_tracking<T>();
     }
 
+    static const basic_pointer_iserializer *
+        find(const boost::serialization::extended_type_info & type){
+        return static_cast<const basic_pointer_iserializer *>(
+            archive_serializer_map<Archive>::find(type)
+        );
+    }
+
     template<class Tptr>
     static void invoke(Archive & ar, Tptr & t){
         load(ar, *t);
         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
+            bpis_ptr,
+            find
         );
         // if the pointer isn't that of the base class
         if(newbpis_ptr != bpis_ptr){
Modified: branches/release/boost/archive/detail/polymorphic_iarchive_route.hpp
==============================================================================
--- branches/release/boost/archive/detail/polymorphic_iarchive_route.hpp	(original)
+++ branches/release/boost/archive/detail/polymorphic_iarchive_route.hpp	2009-12-14 18:52:51 EST (Mon, 14 Dec 2009)
@@ -63,9 +63,12 @@
     }
     virtual const basic_pointer_iserializer * load_pointer(
         void * & t,
-        const basic_pointer_iserializer * bpis_ptr
+        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);
+        return ArchiveImplementation::load_pointer(t, bpis_ptr, finder);
     }
     virtual void set_library_version(version_type archive_library_version){
         ArchiveImplementation::set_library_version(archive_library_version);
Modified: branches/release/boost/archive/polymorphic_iarchive.hpp
==============================================================================
--- branches/release/boost/archive/polymorphic_iarchive.hpp	(original)
+++ branches/release/boost/archive/polymorphic_iarchive.hpp	2009-12-14 18:52:51 EST (Mon, 14 Dec 2009)
@@ -159,7 +159,10 @@
     ) = 0;
     virtual const detail::basic_pointer_iserializer * load_pointer(
         void * & t,
-        const detail::basic_pointer_iserializer * bpis_ptr
+        const detail::basic_pointer_iserializer * bpis_ptr,
+        const detail::basic_pointer_iserializer * (*finder)(
+            const boost::serialization::extended_type_info & type
+        )
     ) = 0;
 };
 
Modified: branches/release/boost/archive/shared_ptr_helper.hpp
==============================================================================
--- branches/release/boost/archive/shared_ptr_helper.hpp	(original)
+++ branches/release/boost/archive/shared_ptr_helper.hpp	2009-12-14 18:52:51 EST (Mon, 14 Dec 2009)
@@ -16,7 +16,7 @@
 
 //  See http://www.boost.org for updates, documentation, and revision history.
 
-#include <map>
+#include <set>
 #include <list>
 #include <utility>
 #include <cstddef> // NULL
@@ -55,9 +55,17 @@
 // a common class for holding various types of shared pointers
 
 class shared_ptr_helper {
-    typedef std::map<
-        void *,
-        boost::shared_ptr<const void>
+    struct collection_type_compare {
+        bool operator()(
+            const shared_ptr<const void> &lhs,
+            const shared_ptr<const void> &rhs
+        )const{
+            return lhs.get() < rhs.get();
+        }
+    };
+    typedef std::set<
+        boost::shared_ptr<const void>,
+        collection_type_compare
     > collection_type;
     typedef collection_type::const_iterator iterator_type;
     // list of shared_pointers create accessable by raw pointer. This
@@ -71,6 +79,16 @@
         void operator()(void const *) const {}
     };
 
+    struct void_deleter {
+        const boost::serialization::extended_type_info * m_eti;
+        void_deleter(const boost::serialization::extended_type_info *eti) :
+            m_eti(eti)
+        {}
+        void operator()(void *vp) const {
+            m_eti->destroy(vp);
+        }
+    };
+
 #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
 public:
 #else
@@ -94,13 +112,11 @@
     std::list<boost_132::shared_ptr<void> > * m_pointers_132;
 //  #endif
 
-    typedef std::pair<const iterator_type, void *> result_type;
-
     // returns pointer to object and an indicator whether this is a
     // new entry (true) or a previous one (false)
-    BOOST_ARCHIVE_DECL(result_type) 
+    BOOST_ARCHIVE_DECL(shared_ptr<void>) 
     get_od(
-        void * od,
+        const void * od,
         const boost::serialization::extended_type_info * true_type, 
         const boost::serialization::extended_type_info * this_type
     );
@@ -156,16 +172,21 @@
                     this_type->get_debug_info()
                 )
             );
-        result_type r =
+        shared_ptr<void> r =
             get_od(
-                static_cast<void *>(t), 
+                static_cast<const void *>(t), 
                 true_type,
                 this_type
             );
+
         s = shared_ptr<T>(
-            r.first->second,
-            static_cast<T *>(r.second)
+            r,
+            static_cast<T *>(r.get())
         );
+
+        //s = static_pointer_cast<T,void>(
+        //    const_pointer_cast<void, const void>(*r)
+        //);
     }
 
 //  #ifdef BOOST_SERIALIZATION_SHARED_PTR_132_HPP