]> git.donarmstrong.com Git - mothur.git/blob - collectorscurvedata.h
finished work on classify.seqs bayesian method and various bug fixes
[mothur.git] / collectorscurvedata.h
1 #ifndef COLLECTORSCURVEDATA_H
2 #define COLLECTORSCURVEDATA_H
3
4 #include "sabundvector.hpp"
5 #include "sharedrabundvector.h"
6 #include "display.h"
7 #include "observable.h"
8
9
10 /***********************************************************************/
11
12 class CollectorsCurveData : public Observable {
13         
14 public:
15         CollectorsCurveData() : rank(0) {};
16         
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();   };
22
23         void notifyDisplays(){  
24                 for(set<Display*>::iterator pos=displays.begin();pos!=displays.end();pos++){
25                         (*pos)->update(rank);
26                 }       
27         };
28         
29 private:
30         set<Display*> displays;
31         SAbundVector* rank;
32         
33 };
34
35 /***********************************************************************/
36
37
38 class SharedCollectorsCurveData : public Observable {
39         
40 public:
41         SharedCollectorsCurveData() { }; //: shared1(0), shared2(0)
42         
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)     {       shared = s; NumSeqs = numSeqs; NumGroupComb = numGroupComb; SharedDataChanged();        };
47         
48         void notifyDisplays(){  
49                 for(set<Display*>::iterator pos=displays.begin();pos!=displays.end();pos++){
50 //cout << (*pos)->getName() << endl;
51                         if ( ( ((*pos)->isCalcMultiple() == true) && ((*pos)->getAll() == true) ) || (shared.size() == 2)  ) {
52                                 (*pos)->update(shared, NumSeqs, NumGroupComb);
53                         }
54                 }       
55         };
56         
57 private:
58         set<Display*> displays;
59         vector<Display*> multiDisplays;
60         vector<SharedRAbundVector*> shared;
61         int NumSeqs, NumGroupComb;
62 };
63
64 /***********************************************************************/
65
66 #endif
67