24 #include <core/exceptions/software.h> 25 #include <fvutils/system/camargp.h> 32 namespace firevision {
68 CameraArgumentParser::CameraArgumentParser(
const char *as)
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);
110 CameraArgumentParser::~CameraArgumentParser()
122 CameraArgumentParser::cam_type()
const 133 CameraArgumentParser::cam_id()
const 145 CameraArgumentParser::has(std::string s)
const 147 return (values.find(s) != values.end());
156 CameraArgumentParser::get(std::string s)
const 158 if (values.find(s) != values.end()) {
160 return (*(values.find(s))).second;
175 CameraArgumentParser::get_int(std::string s)
const 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());
198 CameraArgumentParser::get_float(std::string s)
const 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());
216 std::vector<std::string>
217 CameraArgumentParser::arguments()
const 225 std::map<std::string, std::string>
226 CameraArgumentParser::parameters()
const Fawkes library namespace.
Base class for exceptions in Fawkes.
Expected parameter is missing.