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