| 6 | namespace minitts::app { |
| 7 | |
| 8 | void AppPipelineRegistry::add(std::unique_ptr<IAppPipeline> pipeline) { |
| 9 | if (pipeline == nullptr) { |
| 10 | throw std::runtime_error("cannot register a null app pipeline"); |
| 11 | } |
| 12 | const std::string id = pipeline->id(); |
| 13 | if (id.empty()) { |
| 14 | throw std::runtime_error("app pipeline id must not be empty"); |
| 15 | } |
| 16 | const auto [_, inserted] = pipelines_.emplace(id, std::move(pipeline)); |
| 17 | if (!inserted) { |
| 18 | throw std::runtime_error("duplicate app pipeline id: " + id); |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | const IAppPipeline & AppPipelineRegistry::require(std::string_view id) const { |
| 23 | const auto it = pipelines_.find(std::string(id)); |
no test coverage detected