openMSX
Classes | Namespaces | Macros | Functions
serialize_meta.hh File Reference
#include "hash_map.hh"
#include "xxhash.hh"
#include <memory>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <utility>
#include <vector>
Include dependency graph for serialize_meta.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  openmsx::Creator< T >
 Utility to do T* t = new T(...) More...
 
struct  openmsx::MapConstrArgsEmpty< Base >
 
struct  openmsx::MapConstrArgsCopy< Base, Derived >
 
struct  openmsx::MapConstructorArguments< Base, Derived >
 Define mapping between constructor arg list of base- and subclass. More...
 
class  openmsx::PolymorphicSaverRegistry< Archive >
 
class  openmsx::PolymorphicLoaderRegistry< Archive >
 
class  openmsx::PolymorphicInitializerRegistry< Archive >
 
struct  openmsx::RegisterSaverHelper< Archive, T >
 
struct  openmsx::RegisterLoaderHelper< Archive, T >
 
struct  openmsx::RegisterInitializerHelper< Archive, T >
 
struct  openmsx::SerializeClassVersion< T >
 Store serialization-version number of a class. More...
 

Namespaces

namespace  openmsx
 This file implemented 3 utility functions:
 

Macros

#define REGISTER_CONSTRUCTOR_ARGS_0(C)
 
#define REGISTER_CONSTRUCTOR_ARGS_1(C, T1)
 
#define REGISTER_CONSTRUCTOR_ARGS_2(C, T1, T2)
 
#define REGISTER_CONSTRUCTOR_ARGS_3(C, T1, T2, T3)
 
#define REGISTER_POLYMORPHIC_CLASS_HELPER(B, C, N)
 
#define REGISTER_POLYMORPHIC_INITIALIZER_HELPER(B, C, N)
 
#define REGISTER_BASE_NAME_HELPER(B, N)
 
#define REGISTER_POLYMORPHIC_CLASS(BASE, CLASS, NAME)
 
#define REGISTER_POLYMORPHIC_CLASS_1(BASE, CLASS, NAME, TYPE1)
 
#define REGISTER_POLYMORPHIC_CLASS_2(BASE, CLASS, NAME, TYPE1, TYPE2)
 
#define REGISTER_POLYMORPHIC_CLASS_3(BASE, CLASS, NAME, TYPE1, TYPE2, TYPE3)
 
#define REGISTER_BASE_CLASS(CLASS, NAME)
 
#define REGISTER_BASE_CLASS_1(CLASS, NAME, TYPE1)
 
#define REGISTER_BASE_CLASS_2(CLASS, NAME, TYPE1, TYPE2)
 
#define REGISTER_BASE_CLASS_3(CLASS, NAME, TYPE1, TYPE2, TYPE3)
 
#define REGISTER_POLYMORPHIC_INITIALIZER(BASE, CLASS, NAME)    REGISTER_POLYMORPHIC_INITIALIZER_HELPER(BASE,CLASS,NAME)
 
#define SERIALIZE_CLASS_VERSION(CLASS, VERSION)
 

Functions

void openmsx::polyInitError (const char *expected, const char *actual)
 

Macro Definition Documentation

◆ REGISTER_BASE_CLASS

#define REGISTER_BASE_CLASS (   CLASS,
  NAME 
)
Value:
REGISTER_CONSTRUCTOR_ARGS_0(CLASS)
#define REGISTER_BASE_NAME_HELPER(B, N)

Definition at line 348 of file serialize_meta.hh.

◆ REGISTER_BASE_CLASS_1

#define REGISTER_BASE_CLASS_1 (   CLASS,
  NAME,
  TYPE1 
)
Value:
REGISTER_CONSTRUCTOR_ARGS_1(CLASS,TYPE1)

Definition at line 352 of file serialize_meta.hh.

◆ REGISTER_BASE_CLASS_2

#define REGISTER_BASE_CLASS_2 (   CLASS,
  NAME,
  TYPE1,
  TYPE2 
)
Value:
REGISTER_CONSTRUCTOR_ARGS_2(CLASS,TYPE1,TYPE2)

Definition at line 356 of file serialize_meta.hh.

◆ REGISTER_BASE_CLASS_3

#define REGISTER_BASE_CLASS_3 (   CLASS,
  NAME,
  TYPE1,
  TYPE2,
  TYPE3 
)
Value:
REGISTER_CONSTRUCTOR_ARGS_3(CLASS,TYPE1,TYPE2,TYPE3)

Definition at line 360 of file serialize_meta.hh.

◆ REGISTER_BASE_NAME_HELPER

#define REGISTER_BASE_NAME_HELPER (   B,
 
)
Value:
template<> struct BaseClassName<B> \
{ static const char* getName() { static constexpr const char* const name = N; return name; } };

Definition at line 325 of file serialize_meta.hh.

◆ REGISTER_CONSTRUCTOR_ARGS_0

