| 1 | #ifndef  BOOST_SERIALIZATION_HASH_MAP_HPP | 
|---|
| 2 | #define BOOST_SERIALIZATION_HASH_MAP_HPP | 
|---|
| 3 |  | 
|---|
| 4 | // MS compatible compilers support #pragma once | 
|---|
| 5 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) | 
|---|
| 6 | # pragma once | 
|---|
| 7 | #endif | 
|---|
| 8 |  | 
|---|
| 9 | /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 | 
|---|
| 10 | // serialization/hash_map.hpp: | 
|---|
| 11 | // serialization for stl hash_map templates | 
|---|
| 12 |  | 
|---|
| 13 | // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .  | 
|---|
| 14 | // Use, modification and distribution is subject to the Boost Software | 
|---|
| 15 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | 
|---|
| 16 | // http://www.boost.org/LICENSE_1_0.txt) | 
|---|
| 17 |  | 
|---|
| 18 | //  See http://www.boost.org for updates, documentation, and revision history. | 
|---|
| 19 |  | 
|---|
| 20 | #include <boost/config.hpp> | 
|---|
| 21 | #ifdef BOOST_HAS_HASH | 
|---|
| 22 | #include BOOST_HASH_MAP_HEADER | 
|---|
| 23 |  | 
|---|
| 24 | #include <boost/serialization/utility.hpp> | 
|---|
| 25 | #include <boost/serialization/hash_collections_save_imp.hpp> | 
|---|
| 26 | #include <boost/serialization/hash_collections_load_imp.hpp> | 
|---|
| 27 | #include <boost/serialization/split_free.hpp> | 
|---|
| 28 |  | 
|---|
| 29 | namespace boost {  | 
|---|
| 30 | namespace serialization { | 
|---|
| 31 |  | 
|---|
| 32 | template< | 
|---|
| 33 |     class Archive,  | 
|---|
| 34 |     class Key,  | 
|---|
| 35 |     class HashFcn,  | 
|---|
| 36 |     class EqualKey, | 
|---|
| 37 |     class Allocator | 
|---|
| 38 | > | 
|---|
| 39 | inline void save( | 
|---|
| 40 |     Archive & ar, | 
|---|
| 41 |     const BOOST_STD_EXTENSION_NAMESPACE::hash_map< | 
|---|
| 42 |         Key, HashFcn, EqualKey, Allocator | 
|---|
| 43 |     > &t, | 
|---|
| 44 |     const unsigned int file_version | 
|---|
| 45 | ){ | 
|---|
| 46 |     boost::serialization::stl::save_hash_collection< | 
|---|
| 47 |         Archive,  | 
|---|
| 48 |         BOOST_STD_EXTENSION_NAMESPACE::hash_map< | 
|---|
| 49 |             Key, HashFcn, EqualKey, Allocator | 
|---|
| 50 |         > | 
|---|
| 51 |     >(ar, t); | 
|---|
| 52 | } | 
|---|
| 53 |  | 
|---|
| 54 | template< | 
|---|
| 55 |     class Archive,  | 
|---|
| 56 |     class Key,  | 
|---|
| 57 |     class HashFcn,  | 
|---|
| 58 |     class EqualKey, | 
|---|
| 59 |     class Allocator | 
|---|
| 60 | > | 
|---|
| 61 | inline void load( | 
|---|
| 62 |     Archive & ar, | 
|---|
| 63 |     BOOST_STD_EXTENSION_NAMESPACE::hash_map< | 
|---|
| 64 |         Key, HashFcn, EqualKey, Allocator | 
|---|
| 65 |     > &t, | 
|---|
| 66 |     const unsigned int file_version | 
|---|
| 67 | ){ | 
|---|
| 68 |     boost::serialization::stl::load_hash_collection< | 
|---|
| 69 |         Archive, | 
|---|
| 70 |         BOOST_STD_EXTENSION_NAMESPACE::hash_map< | 
|---|
| 71 |             Key, HashFcn, EqualKey, Allocator | 
|---|
| 72 |         >, | 
|---|
| 73 |         boost::serialization::stl::archive_input_unique< | 
|---|
| 74 |             Archive,  | 
|---|
| 75 |             BOOST_STD_EXTENSION_NAMESPACE::hash_map< | 
|---|
| 76 |                 Key, HashFcn, EqualKey, Allocator | 
|---|
| 77 |             > | 
|---|
| 78 |         > | 
|---|
| 79 |     >(ar, t); | 
|---|
| 80 | } | 
|---|
| 81 |  | 
|---|
| 82 | // split non-intrusive serialization function member into separate | 
|---|
| 83 | // non intrusive save/load member functions | 
|---|
| 84 | template< | 
|---|
| 85 |     class Archive,  | 
|---|
| 86 |     class Key,  | 
|---|
| 87 |     class HashFcn,  | 
|---|
| 88 |     class EqualKey, | 
|---|
| 89 |     class Allocator | 
|---|
| 90 | > | 
|---|
| 91 | inline void serialize( | 
|---|
| 92 |     Archive & ar, | 
|---|
| 93 |     BOOST_STD_EXTENSION_NAMESPACE::hash_map< | 
|---|
| 94 |         Key, HashFcn, EqualKey, Allocator | 
|---|
| 95 |     > &t, | 
|---|
| 96 |     const unsigned int file_version | 
|---|
| 97 | ){ | 
|---|
| 98 |     boost::serialization::split_free(ar, t, file_version); | 
|---|
| 99 | } | 
|---|
| 100 |  | 
|---|
| 101 | // hash_multimap | 
|---|
| 102 | template< | 
|---|
| 103 |     class Archive,  | 
|---|
| 104 |     class Key,  | 
|---|
| 105 |     class HashFcn,  | 
|---|
| 106 |     class EqualKey, | 
|---|
| 107 |     class Allocator | 
|---|
| 108 | > | 
|---|
| 109 | inline void save( | 
|---|
| 110 |     Archive & ar, | 
|---|
| 111 |     const BOOST_STD_EXTENSION_NAMESPACE::hash_multimap< | 
|---|
| 112 |         Key, HashFcn, EqualKey, Allocator | 
|---|
| 113 |     > &t, | 
|---|
| 114 |     const unsigned int file_version | 
|---|
| 115 | ){ | 
|---|
| 116 |     boost::serialization::stl::save_hash_collection< | 
|---|
| 117 |         Archive,  | 
|---|
| 118 |         BOOST_STD_EXTENSION_NAMESPACE::hash_multimap< | 
|---|
| 119 |             Key, HashFcn, EqualKey, Allocator | 
|---|
| 120 |         > | 
|---|
| 121 |     >(ar, t); | 
|---|
| 122 | } | 
|---|
| 123 |  | 
|---|
| 124 | template< | 
|---|
| 125 |     class Archive,  | 
|---|
| 126 |     class Key,  | 
|---|
| 127 |     class HashFcn,  | 
|---|
| 128 |     class EqualKey, | 
|---|
| 129 |     class Allocator | 
|---|
| 130 | > | 
|---|
| 131 | inline void load( | 
|---|
| 132 |     Archive & ar, | 
|---|
| 133 |     BOOST_STD_EXTENSION_NAMESPACE::hash_multimap< | 
|---|
| 134 |         Key, HashFcn, EqualKey, Allocator | 
|---|
| 135 |     > &t, | 
|---|
| 136 |     const unsigned int file_version | 
|---|
| 137 | ){ | 
|---|
| 138 |     boost::serialization::stl::load_hash_collection< | 
|---|
| 139 |         Archive, | 
|---|
| 140 |         BOOST_STD_EXTENSION_NAMESPACE::hash_multimap< | 
|---|
| 141 |             Key, HashFcn, EqualKey, Allocator | 
|---|
| 142 |         >, | 
|---|
| 143 |         boost::serialization::stl::archive_input_multi< | 
|---|
| 144 |             Archive,  | 
|---|
| 145 |             BOOST_STD_EXTENSION_NAMESPACE::hash_multimap< | 
|---|
| 146 |                 Key, HashFcn, EqualKey, Allocator | 
|---|
| 147 |             > | 
|---|
| 148 |         > | 
|---|
| 149 |     >(ar, t); | 
|---|
| 150 | } | 
|---|
| 151 |  | 
|---|
| 152 | // split non-intrusive serialization function member into separate | 
|---|
| 153 | // non intrusive save/load member functions | 
|---|
| 154 | template< | 
|---|
| 155 |     class Archive,  | 
|---|
| 156 |     class Key,  | 
|---|
| 157 |     class HashFcn,  | 
|---|
| 158 |     class EqualKey, | 
|---|
| 159 |     class Allocator | 
|---|
| 160 | > | 
|---|
| 161 | inline void serialize( | 
|---|
| 162 |     Archive & ar, | 
|---|
| 163 |     BOOST_STD_EXTENSION_NAMESPACE::hash_multimap< | 
|---|
| 164 |         Key, HashFcn, EqualKey, Allocator | 
|---|
| 165 |     > &t, | 
|---|
| 166 |     const unsigned int file_version | 
|---|
| 167 | ){ | 
|---|
| 168 |     boost::serialization::split_free(ar, t, file_version); | 
|---|
| 169 | } | 
|---|
| 170 |  | 
|---|
| 171 | } // namespace serialization | 
|---|
| 172 | } // namespace boost | 
|---|
| 173 |  | 
|---|
| 174 | #endif // BOOST_HAS_HASH | 
|---|
| 175 | #endif // BOOST_SERIALIZATION_HASH_MAP_HPP | 
|---|