src/tools/lvr2_chunking_server/Options.cpp
Go to the documentation of this file.
1 
35 #include "Options.hpp"
36 
37 #include <iostream>
38 
39 namespace chunking_server
40 {
41 
42 using boost::program_options::command_line_parser;
43 using boost::program_options::value;
44 using std::cout;
45 using std::endl;
46 
47 Options::Options(int argc, char** argv) : m_descr("Supported options")
48 {
49  // Create option descriptions
50  m_descr.add_options()("help", "Produce help message")
51  ("scanProject", value<string>(), "Path to scan project.")
52  ("hdf5File", value<string>(), "Path to HDF5 file.")
53  ("configFile", value<string>(), "Path to YAML config file.");
54 
55  // Parse command line and generate variables map
56  store(command_line_parser(argc, argv).options(m_descr).positional(m_posDescr).run(),
57  m_variables);
58  notify(m_variables);
59 }
60 
61 bool Options::printUsage() const
62 {
63  if (m_variables.count("help"))
64  {
65  cout << m_descr << endl;
66  return true;
67  }
68 
69  if (!m_variables.count("scanProject"))
70  {
71  cout << "Error: You must specify a scan project path." << endl;
72  cout << endl;
73  cout << m_descr << endl;
74  return true;
75  }
76 
77  if (!m_variables.count("hdf5File"))
78  {
79  cout << "Error: You must specify a HDF5 file path." << endl;
80  cout << endl;
81  cout << m_descr << endl;
82  return true;
83  }
84 
85  if (!m_variables.count("configFile"))
86  {
87  cout << "Error: You must specify a YAML config file path." << endl;
88  cout << endl;
89  cout << m_descr << endl;
90  return true;
91  }
92 
93  return false;
94 }
95 
97 {
98  return m_variables["scanProject"].as<string>();
99 }
100 
102 {
103  return m_variables["hdf5File"].as<string>();
104 }
105 
107 {
108  return m_variables["configFile"].as<string>();
109 }
110 
112 {
113  // TODO Auto-generated destructor stub
114 }
115 
116 } // namespace chunking server
chunking_server
Definition: src/tools/lvr2_chunking_server/Options.cpp:39
chunking_server::Options::printUsage
bool printUsage() const
Prints a usage message to stdout.
Definition: src/tools/lvr2_chunking_server/Options.cpp:61
chunking_server::Options::getScanProjectPath
string getScanProjectPath() const
Returns the scan project file path.
Definition: src/tools/lvr2_chunking_server/Options.cpp:96
chunking_server::Options::m_variables
variables_map m_variables
The internally used variable map.
Definition: src/tools/lvr2_chunking_server/Options.hpp:84
options
const kaboom::Options * options
Definition: src/tools/lvr2_kaboom/Main.cpp:45
chunking_server::Options::m_descr
options_description m_descr
The internally used option description.
Definition: src/tools/lvr2_chunking_server/Options.hpp:87
chunking_server::Options::getHdf5FilePath
string getHdf5FilePath() const
Returns the HDF5 file path.
Definition: src/tools/lvr2_chunking_server/Options.cpp:101
chunking_server::Options::getConfigFilePath
string getConfigFilePath() const
Returns the config file path.
Definition: src/tools/lvr2_chunking_server/Options.cpp:106
argc
int argc
Definition: tests_high_five_parallel.cpp:27
Options.hpp
chunking_server::Options::~Options
virtual ~Options()
Definition: src/tools/lvr2_chunking_server/Options.cpp:111
chunking_server::Options::Options
Options(int argc, char **argv)
Ctor. Parses the command parameters given to the main function of the program.
Definition: src/tools/lvr2_chunking_server/Options.cpp:47
argv
char ** argv
Definition: tests_high_five_parallel.cpp:28
chunking_server::Options::m_posDescr
positional_options_description m_posDescr
The internally used positional option description.
Definition: src/tools/lvr2_chunking_server/Options.hpp:90


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:24