openMSX
Classes | Namespaces | Macros | Functions
serialize_meta.hh File Reference
#include "hash_map.hh"
#include "likely.hh"
#include "memory.hh"
#include "type_traits.hh"
#include "xxhash.hh"
#include <tuple>
#include <typeindex>
#include <type_traits>
#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

class  openmsx::Creator< T >
 Utility to do T* t = new T(...) More...
 
struct  openmsx::ClassSaver< T >
 
struct  openmsx::NonPolymorphicPointerLoader< T >
 
struct  openmsx::ClassLoader< T >
 
struct  openmsx::PolymorphicConstructorArgs< T >
 Store association between polymorphic class (base- or subclass) and the list of constructor arguments. More...
 
struct  openmsx::PolymorphicBaseClass< T >
 Store association between (polymorphic) sub- and baseclass. 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...
 
struct  openmsx::BaseClassName< Base >
 Stores the name of a base class. More...
 
class  openmsx::PolymorphicSaverBase< Archive >
 
class  openmsx::PolymorphicLoaderBase< Archive >
 
class  openmsx::PolymorphicInitializerBase< Archive >
 
class  openmsx::PolymorphicSaver< Archive, T >
 
class  openmsx::PolymorphicLoader< Archive, T >
 
class  openmsx::PolymorphicInitializer< Archive, T >
 
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

 openmsx
 Thanks to enen for testing this on a real cartridge:
 

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 407 of file serialize_meta.hh.

◆ REGISTER_BASE_CLASS_1

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

Definition at line 411 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)
#define REGISTER_BASE_NAME_HELPER(B, N)

Definition at line 415 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)
#define REGISTER_BASE_NAME_HELPER(B, N)

Definition at line 419 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 const char* name = N; return name; } };
const string getName(KeyCode keyCode)
Translate key code to key name.
Definition: Keys.cc:373

Definition at line 384 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 339 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 343 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 347 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 351 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 391 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)
#define REGISTER_POLYMORPHIC_CLASS_HELPER(B, C, N)

Definition at line 395 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)
#define REGISTER_POLYMORPHIC_CLASS_HELPER(B, C, N)

Definition at line 399 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)
#define REGISTER_POLYMORPHIC_CLASS_HELPER(B, C, N)

Definition at line 403 of file serialize_meta.hh.

◆ REGISTER_POLYMORPHIC_CLASS_HELPER

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

Definition at line 368 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 424 of file serialize_meta.hh.

◆ REGISTER_POLYMORPHIC_INITIALIZER_HELPER

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

Definition at line 376 of file serialize_meta.hh.

◆ SERIALIZE_CLASS_VERSION

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

Definition at line 448 of file serialize_meta.hh.

Referenced by openmsx::XMLElement::hasChildren().