PageRenderTime 17ms CodeModel.GetById 13ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/multi_index/detail/serialization_version.hpp

http://hadesmem.googlecode.com/
C++ Header | 75 lines | 43 code | 20 blank | 12 comment | 0 complexity | 828e97e52f52ac540c1c8a5b9744cfde MD5 | raw file
 1/* Copyright 2003-2010 Joaquin M Lopez Munoz.
 2 * Distributed under the Boost Software License, Version 1.0.
 3 * (See accompanying file LICENSE_1_0.txt or copy at
 4 * http://www.boost.org/LICENSE_1_0.txt)
 5 *
 6 * See http://www.boost.org/libs/multi_index for library home page.
 7 */
 8
 9#ifndef BOOST_MULTI_INDEX_DETAIL_SERIALIZATION_VERSION_HPP
10#define BOOST_MULTI_INDEX_DETAIL_SERIALIZATION_VERSION_HPP
11
12#if defined(_MSC_VER)&&(_MSC_VER>=1200)
13#pragma once
14#endif
15
16#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
17#include <boost/serialization/split_member.hpp>
18#include <boost/serialization/version.hpp>
19
20namespace boost{
21
22namespace multi_index{
23
24namespace detail{
25
26/* Helper class for storing and retrieving a given type serialization class
27 * version while avoiding saving the number multiple times in the same
28 * archive.
29 * Behavior undefined if template partial specialization is not supported.
30 */
31
32template<typename T>
33struct serialization_version
34{
35  serialization_version():
36    value(boost::serialization::version<serialization_version>::value){}
37
38  serialization_version& operator=(unsigned int x){value=x;return *this;};
39
40  operator unsigned int()const{return value;}
41
42private:
43  friend class boost::serialization::access;
44
45  BOOST_SERIALIZATION_SPLIT_MEMBER()
46
47  template<class Archive>
48  void save(Archive&,const unsigned int)const{}
49
50  template<class Archive>
51  void load(Archive&,const unsigned int version)
52  {
53    this->value=version;
54  }
55
56  unsigned int value;
57};
58
59} /* namespace multi_index::detail */
60
61} /* namespace multi_index */
62
63#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
64namespace serialization {
65template<typename T>
66struct version<boost::multi_index::detail::serialization_version<T> >
67{
68  BOOST_STATIC_CONSTANT(int,value=version<T>::value);
69};
70} /* namespace serialization */
71#endif
72
73} /* namespace boost */
74
75#endif