Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62047 - trunk/boost/serialization
From: dgregor_at_[hidden]
Date: 2010-05-16 17:35:37


Author: dgregor
Date: 2010-05-16 17:35:36 EDT (Sun, 16 May 2010)
New Revision: 62047
URL: http://svn.boost.org/trac/boost/changeset/62047

Log:
Revert my attempt to use collection_size_type/version_type
consistently throughout the serialization library; I need to do so in
a way that maintains archive compatibility.

Text files modified:
   trunk/boost/serialization/collections_load_imp.hpp | 13 ++++++-------
   trunk/boost/serialization/collections_save_imp.hpp | 6 +++---
   trunk/boost/serialization/hash_collections_load_imp.hpp | 7 +++----
   trunk/boost/serialization/hash_collections_save_imp.hpp | 11 ++++-------
   trunk/boost/serialization/optional.hpp | 8 +++-----
   trunk/boost/serialization/slist.hpp | 6 ++----
   6 files changed, 21 insertions(+), 30 deletions(-)

Modified: trunk/boost/serialization/collections_load_imp.hpp
==============================================================================
--- trunk/boost/serialization/collections_load_imp.hpp (original)
+++ trunk/boost/serialization/collections_load_imp.hpp 2010-05-16 17:35:36 EDT (Sun, 16 May 2010)
@@ -139,13 +139,12 @@
     s.clear();
     // retrieve number of elements
     collection_size_type count;
- unsigned int item_version_val = 0;
+ unsigned int item_version;
     ar >> BOOST_SERIALIZATION_NVP(count);
- if(3 < ar.get_library_version()) {
- boost::archive::version_type item_version(0);
- ar >> BOOST_SERIALIZATION_NVP(item_version);
- item_version_val = item_version.t;
- }
+ if(3 < ar.get_library_version())
+ ar >> BOOST_SERIALIZATION_NVP(item_version);
+ else
+ item_version = 0;
     R rx;
     rx(s, count);
     std::size_t c = count;
@@ -153,7 +152,7 @@
     BOOST_DEDUCED_TYPENAME Container::iterator hint;
     hint = s.begin();
     while(c-- > 0){
- hint = ifunc(ar, s, item_version_val, hint);
+ hint = ifunc(ar, s, item_version, hint);
     }
 }
 

Modified: trunk/boost/serialization/collections_save_imp.hpp
==============================================================================
--- trunk/boost/serialization/collections_save_imp.hpp (original)
+++ trunk/boost/serialization/collections_save_imp.hpp 2010-05-16 17:35:36 EDT (Sun, 16 May 2010)
@@ -41,10 +41,10 @@
     // make sure the target type is registered so we can retrieve
     // the version when we load
     if(3 < ar.get_library_version()){
- const boost::archive::version_type item_version(version<
+ const unsigned int item_version = version<
             BOOST_DEDUCED_TYPENAME Container::value_type
- >::value);
- ar << BOOST_SERIALIZATION_NVP(item_version);
+ >::value;
+ ar << BOOST_SERIALIZATION_NVP(item_version);
     }
     BOOST_DEDUCED_TYPENAME Container::const_iterator it = s.begin();
     collection_size_type c=count;

Modified: trunk/boost/serialization/hash_collections_load_imp.hpp
==============================================================================
--- trunk/boost/serialization/hash_collections_load_imp.hpp (original)
+++ trunk/boost/serialization/hash_collections_load_imp.hpp 2010-05-16 17:35:36 EDT (Sun, 16 May 2010)
@@ -21,7 +21,6 @@
 #include <boost/config.hpp>
 #include <boost/serialization/nvp.hpp>
 //#include <boost/serialization/collections_load_imp.hpp>
