diff options
author | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-07 00:07:45 +0000 |
---|---|---|
committer | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-07 00:07:45 +0000 |
commit | 83654f58e1f5f5518ac0e30ad354eebda67fa774 (patch) | |
tree | ac9fe9f7bc495b4e6a89d07e081ced252d8282ea /decoder/ff_fsa_data.h | |
parent | 784f179f1320220a73506d60a7711a9020c0b3d7 (diff) |
dynamic fsa ff, factory for fsa and ff shares code, factory moved to ff_factory.cc
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@483 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/ff_fsa_data.h')
-rwxr-xr-x | decoder/ff_fsa_data.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/decoder/ff_fsa_data.h b/decoder/ff_fsa_data.h index 66d2cca8..3252c5ac 100755 --- a/decoder/ff_fsa_data.h +++ b/decoder/ff_fsa_data.h @@ -9,11 +9,19 @@ typedef ValueArray<uint8_t> Bytes; -// stuff I see no reason to have virtual. +// stuff I see no reason to have virtual. but there's a diamond inheritance problem to solve now when type erasing the CRTP impl wrapper. virtual inheritance would slow things? struct FsaFeatureFunctionData { + //HACK for diamond inheritance (w/o costing performance) + FsaFeatureFunctionData *sync_to_; + + void sync() const { // call this if you modify any fields after your constructor is done + if (sync_to_) *sync_to_=*this; + } + FsaFeatureFunctionData(int statesz=0,Sentence const& end_sentence_phrase=Sentence()) : ssz(statesz),start(statesz),h_start(statesz),end_phrase_(end_sentence_phrase) { debug_=true; + sync_to_=0; } std::string name_; @@ -65,6 +73,7 @@ protected: int ssz; // don't forget to set this. default 0 (it may depend on params of course) Bytes start,h_start; // start state and estimated-features (heuristic) start state. set these. default empty. Sentence end_phrase_; // words appended for final traversal (final state cost is assessed using Scan) e.g. "</s>" for lm. + // this can be called instead or after constructor (also set bytes and end_phrase_) void set_state_bytes(int sb=0) { if (start.size()!=sb) start.resize(sb); if (h_start.size()!=sb) h_start.resize(sb); |