1 #ifndef __GTS_SETTINGS_H__
2 #define __GTS_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; }
44 void setIsHelp(bool value) throw() { _isHelp = value; }
45 void setIsVersion(bool value) throw() { _isVersion = value; }
46 void setIsDebug(bool value) throw() { _isDebug = value; }
47 void setIsDaemon(bool value) throw() { _isDaemon = value; }
49 void setConfigFile(const std::string & value) throw() { _configFile = value; }
50 void setLogFile(const std::string & value) throw() { _logFile = value; }
51 void setPIDFile(const std::string & value) throw() { _PIDFile = value; }
53 void setSwitchSyncInterval(time_t value) throw() { _switchSyncInterval = value; }
54 void setInfoSyncInterval(time_t value) throw() { _infoSyncInterval = value; }
56 void setUpProfileId(unsigned value) throw() { _upProfileId = value; }
57 void setDownProfileId(unsigned value) throw() { _downProfileId = value; }
59 void setMaxACLPerPDU(size_t value) throw() { _maxACLPerPDU = value; }
61 void setDataURL(const std::string & value) throw() { _dataURL = value; }
69 std::string _configFile;
73 time_t _switchSyncInterval;
74 time_t _infoSyncInterval;
76 unsigned _upProfileId;
77 unsigned _downProfileId;
83 friend class SettingsParser;
86 class SettingsParser : private boost::noncopyable {
91 void init(int argc, char * argv[]);
93 void printHelp() const;
95 const Settings & settings() const { return _settings; };
97 po::options_description _desc;
100 void parseFile(const std::string & fileName);
105 #include "settings.inl.h"