source: NonGTP/Boost/boost/multi_index/detail/index_node_base.hpp @ 857

Revision 857, 2.5 KB checked in by igarcia, 18 years ago (diff)
Line 
1/* Copyright 2003-2005 Joaquín M López Muñoz.
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_INDEX_NODE_BASE_HPP
10#define BOOST_MULTI_INDEX_DETAIL_INDEX_NODE_BASE_HPP
11
12#if defined(_MSC_VER)&&(_MSC_VER>=1200)
13#pragma once
14#endif
15
16#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
17#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
18#include <boost/archive/archive_exception.hpp>
19#include <boost/serialization/access.hpp>
20#include <boost/throw_exception.hpp>
21#endif
22
23namespace boost{
24
25namespace multi_index{
26
27namespace detail{
28
29/* index_node_base tops the node hierarchy of multi_index_container. It holds
30 * the value of the element contained.
31 */
32
33template<typename Value>
34struct index_node_base
35{
36  typedef index_node_base base_type; /* used for serialization purposes */
37  typedef Value           value_type;
38  value_type              value;
39
40private:
41  index_node_base();
42  /* this class is not intended to be cted, merely allocated */
43
44#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
45  friend class boost::serialization::access;
46 
47  /* nodes do not emit any kind of serialization info. They are
48   * fed to Boost.Serialization so that pointers to nodes are
49   * tracked correctly.
50   */
51
52  template<class Archive>
53  void serialize(Archive&,const unsigned int)
54  {
55  }
56#endif
57
58};
59
60} /* namespace multi_index::detail */
61
62} /* namespace multi_index */
63
64#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
65/* Index nodes never get constructed directly by Boost.Serialization,
66 * as archives are always fed pointers to previously existent
67 * nodes. So, if this is called it means we are dealing with a
68 * somehow invalid archive.
69 */
70
71#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
72namespace serialization{
73#else
74namespace multi_index{
75namespace detail{
76#endif
77
78template<class Archive,typename Value>
79inline void load_construct_data(
80  Archive&,boost::multi_index::detail::index_node_base<Value>*,
81  const unsigned int)
82{
83  throw_exception(
84    archive::archive_exception(archive::archive_exception::other_exception));
85}
86
87#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
88} /* namespace serialization */
89#else
90} /* namespace multi_index::detail */
91} /* namespace multi_index */
92#endif
93
94#endif
95
96} /* namespace boost */
97
98#endif
Note: See TracBrowser for help on using the repository browser.