IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Macros
ProgramOptionsMacros.h File Reference

Macros used for program option management With Boost 1.75, the classical cammands boost::program_options::store(parse_command_line(argc, argv, desc), vm); boost::program_options::notify(vm); does not work for string arguments. Some adjustments had to be done and the use is simplified by writing these macros. More...

#include <boost/program_options/cmdline.hpp>
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/variables_map.hpp>

Go to the source code of this file.

Macros

#define IPSDK_PROGRAM_OPTION_STORE_CMD_LINE_PARSER(strArgvInput, desc, vm)   boost::program_options::store(boost::program_options::command_line_parser(boost::program_options::split_unix(strArgvInput)).options(desc).run(), vm);
 macro parsing the command line parameters strArgvInput and storing them in the variable map vm strArgvInput is a single string containing all the parameters, separated by a ' ' The split function to separate back the parameters differs for Windows and Linux because of path management with '\'
 
#define IPSDK_PROGRAM_OPTION_PARSER(argc, argv, desc, vm, bBoostTest)
 

Detailed Description

Macros used for program option management With Boost 1.75, the classical cammands boost::program_options::store(parse_command_line(argc, argv, desc), vm); boost::program_options::notify(vm); does not work for string arguments. Some adjustments had to be done and the use is simplified by writing these macros.

Author
R. Abbal
Date
2022/03/31

Macro Definition Documentation

◆ IPSDK_PROGRAM_OPTION_PARSER

#define IPSDK_PROGRAM_OPTION_PARSER (   argc,
  argv,
  desc,
  vm,
  bBoostTest 
)
Value:
const int argOffset = (bBoostTest ? 2 : 1); \
if(argc > argOffset) { \
for (int i = 1; i < argc; ++i) { \
int j = 0; \
while (argv[i][j] != '\0') { \
if (argv[i][j] == '#') \
argv[i][j] = ' '; \
++j; \
} \
} \
std::string strArgvInput = argv[argOffset]; \
for (int i = 1 + argOffset; i < argc; ++i) \
strArgvInput += " " + std::string(argv[i]); \
IPSDK_PROGRAM_OPTION_STORE_CMD_LINE_PARSER(strArgvInput, desc, vm) \
notify(vm); \
}