feat(mcp): Finalize C/C++ AST tools with robust testing and bug fixes
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
#include "component_registry.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace gencpp {
|
||||
namespace registry {
|
||||
|
||||
ComponentRegistry& ComponentRegistry::Instance() {
|
||||
static ComponentRegistry instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void ComponentRegistry::Register(const std::string& type, ComponentCreator creator) {
|
||||
std::cout << "Registering component type: " << type << std::endl;
|
||||
m_creators[type] = creator;
|
||||
}
|
||||
|
||||
std::unique_ptr<core::BaseComponent<void*>> ComponentRegistry::Create(const std::string& type) {
|
||||
auto it = m_creators.find(type);
|
||||
if (it != m_creators.end()) {
|
||||
return it->second();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace registry
|
||||
} // namespace gencpp
|
||||
Reference in New Issue
Block a user