|
11 | 11 | #include <stdcorelib/pimpl.h> |
12 | 12 | #include <stdcorelib/str.h> |
13 | 13 |
|
| 14 | +#include <synthrt/G2P/Base/LangCommon.h> |
14 | 15 | #include <synthrt/G2P/Package/Package.h> |
15 | 16 | #include <synthrt/G2P/Support/ContextUtils.h> |
16 | 17 | #include <synthrt/G2P/Support/Error.h> |
@@ -76,6 +77,20 @@ namespace srt::g2p { |
76 | 77 | const srt::core::JsonValue &config) const override; |
77 | 78 | }; |
78 | 79 |
|
| 80 | + /// Concrete ModuleCategory for the "driver" category. |
| 81 | + /// Hosts register G2P driver factories (e.g. g2pOnnxDriver) here via |
| 82 | + /// addObject() before Manager::initialize(). Drivers are registered |
| 83 | + /// programmatically, not parsed from package.json, so parseSpec uses |
| 84 | + /// the default NotImplemented behavior. |
| 85 | + class DriverCategory : public srt::core::ModuleCategory { |
| 86 | + public: |
| 87 | + explicit DriverCategory(void *mgr) |
| 88 | + : srt::core::ModuleCategory(kDriverCategory, mgr) {} |
| 89 | + |
| 90 | + std::string key() const override { return kDriverCategory; } |
| 91 | + std::string category() const override { return kDriverCategory; } |
| 92 | + }; |
| 93 | + |
79 | 94 | /// Load a config file referenced by "configuration" in a module entry. |
80 | 95 | /// Returns the inner "configuration" sub-object and updates apiLevel. |
81 | 96 | /// This is a free helper (no friend access needed - only uses public JSON API). |
@@ -216,8 +231,9 @@ namespace srt::g2p { |
216 | 231 | } // namespace |
217 | 232 |
|
218 | 233 | PackageManager::Impl::Impl(PackageManager *decl) : decl(decl) { |
219 | | - categories["g2p"] = new G2pCategory(decl); |
220 | | - categories["dict"] = new DictCategory(decl); |
| 234 | + categories[kG2pCategory] = new G2pCategory(decl); |
| 235 | + categories[kDictCategory] = new DictCategory(decl); |
| 236 | + categories[kDriverCategory] = new DriverCategory(decl); |
221 | 237 | } |
222 | 238 |
|
223 | 239 | PackageManager::Impl::~Impl() { |
|
0 commit comments