git repos / blockattack-game

blame: source/code/Libs/include/cereal/macros.hpp

normal view · raw

7a956470 sago007 2016-02-14 17:09 1
/*! \file macros.hpp
7a956470 sago007 2016-02-14 17:09 2
    \brief Preprocessor macros that can customise the cereal library
7a956470 sago007 2016-02-14 17:09 3
7a956470 sago007 2016-02-14 17:09 4
    By default, cereal looks for serialization functions with very
7a956470 sago007 2016-02-14 17:09 5
    specific names, that is: serialize, load, save, load_minimal,
7a956470 sago007 2016-02-14 17:09 6
    or save_minimal.
7a956470 sago007 2016-02-14 17:09 7
7a956470 sago007 2016-02-14 17:09 8
    This file allows an advanced user to change these names to conform
7a956470 sago007 2016-02-14 17:09 9
    to some other style or preference.  This is implemented using
7a956470 sago007 2016-02-14 17:09 10
    preprocessor macros.
7a956470 sago007 2016-02-14 17:09 11
7a956470 sago007 2016-02-14 17:09 12
    As a result of this, in internal cereal code you will see macros
7a956470 sago007 2016-02-14 17:09 13
    used for these function names.  In user code, you should name
7a956470 sago007 2016-02-14 17:09 14
    the functions like you normally would and not use the macros
7a956470 sago007 2016-02-14 17:09 15
    to improve readability.
7a956470 sago007 2016-02-14 17:09 16
    \ingroup utility */
7a956470 sago007 2016-02-14 17:09 17
/*
7a956470 sago007 2016-02-14 17:09 18
  Copyright (c) 2014, Randolph Voorhies, Shane Grant
7a956470 sago007 2016-02-14 17:09 19
  All rights reserved.
7a956470 sago007 2016-02-14 17:09 20
7a956470 sago007 2016-02-14 17:09 21
  Redistribution and use in source and binary forms, with or without
7a956470 sago007 2016-02-14 17:09 22
  modification, are permitted provided that the following conditions are met:
7a956470 sago007 2016-02-14 17:09 23
      * Redistributions of source code must retain the above copyright
7a956470 sago007 2016-02-14 17:09 24
        notice, this list of conditions and the following disclaimer.
7a956470 sago007 2016-02-14 17:09 25
      * Redistributions in binary form must reproduce the above copyright
7a956470 sago007 2016-02-14 17:09 26
        notice, this list of conditions and the following disclaimer in the
7a956470 sago007 2016-02-14 17:09 27
        documentation and/or other materials provided with the distribution.
7a956470 sago007 2016-02-14 17:09 28
      * Neither the name of cereal nor the
7a956470 sago007 2016-02-14 17:09 29
        names of its contributors may be used to endorse or promote products
7a956470 sago007 2016-02-14 17:09 30
        derived from this software without specific prior written permission.
7a956470 sago007 2016-02-14 17:09 31
7a956470 sago007 2016-02-14 17:09 32
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
7a956470 sago007 2016-02-14 17:09 33
  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
7a956470 sago007 2016-02-14 17:09 34
  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
7a956470 sago007 2016-02-14 17:09 35
  DISCLAIMED. IN NO EVENT SHALL RANDOLPH VOORHIES OR SHANE GRANT BE LIABLE FOR ANY
7a956470 sago007 2016-02-14 17:09 36
  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
7a956470 sago007 2016-02-14 17:09 37
  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
7a956470 sago007 2016-02-14 17:09 38
  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
7a956470 sago007 2016-02-14 17:09 39
  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
7a956470 sago007 2016-02-14 17:09 40
  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
7a956470 sago007 2016-02-14 17:09 41
  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7a956470 sago007 2016-02-14 17:09 42
*/
7a956470 sago007 2016-02-14 17:09 43
7a956470 sago007 2016-02-14 17:09 44
#ifndef CEREAL_MACROS_HPP_
7a956470 sago007 2016-02-14 17:09 45
#define CEREAL_MACROS_HPP_
7a956470 sago007 2016-02-14 17:09 46
6c5f2c01 sago007 2017-03-15 17:56 47
#ifndef CEREAL_THREAD_SAFE
6c5f2c01 sago007 2017-03-15 17:56 48
//! Whether cereal should be compiled for a threaded environment
6c5f2c01 sago007 2017-03-15 17:56 49
/*! This macro causes cereal to use mutexes to control access to
6c5f2c01 sago007 2017-03-15 17:56 50
    global internal state in a thread safe manner.
6c5f2c01 sago007 2017-03-15 17:56 51
6c5f2c01 sago007 2017-03-15 17:56 52
    Note that even with this enabled you must still ensure that
6c5f2c01 sago007 2017-03-15 17:56 53
    archives are accessed by only one thread at a time; it is safe
6c5f2c01 sago007 2017-03-15 17:56 54
    to use multiple archives in paralel, but not to access one archive
6c5f2c01 sago007 2017-03-15 17:56 55
    from many places simultaneously. */
