X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/641204dfbdb9fc870cdd2e7f9e3169a44693e7bf..c02406ecfa463f3846f775ab9d4b9f69f5ba21a1:/projects/stargazer/settings.h diff --git a/projects/stargazer/settings.h b/projects/stargazer/settings.h index a9256cc9..711b43e6 100644 --- a/projects/stargazer/settings.h +++ b/projects/stargazer/settings.h @@ -34,16 +34,13 @@ */ -#ifndef settingsh_h -#define settingsh_h 1 +#ifndef SETTINGS_H +#define SETTINGS_H -#include #include -#include #include "common.h" #include "base_settings.h" -#include "stg_logger.h" using namespace std; @@ -56,6 +53,9 @@ dsPeriod_1_4, dsPeriod_1_6, }; //----------------------------------------------------------------------------- +class STG_LOGGER; +class DOTCONFDocumentNode; +//----------------------------------------------------------------------------- class SETTINGS { public: @@ -63,26 +63,25 @@ public: SETTINGS(const std::string &); SETTINGS(const SETTINGS &); virtual ~SETTINGS(); - int Reload(); + int Reload() { return ReadSettings(); }; int ReadSettings(); - string GetStrError() const; + string GetStrError() const { return strError; }; int GetExecMsgKey() const { return stgExecMsgKey; }; - int GetExecutersNum() const { return executersNum; }; - //int GetExecutersWaitTimeout() const; + unsigned GetExecutersNum() const { return executersNum; }; const string & GetDirName(int num) const { return dirName[num]; }; const string & GetConfDir() const { return confDir; }; const string & GetScriptDir() const { return scriptDir; }; const string & GetRulesFileName() const { return rules; }; const string & GetLogFileName() const { return logFile; }; const string & GetPIDFileName() const { return pidFile; }; - int GetDetailStatWritePeriod() const + unsigned GetDetailStatWritePeriod() const { return detailStatWritePeriod; }; - int GetStatWritePeriod() const { return statWritePeriod * 60; }; - int GetDayFee() const { return dayFee; }; + unsigned GetStatWritePeriod() const { return statWritePeriod * 60; }; + unsigned GetDayFee() const { return dayFee; }; bool GetFullFee() const { return fullFee; }; - int GetDayResetTraff() const { return dayResetTraff; }; + unsigned GetDayResetTraff() const { return dayResetTraff; }; bool GetSpreadFee() const { return spreadFee; }; bool GetFreeMbAllowInet() const { return freeMbAllowInet; }; bool GetDayFeeIsLastDay() const { return dayFeeIsLastDay; }; @@ -91,15 +90,20 @@ public: bool GetShowFeeInCash() const { return showFeeInCash; }; const string & GetMonitorDir() const { return monitorDir; }; bool GetMonitoring() const { return monitoring; }; + unsigned GetMessageTimeout() const { return messageTimeout * 3600 * 24; }; const string & GetModulesPath() const { return modulesPath; }; - const MODULE_SETTINGS & GetStoreModuleSettings() const; - const vector & GetModulesSettings() const; + const MODULE_SETTINGS & GetStoreModuleSettings() const + { return storeModuleSettings; }; + const vector & GetModulesSettings() const + { return modulesSettings; }; private: int ParseInt(const string & value, int * val); + int ParseUnsigned(const string & value, unsigned * val); int ParseIntInRange(const string & value, int min, int max, int * val); + int ParseUnsignedInRange(const string & value, unsigned min, unsigned max, unsigned * val); int ParseYesNo(const string & value, bool * val); int ParseDetailStatWritePeriod(const string & detailStatPeriodStr); @@ -118,19 +122,19 @@ private: string pidFile; string monitorDir; bool monitoring; - int detailStatWritePeriod; - int statWritePeriod; + unsigned detailStatWritePeriod; + unsigned statWritePeriod; int stgExecMsgKey; - int executersNum; - //int executersWaitTimeout; + unsigned executersNum; bool fullFee; - int dayFee; // ÄÅÎØ ÓÎÑÔÉÑ ÁÂÏÎÐÌÁÔÙ - int dayResetTraff; // îÁÞÁÌÏ ÕÞÅÔÎÏÇÏ ÐÅÒÉÏÄÁ: ÄÅÎØ ÏÂÎÕÌÅÎÉÑ ÔÒÁÆÉËÁ É ÓÍÅÎÙ ÔÁÒÉÆÁ + unsigned dayFee; // ÄÅÎØ ÓÎÑÔÉÑ ÁÂÏÎÐÌÁÔÙ + unsigned dayResetTraff; // îÁÞÁÌÏ ÕÞÅÔÎÏÇÏ ÐÅÒÉÏÄÁ: ÄÅÎØ ÏÂÎÕÌÅÎÉÑ ÔÒÁÆÉËÁ É ÓÍÅÎÙ ÔÁÒÉÆÁ bool spreadFee; bool freeMbAllowInet; bool dayFeeIsLastDay; // áð ÓÎÉÍÁÅÔÓÑ × ËÏÎÃÅ ÍÅÓÑÃÁ (true) ÉÌÉ × ÎÁÞÁÌÅ (false) bool writeFreeMbTraffCost; // ðÉÓÁÔØ × ÄÅÔÁÌØÎÕÀ ÓÔÁÔÉÓÔÉËÕ ÓÔÏÉÍÏÓÔØ ÔÒÁÆÉËÁ, ÅÓÌÉ ÅÝÅ ÅÓÔØ ÐÒÅÄÏÐÌÁÞÅÎÎÙÊ ÔÒÁÆÉË bool showFeeInCash; // ðÏËÁÚÙ×ÁÔØ ÐÏÌØÚÏ×ÁÔÅÌÀ áð ÎÅ ÓÞÅÔÕ É ÐÏÚ×ÏÌÑÔØ ÅÅ ÉÓÐÏÌØÚÏ×ÁÔØ + unsigned messageTimeout; // ÷ÒÅÍÑ ÖÉÚÎÉ ÎÅÏÔÐÒÁ×ÌÅÎÎÏÇÏ ÓÏÏÂÝÅÎÉÑ × ÓÅËÕÎÄÁÈ vector modulesSettings; MODULE_SETTINGS storeModuleSettings; @@ -139,4 +143,3 @@ private: }; //----------------------------------------------------------------------------- #endif -