test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
24 // We cannot include Equal.h here since it is C++11
25 namespace cond {
26 namespace serialization {
27  template <typename CondSerializationT, typename Enabled = void>
28  struct access;
29 }
30 }
31 
32 // Marks a class/struct as serializable Conditions.
33 // It must be used in the end of the class/struct, to avoid
34 // changing the default access specifier.
35 // Note: the serialization code generator script depends on
36 // the implementation of the macro.
37 #define COND_SERIALIZABLE \
38  private: \
39  template <class Archive> void serialize(Archive & ar, const unsigned int version); \
40  template <typename CondSerializationT, typename Enabled> friend struct cond::serialization::access; \
41  friend class boost::serialization::access;
42 
43 // Same, but does *not* automatically generate the serialization code.
44 // This is useful when special features are required, e.g. versioning
45 // or using non-deducible contexts.
46 #define COND_SERIALIZABLE_MANUAL \
47  COND_SERIALIZABLE; \
48  void cond_serialization_manual();
49 
50 // Polymorphic classes must be tagged as such
51 #define COND_SERIALIZABLE_POLYMORPHIC(T) \
52  BOOST_CLASS_EXPORT(T);
53 
54 // Marks a member as transient, i.e. not included in the automatically
55 // generated serialization code. All variables in the same 'statement'
56 // (up to the ';') will be marked as transient, so please avoid declaring
57 // more than one transient member per 'statement'/line. In order to
58 // avoid that, in the future we may be able to use custom C++11 attributes
59 // like [[cond::serialization::transient]]
60 #define COND_TRANSIENT
61 
62 #endif /* !defined(__GCCXML__) */