annotate DEPENDENCIES/generic/include/boost/serialization/hash_collections_load_imp.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 #ifndef BOOST_SERIALIZATION_HASH_COLLECTIONS_LOAD_IMP_HPP
Chris@16 2 #define BOOST_SERIALIZATION_HASH_COLLECTIONS_LOAD_IMP_HPP
Chris@16 3
Chris@16 4 // MS compatible compilers support #pragma once
Chris@101 5 #if defined(_MSC_VER)
Chris@16 6 # pragma once
Chris@16 7 # pragma warning (disable : 4786) // too long name, harmless warning
Chris@16 8 #endif
Chris@16 9
Chris@16 10 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
Chris@16 11 // hash_collections_load_imp.hpp: serialization for loading stl collections
Chris@16 12
Chris@16 13 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
Chris@16 14 // Use, modification and distribution is subject to the Boost Software
Chris@16 15 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 16 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 17
Chris@16 18 // See http://www.boost.org for updates, documentation, and revision history.
Chris@16 19
Chris@16 20 // helper function templates for serialization of hashed collections
Chris@16 21 #include <boost/config.hpp>
Chris@16 22 #include <boost/archive/detail/basic_iarchive.hpp>
Chris@16 23 #include <boost/serialization/nvp.hpp>
Chris@16 24 #include <boost/serialization/collection_size_type.hpp>
Chris@16 25 #include <boost/serialization/item_version_type.hpp>
Chris@16 26
Chris@16 27 namespace boost{
Chris@16 28 namespace serialization {
Chris@16 29 namespace stl {
Chris@16 30
Chris@16 31 //////////////////////////////////////////////////////////////////////
Chris@16 32 // implementation of serialization for STL containers
Chris@16 33 //
Chris@16 34 template<class Archive, class Container, class InputFunction>
Chris@16 35 inline void load_hash_collection(Archive & ar, Container &s)
Chris@16 36 {
Chris@16 37 collection_size_type count;
Chris@16 38 collection_size_type bucket_count;
Chris@16 39 boost::serialization::item_version_type item_version(0);
Chris@16 40 boost::archive::library_version_type library_version(
Chris@16 41 ar.get_library_version()
Chris@16 42 );
Chris@16 43 // retrieve number of elements
Chris@16 44 if(boost::archive::library_version_type(6) != library_version){
Chris@16 45 ar >> BOOST_SERIALIZATION_NVP(count);
Chris@16 46 ar >> BOOST_SERIALIZATION_NVP(bucket_count);
Chris@16 47 }
Chris@16 48 else{
Chris@16 49 // note: fixup for error in version 6. collection size was
Chris@16 50 // changed to size_t BUT for hashed collections it was implemented
Chris@16 51 // as an unsigned int. This should be a problem only on win64 machines
Chris@16 52 // but I'll leave it for everyone just in case.
Chris@16 53 unsigned int c;
Chris@16 54 unsigned int bc;
Chris@16 55 ar >> BOOST_SERIALIZATION_NVP(c);
Chris@16 56 count = c;
Chris@16 57 ar >> BOOST_SERIALIZATION_NVP(bc);
Chris@16 58 bucket_count = bc;
Chris@16 59 }
Chris@16 60 if(boost::archive::library_version_type(3) < library_version){
Chris@16 61 ar >> BOOST_SERIALIZATION_NVP(item_version);
Chris@16 62 }
Chris@101 63 s.clear();
Chris@16 64 #if ! defined(__MWERKS__)
Chris@16 65 s.resize(bucket_count);
Chris@16 66 #endif
Chris@16 67 InputFunction ifunc;
Chris@16 68 while(count-- > 0){
Chris@16 69 ifunc(ar, s, item_version);
Chris@16 70 }
Chris@16 71 }
Chris@16 72
Chris@16 73 } // namespace stl
Chris@16 74 } // namespace serialization
Chris@16 75 } // namespace boost
Chris@16 76
Chris@16 77 #endif //BOOST_SERIALIZATION_HASH_COLLECTIONS_LOAD_IMP_HPP