]> git.donarmstrong.com Git - mothur.git/blob - summarydata.h
8a4d2dac76d4a885d17dd0c04195d650bfc4a555
[mothur.git] / summarydata.h
1 #ifndef SUMMARYDATA_H
2 #define SUMMARYDATA_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 SummaryData : public Observable {
14         
15 public:
16         SummaryData() : sabund(0) {};
17         
18         void registerDisplay(Display* o)        {       displays.insert(o);                             };
19         void removeDisplay(Display* o)          {       displays.erase(o);      delete o;       };
20         SAbundVector* getSabundData()                   {       return sabund;                                  };
21         void sabundDataChanged()                                {       notifyDisplays();                               };
22         void updatesabundData(SAbundVector* rv) {       sabund = rv; sabundDataChanged();       };
23         
24         void notifyDisplays(){  
25                 for(set<Display*>::iterator pos=displays.begin();pos!=displays.end();pos++){
26                         (*pos)->update(sabund);
27                 }       
28         };
29         
30 private:
31         set<Display*> displays;
32         SAbundVector* sabund;
33         
34 };
35
36 /***********************************************************************/
37
38 #endif