Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:51:30

0001 #ifndef CondFormats_Serialization_Serializable_h
0002 #define CondFormats_Serialization_Serializable_h
0003 
0004 #if defined(__GCCXML__)
0005 
0006 #define COND_SERIALIZABLE
0007 #define COND_TRANSIENT
0008 
0009 #else
0010 
0011 // The archives must be listed before any boost/serialization header.
0012 // Otherwise, in some cases the export macros trigger compilation errors.
0013 // #include "CondFormats/Serialization/interface/Archive.h"
0014 
0015 #include <boost/serialization/access.hpp>
0016 
0017 #include <boost/serialization/string.hpp>
0018 #include <boost/serialization/vector.hpp>
0019 #include <boost/serialization/list.hpp>
0020 #include <boost/serialization/set.hpp>
0021 #include <boost/serialization/map.hpp>
0022 #include <boost/serialization/bitset.hpp>
0023 #include <boost/serialization/unordered_map.hpp>
0024 #include <boost/serialization/utility.hpp>
0025 
0026 // We cannot include Equal.h here since it is C++11
0027 namespace cond {
0028   namespace serialization {
0029     template <typename CondSerializationT, typename Enabled = void>
0030     struct access;
0031   }
0032 }  // namespace cond
0033 
0034 // Marks a class/struct as serializable Conditions.
0035 // It must be used in the end of the class/struct, to avoid
0036 // changing the default access specifier.
0037 // Note: the serialization code generator script depends on
0038 //       the implementation of the macro.
0039 #define COND_SERIALIZABLE                                  \
0040 private:                                                   \
0041   template <class Archive>                                 \
0042   void serialize(Archive& ar, const unsigned int version); \
0043   template <typename CondSerializationT, typename Enabled> \
0044   friend struct cond::serialization::access;               \
0045   friend class boost::serialization::access;
0046 
0047 // Same, but does *not* automatically generate the serialization code.
0048 // This is useful when special features are required, e.g. versioning
0049 // or using non-deducible contexts.
0050 #define COND_SERIALIZABLE_MANUAL \
0051   COND_SERIALIZABLE;             \
0052   void cond_serialization_manual();
0053 
0054 // Polymorphic classes must be tagged as such
0055 #define COND_SERIALIZABLE_POLYMORPHIC(T) BOOST_CLASS_EXPORT(T);
0056 
0057 // Marks a member as transient, i.e. not included in the automatically
0058 // generated serialization code. All variables in the same 'statement'
0059 // (up to the ';') will be marked as transient, so please avoid declaring
0060 // more than one transient member per 'statement'/line. In order to
0061 // avoid that, in the future we may be able to use custom C++11 attributes
0062 // like [[cond::serialization::transient]]
0063 #define COND_TRANSIENT
0064 
0065 #endif /* !defined(__GCCXML__) */
0066 #endif