diff options
Diffstat (limited to 'contrib/moses2/FF/FeatureRegistry.h')
-rw-r--r-- | contrib/moses2/FF/FeatureRegistry.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/contrib/moses2/FF/FeatureRegistry.h b/contrib/moses2/FF/FeatureRegistry.h new file mode 100644 index 000000000..065820ea7 --- /dev/null +++ b/contrib/moses2/FF/FeatureRegistry.h @@ -0,0 +1,48 @@ +#pragma once +#include <boost/unordered_map.hpp> +#include <boost/shared_ptr.hpp> + +namespace Moses2 +{ +class FeatureFunction; + +//////////////////////////////////////////////////////////////////// +class FeatureFactory +{ +public: + virtual ~FeatureFactory() + { + } + + virtual FeatureFunction *Create(size_t startInd, const std::string &line) = 0; + +protected: + FeatureFactory() + { + } +}; + +//////////////////////////////////////////////////////////////////// +class FeatureRegistry +{ +public: + FeatureRegistry(); + + ~FeatureRegistry(); + + FeatureFunction *Construct(size_t startInd, const std::string &name, + const std::string &line); + void PrintFF() const; + +private: + void Add(const std::string &name, FeatureFactory *factory); + + typedef boost::unordered_map<std::string, boost::shared_ptr<FeatureFactory> > Map; + + Map registry_; +}; + +//////////////////////////////////////////////////////////////////// + +} + |