cereal
A C++11 library for serialization
|
Preprocessor macros that can customise the cereal library. More...
Go to the source code of this file.
Macros | |
#define | CEREAL_THREAD_SAFE 0 |
Whether cereal should be compiled for a threaded environment. More... | |
#define | CEREAL_SIZE_TYPE uint64_t |
Determines the data type used for size_type. More... | |
#define | CEREAL_SERIALIZE_FUNCTION_NAME serialize |
The serialization/deserialization function name to search for. More... | |
#define | CEREAL_LOAD_FUNCTION_NAME load |
The deserialization (load) function name to search for. More... | |
#define | CEREAL_SAVE_FUNCTION_NAME save |
The serialization (save) function name to search for. More... | |
#define | CEREAL_LOAD_MINIMAL_FUNCTION_NAME load_minimal |
The deserialization (load_minimal) function name to search for. More... | |
#define | CEREAL_SAVE_MINIMAL_FUNCTION_NAME save_minimal |
The serialization (save_minimal) function name to search for. More... | |
#define | CEREAL_NOEXCEPT |
Defines the CEREAL_NOEXCEPT macro to use instead of noexcept. More... | |
#define | CEREAL_ALIGNOF alignof |
Checks if C++14 is available. More... | |
Preprocessor macros that can customise the cereal library.
By default, cereal looks for serialization functions with very specific names, that is: serialize, load, save, load_minimal, or save_minimal.
This file allows an advanced user to change these names to conform to some other style or preference. This is implemented using preprocessor macros.
As a result of this, in internal cereal code you will see macros used for these function names. In user code, you should name the functions like you normally would and not use the macros to improve readability.
#define CEREAL_ALIGNOF alignof |
Checks if C++14 is available.
Checks if C++17 is available NOTE: clang v5 has a bug with inline variables, so disable C++17 on that compiler Defines the CEREAL_ALIGNOF macro to use instead of alignof
#define CEREAL_LOAD_FUNCTION_NAME load |
The deserialization (load) function name to search for.
You can define CEREAL_LOAD_FUNCTION_NAME
to be different assuming you do so before this file is included.
#define CEREAL_LOAD_MINIMAL_FUNCTION_NAME load_minimal |
The deserialization (load_minimal) function name to search for.
You can define CEREAL_LOAD_MINIMAL_FUNCTION_NAME
to be different assuming you do so before this file is included.
#define CEREAL_NOEXCEPT |
Defines the CEREAL_NOEXCEPT macro to use instead of noexcept.
If a compiler we support does not support noexcept, this macro will detect this and define CEREAL_NOEXCEPT as a no-op
#define CEREAL_SAVE_FUNCTION_NAME save |
The serialization (save) function name to search for.
You can define CEREAL_SAVE_FUNCTION_NAME
to be different assuming you do so before this file is included.
#define CEREAL_SAVE_MINIMAL_FUNCTION_NAME save_minimal |
The serialization (save_minimal) function name to search for.
You can define CEREAL_SAVE_MINIMAL_FUNCTION_NAME
to be different assuming you do so before this file is included.
#define CEREAL_SERIALIZE_FUNCTION_NAME serialize |
The serialization/deserialization function name to search for.
You can define CEREAL_SERIALIZE_FUNCTION_NAME
to be different assuming you do so before this file is included.
#define CEREAL_SIZE_TYPE uint64_t |
Determines the data type used for size_type.
cereal uses size_type to ensure that the serialized size of dynamic containers is compatible across different architectures (e.g. 32 vs 64 bit), which may use different underlying types for std::size_t.
More information can be found in cereal/details/helpers.hpp.
If you choose to modify this type, ensure that you use a fixed size type (e.g. uint32_t).
#define CEREAL_THREAD_SAFE 0 |
Whether cereal should be compiled for a threaded environment.
This macro causes cereal to use mutexes to control access to global internal state in a thread safe manner.
Note that even with this enabled you must still ensure that archives are accessed by only one thread at a time; it is safe to use multiple archives in parallel, but not to access one archive from many places simultaneously.