-#include <boost/serialization/collection_size_type.hpp>
 
 namespace boost{
 namespace serialization {
@@ -35,9 +34,9 @@
 {
     s.clear();
     // retrieve number of elements
- collection_size_type count;
- boost::archive::version_type item_version(0);
- collection_size_type bucket_count;
+ unsigned int count;
+ unsigned int item_version(0);
+ unsigned int bucket_count;;
     ar >> BOOST_SERIALIZATION_NVP(count);
     if(3 < ar.get_library_version()){
        ar >> BOOST_SERIALIZATION_NVP(bucket_count);

Modified: trunk/boost/serialization/hash_collections_save_imp.hpp
==============================================================================
--- trunk/boost/serialization/hash_collections_save_imp.hpp (original)
+++ trunk/boost/serialization/hash_collections_save_imp.hpp 2010-05-16 17:35:36 EDT (Sun, 16 May 2010)
@@ -22,7 +22,6 @@
 #include <boost/serialization/nvp.hpp>
 #include <boost/serialization/serialization.hpp>
 #include <boost/serialization/version.hpp>
-#include <boost/serialization/collection_size_type.hpp>
 
 namespace boost{
 namespace serialization {
@@ -36,20 +35,18 @@
 inline void save_hash_collection(Archive & ar, const Container &s)
 {
     // record number of elements
- unsigned int c = s.size();
- collection_size_type count(c);
+ unsigned int count = s.size();
     ar << BOOST_SERIALIZATION_NVP(count);
     // make sure the target type is registered so we can retrieve
     // the version when we load
     if(3 < ar.get_library_version()){
- const collection_size_type bucket_count(s.bucket_count());
+ const unsigned int bucket_count = s.bucket_count();
         ar << BOOST_SERIALIZATION_NVP(bucket_count);
- const boost::archive::version_type item_version(
- version<BOOST_DEDUCED_TYPENAME Container::value_type>::value);
+ const unsigned int item_version = version<BOOST_DEDUCED_TYPENAME Container::value_type>::value;
         ar << BOOST_SERIALIZATION_NVP(item_version);
     }
     BOOST_DEDUCED_TYPENAME Container::const_iterator it = s.begin();
- while(c-- > 0){
+ while(count-- > 0){
         // note borland emits a no-op without the explicit namespace
         boost::serialization::save_construct_data_adl(
             ar,

Modified: trunk/boost/serialization/optional.hpp
==============================================================================
--- trunk/boost/serialization/optional.hpp (original)
+++ trunk/boost/serialization/optional.hpp 2010-05-16 17:35:36 EDT (Sun, 16 May 2010)
@@ -38,8 +38,8 @@
     ar << boost::serialization::make_nvp("initialized", tflag);
     if (tflag){
         if(3 < ar.get_library_version()){
- const boost::archive::version_type v(version<T>::value);
- ar << boost::serialization::make_nvp("item_version", v);
+ const int v = version<T>::value;
+ ar << boost::serialization::make_nvp("item_version", v);
         }
         ar << boost::serialization::make_nvp("value", *t);
     }
@@ -56,9 +56,7 @@
     if (tflag){
         unsigned int v = 0;
         if(3 < ar.get_library_version()){
- boost::archive::version_type vt(v);
- ar >> boost::serialization::make_nvp("item_version", vt);
- v = vt.t;
+ ar >> boost::serialization::make_nvp("item_version", v);
         }
         detail::stack_construct<Archive, T> aux(ar, v);
         ar >> boost::serialization::make_nvp("value", aux.reference());

Modified: trunk/boost/serialization/slist.hpp
==============================================================================
--- trunk/boost/serialization/slist.hpp (original)
+++ trunk/boost/serialization/slist.hpp 2010-05-16 17:35:36 EDT (Sun, 16 May 2010)
@@ -60,11 +60,9 @@
     ar >> BOOST_SERIALIZATION_NVP(count);
     if(std::size_t(0) == count)
         return;
- unsigned int v = 0;
+ unsigned int v;
     if(3 < ar.get_library_version()){
- boost::archive::version_type item_version(0);
- ar >> BOOST_SERIALIZATION_NVP(item_version);
- v = item_version.t;
+ ar >> boost::serialization::make_nvp("item_version", v);
     }
     boost::serialization::detail::stack_construct<Archive, U> u(ar, v);
     ar >> boost::serialization::make_nvp("item", u.reference());


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