hash_map.hpp 4.3 KB

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