summaryrefslogtreecommitdiff
path: root/quackleio/gaddagfactory.h
diff options
context:
space:
mode:
authorJohn Fultz <jfultz@wolfram.com>2015-08-24 04:45:27 -0500
committerJohn Fultz <jfultz@wolfram.com>2015-08-24 04:45:46 -0500
commit1f7b8ef6f96e1d5a2c50565a0f52cc633215e485 (patch)
tree11f406677824d20924748225ab7eb129ba929cd0 /quackleio/gaddagfactory.h
parent8c7ffef1b6c669592e979fb6038dd634df7f95fc (diff)
Version the GADDAGs.
Basically the same thing I just did to the DAWG files, now done to GADDAGs. Also, add hashing, and make sure GADDAGs only load if their hash matches that of the DAWG files.
Diffstat (limited to 'quackleio/gaddagfactory.h')
-rw-r--r--quackleio/gaddagfactory.h23
1 files changed, 13 insertions, 10 deletions
diff --git a/quackleio/gaddagfactory.h b/quackleio/gaddagfactory.h
index 9eb8d72..2d21192 100644
--- a/quackleio/gaddagfactory.h
+++ b/quackleio/gaddagfactory.h
@@ -30,13 +30,14 @@ public:
GaddagFactory(const QString& alphabetFile);
~GaddagFactory();
- int wordCount() const { return gaddagizedWords.size(); };
- int nodeCount() const { return nodelist.size(); };
+ int wordCount() const { return m_gaddagizedWords.size(); };
+ int nodeCount() const { return m_nodelist.size(); };
int encodableWords() const { return m_encodableWords; };
int unencodableWords() const { return m_unencodableWords; };
bool pushWord(const QString& word);
- void sortWords() { sort(gaddagizedWords.begin(), gaddagizedWords.end()); };
+ void hashWord(const Quackle::LetterString &word);
+ void sortWords() { sort(m_gaddagizedWords.begin(), m_gaddagizedWords.end()); };
void generate();
void writeIndex(const QString& fname);
@@ -49,17 +50,19 @@ private:
int pointer;
bool lastchild;
void pushWord(const Quackle::LetterString& word);
- void print(vector< Node* >& nodelist);
+ void print(vector< Node* >& m_nodelist);
};
int m_encodableWords;
int m_unencodableWords;
- Quackle::WordList gaddagizedWords;
- vector< Node* > nodelist;
- Quackle::AlphabetParameters *alphas;
- Node root;
-
-
+ Quackle::WordList m_gaddagizedWords;
+ vector< Node* > m_nodelist;
+ Quackle::AlphabetParameters *m_alphas;
+ Node m_root;
+ union {
+ char charptr[16];
+ int32_t int32ptr[4];
+ } m_hash;
};
#endif