Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/boost/serialization/map.hpp @ 29

Last change on this file since 29 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

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