cereal
A C++11 library for serialization
specialize.hpp
Go to the documentation of this file.
1 
3 /*
4  Copyright (c) 2014, Randolph Voorhies, Shane Grant
5  All rights reserved.
6 
7  Redistribution and use in source and binary forms, with or without
8  modification, are permitted provided that the following conditions are met:
9  * Redistributions of source code must retain the above copyright
10  notice, this list of conditions and the following disclaimer.
11  * Redistributions in binary form must reproduce the above copyright
12  notice, this list of conditions and the following disclaimer in the
13  documentation and/or other materials provided with the distribution.
14  * Neither the name of the copyright holder nor the
15  names of its contributors may be used to endorse or promote products
16  derived from this software without specific prior written permission.
17 
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
22  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29 
30 #ifndef CEREAL_SPECIALIZE_HPP_
31 #define CEREAL_SPECIALIZE_HPP_
32 
33 namespace cereal
34 {
35  // Forward declaration of access class that users can become friends with
36  class access;
37 
38  // ######################################################################
41 
43  enum class specialization
44  {
45  member_serialize,
46  member_load_save,
47  member_load_save_minimal,
48  non_member_serialize,
49  non_member_load_save,
50  non_member_load_save_minimal
51  };
52 
54 
107  template <class Archive, class T, specialization S>
108  struct specialize : public std::false_type {};
109 
111 
121  #define CEREAL_SPECIALIZE_FOR_ALL_ARCHIVES( Type, Specialization ) \
122  namespace cereal { template <class Archive> struct specialize<Archive, Type, Specialization> {}; }
123 
125 
135  #define CEREAL_SPECIALIZE_FOR_ARCHIVE( Archive, Type, Specialization ) \
136  namespace cereal { template <> struct specialize<Archive, Type, Specialization> {}; }
137 }
138 
139 #endif
cereal::specialize::specialization
specialization
Definition: specialize.hpp:43
cereal::specialize
A class used to disambiguate cases where cereal cannot detect a unique way of serializing a class.
Definition: specialize.hpp:108