Potato Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
Archivable.hpp
Go to the documentation of this file.
1
2
#pragma once
3
4
#include <unordered_map>
5
#include <functional>
6
13
#define ARCHIVE_STATIC(type) \
14
static struct __##type##_Register { \
15
__##type##_Register() { \
16
__Archive::_GetArchive()[#type] = []() -> Archivable* { return new type(); }; \
17
} \
18
} __##type##_register;
19
27
class
Archivable
28
{
29
public
:
30
Archivable() =
default
;
31
virtual
~Archivable() =
default
;
32
};
33
34
using
__ArchiveType = std::unordered_map< std::string, std::function<
Archivable
*()> >;
35
36
namespace
__Archive {
37
inline
__ArchiveType& _GetArchive(){
38
static
__ArchiveType archive;
39
return
archive;
40
}
41
}
Archivable
Abstract factory class inherited by all classes that should be archived.
Definition
Archivable.hpp:28
Core
Datastore
Archivable.hpp
Generated by
1.17.0