24#include <core/exceptions/software.h>
25#include <fvutils/system/camargp.h>
76 string::size_type start = 0;
77 string::size_type end;
78 if ((end = s.find(
":", start)) != string::npos) {
79 _cam_type = s.substr(start, end);
84 if ((end = s.find(
":", start)) != string::npos) {
85 _cam_id = s.substr(start, end - start);
91 while ((end = s.find(
":", start)) != string::npos) {
92 string t = s.substr(start, (end - start));
94 if ((e = t.find(
"=", 0)) != string::npos) {
95 if ((e > 0) && (e < t.length() - 1)) {
96 string key = t.substr(0, e);
97 string value = t.substr(e + 1);
147 return (values.find(s) != values.end());
158 if (values.find(s) != values.end()) {
160 return (*(values.find(s))).second;
177 if (values.find(s) != values.end()) {
179 long int rv = strtol((*(values.find(s))).second.c_str(), &endptr, 10);
180 if (endptr[0] != 0) {
185 throw Exception(
"Value for '%s' not available", s.c_str());
200 if (values.find(s) != values.end()) {
202 double rv = strtod((*(values.find(s))).second.c_str(), &endptr);
203 if (endptr[0] != 0) {
208 throw Exception(
"Value for '%s' not available", s.c_str());
216std::vector<std::string>
225std::map<std::string, std::string>
Base class for exceptions in Fawkes.
Expected parameter is missing.
~CameraArgumentParser()
Destructor.
long int get_int(std::string s) const
Get the value of the given parameter as integer.
std::vector< std::string > arguments() const
Get the arguments.
std::string cam_id() const
Get camera ID.
std::string cam_type() const
Get camera type.
bool has(std::string s) const
Check if an parameter was given.
std::string get(std::string s) const
Get the value of the given parameter.
double get_float(std::string s) const
Get the value of the given parameter as integer.
CameraArgumentParser(const char *as)
Constructor.
std::map< std::string, std::string > parameters() const
Get a map of parameters.
Fawkes library namespace.