|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r58391 - branches/release/boost/serialization
From: ramey_at_[hidden]
Date: 2009-12-14 18:53:17
Author: ramey
Date: 2009-12-14 18:53:16 EST (Mon, 14 Dec 2009)
New Revision: 58391
URL: http://svn.boost.org/trac/boost/changeset/58391
Log:
Merge from trunk to release
Properties modified:
branches/release/boost/serialization/ (props changed)
Text files modified:
branches/release/boost/serialization/collections_load_imp.hpp | 84 +++++++++++----------------------------
branches/release/boost/serialization/extended_type_info.hpp | 9 ---
branches/release/boost/serialization/extended_type_info_no_rtti.hpp | 8 +++
branches/release/boost/serialization/extended_type_info_typeid.hpp | 17 +++----
branches/release/boost/serialization/hash_collections_load_imp.hpp | 2
branches/release/boost/serialization/hash_map.hpp | 60 +++++++++++++++++++++++++++
branches/release/boost/serialization/hash_set.hpp | 47 +++++++++++++++++++++
branches/release/boost/serialization/map.hpp | 2
branches/release/boost/serialization/set.hpp | 2
branches/release/boost/serialization/weak_ptr.hpp | 4
10 files changed, 149 insertions(+), 86 deletions(-)
Modified: branches/release/boost/serialization/collections_load_imp.hpp
==============================================================================
--- branches/release/boost/serialization/collections_load_imp.hpp (original)
+++ branches/release/boost/serialization/collections_load_imp.hpp 2009-12-14 18:53:16 EST (Mon, 14 Dec 2009)
@@ -50,10 +50,12 @@
template<class Archive, class Container>
struct archive_input_seq
{
- inline void operator()(
+ inline BOOST_DEDUCED_TYPENAME Container::iterator
+ operator()(
Archive &ar,
Container &s,
- const unsigned int v
+ const unsigned int v,
+ BOOST_DEDUCED_TYPENAME Container::iterator hint
){
typedef BOOST_DEDUCED_TYPENAME Container::value_type type;
detail::stack_construct<Archive, type> t(ar, v);
@@ -61,6 +63,7 @@
ar >> boost::serialization::make_nvp("item", t.reference());
s.push_back(t.reference());
ar.reset_object_address(& s.back() , & t.reference());
+ return hint;
}
};
@@ -68,51 +71,27 @@
template<class Archive, class Container>
struct archive_input_map
{
- inline void operator()(
+ inline BOOST_DEDUCED_TYPENAME Container::iterator
+ operator()(
Archive &ar,
Container &s,
- const unsigned int v
+ const unsigned int v,
+ BOOST_DEDUCED_TYPENAME Container::iterator hint
){
typedef BOOST_DEDUCED_TYPENAME Container::value_type type;
detail::stack_construct<Archive, type> t(ar, v);
// borland fails silently w/o full namespace
ar >> boost::serialization::make_nvp("item", t.reference());
- std::pair<BOOST_DEDUCED_TYPENAME Container::const_iterator, bool> result =
- s.insert(t.reference());
- // note: the following presumes that the map::value_type was NOT tracked
- // in the archive. This is the usual case, but here there is no way
- // to determine that.
- if(result.second){
- ar.reset_object_address(
- & (result.first->second),
- & t.reference().second
- );
- }
- }
-};
-
-// multimap input
-template<class Archive, class Container>
-struct archive_input_multimap
-{
- inline void operator()(
- Archive &ar,
- Container &s,
- const unsigned int v
- ){
- typedef BOOST_DEDUCED_TYPENAME Container::value_type type;
- detail::stack_construct<Archive, type> t(ar, v);
- // borland fails silently w/o full namespace
- ar >> boost::serialization::make_nvp("item", t.reference());
- BOOST_DEDUCED_TYPENAME Container::const_iterator result
- = s.insert(t.reference());
+ BOOST_DEDUCED_TYPENAME Container::iterator result =
+ s.insert(hint, t.reference());
// note: the following presumes that the map::value_type was NOT tracked
// in the archive. This is the usual case, but here there is no way
// to determine that.
ar.reset_object_address(
- & result->second,
- & t.reference()
+ & (result->second),
+ & t.reference().second
);
+ return result;
}
};
@@ -120,38 +99,21 @@
template<class Archive, class Container>
struct archive_input_set
{
- inline void operator()(
- Archive &ar,
- Container &s,
- const unsigned int v
- ){
- typedef BOOST_DEDUCED_TYPENAME Container::value_type type;
- detail::stack_construct<Archive, type> t(ar, v);
- // borland fails silently w/o full namespace
- ar >> boost::serialization::make_nvp("item", t.reference());
- std::pair<BOOST_DEDUCED_TYPENAME Container::const_iterator, bool> result =
- s.insert(t.reference());
- if(result.second)
- ar.reset_object_address(& (* result.first), & t.reference());
- }
-};
-
-// multiset input
-template<class Archive, class Container>
-struct archive_input_multiset
-{
- inline void operator()(
+ inline BOOST_DEDUCED_TYPENAME Container::iterator
+ operator()(
Archive &ar,
Container &s,
- const unsigned int v
+ const unsigned int v,
+ BOOST_DEDUCED_TYPENAME Container::iterator hint
){
typedef BOOST_DEDUCED_TYPENAME Container::value_type type;
detail::stack_construct<Archive, type> t(ar, v);
// borland fails silently w/o full namespace
ar >> boost::serialization::make_nvp("item", t.reference());
- BOOST_DEDUCED_TYPENAME Container::const_iterator result
- = s.insert(t.reference());
+ BOOST_DEDUCED_TYPENAME Container::iterator result =
+ s.insert(hint, t.reference());
ar.reset_object_address(& (* result), & t.reference());
+ return result;
}
};
@@ -187,8 +149,10 @@
rx(s, count);
std::size_t c = count;
InputFunction ifunc;
+ BOOST_DEDUCED_TYPENAME Container::iterator hint;
+ hint = s.begin();
while(c-- > 0){
- ifunc(ar, s, item_version);
+ hint = ifunc(ar, s, item_version, hint);
}
}
Modified: branches/release/boost/serialization/extended_type_info.hpp
==============================================================================
--- branches/release/boost/serialization/extended_type_info.hpp (original)
+++ branches/release/boost/serialization/extended_type_info.hpp 2009-12-14 18:53:16 EST (Mon, 14 Dec 2009)
@@ -82,13 +82,8 @@
}
static const extended_type_info * find(const char *key);
// for plugins
- virtual void * construct(unsigned int /*count*/ = 0, ...) const {
- assert(false); // must be implemented if used
- return NULL;
- };
- virtual void destroy(void const * const /*p*/) const {
- assert(false); // must be implemented if used
- }
+ virtual void * construct(unsigned int /*count*/ = 0, ...) const = 0;
+ virtual void destroy(void const * const /*p*/) const = 0;
};
template<class T>
Modified: branches/release/boost/serialization/extended_type_info_no_rtti.hpp
==============================================================================
--- branches/release/boost/serialization/extended_type_info_no_rtti.hpp (original)
+++ branches/release/boost/serialization/extended_type_info_no_rtti.hpp 2009-12-14 18:53:16 EST (Mon, 14 Dec 2009)
@@ -31,6 +31,9 @@
#include <boost/serialization/factory.hpp>
#include <boost/serialization/throw_exception.hpp>
+// hijack serialization access
+#include <boost/serialization/access.hpp>
+
#include <boost/config/abi_prefix.hpp> // must be the last header
#ifdef BOOST_MSVC
# pragma warning(push)
@@ -141,7 +144,10 @@
}
}
virtual void destroy(void const * const p) const{
- delete static_cast<T const *>(p) ;
+ boost::serialization::access::destroy(
+ static_cast<T const * const>(p)
+ );
+ //delete static_cast<T const * const>(p) ;
}
};
Modified: branches/release/boost/serialization/extended_type_info_typeid.hpp
==============================================================================
--- branches/release/boost/serialization/extended_type_info_typeid.hpp (original)
+++ branches/release/boost/serialization/extended_type_info_typeid.hpp 2009-12-14 18:53:16 EST (Mon, 14 Dec 2009)
@@ -32,6 +32,9 @@
#include <boost/serialization/extended_type_info.hpp>
#include <boost/serialization/factory.hpp>
+// hijack serialization access
+#include <boost/serialization/access.hpp>
+
#include <boost/mpl/if.hpp>
#include <boost/config/abi_prefix.hpp> // must be the last header
@@ -125,15 +128,11 @@
return NULL;
}
}
- virtual void destroy(void const * const /* p */) const {
- // the only current usage of extended type info is in the
- // serialization library. The statement below requires
- // that destructor of type T be public and this creates
- // a problem for some users. So, for now, comment this
- // out
- //delete static_cast<T const *>(p);
- // and trap any attempt to invoke this function
- assert(false);
+ virtual void destroy(void const * const p) const {
+ boost::serialization::access::destroy(
+ static_cast<T const * const>(p)
+ );
+ //delete static_cast<T const * const>(p);
}
};
Modified: branches/release/boost/serialization/hash_collections_load_imp.hpp
==============================================================================
--- branches/release/boost/serialization/hash_collections_load_imp.hpp (original)
+++ branches/release/boost/serialization/hash_collections_load_imp.hpp 2009-12-14 18:53:16 EST (Mon, 14 Dec 2009)
@@ -20,7 +20,7 @@
// helper function templates for serialization of hashed collections
#include <boost/config.hpp>
#include <boost/serialization/nvp.hpp>
-#include <boost/serialization/collections_load_imp.hpp>
+//#include <boost/serialization/collections_load_imp.hpp>
namespace boost{
namespace serialization {
Modified: branches/release/boost/serialization/hash_map.hpp
==============================================================================
--- branches/release/boost/serialization/hash_map.hpp (original)
+++ branches/release/boost/serialization/hash_map.hpp 2009-12-14 18:53:16 EST (Mon, 14 Dec 2009)
@@ -29,6 +29,62 @@
namespace boost {
namespace serialization {
+namespace stl {
+
+// map input
+template<class Archive, class Container>
+struct archive_input_hash_map
+{
+ inline void operator()(
+ Archive &ar,
+ Container &s,
+ const unsigned int v
+ ){
+ typedef BOOST_DEDUCED_TYPENAME Container::value_type type;
+ detail::stack_construct<Archive, type> t(ar, v);
+ // borland fails silently w/o full namespace
+ ar >> boost::serialization::make_nvp("item", t.reference());
+ std::pair<BOOST_DEDUCED_TYPENAME Container::const_iterator, bool> result =
+ s.insert(t.reference());
+ // note: the following presumes that the map::value_type was NOT tracked
+ // in the archive. This is the usual case, but here there is no way
+ // to determine that.
+ if(result.second){
+ ar.reset_object_address(
+ & (result.first->second),
+ & t.reference().second
+ );
+ }
+ }
+};
+
+// multimap input
+template<class Archive, class Container>
+struct archive_input_hash_multimap
+{
+ inline void operator()(
+ Archive &ar,
+ Container &s,
+ const unsigned int v
+ ){
+ typedef BOOST_DEDUCED_TYPENAME Container::value_type type;
+ detail::stack_construct<Archive, type> t(ar, v);
+ // borland fails silently w/o full namespace
+ ar >> boost::serialization::make_nvp("item", t.reference());
+ BOOST_DEDUCED_TYPENAME Container::const_iterator result
+ = s.insert(t.reference());
+ // note: the following presumes that the map::value_type was NOT tracked
+ // in the archive. This is the usual case, but here there is no way
+ // to determine that.
+ ar.reset_object_address(
+ & result->second,
+ & t.reference()
+ );
+ }
+};
+
+} // stl
+
template<
class Archive,
class Key,
@@ -70,7 +126,7 @@
BOOST_STD_EXTENSION_NAMESPACE::hash_map<
Key, HashFcn, EqualKey, Allocator
>,
- boost::serialization::stl::archive_input_map<
+ boost::serialization::stl::archive_input_hash_map<
Archive,
BOOST_STD_EXTENSION_NAMESPACE::hash_map<
Key, HashFcn, EqualKey, Allocator
@@ -140,7 +196,7 @@
BOOST_STD_EXTENSION_NAMESPACE::hash_multimap<
Key, HashFcn, EqualKey, Allocator
>,
- boost::serialization::stl::archive_input_multimap<
+ boost::serialization::stl::archive_input_hash_multimap<
Archive,
BOOST_STD_EXTENSION_NAMESPACE::hash_multimap<
Key, HashFcn, EqualKey, Allocator
Modified: branches/release/boost/serialization/hash_set.hpp
==============================================================================
--- branches/release/boost/serialization/hash_set.hpp (original)
+++ branches/release/boost/serialization/hash_set.hpp 2009-12-14 18:53:16 EST (Mon, 14 Dec 2009)
@@ -27,6 +27,49 @@
namespace boost {
namespace serialization {
+namespace stl {
+
+// hash_set input
+template<class Archive, class Container>
+struct archive_input_hash_set
+{
+ inline void operator()(
+ Archive &ar,
+ Container &s,
+ const unsigned int v
+ ){
+ typedef BOOST_DEDUCED_TYPENAME Container::value_type type;
+ detail::stack_construct<Archive, type> t(ar, v);
+ // borland fails silently w/o full namespace
+ ar >> boost::serialization::make_nvp("item", t.reference());
+ std::pair<BOOST_DEDUCED_TYPENAME Container::const_iterator, bool> result =
+ s.insert(t.reference());
+ if(result.second)
+ ar.reset_object_address(& (* result.first), & t.reference());
+ }
+};
+
+// hash_multiset input
+template<class Archive, class Container>
+struct archive_input_hash_multiset
+{
+ inline void operator()(
+ Archive &ar,
+ Container &s,
+ const unsigned int v
+ ){
+ typedef BOOST_DEDUCED_TYPENAME Container::value_type type;
+ detail::stack_construct<Archive, type> t(ar, v);
+ // borland fails silently w/o full namespace
+ ar >> boost::serialization::make_nvp("item", t.reference());
+ BOOST_DEDUCED_TYPENAME Container::const_iterator result
+ = s.insert(t.reference());
+ ar.reset_object_address(& (* result), & t.reference());
+ }
+};
+
+} // stl
+
template<
class Archive,
class Key,
@@ -68,7 +111,7 @@
BOOST_STD_EXTENSION_NAMESPACE::hash_set<
Key, HashFcn, EqualKey, Allocator
>,
- boost::serialization::stl::archive_input_set<
+ boost::serialization::stl::archive_input_hash_set<
Archive,
BOOST_STD_EXTENSION_NAMESPACE::hash_set<
Key, HashFcn, EqualKey, Allocator
@@ -138,7 +181,7 @@
BOOST_STD_EXTENSION_NAMESPACE::hash_multiset<
Key, HashFcn, EqualKey, Allocator
>,
- boost::serialization::stl::archive_input_multiset<
+ boost::serialization::stl::archive_input_hash_multiset<
Archive,
BOOST_STD_EXTENSION_NAMESPACE::hash_multiset<
Key, HashFcn, EqualKey, Allocator
Modified: branches/release/boost/serialization/map.hpp
==============================================================================
--- branches/release/boost/serialization/map.hpp (original)
+++ branches/release/boost/serialization/map.hpp 2009-12-14 18:53:16 EST (Mon, 14 Dec 2009)
@@ -92,7 +92,7 @@
boost::serialization::stl::load_collection<
Archive,
std::multimap<Key, Type, Compare, Allocator>,
- boost::serialization::stl::archive_input_multimap<
+ boost::serialization::stl::archive_input_map<
Archive, std::multimap<Key, Type, Compare, Allocator>
>,
boost::serialization::stl::no_reserve_imp<
Modified: branches/release/boost/serialization/set.hpp
==============================================================================
--- branches/release/boost/serialization/set.hpp (original)
+++ branches/release/boost/serialization/set.hpp 2009-12-14 18:53:16 EST (Mon, 14 Dec 2009)
@@ -89,7 +89,7 @@
boost::serialization::stl::load_collection<
Archive,
std::multiset<Key, Compare, Allocator>,
- boost::serialization::stl::archive_input_multiset<
+ boost::serialization::stl::archive_input_set<
Archive, std::multiset<Key, Compare, Allocator>
>,
boost::serialization::stl::no_reserve_imp<
Modified: branches/release/boost/serialization/weak_ptr.hpp
==============================================================================
--- branches/release/boost/serialization/weak_ptr.hpp (original)
+++ branches/release/boost/serialization/weak_ptr.hpp 2009-12-14 18:53:16 EST (Mon, 14 Dec 2009)
@@ -29,7 +29,7 @@
const unsigned int /* file_version */
){
const boost::shared_ptr<T> sp = t.lock();
- ar << boost::serialization::make_nvp("shared_ptr", sp);
+ ar << boost::serialization::make_nvp("weak_ptr", sp);
}
template<class Archive, class T>
@@ -39,7 +39,7 @@
const unsigned int /* file_version */
){
boost::shared_ptr<T> sp;
- ar >> boost::serialization::make_nvp("shared_ptr", sp);
+ ar >> boost::serialization::make_nvp("weak_ptr", sp);
t = sp;
}
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