1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
#ifndef RAREFACTIONCURVEDATA_H
#define RAREFACTIONCURVEDATA_H
#include "mothur.h"
#include "sabundvector.hpp"
#include "display.h"
#include "observable.h"
/***********************************************************************/
class RarefactionCurveData : public Observable {
public:
RarefactionCurveData() : rank(0) {};
void registerDisplay(Display* o) { displays.insert(o); };
void removeDisplay(Display* o) { displays.erase(o); delete o; };
SAbundVector* getRankData() { return rank; };
void rankDataChanged() { notifyDisplays(); };
void updateRankData(SAbundVector* rv) { rank = rv; rankDataChanged(); };
void notifyDisplays(){
for(set<Display*>::iterator pos=displays.begin();pos!=displays.end();pos++){
(*pos)->update(rank);
}
};
private:
set<Display*> displays;
SAbundVector* rank;
};
/***********************************************************************/
class SharedRarefactionCurveData : public Observable {
public:
SharedRarefactionCurveData() {}; //: shared1(0), shared2(0)
void registerDisplay(Display* o) { displays.insert(o); };
void removeDisplay(Display* o) { displays.erase(o); delete o; };
void SharedDataChanged() { notifyDisplays(); };
void updateSharedData(vector<SharedRAbundVector*> r, int numSeqs, int numGroupComb) { shared = r; NumSeqs = numSeqs; NumGroupComb = numGroupComb; SharedDataChanged(); };
void notifyDisplays(){
for(set<Display*>::iterator pos=displays.begin();pos!=displays.end();pos++){
(*pos)->update(shared, NumSeqs, NumGroupComb);
}
};
private:
set<Display*> displays;
vector<SharedRAbundVector*> shared;
int NumSeqs, NumGroupComb;
};
/***********************************************************************/
#endif
|