Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59525 - in branches/release: boost boost/multi_index/detail libs/multi_index/doc libs/multi_index/test
From: joaquin_at_[hidden]
Date: 2010-02-06 09:38:29


Author: joaquin
Date: 2010-02-06 09:38:28 EST (Sat, 06 Feb 2010)
New Revision: 59525
URL: http://svn.boost.org/trac/boost/changeset/59525

Log:
merged [58485] and [59443] from trunk
Added:
   branches/release/boost/multi_index/detail/serialization_version.hpp
      - copied unchanged from r59524, /trunk/boost/multi_index/detail/serialization_version.hpp
Text files modified:
   branches/release/boost/multi_index_container.hpp | 32 ++++++++++++----
   branches/release/libs/multi_index/doc/release_notes.html | 30 ++++++++++++++-
   branches/release/libs/multi_index/test/test_serialization3.cpp | 75 +++++++++++++++++++++++++++++++++++++++
   3 files changed, 125 insertions(+), 12 deletions(-)

Modified: branches/release/boost/multi_index_container.hpp
==============================================================================
--- branches/release/boost/multi_index_container.hpp (original)
+++ branches/release/boost/multi_index_container.hpp 2010-02-06 09:38:28 EST (Sat, 06 Feb 2010)
@@ -1,6 +1,6 @@
 /* Multiply indexed container.
  *
- * Copyright 2003-2009 Joaquin M Lopez Munoz.
+ * Copyright 2003-2010 Joaquin M Lopez Munoz.
  * 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)
@@ -44,6 +44,7 @@
 
 #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
 #include <boost/multi_index/detail/archive_constructed.hpp>
+#include <boost/multi_index/detail/serialization_version.hpp>
 #include <boost/serialization/collection_size_type.hpp>
 #include <boost/serialization/nvp.hpp>
 #include <boost/serialization/split_member.hpp>
@@ -634,16 +635,20 @@
   {
 
 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
- const serialization::collection_size_type s(size_());
+ const serialization::collection_size_type s(size_());
+ const detail::serialization_version<value_type> value_version;
     ar<<serialization::make_nvp("count",s);
+ ar<<serialization::make_nvp("value_version",value_version);
 #else
- const std::size_t s=size_();
+ const std::size_t s=size_();
+ const unsigned int value_version=0;
     ar<<serialization::make_nvp("count",s);
 #endif
 
     index_saver_type sm(bfm_allocator::member,s);
 
     for(iterator it=super::begin(),it_end=super::end();it!=it_end;++it){
+ serialization::save_construct_data_adl(ar,&*it,value_version);
       ar<<serialization::make_nvp("item",*it);
       sm.add(it.get_node(),ar,version);
     }
@@ -660,7 +665,8 @@
     clear_();
 
 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
- serialization::collection_size_type s;
+ serialization::collection_size_type s;
+ detail::serialization_version<value_type> value_version;
     if(version<1){
       std::size_t sz;
       ar>>serialization::make_nvp("count",sz);
@@ -669,15 +675,22 @@
     else{
       ar>>serialization::make_nvp("count",s);
     }
+ if(version<2){
+ value_version=0;
+ }
+ else{
+ ar>>serialization::make_nvp("value_version",value_version);
+ }
 #else
- std::size_t s;
+ std::size_t s;
+ unsigned int value_version=0;
     ar>>serialization::make_nvp("count",s);
 #endif
 
     index_loader_type lm(bfm_allocator::member,s);
 
     for(std::size_t n=0;n<s;++n){
- detail::archive_constructed<Value> value("item",ar,version);
+ detail::archive_constructed<Value> value("item",ar,value_version);
       std::pair<node_type*,bool> p=insert_(
         value.get(),super::end().get_node());
       if(!p.second)throw_exception(
@@ -1100,8 +1113,9 @@
 
 #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)&&\
     !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
-/* Serialization class version bump as we now serialize the size
- * through boost::serialization::collection_size_type.
+/* class version = 1 : we now serialize the size through
+ * boost::serialization::collection_size_type.
+ * class version = 2 : proper use of {save|load}_construct_data.
  */
 
 namespace serialization {
@@ -1110,7 +1124,7 @@
   boost::multi_index_container<Value,IndexSpecifierList,Allocator>
>
 {
- BOOST_STATIC_CONSTANT(unsigned int,value=1);
+ BOOST_STATIC_CONSTANT(unsigned int,value=2);
 };
 } /* namespace serialization */
 #endif

