24 #include <fvutils/system/camargp.h> 25 #include <core/exceptions/software.h> 71 CameraArgumentParser::CameraArgumentParser(
const char *as)
79 string::size_type start = 0;
80 string::size_type end;
81 if ( (end = s.find(
":", start)) != string::npos ) {
82 _cam_type = s.substr(start, end);
87 if ( (end = s.find(
":", start)) != string::npos ) {
88 _cam_id = s.substr(start, end - start);
94 while ( (end = s.find(
":", start)) != string::npos ) {
95 string t = s.substr(start, (end - start));
97 if ( (e = t.find(
"=", 0)) != string::npos ) {
98 if ( (e > 0 ) && (e < t.length() - 1) ) {
99 string key = t.substr(0, e);
100 string value = t.substr(e+1);
114 CameraArgumentParser::~CameraArgumentParser()
127 CameraArgumentParser::cam_type()
const 139 CameraArgumentParser::cam_id()
const 152 CameraArgumentParser::has(std::string s)
const 154 return (values.find(s) != values.end());
164 CameraArgumentParser::get(std::string s)
const 166 if ( values.find(s) != values.end() ) {
168 return (*(values.find(s))).second;
184 CameraArgumentParser::get_int(std::string s)
const 186 if ( values.find(s) != values.end() ) {
188 long int rv = strtol((*(values.find(s))).second.c_str(), &endptr, 10);
189 if ( endptr[0] != 0 ) {
194 throw Exception(
"Value for '%s' not available", s.c_str());
208 CameraArgumentParser::get_float(std::string s)
const 210 if ( values.find(s) != values.end() ) {
212 double rv = strtod((*(values.find(s))).second.c_str(), &endptr);
213 if ( endptr[0] != 0 ) {
218 throw Exception(
"Value for '%s' not available", s.c_str());
227 std::vector<std::string>
228 CameraArgumentParser::arguments()
const 237 std::map<std::string, std::string>
238 CameraArgumentParser::parameters()
const Fawkes library namespace.
Base class for exceptions in Fawkes.
Expected parameter is missing.