1 #ifndef __SSMD_SETTINGS_H__
2 #define __SSMD_SETTINGS_H__
6 #include <boost/noncopyable.hpp>
7 #include <boost/program_options.hpp>
9 namespace po = boost::program_options;
16 // Construction / destruction
18 Settings(const Settings & rvalue);
21 const Settings & operator=(const Settings & rvalue);
24 bool isHelp() const throw() { return _isHelp; }
25 bool isVersion() const throw() { return _isVersion; }
26 bool isDebug() const throw() { return _isDebug; }
27 bool isDaemon() const throw() { return _isDaemon; }
29 const std::string & configFile() const throw() { return _configFile; }
30 const std::string & logFile() const throw() { return _logFile; }
31 const std::string & PIDFile() const throw() { return _PIDFile; }
33 time_t switchSyncInterval() const throw() { return _switchSyncInterval; }
34 time_t infoSyncInterval() const throw() { return _infoSyncInterval; }
36 unsigned upProfileId() const throw() { return _upProfileId; }
37 unsigned downProfileId() const throw() { return _downProfileId; }
39 size_t maxACLPerPDU() const throw() { return _maxACLPerPDU; }
41 const std::string & dataURL() const throw() { return _dataURL; }
43 const std::string & scriptBase() const throw() { return _scriptBase; }
44 bool dumpScripts() const throw() { return _dumpScripts; }
47 void setIsHelp(bool value) throw() { _isHelp = value; }
48 void setIsVersion(bool value) throw() { _isVersion = value; }
49 void setIsDebug(bool value) throw() { _isDebug = value; }
50 void setIsDaemon(bool value) throw() { _isDaemon = value; }
52 void setConfigFile(const std::string & value) throw() { _configFile = value; }
53 void setLogFile(const std::string & value) throw() { _logFile = value; }
54 void setPIDFile(const std::string & value) throw() { _PIDFile = value; }
56 void setSwitchSyncInterval(time_t value) throw() { _switchSyncInterval = value; }
57 void setInfoSyncInterval(time_t value) throw() { _infoSyncInterval = value; }
59 void setUpProfileId(unsigned value) throw() { _upProfileId = value; }
60 void setDownProfileId(unsigned value) throw() { _downProfileId = value; }
62 void setMaxACLPerPDU(size_t value) throw() { _maxACLPerPDU = value; }
64 void setDataURL(const std::string & value) throw() { _dataURL = value; }
72 std::string _configFile;
76 time_t _switchSyncInterval;
77 time_t _infoSyncInterval;
79 unsigned _upProfileId;
80 unsigned _downProfileId;
86 std::string _scriptBase;
89 friend class SettingsParser;
92 class SettingsParser : private boost::noncopyable {
97 void init(int argc, char * argv[]);
99 void printHelp() const;
101 const Settings & settings() const { return _settings; };
103 po::options_description _desc;
106 void parseFile(const std::string & fileName);
111 #include "settings.inl.h"