27 #ifndef G2O_COMMAND_ARGS_H 28 #define G2O_COMMAND_ARGS_H 57 CommandArgument() : name(
""), description(
""), type(0), data(0), parsed(false), optional(false)
71 bool parseArgs(
int argc,
char** argv,
bool exitOnError =
true);
74 void param(
const std::string& name,
bool& p,
bool defValue,
const std::string& desc);
76 void param(
const std::string& name,
int& p,
int defValue,
const std::string& desc);
78 void param(
const std::string& name,
float& p,
float defValue,
const std::string& desc);
80 void param(
const std::string& name,
double& p,
double defValue,
const std::string& desc);
82 void param(
const std::string& name, std::string& p,
const std::string& defValue,
const std::string& desc);
84 void param(
const std::string& name, std::vector<int>& p,
const std::vector<int>& defValue,
const std::string& desc);
86 void param(
const std::string& name, std::vector<double>& p,
const std::vector<double>& defValue,
const std::string& desc);
88 void paramLeftOver(
const std::string& name, std::string& p,
const std::string& defValue,
const std::string& desc,
bool optional =
false);
93 void printParams(std::ostream& os);
96 const std::string&
getBanner()
const {
return _banner; }
97 void setBanner(
const std::string& banner);
102 void printHelp(std::ostream& os);
107 bool parsedParam(
const std::string& paramFlag)
const;
116 const char* type2str(
int t)
const;
120 std::string
trim(
const std::string& s)
const;
Command line parsing of argc and argv.
std::string trim(const std::string &s)
std::vector< CommandArgument > _args
std::vector< CommandArgument > _leftOvers
std::vector< CommandArgument > _leftOversOptional
const std::string & getBanner() const
return the banner string