X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=collectorscurvedata.h;fp=collectorscurvedata.h;h=e6f62785e221e1321aa21305f0c1b142e4e460e0;hb=20a2d0350a737a434c89f303662d64a8eeea7b05;hp=0000000000000000000000000000000000000000;hpb=bbb5879a7e566935c23d63d42bb945072424b939;p=mothur.git diff --git a/collectorscurvedata.h b/collectorscurvedata.h new file mode 100644 index 0000000..e6f6278 --- /dev/null +++ b/collectorscurvedata.h @@ -0,0 +1,66 @@ +#ifndef COLLECTORSCURVEDATA_H +#define COLLECTORSCURVEDATA_H + +#include +#include "sabundvector.hpp" +#include "sharedRAbundvector.h" +#include "display.h" +#include "observable.h" + +using namespace std; + +/***********************************************************************/ + +class CollectorsCurveData : public Observable { + +public: + CollectorsCurveData() : 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::iterator pos=displays.begin();pos!=displays.end();pos++){ + (*pos)->update(rank); + } + }; + +private: + set displays; + SAbundVector* rank; + +}; + +/***********************************************************************/ + + +class SharedCollectorsCurveData : public Observable { + +public: + SharedCollectorsCurveData() : 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(SharedRAbundVector* rv, SharedRAbundVector* rv2, int numSeqs, int numGroupComb) { shared1 = rv; shared2 = rv2; NumSeqs = numSeqs; NumGroupComb = numGroupComb; SharedDataChanged(); }; + + void notifyDisplays(){ + for(set::iterator pos=displays.begin();pos!=displays.end();pos++){ + (*pos)->update(shared1, shared2, NumSeqs, NumGroupComb); + } + }; + +private: + set displays; + SharedRAbundVector* shared1; + SharedRAbundVector* shared2; + int NumSeqs, NumGroupComb; +}; + +/***********************************************************************/ + +#endif +