source: NonGTP/Boost/boost/serialization/hash_set.hpp @ 857

Revision 857, 4.3 KB checked in by igarcia, 19 years ago (diff)
Line 
1#ifndef  BOOST_SERIALIZATION_HASH_SET_HPP
2#define BOOST_SERIALIZATION_HASH_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// hash_set.hpp: serialization for stl hash_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 <boost/config.hpp>
20#ifdef BOOST_HAS_HASH
21
22#ifdef __GLIBCPP__
23#include <ext/hash_set>
24#else
25#include <hash_set>
26#endif
27
28#include <boost/serialization/collections_save_imp.hpp>
29#include <boost/serialization/collections_load_imp.hpp>
30#include <boost/serialization/split_free.hpp>
31
32// function specializations must be defined in the appropriate
33// namespace - boost::serialization
34#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
35#define STD _STLP_STD
36#else
37#define STD BOOST_STD_EXTENSION_NAMESPACE
38#endif
39
40namespace boost {
41namespace serialization {
42
43template<class Archive, class Key, class Compare, class Allocator >
44inline void save(
45    Archive & ar,
46    const STD::hash_set<Key, Compare, Allocator> &t,
47    const unsigned int file_version
48){
49    boost::serialization::stl::save_collection<
50        Archive,
51        STD::hash_set<Key, Compare, Allocator>
52    >(ar, t);
53}
54
55template<class Archive, class Key, class Compare, class Allocator >
56inline void load(
57    Archive & ar,
58    STD::hash_set<Key, Compare, Allocator> &t,
59    const unsigned int file_version
60){
61    boost::serialization::stl::load_collection<
62        Archive,
63        BOOST_STD_EXTENSION_NAMESPACE::hash_set<Key, Compare, Allocator>,
64        boost::serialization::stl::archive_input_set<
65            Archive,
66            STD::hash_set<Key, Compare, Allocator>
67        >,
68        boost::serialization::stl::no_reserve_imp<
69            STD::hash_set<Key, Compare, Allocator>
70        >
71    >(ar, t);
72}
73
74// split non-intrusive serialization function member into separate
75// non intrusive save/load member functions
76template<class Archive, class Key, class Compare, class Allocator >
77inline void serialize(
78    Archive & ar,
79    STD::hash_set<Key, Compare, Allocator> & t,
80    const unsigned int file_version
81){
82    boost::serialization::split_free(ar, t, file_version);
83}
84
85// hash_multiset
86template<class Archive, class Key, class Compare, class Allocator >
87inline void save(
88    Archive & ar,
89    const STD::hash_multiset<Key, Compare, Allocator> &t,
90    const unsigned int file_version
91){
92    boost::serialization::stl::save_collection<
93        Archive,
94        STD::hash_multiset<Key, Compare, Allocator>
95    >(ar, t);
96}
97
98template<class Archive, class Key, class Compare, class Allocator >
99inline void load(
100    Archive & ar,
101    STD::hash_multiset<Key, Compare, Allocator> &t,
102    const unsigned int file_version
103){
104    boost::serialization::stl::load_collection<
105        Archive,
106        BOOST_STD_EXTENSION_NAMESPACE::hash_multiset<Key, Compare, Allocator>,
107        boost::serialization::stl::archive_input_multiset<
108            Archive, STD::hash_multiset<
109                Key,
110                Compare,
111                Allocator
112            >
113        >,
114        boost::serialization::stl::no_reserve_imp<
115            STD::hash_multiset<Key, Compare, Allocator>
116        >
117    >(ar, t);
118}
119
120// split non-intrusive serialization function member into separate
121// non intrusive save/load member functions
122template<class Archive, class Key, class Compare, class Allocator >
123inline void serialize(
124    Archive & ar,
125    STD::hash_multiset<Key, Compare, Allocator> & t,
126    const unsigned int file_version
127){
128    boost::serialization::split_free(ar, t, file_version);
129}
130
131} // namespace serialization
132} // namespace boost
133
134#include <boost/serialization/collection_traits.hpp>
135
136BOOST_SERIALIZATION_COLLECTION_TRAITS(STD::hash_set)
137BOOST_SERIALIZATION_COLLECTION_TRAITS(STD::hash_multiset)
138
139#undef STD
140
141#endif // BOOST_HAS_HASH
142#endif // BOOST_SERIALIZATION_HASH_SET_HPP
Note: See TracBrowser for help on using the repository browser.