Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
Registrar.h
Go to the documentation of this file.
1// Registrar.h
2#pragma once
3#include <plog/Log.h>
4#include "Factory.h"
6
7namespace EngineCore {
8
9 template<typename T>
10 struct Registrar {
12 std::string typeName = getTypeName<T>();
13
15 typeName,
16 []() -> std::unique_ptr<Serializable> { return std::make_unique<T>(); },
17 []() -> nlohmann::json {
18 PLOGI << "Creating default JSON for " << getTypeName<T>();
20 }
21 );
22
24 PLOGI << "Registered type: " << typeName;
25 }
26 };
27}
static DefaultJsonGenerator & getInstance()
static void registerType(const std::string &typeName, CreateFunction creator, JsonFactory jsonFactory)
Definition Factory.h:20
static void addRegisteredType(const std::string &typeName)
Definition Factory.h:83
Log category system implementation.
std::string getTypeName()
Definition Factory.h:93