Commit 0971ce9f authored by Mikaël Salson's avatar Mikaël Salson
Browse files

IKmerStore: Use a boolean to tell if the index has already been finished.

It prevents from finishing several times (which may cause some troubles)
parent 57eba383
...@@ -11,7 +11,10 @@ AbstractACAutomaton<Info>::AbstractACAutomaton():IKmerStore<Info>() {} ...@@ -11,7 +11,10 @@ AbstractACAutomaton<Info>::AbstractACAutomaton():IKmerStore<Info>() {}
template <class Info> template <class Info>
void AbstractACAutomaton<Info>::finish_building() { void AbstractACAutomaton<Info>::finish_building() {
build_failure_functions(); if (! IKmerStore<Info>::finished_building) {
IKmerStore<Info>::finish_building();
build_failure_functions();
}
} }
template<class Info> template<class Info>
......
...@@ -61,6 +61,7 @@ protected: ...@@ -61,6 +61,7 @@ protected:
string seed ; string seed ;
size_t nb_kmers_inserted; size_t nb_kmers_inserted;
size_t max_size_indexing; size_t max_size_indexing;
bool finished_building;
public: public:
...@@ -189,6 +190,7 @@ template<class T> ...@@ -189,6 +190,7 @@ template<class T>
IKmerStore<T>::IKmerStore() { IKmerStore<T>::IKmerStore() {
id = ++last_id; id = ++last_id;
refs = 0; refs = 0;
finished_building = false;
} }
template<class T> int IKmerStore<T>::last_id = 0; template<class T> int IKmerStore<T>::last_id = 0;
...@@ -330,7 +332,9 @@ void IKmerStore<T>::insert(const seqtype &sequence, ...@@ -330,7 +332,9 @@ void IKmerStore<T>::insert(const seqtype &sequence,
} }
template<class T> template<class T>
void IKmerStore<T>::finish_building() {} void IKmerStore<T>::finish_building() {
finished_building = true;
}
template<class T> template<class T>
float IKmerStore<T>::getIndexLoad(const T kmer) const { float IKmerStore<T>::getIndexLoad(const T kmer) const {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment