| 56 | } |
| 57 | |
| 58 | bool ModuleBuilder::DeregisterModuleClass(const std::string &class_name) { |
| 59 | // Check if the module builder exists |
| 60 | auto it = all_module_builders_holder().find(class_name); |
| 61 | if (it == all_module_builders_holder().end()) { |
| 62 | return false; |
| 63 | } |
| 64 | |
| 65 | // Check if any module of the class still exists |
| 66 | const ModuleBuilder *builder = &(it->second); |
| 67 | if (ModuleGraph::HasModuleOfClass(builder)) |
| 68 | return false; |
| 69 | |
| 70 | all_module_builders_holder().erase(it); |
| 71 | return true; |
| 72 | } |
| 73 | |
| 74 | std::map<std::string, ModuleBuilder> &ModuleBuilder::all_module_builders_holder( |
| 75 | bool reset) { |