CMS 3D CMS Logo

Serializable.h
Go to the documentation of this file.
1 #pragma once
2 
3 #if defined(__GCCXML__)
4 
5 #define COND_SERIALIZABLE
6 #define COND_TRANSIENT
7 
8 #else
9 
10 // The archives must be listed before any boost/serialization header.
11 // Otherwise, in some cases the export macros trigger compilation errors.
12 // #include "CondFormats/Serialization/interface/Archive.h"
13 
14 #include <boost/serialization/access.hpp>
15 
16 #include <boost/serialization/string.hpp>
17 #include <boost/serialization/vector.hpp>
18 #include <boost/serialization/list.hpp>
19 #include <boost/serialization/set.hpp>
20 #include <boost/serialization/map.hpp>
21 #include <boost/serialization/bitset.hpp>
22 #include <boost/serialization/shared_ptr.hpp>
23 #include <boost/serialization/unordered_map.hpp>
24 
25 // We cannot include Equal.h here since it is C++11
26 namespace cond {
27 namespace serialization {
28  template <typename CondSerializationT, typename Enabled = void>
29  struct access;
30 }
31 }
32 
33 // Marks a class/struct as serializable Conditions.
34 // It must be used in the end of the class/struct, to avoid
35 // changing the default access specifier.
36 // Note: the serialization code generator script depends on
37 // the implementation of the macro.
38 #define COND_SERIALIZABLE \
39  private: \
40  template <class Archive> void serialize(Archive & ar, const unsigned int version); \
41  template <typename CondSerializationT, typename Enabled> friend struct cond::serialization::access; \
42  friend class boost::serialization::access;
43 
44 // Same, but does *not* automatically generate the serialization code.
45 // This is useful when special features are required, e.g. versioning
46 // or using non-deducible contexts.
47 #define COND_SERIALIZABLE_MANUAL \
48  COND_SERIALIZABLE; \
49  void cond_serialization_manual();
50 
51 // Polymorphic classes must be tagged as such
52 #define COND_SERIALIZABLE_POLYMORPHIC(T) \
53  BOOST_CLASS_EXPORT(T);
54 
55 // Marks a member as transient, i.e. not included in the automatically
56 // generated serialization code. All variables in the same 'statement'
57 // (up to the ';') will be marked as transient, so please avoid declaring
58 // more than one transient member per 'statement'/line. In order to
59 // avoid that, in the future we may be able to use custom C++11 attributes
60 // like [[cond::serialization::transient]]
61 #define COND_TRANSIENT
62 
63 #endif /* !defined(__GCCXML__) */
Definition: plugin.cc:24