]> git.donarmstrong.com Git - mothur.git/blob - collectorscurvedata.h
added concensus command and updated calcs
[mothur.git] / collectorscurvedata.h
1 #ifndef COLLECTORSCURVEDATA_H
2 #define COLLECTORSCURVEDATA_H
3
4 #include "mothur.h"
5 #include "sabundvector.hpp"
6 #include "sharedrabundvector.h"
7 #include "display.h"
8 #include "observable.h"
9
10 using namespace std;
11
12 /***********************************************************************/
13
14 class CollectorsCurveData : public Observable {
15         
16 public:
17         CollectorsCurveData() : rank(0) {};
18         
19         void registerDisplay(Display* o)                {       displays.insert(o);                             };
20         void removeDisplay(Display* o)                  {       displays.erase(o);      delete o;       };
21         SAbundVector* getRankData()                             {       return rank;                                    };
22         void rankDataChanged()                                  {       notifyDisplays();                               };
23         void updateRankData(SAbundVector* rv)   {       rank = rv; rankDataChanged();   };
24
25         void notifyDisplays(){  
26                 for(set<Display*>::iterator pos=displays.begin();pos!=displays.end();pos++){
27                         (*pos)->update(rank);
28                 }       
29         };
30         
31 private:
32         set<Display*> displays;
33         SAbundVector* rank;
34         
35 };
36
37 /***********************************************************************/
38
39
40 class SharedCollectorsCurveData : public Observable {
41         
42 public:
43         SharedCollectorsCurveData() { }; //: shared1(0), shared2(0)
44         
45         void registerDisplay(Display* o)                {       displays.insert(o);                             };
46         void removeDisplay(Display* o)                  {       displays.erase(o);      delete o;       };
47         void SharedDataChanged()                                {       notifyDisplays();                               };
48         void updateSharedData(vector<SharedRAbundVector*> s, int numSeqs, int numGroupComb)     {       shared = s; NumSeqs = numSeqs; NumGroupComb = numGroupComb; SharedDataChanged();        };
49         
50         void notifyDisplays(){  
51                 for(set<Display*>::iterator pos=displays.begin();pos!=displays.end();pos++){
52                         if ( ((*pos)->isCalcMultiple() == true) || ( ((*pos)->isCalcMultiple() == false) && (shared.size() == 2) ) ) {
53                                 (*pos)->update(shared, NumSeqs, NumGroupComb);
54                         }
55                 }       
56         };
57         
58 private:
59         set<Display*> displays;
60         vector<Display*> multiDisplays;
61         vector<SharedRAbundVector*> shared;
62         int NumSeqs, NumGroupComb;
63 };
64
65 /***********************************************************************/
66
67 #endif
68