Modified: branches/release/libs/multi_index/doc/release_notes.html
==============================================================================
--- branches/release/libs/multi_index/doc/release_notes.html (original)
+++ branches/release/libs/multi_index/doc/release_notes.html 2010-02-06 09:38:28 EST (Sat, 06 Feb 2010)
@@ -31,6 +31,8 @@
 <h2>Contents</h2>
 
 <ul>
+ <li>Boost 1.43 release</li>
+ <li>Boost 1.42 release</li>
   <li>Boost 1.41 release</li>
   <li>Boost 1.38 release</li>
   <li>Boost 1.37 release</li>
@@ -41,6 +43,30 @@
   <li>Boost 1.33 release</li>
 </ul>
 
+<h2><a name="boost_1_43">Boost 1.43 release</a></h2>
+
+<p>
+<ul>
+ <li>
+ <a href="../../serialization/doc/serialization.html#constructors">Serialization
+ of non default constructible values</a> is now properly supported
+ through user-provided facilities <code>save_construct_data</code> and
+ <code>load_construct_data</code>.
+ <code>multi_index_container</code> serialization
+ class version has been
+ bumped from 1 to 2.
+ </li>
+</ul>
+</p>
+
+<h2><a name="boost_1_42">Boost 1.42 release</a></h2>
+
+<p>
+<ul>
+ <li>Maintenance fixes.</li>
+</ul>
+</p>
+
 <h2><a name="boost_1_41">Boost 1.41 release</a></h2>
 <p>
 <ul>
@@ -282,9 +308,9 @@
 
 <br>
 
-<p>Revised September 22nd 2009</p>
+<p>Revised February 3rd 2010</p>
 
-<p>&copy; Copyright 2003-2009 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
+<p>&copy; Copyright 2003-2010 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
 Distributed under the Boost Software
 License, Version 1.0. (See accompanying file <a href="../../../LICENSE_1_0.txt">
 LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">

Modified: branches/release/libs/multi_index/test/test_serialization3.cpp
==============================================================================
--- branches/release/libs/multi_index/test/test_serialization3.cpp (original)
+++ branches/release/libs/multi_index/test/test_serialization3.cpp 2010-02-06 09:38:28 EST (Sat, 06 Feb 2010)
@@ -1,6 +1,6 @@
 /* Boost.MultiIndex test for serialization, part 3.
  *
- * Copyright 2003-2008 Joaquin M Lopez Munoz.
+ * Copyright 2003-2010 Joaquin M Lopez Munoz.
  * 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)
@@ -13,9 +13,67 @@
 
 #include <boost/multi_index/hashed_index.hpp>
 #include <boost/multi_index/sequenced_index.hpp>
+#include <boost/multi_index/ordered_index.hpp>
 #include <boost/multi_index/key_extractors.hpp>
 #include "non_std_allocator.hpp"
 
+struct non_default_ctble
+{
+ non_default_ctble(int n_):n(n_){}
+
+ bool operator==(const non_default_ctble& x)const{return n==x.n;}
+
+ int n;
+};
+
+#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
+namespace boost{
+namespace serialization{
+#endif
+
+template<class Archive>
+void save_construct_data(
+ Archive& ar,const non_default_ctble* p,const unsigned int version)
+{
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
+ if(version<3)return;
+#endif
+
+ ar<<boost::serialization::make_nvp("n",p->n);
+}
+
+template<class Archive>
+void load_construct_data(
+ Archive& ar,non_default_ctble* p,const unsigned int version)
+{
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
+ if(version<3)return;
+#endif
+
+ int n=0;
+ ar>>boost::serialization::make_nvp("n",n);
+ ::new(p)non_default_ctble(n);
+}
+
+template<class Archive>
+void serialize(Archive&,non_default_ctble&,const unsigned int)
+{
+}
+
+#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
+} /* namespace serialization */
+} /* namespace boost*/
+#endif
+
+namespace boost{
+namespace serialization{
+template<> struct version<non_default_ctble>
+{
+ BOOST_STATIC_CONSTANT(unsigned int,value=3);
+};
+} /* namespace serialization */
+} /* namespace boost*/
+
 using namespace boost::multi_index;
 
 void test_serialization3()
@@ -96,4 +154,19 @@
     ia>>it2;
     BOOST_CHECK(it2==hs2.end(buc));
   }
+
+ {
+ typedef multi_index_container<
+ non_default_ctble,
+ indexed_by<
+ ordered_unique<
+ BOOST_MULTI_INDEX_MEMBER(non_default_ctble,int,n)
+ >
+ >
+ > multi_index_t;
+
+ multi_index_t m;
+ for(int i=0;i<100;++i)m.insert(non_default_ctble(i));
+ test_serialization(m);
+ }
 }


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