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