Skip to content

Commit

Permalink
Make clear() be initialize() and add a new clear() that clears existi…
Browse files Browse the repository at this point in the history
…ng data.
  • Loading branch information
brianwalenz committed Sep 13, 2017
1 parent dfff4ab commit 4a38db3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
35 changes: 22 additions & 13 deletions src/stores/ovStoreHistogram.C
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ using namespace std;


void
ovStoreHistogram::clear(gkStore *gkp) {
ovStoreHistogram::initialize(gkStore *gkp) {
_gkp = gkp;

_maxOlength = 0;
Expand Down Expand Up @@ -60,21 +60,38 @@ ovStoreHistogram::clear(gkStore *gkp) {



void
ovStoreHistogram::clear(void) {

if (_opel)
for (uint32 ii=0; ii<AS_MAX_EVALUE + 1; ii++)
delete [] _opel[ii];

delete [] _opel;
delete [] _opr;
delete [] _scoresList;
delete [] _scores;

initialize(_gkp);
}



ovStoreHistogram::ovStoreHistogram() {
clear();
initialize();
}



ovStoreHistogram::ovStoreHistogram(char *path) {
clear();
initialize();
loadData(path);
}



ovStoreHistogram::ovStoreHistogram(gkStore *gkp, ovFileType type) {
clear(gkp);
initialize(gkp);

// When writing full overlaps out of an overlapper (ovFileFullWrite) we want
// to keep track of the number of overlaps per read. We could pre-allocate
Expand Down Expand Up @@ -140,15 +157,7 @@ ovStoreHistogram::ovStoreHistogram(gkStore *gkp, ovFileType type) {


ovStoreHistogram::~ovStoreHistogram() {

if (_opel)
for (uint32 ii=0; ii<AS_MAX_EVALUE + 1; ii++)
delete [] _opel[ii];

delete [] _opel;
delete [] _opr;
delete [] _scoresList;
delete [] _scores;
clear();
}


Expand Down
4 changes: 3 additions & 1 deletion src/stores/ovStoreHistogram.H
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ public:

class ovStoreHistogram {
private:
void clear(gkStore *gkp=NULL);
void initialize(gkStore *gkp=NULL);
public:
void clear(void);

public:
ovStoreHistogram(); // Used when loading data, user must loadData() later
Expand Down

0 comments on commit 4a38db3

Please sign in to comment.