All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Pages
unordered_map_serialization.hpp
Go to the documentation of this file.
1 
9 //TODO remove when it appears in boost
10 #ifndef PAAL_UNORDERED_MAP_SERIALIZATION_HPP
11 #define PAAL_UNORDERED_MAP_SERIALIZATION_HPP
12 
13 // MS compatible compilers support #pragma once
14 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
15 # pragma once
16 #endif
17 
19 // serialization/map.hpp:
20 // serialization for stl map templates
21 
22 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
23 // Use, modification and distribution is subject to the Boost Software
24 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
25 // http://www.boost.org/LICENSE_1_0.txt)
26 
27 // See http://www.boost.org for updates, documentation, and revision history.
28 
29 #include <boost/unordered_map.hpp>
30 #include <boost/serialization/unordered_map.hpp>
31 
32 #include <boost/config.hpp>
33 
34 #include <boost/serialization/utility.hpp>
35 #include <boost/serialization/collections_save_imp.hpp>
36 #include <boost/serialization/collections_load_imp.hpp>
37 #include <boost/serialization/split_free.hpp>
38 
39 namespace boost {
40 namespace serialization {
41 
43 template<class Archive, class Type, class Key, class Hash, class Compare, class Allocator >
44  inline void save(
45  Archive & ar,
46  const boost::unordered_map<Key, Type, Hash, Compare, Allocator> &t,
47  const unsigned int /* file_version */
48  ){
49  boost::serialization::stl::save_collection<
50  Archive,
51  boost::unordered_map<Key, Type, Hash, Compare, Allocator>
52  >(ar, t);
53  }
54 
56 template<class Archive, class Type, class Key, class Hash, class Compare, class Allocator >
57  inline void load(
58  Archive & ar,
59  boost::unordered_map<Key, Type, Hash, Compare, Allocator> &t,
60  const unsigned int /* file_version */
61  ){
62  boost::serialization::stl::load_collection<
63  Archive,
64  boost::unordered_map<Key, Type, Hash, Compare, Allocator>,
65  boost::serialization::stl::archive_input_map<
66  Archive, boost::unordered_map<Key, Type, Hash, Compare, Allocator> >,
67  boost::serialization::stl::no_reserve_imp<boost::unordered_map<
68  Key, Type, Hash, Compare, Allocator
69  >
70  >
71  >(ar, t);
72  }
73 
76 template<class Archive, class Type, class Key, class Hash, class Compare, class Allocator >
77  inline void serialize(
78  Archive & ar,
79  boost::unordered_map<Key, Type, Hash, Compare, Allocator> &t,
80  const unsigned int file_version
81  ){
82  boost::serialization::split_free(ar, t, file_version);
83  }
84 
86 template<class Archive, class Type, class Key, class Hash, class Compare, class Allocator >
87  inline void save(
88  Archive & ar,
89  const boost::unordered_multimap<Key, Type, Hash, Compare, Allocator> &t,
90  const unsigned int /* file_version */
91  ){
92  boost::serialization::stl::save_collection<
93  Archive,
94  boost::unordered_multimap<Key, Type, Hash, Compare, Allocator>
95  >(ar, t);
96  }
97 
99 template<class Archive, class Type, class Key, class Hash, class Compare, class Allocator >
100  inline void load(
101  Archive & ar,
102  boost::unordered_multimap<Key, Type, Hash, Compare, Allocator> &t,
103  const unsigned int /* file_version */
104  ){
105  boost::serialization::stl::load_collection<
106  Archive,
107  boost::unordered_multimap<Key, Type, Hash, Compare, Allocator>,
108  boost::serialization::stl::archive_input_unordered_multimap<
109  Archive, boost::unordered_multimap<Key, Type, Hash, Compare, Allocator>
110  >,
111  boost::serialization::stl::no_reserve_imp<
112  boost::unordered_multimap<Key, Type, Hash, Compare, Allocator>
113  >
114  >(ar, t);
115  }
116 
119 template<class Archive, class Type, class Key, class Hash, class Compare, class Allocator >
120  inline void serialize(
121  Archive & ar,
122  boost::unordered_multimap<Key, Type, Hash, Compare, Allocator> &t,
123  const unsigned int file_version
124  ){
125  boost::serialization::split_free(ar, t, file_version);
126  }
127 
128 } // serialization
129 } // namespace boost
130 
131 #endif /* PAAL_UNORDERED_MAP_SERIALIZATION_HPP */