]> git.donarmstrong.com Git - mothur.git/blob - collectorscurvedata.h
Initial revision
[mothur.git] / collectorscurvedata.h
1 #ifndef COLLECTORSCURVEDATA_H
2 #define COLLECTORSCURVEDATA_H
3
4 #include <set>
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(SharedRAbundVector* rv, SharedRAbundVector* rv2, int numSeqs, int numGroupComb)   {       shared1 = rv; shared2 = rv2; NumSeqs = numSeqs; NumGroupComb = numGroupComb; SharedDataChanged();       };
49
50         void notifyDisplays(){  
51                 for(set<Display*>::iterator pos=displays.begin();pos!=displays.end();pos++){
52                         (*pos)->update(shared1, shared2, NumSeqs, NumGroupComb);
53                 }       
54         };
55         
56 private:
57         set<Display*> displays;
58         SharedRAbundVector* shared1;
59         SharedRAbundVector* shared2;
60         int NumSeqs, NumGroupComb;
61 };
62
63 /***********************************************************************/
64
65 #endif
66