[857] | 1 | #ifndef BOOST_SERIALIZATION_SET_HPP
|
---|
| 2 | #define BOOST_SERIALIZATION_SET_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 | // set.hpp: serialization for stl set templates
|
---|
| 11 |
|
---|
| 12 | // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
---|
| 13 | // Use, modification and distribution is subject to the Boost Software
|
---|
| 14 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
---|
| 15 | // http://www.boost.org/LICENSE_1_0.txt)
|
---|
| 16 |
|
---|
| 17 | // See http://www.boost.org for updates, documentation, and revision history.
|
---|
| 18 |
|
---|
| 19 | #include <set>
|
---|
| 20 |
|
---|
| 21 | #include <boost/config.hpp>
|
---|
| 22 |
|
---|
| 23 | #include <boost/serialization/collections_save_imp.hpp>
|
---|
| 24 | #include <boost/serialization/collections_load_imp.hpp>
|
---|
| 25 | #include <boost/serialization/split_free.hpp>
|
---|
| 26 |
|
---|
| 27 | #if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
|
---|
| 28 | #define STD _STLP_STD
|
---|
| 29 | #else
|
---|
| 30 | #define STD std
|
---|
| 31 | #endif
|
---|
| 32 |
|
---|
| 33 | namespace boost {
|
---|
| 34 | namespace serialization {
|
---|
| 35 |
|
---|
| 36 | template<class Archive, class Key, class Compare, class Allocator >
|
---|
| 37 | inline void save(
|
---|
| 38 | Archive & ar,
|
---|
| 39 | const STD::set<Key, Compare, Allocator> &t,
|
---|
| 40 | const unsigned int /* file_version */
|
---|
| 41 | ){
|
---|
| 42 | boost::serialization::stl::save_collection<
|
---|
| 43 | Archive, STD::set<Key, Compare, Allocator>
|
---|
| 44 | >(ar, t);
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | template<class Archive, class Key, class Compare, class Allocator >
|
---|
| 48 | inline void load(
|
---|
| 49 | Archive & ar,
|
---|
| 50 | STD::set<Key, Compare, Allocator> &t,
|
---|
| 51 | const unsigned int /* file_version */
|
---|
| 52 | ){
|
---|
| 53 | boost::serialization::stl::load_collection<
|
---|
| 54 | Archive,
|
---|
| 55 | STD::set<Key, Compare, Allocator>,
|
---|
| 56 | boost::serialization::stl::archive_input_set<
|
---|
| 57 | Archive, STD::set<Key, Compare, Allocator>
|
---|
| 58 | >,
|
---|
| 59 | boost::serialization::stl::no_reserve_imp<STD::set<
|
---|
| 60 | Key, Compare, Allocator>
|
---|
| 61 | >
|
---|
| 62 | >(ar, t);
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | // split non-intrusive serialization function member into separate
|
---|
| 66 | // non intrusive save/load member functions
|
---|
| 67 | template<class Archive, class Key, class Compare, class Allocator >
|
---|
| 68 | inline void serialize(
|
---|
| 69 | Archive & ar,
|
---|
| 70 | STD::set<Key, Compare, Allocator> & t,
|
---|
| 71 | const unsigned int file_version
|
---|
| 72 | ){
|
---|
| 73 | boost::serialization::split_free(ar, t, file_version);
|
---|
| 74 | }
|
---|
| 75 |
|
---|
| 76 | // multiset
|
---|
| 77 | template<class Archive, class Key, class Compare, class Allocator >
|
---|
| 78 | inline void save(
|
---|
| 79 | Archive & ar,
|
---|
| 80 | const STD::multiset<Key, Compare, Allocator> &t,
|
---|
| 81 | const unsigned int /* file_version */
|
---|
| 82 | ){
|
---|
| 83 | boost::serialization::stl::save_collection<
|
---|
| 84 | Archive,
|
---|
| 85 | STD::multiset<Key, Compare, Allocator>
|
---|
| 86 | >(ar, t);
|
---|
| 87 | }
|
---|
| 88 |
|
---|
| 89 | template<class Archive, class Key, class Compare, class Allocator >
|
---|
| 90 | inline void load(
|
---|
| 91 | Archive & ar,
|
---|
| 92 | STD::multiset<Key, Compare, Allocator> &t,
|
---|
| 93 | const unsigned int /* file_version */
|
---|
| 94 | ){
|
---|
| 95 | boost::serialization::stl::load_collection<
|
---|
| 96 | Archive,
|
---|
| 97 | STD::multiset<Key, Compare, Allocator>,
|
---|
| 98 | boost::serialization::stl::archive_input_multiset<
|
---|
| 99 | Archive, STD::multiset<Key, Compare, Allocator>
|
---|
| 100 | >,
|
---|
| 101 | boost::serialization::stl::no_reserve_imp<
|
---|
| 102 | STD::multiset<Key, Compare, Allocator>
|
---|
| 103 | >
|
---|
| 104 | >(ar, t);
|
---|
| 105 | }
|
---|
| 106 |
|
---|
| 107 | // split non-intrusive serialization function member into separate
|
---|
| 108 | // non intrusive save/load member functions
|
---|
| 109 | template<class Archive, class Key, class Compare, class Allocator >
|
---|
| 110 | inline void serialize(
|
---|
| 111 | Archive & ar,
|
---|
| 112 | STD::multiset<Key, Compare, Allocator> & t,
|
---|
| 113 | const unsigned int file_version
|
---|
| 114 | ){
|
---|
| 115 | boost::serialization::split_free(ar, t, file_version);
|
---|
| 116 | }
|
---|
| 117 |
|
---|
| 118 | } // namespace serialization
|
---|
| 119 | } // namespace boost
|
---|
| 120 |
|
---|
| 121 | #include <boost/serialization/collection_traits.hpp>
|
---|
| 122 |
|
---|
| 123 | BOOST_SERIALIZATION_COLLECTION_TRAITS(STD::set)
|
---|
| 124 | BOOST_SERIALIZATION_COLLECTION_TRAITS(STD::multiset)
|
---|
| 125 | #undef STD
|
---|
| 126 |
|
---|
| 127 | #endif // BOOST_SERIALIZATION_SET_HPP
|
---|