PhoenixSerializer
3.0.0
PhoenixSerializer is a framework to save/load/serialize/deserialize data
Toggle main menu visibility
Loading...
Searching...
No Matches
data_stream_enum.h
Go to the documentation of this file.
1
/***************************************
2
Auteur : Pierre Aubert
3
Mail : pierre.aubert@lapp.in2p3.fr
4
Licence : LGPL-3.0-only
5
****************************************/
6
7
#ifndef __DATA_STREAM_ENUM_H__
8
#define __DATA_STREAM_ENUM_H__
9
10
#include "
data_stream_include.h
"
11
12
// NOLINTBEGIN(bugprone-macro-parentheses,cppcoreguidelines-macro-usage) X is a type (X & data), it cannot be enclosed in parentheses ; the macro declares class template specialisations, a constexpr function cannot
14
#define PHOENIX_DATA_STREAM_ENUM(X) \
15
template <typename Stream> \
16
struct Serializer<Stream, SerializeMode::READ, X> { \
17
static bool phoenix_serialize(Stream & ds, X & data) { \
18
int value(0); \
19
bool b = Serializer<Stream, SerializeMode::READ, int>::phoenix_serialize(ds, value); \
20
data = (X)value; \
21
return b; \
22
} \
23
}; \
24
template <typename Stream> \
25
struct Serializer<Stream, SerializeMode::WRITE, X> { \
26
static bool phoenix_serialize(Stream & ds, X & data) { \
27
int value = (int)data; \
28
return Serializer<Stream, SerializeMode::WRITE, int>::phoenix_serialize(ds, value); \
29
} \
30
};
31
32
// NOLINTEND(bugprone-macro-parentheses,cppcoreguidelines-macro-usage)
33
34
#endif
data_stream_include.h
src
data_stream_enum.h
Generated by
1.18.0