Commit 62133d1d authored by Mikaël Salson's avatar Mikaël Salson

core/read_storage: Add private __init and free_objects

This will help to reuse those functions elsewhere in the code

See #3393
parent de494035
......@@ -17,6 +17,10 @@ BinReadStorage::BinReadStorage()
nb_inserted(0), nb_stored(0), smallest_bin_not_empty(~0),label(),inited(false) {}
void BinReadStorage::init(size_t nb_bins, size_t max_score, const VirtualReadScore *vrs, bool no_list) {
__init(nb_bins, max_score, vrs, no_list);
}
void BinReadStorage::__init(size_t nb_bins, size_t max_score, const VirtualReadScore *vrs, bool no_list) {
this->all_read_lengths = 0;
if (inited)
return;
......@@ -38,6 +42,10 @@ void BinReadStorage::init(size_t nb_bins, size_t max_score, const VirtualReadSco
}
BinReadStorage::~BinReadStorage() {
free_objects();
}
void BinReadStorage::free_objects() {
if (bins)
delete [] bins;
if (score_bins) {
......
......@@ -94,6 +94,17 @@ public:
*/
void init(size_t nb_bins, size_t max_score, const VirtualReadScore *vrs, bool no_list = false);
private:
/**
* Private function used by init() that actually does the job. It actually creates the number of bins
* given in parameter.
*/
void __init(size_t nb_bins, size_t max_score, const VirtualReadScore *vrs, bool no_list = false);
void free_objects();
public:
~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