]> git.stg.codes - stg.git/blob - projects/stargazer/plugins/other/smux/tables.h
Table builders added for the SMUX plugin
[stg.git] / projects / stargazer / plugins / other / smux / tables.h
1 #ifndef __TABLES_H__
2 #define __TABLES_H__
3
4 #include <string>
5 #include <map>
6
7 #include "sensors.h"
8
9 class TableSensor {
10     public:
11         TableSensor(const std::string & p) : prefix(p) {}
12         virtual ~TableSensor() {}
13
14         const std::string & GetPrefix() const { return prefix; }
15         virtual void UpdateSensors(Sensors & sensors) const = 0;
16
17     protected:
18         std::string prefix;
19 };
20
21 class TariffUsersTable : public TableSensor {
22     public:
23         TariffUsersTable(const std::string & p,
24                          USERS & u)
25             : TableSensor(p),
26               users(u)
27         {}
28         virtual ~TariffUsersTable() {}
29
30         void UpdateSensors(Sensors & sensors) const;
31
32     private:
33         USERS & users;
34 };
35
36 typedef std::map<std::string, TableSensor *> Tables;
37
38 #endif