From aaac9f8ee73ba59b72609af9a78b167312a6dac7 Mon Sep 17 00:00:00 2001 From: graehl Date: Sat, 7 Aug 2010 02:24:51 +0000 Subject: propagation of feature name+debug from factory, return correct features array for fsa ffs git-svn-id: https://ws10smt.googlecode.com/svn/trunk@486 ec762483-ff6d-05da-a07a-a48fb63a330f --- decoder/ff_factory.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'decoder/ff_factory.h') 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 struct FFFactory : public FactoryBase { 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 { template struct FsaFactory : public FactoryBase { 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 "<(*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; } }; -- cgit v1.2.3