14 #include <boost/program_options/options_description.hpp> 15 #include <boost/program_options/parsers.hpp> 16 #include <boost/program_options/variables_map.hpp> 22 #define CONFIG_PATH "/etc/opcua/server" 27 namespace po = boost::program_options;
28 using namespace OpcUa;
30 const char * DefaultLogFilePath =
"/var/log/opcua/server.log";
32 const char * OPTION_HELP =
"help";
33 const char * OPTION_CONFIG =
"config-dir";
34 const char * OPTION_DAEMON =
"daemon";
35 const char * OPTION_LOGFILE =
"log-file";
37 std::string GetConfigOptionValue(
const po::variables_map & vm)
39 if (vm.count(OPTION_CONFIG))
48 bool GetDaemonMode(
const po::variables_map & vm)
50 return vm.count(OPTION_DAEMON) != 0;
53 std::string GetLogFile(
const po::variables_map & vm)
55 if (vm.count(OPTION_LOGFILE))
60 return DefaultLogFilePath;
76 po::options_description desc(
"Parameters");
78 (OPTION_HELP,
"Print help message and exit.")
79 (OPTION_CONFIG, po::value<std::string>(), (
std::string(
"Path to directory with configuration files. Default: ") +
CONFIG_PATH).c_str())
80 (OPTION_LOGFILE, po::value<std::string>(),
"Set path to the log file. Default 'var/log/opcua/server.log")
81 (OPTION_DAEMON,
"Start in daemon mode.")
85 po::store(po::parse_command_line(argc, argv, desc), vm);
88 if (vm.count(OPTION_HELP))
90 desc.print(std::cout);
std::string GetLogFile() const
OPC UA Address space part. GNU LGPL.
CommandLine(int argc, const char **argv)
#define CONFIG_PATH
OpcUa client command line options parser. GNU LGPL.