#define REGISTER_CONSTRUCTOR_ARGS_0 (   C)
Value:
template<> struct PolymorphicConstructorArgs<C> \
{ using type = std::tuple<>; };

Definition at line 280 of file serialize_meta.hh.

◆ REGISTER_CONSTRUCTOR_ARGS_1

#define REGISTER_CONSTRUCTOR_ARGS_1 (   C,
  T1 
)
Value:
template<> struct PolymorphicConstructorArgs<C> \
{ using type = std::tuple<T1>; };

Definition at line 284 of file serialize_meta.hh.

◆ REGISTER_CONSTRUCTOR_ARGS_2

#define REGISTER_CONSTRUCTOR_ARGS_2 (   C,
  T1,
  T2 
)
Value:
template<> struct PolymorphicConstructorArgs<C> \
{ using type = std::tuple<T1,T2>; };

Definition at line 288 of file serialize_meta.hh.

◆ REGISTER_CONSTRUCTOR_ARGS_3

#define REGISTER_CONSTRUCTOR_ARGS_3 (   C,
  T1,
  T2,
  T3 
)
Value:
template<> struct PolymorphicConstructorArgs<C> \
{ using type = std::tuple<T1,T2,T3>; };

Definition at line 292 of file serialize_meta.hh.

◆ REGISTER_POLYMORPHIC_CLASS

#define REGISTER_POLYMORPHIC_CLASS (   BASE,
  CLASS,
  NAME 
)
Value:
REGISTER_CONSTRUCTOR_ARGS_0(CLASS)
#define REGISTER_POLYMORPHIC_CLASS_HELPER(B, C, N)

Definition at line 332 of file serialize_meta.hh.

◆ REGISTER_POLYMORPHIC_CLASS_1

#define REGISTER_POLYMORPHIC_CLASS_1 (   BASE,
  CLASS,
  NAME,
  TYPE1 
)
Value:
REGISTER_CONSTRUCTOR_ARGS_1(CLASS,TYPE1)

Definition at line 336 of file serialize_meta.hh.

◆ REGISTER_POLYMORPHIC_CLASS_2

#define REGISTER_POLYMORPHIC_CLASS_2 (   BASE,
  CLASS,
  NAME,
  TYPE1,
  TYPE2 
)
Value:
REGISTER_CONSTRUCTOR_ARGS_2(CLASS,TYPE1,TYPE2)

Definition at line 340 of file serialize_meta.hh.

◆ REGISTER_POLYMORPHIC_CLASS_3

#define REGISTER_POLYMORPHIC_CLASS_3 (   BASE,
  CLASS,
  NAME,
  TYPE1,
  TYPE2,
  TYPE3 
)
Value:
REGISTER_CONSTRUCTOR_ARGS_3(CLASS,TYPE1,TYPE2,TYPE3)

Definition at line 344 of file serialize_meta.hh.

◆ REGISTER_POLYMORPHIC_CLASS_HELPER

#define REGISTER_POLYMORPHIC_CLASS_HELPER (   B,
  C,
 
)
Value:
static_assert(std::is_base_of_v<B,C>, "must be base and sub class"); \
static const RegisterLoaderHelper<MemInputArchive, C> registerHelper3##C(N); \
static const RegisterSaverHelper <MemOutputArchive, C> registerHelper4##C(N); \
static const RegisterLoaderHelper<XmlInputArchive, C> registerHelper5##C(N); \
static const RegisterSaverHelper <XmlOutputArchive, C> registerHelper6##C(N); \
template<> struct PolymorphicBaseClass<C> { using type = B; };

Definition at line 309 of file serialize_meta.hh.

◆ REGISTER_POLYMORPHIC_INITIALIZER

#define REGISTER_POLYMORPHIC_INITIALIZER (   BASE,
  CLASS,
  NAME 
)     REGISTER_POLYMORPHIC_INITIALIZER_HELPER(BASE,CLASS,NAME)

Definition at line 365 of file serialize_meta.hh.

◆ REGISTER_POLYMORPHIC_INITIALIZER_HELPER

#define REGISTER_POLYMORPHIC_INITIALIZER_HELPER (   B,
  C,
 
)
Value:
static_assert(std::is_base_of_v<B,C>, "must be base and sub class"); \
static const RegisterInitializerHelper<MemInputArchive, C> registerHelper3##C(N); \
static const RegisterSaverHelper <MemOutputArchive, C> registerHelper4##C(N); \
static const RegisterInitializerHelper<XmlInputArchive, C> registerHelper5##C(N); \
static const RegisterSaverHelper <XmlOutputArchive, C> registerHelper6##C(N); \
template<> struct PolymorphicBaseClass<C> { using type = B; };

Definition at line 317 of file serialize_meta.hh.

◆ SERIALIZE_CLASS_VERSION

#define SERIALIZE_CLASS_VERSION (   CLASS,
  VERSION 
)
Value:
template<> struct SerializeClassVersion<CLASS> \
{ \
static constexpr unsigned value = VERSION; \
};

Definition at line 389 of file serialize_meta.hh.