This commit is contained in:
2025-05-13 02:50:08 +03:00
parent 20b4502be5
commit 9af2bb814e
102 changed files with 259423 additions and 2 deletions
+21
View File
@@ -0,0 +1,21 @@
#include "ObjectsFactory.h"
void ObjectsFactory::register_factory(factory_function factory, const std::wstring& class_name) {
_factory_functions[class_name] = factory;
}
ObjectsFactory& ObjectsFactory::instance()
{
static ObjectsFactory instance;
return instance;
}
std::shared_ptr<Object> ObjectsFactory::create_object(const std::wstring& class_name) const {
try {
return _factory_functions.at(class_name)();
} catch (...) {
return nullptr;
}
}