X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/4271ab433cd55bbd2612292bcf39e4dc3d7274f1..0907aa4037b12b6b88ee24495d4577a064d4f8db:/projects/stargazer/plugins/other/smux/tables.h diff --git a/projects/stargazer/plugins/other/smux/tables.h b/projects/stargazer/plugins/other/smux/tables.h new file mode 100644 index 00000000..edfe4377 --- /dev/null +++ b/projects/stargazer/plugins/other/smux/tables.h @@ -0,0 +1,47 @@ +#ifndef __TABLES_H__ +#define __TABLES_H__ + +#include +#include + +#include "sensors.h" + +namespace STG +{ +struct Tariffs; +struct Users; +} + +class TableSensor { + public: + explicit TableSensor(const std::string & p) : prefix(p) {} + virtual ~TableSensor() {} + + const std::string & GetPrefix() const { return prefix; } + virtual void UpdateSensors(Sensors & sensors) const = 0; + + protected: + std::string prefix; +}; + +class TariffUsersTable : public TableSensor { + public: + TariffUsersTable(const std::string & p, + STG::Tariffs & t, + STG::Users & u) + : TableSensor(p), + tariffs(t), + users(u) + {} + virtual ~TariffUsersTable() {} + + void UpdateSensors(Sensors & sensors) const; + + private: + STG::Tariffs & tariffs; + STG::Users & users; +}; + +typedef std::map Tables; + +#endif