CMS 3D CMS Logo

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