]> git.stg.codes - stg.git/blob - projects/stargazer/plugins/configuration/xrconfig/xrconfig.h
Merge branch 'naffanya-dev'
[stg.git] / projects / stargazer / plugins / configuration / xrconfig / xrconfig.h
1 #include <string>
2 #include <pthread.h>
3 #include "base_plugin.h"
4 #include "common.h"
5
6 using namespace std;
7
8 extern "C" BASE_PLUGIN * GetPlugin();
9
10 class STG_CONFIG;
11
12 //-----------------------------------------------------------------------------
13 class XR_CONFIG_SETTINGS
14 {
15 public:
16                     XR_CONFIG_SETTINGS();
17     virtual         ~XR_CONFIG_SETTINGS(){};
18     const string &  GetStrError() const;
19     int             ParseSettings(const MODULE_SETTINGS & s);
20     uint16_t        GetPort();
21
22 private:
23     string  errorStr;
24     int     port;
25 };
26 //-----------------------------------------------------------------------------
27 class XR_CONFIG :public BASE_PLUGIN
28 {
29 public:
30     XR_CONFIG();
31     virtual ~XR_CONFIG(){};
32
33     void                SetUsers(USERS * u);
34     void                SetTariffs(TARIFFS * t);
35     void                SetAdmins(ADMINS * a);
36     void                SetStore(BASE_STORE * s);
37     void                SetStgSettings(const SETTINGS * s);
38     void                SetSettings(const MODULE_SETTINGS & s);
39     int                 ParseSettings();
40
41     int                 Start();
42     int                 Stop();
43     int                 Reload() { return 0; };
44     bool                IsRunning();
45
46     const string      & GetStrError() const;
47     const string        GetVersion() const;
48     uint16_t            GetStartPosition() const;
49     uint16_t            GetStopPosition() const;
50
51 private:
52
53
54     int                 SetUserCash(const string & admLogin, const string & usrLogin, double cash) const;
55
56     static void *       Run(void *);
57     mutable string      errorStr;
58     XR_CONFIG_SETTINGS  xrConfigSettings;
59     pthread_t           thread;
60     bool                nonstop;
61     bool                isRunning;
62
63     //CONFIGPROTO         config;
64
65     USERS *             users;
66     ADMINS *            admins;
67     TARIFFS *           tariffs;
68     BASE_STORE *        store;
69     MODULE_SETTINGS     settings;
70     const SETTINGS *    stgSettings;
71 };
72 //-----------------------------------------------------------------------------
73
74