6c5f2c01 sago007 2017-03-15 17:56 56
#define CEREAL_THREAD_SAFE 0
6c5f2c01 sago007 2017-03-15 17:56 57
#endif // CEREAL_THREAD_SAFE
6c5f2c01 sago007 2017-03-15 17:56 58
6c5f2c01 sago007 2017-03-15 17:56 59
#ifndef CEREAL_SIZE_TYPE
6c5f2c01 sago007 2017-03-15 17:56 60
//! Determines the data type used for size_type
6c5f2c01 sago007 2017-03-15 17:56 61
/*! cereal uses size_type to ensure that the serialized size of
6c5f2c01 sago007 2017-03-15 17:56 62
    dynamic containers is compatible across different architectures
6c5f2c01 sago007 2017-03-15 17:56 63
    (e.g. 32 vs 64 bit), which may use different underlying types for
6c5f2c01 sago007 2017-03-15 17:56 64
    std::size_t.
6c5f2c01 sago007 2017-03-15 17:56 65
6c5f2c01 sago007 2017-03-15 17:56 66
    More information can be found in cereal/details/helpers.hpp.
6c5f2c01 sago007 2017-03-15 17:56 67
6c5f2c01 sago007 2017-03-15 17:56 68
    If you choose to modify this type, ensure that you use a fixed
6c5f2c01 sago007 2017-03-15 17:56 69
    size type (e.g. uint32_t). */
6c5f2c01 sago007 2017-03-15 17:56 70
#define CEREAL_SIZE_TYPE uint64_t
6c5f2c01 sago007 2017-03-15 17:56 71
#endif // CEREAL_SIZE_TYPE
6c5f2c01 sago007 2017-03-15 17:56 72
6c5f2c01 sago007 2017-03-15 17:56 73
// ######################################################################
7a956470 sago007 2016-02-14 17:09 74
#ifndef CEREAL_SERIALIZE_FUNCTION_NAME
7a956470 sago007 2016-02-14 17:09 75
//! The serialization/deserialization function name to search for.
7a956470 sago007 2016-02-14 17:09 76
/*! You can define @c CEREAL_SERIALIZE_FUNCTION_NAME to be different assuming
7a956470 sago007 2016-02-14 17:09 77
    you do so before this file is included. */
7a956470 sago007 2016-02-14 17:09 78
#define CEREAL_SERIALIZE_FUNCTION_NAME serialize
7a956470 sago007 2016-02-14 17:09 79
#endif // CEREAL_SERIALIZE_FUNCTION_NAME
7a956470 sago007 2016-02-14 17:09 80
7a956470 sago007 2016-02-14 17:09 81
#ifndef CEREAL_LOAD_FUNCTION_NAME
7a956470 sago007 2016-02-14 17:09 82
//! The deserialization (load) function name to search for.
7a956470 sago007 2016-02-14 17:09 83
/*! You can define @c CEREAL_LOAD_FUNCTION_NAME to be different assuming you do so
7a956470 sago007 2016-02-14 17:09 84
    before this file is included. */
7a956470 sago007 2016-02-14 17:09 85
#define CEREAL_LOAD_FUNCTION_NAME load
7a956470 sago007 2016-02-14 17:09 86
#endif // CEREAL_LOAD_FUNCTION_NAME
7a956470 sago007 2016-02-14 17:09 87
7a956470 sago007 2016-02-14 17:09 88
#ifndef CEREAL_SAVE_FUNCTION_NAME
7a956470 sago007 2016-02-14 17:09 89
//! The serialization (save) function name to search for.
7a956470 sago007 2016-02-14 17:09 90
/*! You can define @c CEREAL_SAVE_FUNCTION_NAME to be different assuming you do so
7a956470 sago007 2016-02-14 17:09 91
    before this file is included. */
