From 5aa60be17d5ee1263c13f5b65190980f8d05e58e Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Fri, 15 May 2020 20:00:34 +0100 Subject: [PATCH] SerialisableClassName method for serialisable enum, and boolean to test if a serialisable object is an enum --- Grid/serialisation/MacroMagic.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Grid/serialisation/MacroMagic.h b/Grid/serialisation/MacroMagic.h index 7866327e..0495b91e 100644 --- a/Grid/serialisation/MacroMagic.h +++ b/Grid/serialisation/MacroMagic.h @@ -114,7 +114,8 @@ THE SOFTWARE. #define GRID_MACRO_WRITE_MEMBER(A,B) ::Grid::write(WR,#B,obj. B); #define GRID_SERIALIZABLE_CLASS_MEMBERS(cname,...)\ - std::string SerialisableClassName(void) const {return std::string(#cname);} \ +static inline std::string SerialisableClassName(void) {return std::string(#cname);} \ +static constexpr bool isEnum = false; \ GRID_MACRO_EVAL(GRID_MACRO_MAP(GRID_MACRO_MEMBER,__VA_ARGS__))\ template \ static inline void write(Writer &WR,const std::string &s, const cname &obj){ \ @@ -162,6 +163,8 @@ public:\ public:\ accelerator name(void) : value_(undefname) {}; \ accelerator name(int value): value_(value) {}; \ + static inline std::string SerialisableClassName(void) {return std::string(#name);}\ + static constexpr bool isEnum = true; \ template \ static inline void write(::Grid::Writer &WR,const std::string &s, const name &obj) \ {\