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
string getHdf5FilePath() const
Returns the HDF5 file path.
const kaboom::Options * options
bool printUsage() const
Prints a usage message to stdout.
variables_map m_variables
The internally used variable map.
string getConfigFilePath() const
Returns the config file path.
positional_options_description m_posDescr
The internally used positional option description.
Options(int argc, char **argv)
Ctor. Parses the command parameters given to the main function of the program.
options_description m_descr
The internally used option description.
string getScanProjectPath() const
Returns the scan project file path.
char ** argv


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 Mon Feb 28 2022 22:46:08