1 #ifndef COLLECTORSCURVEDATA_H
2 #define COLLECTORSCURVEDATA_H
4 #include "sabundvector.hpp"
5 #include "sharedrabundvector.h"
7 #include "observable.h"
10 /***********************************************************************/
12 class CollectorsCurveData : public Observable {
15 CollectorsCurveData() : rank(0) {};
17 void registerDisplay(Display* o) { displays.insert(o); };
18 void removeDisplay(Display* o) { displays.erase(o); delete o; };
19 SAbundVector* getRankData() { return rank; };
20 void rankDataChanged() { notifyDisplays(); };
21 void updateRankData(SAbundVector* rv) { rank = rv; rankDataChanged(); };
23 void notifyDisplays(){
24 for(set<Display*>::iterator pos=displays.begin();pos!=displays.end();pos++){
30 set<Display*> displays;
35 /***********************************************************************/
38 class SharedCollectorsCurveData : public Observable {
41 SharedCollectorsCurveData() { }; //: shared1(0), shared2(0)
43 void registerDisplay(Display* o) { displays.insert(o); };
44 void removeDisplay(Display* o) { displays.erase(o); delete o; };
45 void SharedDataChanged() { notifyDisplays(); };
46 void updateSharedData(vector<SharedRAbundVector*> s, int numSeqs, int numGroupComb, bool p) { pairs = p; shared = s; NumSeqs = numSeqs; NumGroupComb = numGroupComb; SharedDataChanged(); };
48 void notifyDisplays(){
49 for(set<Display*>::iterator pos=displays.begin();pos!=displays.end();pos++){
51 if ((*pos)->calcNeedsAll() == true) {
52 (*pos)->update(shared, NumSeqs, NumGroupComb);
55 if ( ((*pos)->isCalcMultiple() == true) && ((*pos)->getAll() == true) && (!pairs) ) {
56 (*pos)->update(shared, NumSeqs, NumGroupComb);
58 vector<SharedRAbundVector*> temp; temp.push_back(shared[0]); temp.push_back(shared[1]);
61 (*pos)->update(shared, NumSeqs, NumGroupComb);
68 set<Display*> displays;
69 vector<Display*> multiDisplays;
70 vector<SharedRAbundVector*> shared;
71 int NumSeqs, NumGroupComb;
75 /***********************************************************************/