hash_set.hpp 4.5 KB

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