7a956470 sago007 2016-02-14 17:09 92
#define CEREAL_SAVE_FUNCTION_NAME save
7a956470 sago007 2016-02-14 17:09 93
#endif // CEREAL_SAVE_FUNCTION_NAME
7a956470 sago007 2016-02-14 17:09 94
7a956470 sago007 2016-02-14 17:09 95
#ifndef CEREAL_LOAD_MINIMAL_FUNCTION_NAME
7a956470 sago007 2016-02-14 17:09 96
//! The deserialization (load_minimal) function name to search for.
7a956470 sago007 2016-02-14 17:09 97
/*! You can define @c CEREAL_LOAD_MINIMAL_FUNCTION_NAME to be different assuming you do so
7a956470 sago007 2016-02-14 17:09 98
    before this file is included. */
7a956470 sago007 2016-02-14 17:09 99
#define CEREAL_LOAD_MINIMAL_FUNCTION_NAME load_minimal
7a956470 sago007 2016-02-14 17:09 100
#endif // CEREAL_LOAD_MINIMAL_FUNCTION_NAME
7a956470 sago007 2016-02-14 17:09 101
7a956470 sago007 2016-02-14 17:09 102
#ifndef CEREAL_SAVE_MINIMAL_FUNCTION_NAME
7a956470 sago007 2016-02-14 17:09 103
//! The serialization (save_minimal) function name to search for.
7a956470 sago007 2016-02-14 17:09 104
/*! You can define @c CEREAL_SAVE_MINIMAL_FUNCTION_NAME to be different assuming you do so
7a956470 sago007 2016-02-14 17:09 105
    before this file is included. */
7a956470 sago007 2016-02-14 17:09 106
#define CEREAL_SAVE_MINIMAL_FUNCTION_NAME save_minimal
7a956470 sago007 2016-02-14 17:09 107
#endif // CEREAL_SAVE_MINIMAL_FUNCTION_NAME
7a956470 sago007 2016-02-14 17:09 108
6c5f2c01 sago007 2017-03-15 17:56 109
// ######################################################################
6c5f2c01 sago007 2017-03-15 17:56 110
//! Defines the CEREAL_NOEXCEPT macro to use instead of noexcept
6c5f2c01 sago007 2017-03-15 17:56 111
/*! If a compiler we support does not support noexcept, this macro
6c5f2c01 sago007 2017-03-15 17:56 112
    will detect this and define CEREAL_NOEXCEPT as a no-op
6c5f2c01 sago007 2017-03-15 17:56 113
    @internal */
6c5f2c01 sago007 2017-03-15 17:56 114
#if !defined(CEREAL_HAS_NOEXCEPT)
6c5f2c01 sago007 2017-03-15 17:56 115
  #if defined(__clang__)
6c5f2c01 sago007 2017-03-15 17:56 116
    #if __has_feature(cxx_noexcept)
6c5f2c01 sago007 2017-03-15 17:56 117
      #define CEREAL_HAS_NOEXCEPT
6c5f2c01 sago007 2017-03-15 17:56 118
    #endif
6c5f2c01 sago007 2017-03-15 17:56 119
  #else // NOT clang
6c5f2c01 sago007 2017-03-15 17:56 120
    #if defined(__GXX_EXPERIMENTAL_CXX0X__) && __GNUC__ * 10 + __GNUC_MINOR__ >= 46 || \
6c5f2c01 sago007 2017-03-15 17:56 121
        defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 190023026
6c5f2c01 sago007 2017-03-15 17:56 122
      #define CEREAL_HAS_NOEXCEPT
6c5f2c01 sago007 2017-03-15 17:56 123
    #endif // end GCC/MSVC check
6c5f2c01 sago007 2017-03-15 17:56 124
  #endif // end NOT clang block
6c5f2c01 sago007 2017-03-15 17:56 125
6c5f2c01 sago007 2017-03-15 17:56 126
  #ifndef CEREAL_NOEXCEPT
6c5f2c01 sago007 2017-03-15 17:56 127
    #ifdef CEREAL_HAS_NOEXCEPT
6c5f2c01 sago007 2017-03-15 17:56 128
      #define CEREAL_NOEXCEPT noexcept
6c5f2c01 sago007 2017-03-15 17:56 129
    #else
6c5f2c01 sago007 2017-03-15 17:56 130
      #define CEREAL_NOEXCEPT
6c5f2c01 sago007 2017-03-15 17:56 131
    #endif // end CEREAL_HAS_NOEXCEPT
6c5f2c01 sago007 2017-03-15 17:56 132
  #endif // end !defined(CEREAL_HAS_NOEXCEPT)
6c5f2c01 sago007 2017-03-15 17:56 133
#endif // ifndef CEREAL_NOEXCEPT
6c5f2c01 sago007 2017-03-15 17:56 134
7a956470 sago007 2016-02-14 17:09 135
#endif // CEREAL_MACROS_HPP_
1970-01-01 00:00 136