Commit 2c916ebe authored by Cyprien Borée's avatar Cyprien Borée Committed by Mikaël Salson

core/read_storage: Add reallocate method

Will be called when not all the reads can be stored.
parent ac03a391
......@@ -42,6 +42,25 @@ void BinReadStorage::__init(size_t nb_bins, size_t max_score, const VirtualReadS
inited=true;
}
void BinReadStorage::reallocate(){
list<Sequence> tmpBin;
if (bins)
tmpBin = bins[0];
free_objects();
all_read_lengths = 0;
smallest_bin_not_empty = ~0;
total_nb_scores = 0;
nb_stored = 0;
inited = false;
__init(max_bins, max_score, scorer, tmpBin.size() == 0);
for(auto s : tmpBin){
this->add(s);
}
nb_inserted -= nb_stored;
}
BinReadStorage::~BinReadStorage() {
free_objects();
}
......
......@@ -107,7 +107,13 @@ public:
public:
/**
* If the bin is full we need, the storage needs to be reallocated to have more memory.
*/
void reallocate();
~BinReadStorage();
void add(Sequence &s);
......
Markdown is supported
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