summaryrefslogtreecommitdiff
path: root/decoder/ff_factory.cc
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-07 00:31:04 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-07 00:31:04 +0000
commite2ef62dc50b9795fc801f97aba7bac8c80bb7c54 (patch)
tree7a9f07d86555c4214c794beaeb3a8e105ed0a0f8 /decoder/ff_factory.cc
parenta59730198f86abaf2872d07de149b0b21a120a8b (diff)
usage for FSA features
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@485 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/ff_factory.cc')
-rw-r--r--decoder/ff_factory.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/decoder/ff_factory.cc b/decoder/ff_factory.cc
index b3aeeac1..767cc675 100644
--- a/decoder/ff_factory.cc
+++ b/decoder/ff_factory.cc
@@ -2,6 +2,7 @@
#include "ff.h"
#include "stringlib.h"
+#include <stdexcept>
using boost::shared_ptr;
using namespace std;
@@ -27,6 +28,10 @@ bool UntypedFactoryRegistry::parse_debug(std::string & param) {
return debug;
}
+bool UntypedFactoryRegistry::have(std::string const& ffname) {
+ return reg_.find(ffname)!=reg_.end();
+}
+
void UntypedFactoryRegistry::DisplayList() const {
for (Factmap::const_iterator it = reg_.begin();
it != reg_.end(); ++it) {
@@ -75,3 +80,15 @@ struct null_deleter
boost::shared_ptr<FsaFFRegistry> global_fsa_ff_registry(&fsa_ff_registry,null_deleter());
boost::shared_ptr<FFRegistry> global_ff_registry(&ff_registry,null_deleter());
*/
+
+void ff_usage(std::string const& n,std::ostream &out)
+{
+ bool have=ff_registry.have(n);
+ if (have)
+ cout<<"FF "<<ff_registry.usage(n,true,true)<<endl;
+ if (fsa_ff_registry.have(n))
+ cout<<"Fsa FF "<<fsa_ff_registry.usage(n,true,true)<<endl;
+ else if (!have)
+ throw std::runtime_error("Unknown feature "+n);
+}
+