*/
-#ifndef settingsh_h
-#define settingsh_h 1
+#ifndef SETTINGS_H
+#define SETTINGS_H
-#include <sys/types.h>
#include <vector>
-#include <dotconfpp.h>
#include "common.h"
#include "base_settings.h"
-#include "stg_logger.h"
using namespace std;
dsPeriod_1_6,
};
//-----------------------------------------------------------------------------
+class STG_LOGGER;
+class DOTCONFDocumentNode;
+//-----------------------------------------------------------------------------
class SETTINGS
{
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;
+ size_t 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; };
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<MODULE_SETTINGS> & GetModulesSettings() const;
+ const MODULE_SETTINGS & GetStoreModuleSettings() const
+ { return storeModuleSettings; };
+ const vector<MODULE_SETTINGS> & 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);
string pidFile;
string monitorDir;
bool monitoring;
- int detailStatWritePeriod;
- int statWritePeriod;
+ unsigned detailStatWritePeriod;
+ unsigned statWritePeriod;
int stgExecMsgKey;
- int executersNum;
- //int executersWaitTimeout;
+ size_t 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<MODULE_SETTINGS> modulesSettings;
MODULE_SETTINGS storeModuleSettings;
};
//-----------------------------------------------------------------------------
#endif
-