diff options
Diffstat (limited to 'decoder/ff_factory.h')
-rw-r--r-- | decoder/ff_factory.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/decoder/ff_factory.h b/decoder/ff_factory.h index 102e709c..5eb68c8b 100644 --- a/decoder/ff_factory.h +++ b/decoder/ff_factory.h @@ -42,7 +42,9 @@ struct FactoryBase : public UntypedFactory { template<class FF> struct FFFactory : public FactoryBase<FeatureFunction> { FP Create(std::string param) const { - return FP(new FF(param)); + FF *ret=new FF(param); + ret->Init(); + return FP(ret); } virtual std::string usage(bool params,bool verbose) const { return FF::usage(params,verbose); @@ -54,7 +56,9 @@ struct FFFactory : public FactoryBase<FeatureFunction> { template<class FF> struct FsaFactory : public FactoryBase<FsaFeatureFunction> { FP Create(std::string param) const { - return FP(new FF(param)); + FF *ret=new FF(param); + ret->Init(); + return FP(ret); } virtual std::string usage(bool params,bool verbose) const { return FF::usage(params,verbose); @@ -94,8 +98,8 @@ struct FactoryRegistry : public UntypedFactoryRegistry { if (debug) cerr<<"debug enabled for "<<ffname<< " - remaining options: '"<<param<<"'\n"; FP res = dynamic_cast<FB const&>(*it->second).Create(param); - res->name_ = ffname; - res->debug_ = debug; + res->init_name_debug(ffname,debug); + // could add a res->Init() here instead of in Create if we wanted feature id to potentially differ based on the registered name rather than static usage() - of course, specific feature ids can be computed on the basis of feature param as well; this only affects the default single feature id=name return res; } }; |