Bayeux
3.4.1
Core Foundation library for SuperNEMO
bayeux
datatools
serialization_macros.h
Go to the documentation of this file.
1
/*
3
* Description :
4
*
5
* Some useful macros related to Boost/Serialisation within datatools.
6
*
7
* Copyright (C) 2011-2018 Francois Mauger <mauger@lpccaen.in2p3.fr>
8
*
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; either version 3 of the License, or (at
12
* your option) any later version.
13
*
14
* This program is distributed in the hope that it will be useful, but
15
* WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
* General Public License for more details.
18
*
19
* You should have received a copy of the GNU General Public License
20
* along with this program; if not, write to the Free Software
21
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
22
* Boston, MA 02110-1301, USA.
23
*
24
*/
25
#ifndef DATATOOLS_SERIALIZATION_MACROS_H
26
#define DATATOOLS_SERIALIZATION_MACROS_H
27
28
// Third Party:
29
// - Boost:
30
#include <boost/serialization/access.hpp>
31
#include <boost/serialization/split_member.hpp>
32
33
// declare the template load member function from the header file :
34
#define BOOST_SERIALIZATION_SPLIT_MEMBER_LOAD_DECLARATION() \
35
template<class Archive> \
36
void load(Archive& ar, const unsigned int file_version); \
37
38
39
// declare the template save member function from the header file :
40
#define BOOST_SERIALIZATION_SPLIT_MEMBER_SAVE_DECLARATION() \
41
template<class Archive> \
42
void save(Archive& ar, const unsigned int file_version) const; \
43
44
45
// declare the template serialize member function from the header file :
46
#define BOOST_SERIALIZATION_SERIALIZE_DECLARATION() \
47
template<class Archive> \
48
void serialize(Archive& ar, const unsigned int file_version); \
49
50
51
62
#define BOOST_SERIALIZATION_BASIC_DECLARATION() \
63
protected: \
64
friend class boost::serialization::access; \
65
BOOST_SERIALIZATION_SERIALIZE_DECLARATION() \
66
67
68
// split member serialize functions save/load/serialize
69
// from the header file :
70
#define BOOST_SERIALIZATION_SPLIT_MEMBER_SERIALIZE_DECLARATIONS() \
71
BOOST_SERIALIZATION_SPLIT_MEMBER_LOAD_DECLARATION() \
72
BOOST_SERIALIZATION_SPLIT_MEMBER_SAVE_DECLARATION() \
73
BOOST_SERIALIZATION_SERIALIZE_DECLARATION() \
74
75
76
// split member function serialize function into save/load
77
// from the implementation file :
78
#define BOOST_SERIALIZATION_SPLIT_MEMBER_SERIALIZE_IMPLEMENTATION(T) \
79
template<class Archive> \
80
void T::serialize(Archive& ar, const unsigned int file_version) { \
81
boost::serialization::split_member(ar, *this, file_version); \
82
} \
83
84
85
#endif // DATATOOLS_SERIALIZATION_MACROS_H
86
87
// Local Variables: --
88
// mode: c++ --
89
// c-file-style: "gnu" --
90
// tab-width: 2 --
91
// End: --
Generated by
1.8.15