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