cereal
A C++11 library for serialization
macros.hpp
Go to the documentation of this file.
1 
17 /*
18  Copyright (c) 2014, Randolph Voorhies, Shane Grant
19  All rights reserved.
20 
21  Redistribution and use in source and binary forms, with or without
22  modification, are permitted provided that the following conditions are met:
23  * Redistributions of source code must retain the above copyright
24  notice, this list of conditions and the following disclaimer.
25  * Redistributions in binary form must reproduce the above copyright
26  notice, this list of conditions and the following disclaimer in the
27  documentation and/or other materials provided with the distribution.
28  * Neither the name of cereal nor the
29  names of its contributors may be used to endorse or promote products
30  derived from this software without specific prior written permission.
31 
32  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
33  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
34  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
35  DISCLAIMED. IN NO EVENT SHALL RANDOLPH VOORHIES OR SHANE GRANT BE LIABLE FOR ANY
36  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
37  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
38  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
39  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
41  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 */
43 
44 #ifndef CEREAL_MACROS_HPP_
45 #define CEREAL_MACROS_HPP_
46 
47 #ifndef CEREAL_THREAD_SAFE
48 
56 #define CEREAL_THREAD_SAFE 0
57 #endif // CEREAL_THREAD_SAFE
58 
59 #ifndef CEREAL_SIZE_TYPE
60 
70 #define CEREAL_SIZE_TYPE uint64_t
71 #endif // CEREAL_SIZE_TYPE
72 
73 // ######################################################################
74 #ifndef CEREAL_SERIALIZE_FUNCTION_NAME
75 
78 #define CEREAL_SERIALIZE_FUNCTION_NAME serialize
79 #endif // CEREAL_SERIALIZE_FUNCTION_NAME
80 
81 #ifndef CEREAL_LOAD_FUNCTION_NAME
82 
85 #define CEREAL_LOAD_FUNCTION_NAME load
86 #endif // CEREAL_LOAD_FUNCTION_NAME
87 
88 #ifndef CEREAL_SAVE_FUNCTION_NAME
89 
92 #define CEREAL_SAVE_FUNCTION_NAME save
93 #endif // CEREAL_SAVE_FUNCTION_NAME
94 
95 #ifndef CEREAL_LOAD_MINIMAL_FUNCTION_NAME
96 
99 #define CEREAL_LOAD_MINIMAL_FUNCTION_NAME load_minimal
100 #endif // CEREAL_LOAD_MINIMAL_FUNCTION_NAME
101 
102 #ifndef CEREAL_SAVE_MINIMAL_FUNCTION_NAME
103 
106 #define CEREAL_SAVE_MINIMAL_FUNCTION_NAME save_minimal
107 #endif // CEREAL_SAVE_MINIMAL_FUNCTION_NAME
108 
109 // ######################################################################
111 
114 #if !defined(CEREAL_HAS_NOEXCEPT)
115  #if defined(__clang__)
116  #if __has_feature(cxx_noexcept)
117  #define CEREAL_HAS_NOEXCEPT
118  #endif
119  #else // NOT clang
120  #if defined(__GXX_EXPERIMENTAL_CXX0X__) && __GNUC__ * 10 + __GNUC_MINOR__ >= 46 || \
121  defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 190023026
122  #define CEREAL_HAS_NOEXCEPT
123  #endif // end GCC/MSVC check
124  #endif // end NOT clang block
125 
126  #ifndef CEREAL_NOEXCEPT
127  #ifdef CEREAL_HAS_NOEXCEPT
128  #define CEREAL_NOEXCEPT noexcept
129  #else
130  #define CEREAL_NOEXCEPT
131  #endif // end CEREAL_HAS_NOEXCEPT
132  #endif // end !defined(CEREAL_HAS_NOEXCEPT)
133 #endif // ifndef CEREAL_NOEXCEPT
134 
135 #endif // CEREAL_MACROS_HPP_