Chris@16: #ifndef BOOST_SERIALIZATION_HASH_COLLECTIONS_LOAD_IMP_HPP Chris@16: #define BOOST_SERIALIZATION_HASH_COLLECTIONS_LOAD_IMP_HPP Chris@16: Chris@16: // MS compatible compilers support #pragma once Chris@101: #if defined(_MSC_VER) Chris@16: # pragma once Chris@16: # pragma warning (disable : 4786) // too long name, harmless warning Chris@16: #endif Chris@16: Chris@16: /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 Chris@16: // hash_collections_load_imp.hpp: serialization for loading stl collections Chris@16: Chris@16: // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . Chris@16: // Use, modification and distribution is subject to the Boost Software Chris@16: // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: // See http://www.boost.org for updates, documentation, and revision history. Chris@16: Chris@16: // helper function templates for serialization of hashed collections Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: namespace boost{ Chris@16: namespace serialization { Chris@16: namespace stl { Chris@16: Chris@16: ////////////////////////////////////////////////////////////////////// Chris@16: // implementation of serialization for STL containers Chris@16: // Chris@16: template Chris@16: inline void load_hash_collection(Archive & ar, Container &s) Chris@16: { Chris@16: collection_size_type count; Chris@16: collection_size_type bucket_count; Chris@16: boost::serialization::item_version_type item_version(0); Chris@16: boost::archive::library_version_type library_version( Chris@16: ar.get_library_version() Chris@16: ); Chris@16: // retrieve number of elements Chris@16: if(boost::archive::library_version_type(6) != library_version){ Chris@16: ar >> BOOST_SERIALIZATION_NVP(count); Chris@16: ar >> BOOST_SERIALIZATION_NVP(bucket_count); Chris@16: } Chris@16: else{ Chris@16: // note: fixup for error in version 6. collection size was Chris@16: // changed to size_t BUT for hashed collections it was implemented Chris@16: // as an unsigned int. This should be a problem only on win64 machines Chris@16: // but I'll leave it for everyone just in case. Chris@16: unsigned int c; Chris@16: unsigned int bc; Chris@16: ar >> BOOST_SERIALIZATION_NVP(c); Chris@16: count = c; Chris@16: ar >> BOOST_SERIALIZATION_NVP(bc); Chris@16: bucket_count = bc; Chris@16: } Chris@16: if(boost::archive::library_version_type(3) < library_version){ Chris@16: ar >> BOOST_SERIALIZATION_NVP(item_version); Chris@16: } Chris@101: s.clear(); Chris@16: #if ! defined(__MWERKS__) Chris@16: s.resize(bucket_count); Chris@16: #endif Chris@16: InputFunction ifunc; Chris@16: while(count-- > 0){ Chris@16: ifunc(ar, s, item_version); Chris@16: } Chris@16: } Chris@16: Chris@16: } // namespace stl Chris@16: } // namespace serialization Chris@16: } // namespace boost Chris@16: Chris@16: #endif //BOOST_SERIALIZATION_HASH_COLLECTIONS_LOAD_IMP_HPP