X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=collectdisplay.h;fp=collectdisplay.h;h=71275737d24a437f09a97eefa528e7f30ed4a134;hb=20a2d0350a737a434c89f303662d64a8eeea7b05;hp=0000000000000000000000000000000000000000;hpb=bbb5879a7e566935c23d63d42bb945072424b939;p=mothur.git diff --git a/collectdisplay.h b/collectdisplay.h new file mode 100644 index 0000000..7127573 --- /dev/null +++ b/collectdisplay.h @@ -0,0 +1,54 @@ +#ifndef COLLECTDISPLAY_H +#define COLLECTDISPLAY_H + +#include "sabundvector.hpp" +#include "sharedsabundvector.h" +#include "calculator.h" +#include "fileoutput.h" +#include "display.h" +#include + +using namespace std; + +/***********************************************************************/ + +class CollectDisplay : public Display { + +public: + CollectDisplay(Calculator* calc, FileOutput* file) : estimate(calc), output(file) {timesCalled = 0;}; + ~CollectDisplay() { delete estimate; delete output; } + void update(SAbundVector* rank){ + nSeqs=rank->getNumSeqs(); + data = estimate->getValues(rank); + output->output(nSeqs, data); + }; + + void update(SharedRAbundVector* shared1, SharedRAbundVector* shared2, int numSeqs, int numGroupComb){ + timesCalled++; + data = estimate->getValues(shared1, shared2); //passes estimators a shared vector from each group to be compared + //fills groupdata with datas info + for (int i = 0; i < data.size(); i++) { + groupData.push_back(data[i]); + } + //when you get all your groups info then output + if ((timesCalled % numGroupComb) == 0) { + output->output(numSeqs, groupData); + groupData.clear(); + } + }; + + void init(string s) { output->initFile(s); }; + void reset() { output->resetFile(); }; + void close() { output->resetFile(); }; + +private: + Calculator* estimate; + FileOutput* output; + int nSeqs, timesCalled; + vector data; + vector groupData; +}; + +/***********************************************************************/ + +#endif \ No newline at end of file