27 #define KRATOS_REGISTRY_NAME_(A,B) A##B
28 #define KRATOS_REGISTRY_NAME(A,B) KRATOS_REGISTRY_NAME_(A,B)
43 #define KRATOS_REGISTRY_ADD_PROTOTYPE(NAME, X, Y) \
44 static inline bool KRATOS_REGISTRY_NAME(_is_registered_, __LINE__) = []() -> bool { \
45 using TFunctionType = std::function<std::shared_ptr<X>()>; \
46 std::string key_name = NAME + std::string(".") + std::string(#Y); \
47 if (!Registry::HasItem(key_name)) \
49 auto &r_item = Registry::AddItem<RegistryItem>(key_name); \
50 TFunctionType dispatcher = [](){return std::make_shared<Y>();}; \
51 r_item.AddItem<TFunctionType>("Prototype", std::move(dispatcher)); \
53 return Registry::HasItem(key_name); \
56 #define KRATOS_REGISTRY_ADD_TEMPLATE_PROTOTYPE(NAME, X, Y, ...) \
57 static inline bool KRATOS_REGISTRY_NAME(_is_registered_, __LINE__) = []() -> bool { \
58 using TFunctionType = std::function<std::shared_ptr<X>()>; \
59 std::string key_name = NAME + std::string(".") + std::string(#Y) + "<" + Kratos::Registry::RegistryTemplateToString(__VA_ARGS__) + ">"; \
60 if (!Registry::HasItem(key_name)) \
62 auto &r_item = Registry::AddItem<RegistryItem>(key_name); \
63 TFunctionType dispatcher = [](){return std::make_shared<Y<__VA_ARGS__>>();}; \
64 r_item.AddItem<TFunctionType>("Prototype", std::move(dispatcher)); \
67 return Registry::HasItem(key_name); \