qa_camargp.cpp

00001 
00002 /***************************************************************************
00003  *  qa_camargp.h - QA for camera argument parser
00004  *
00005  *  Generated: Wed Apr 11 16:02:33 2007
00006  *  Copyright  2005-2007  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023 
00024 /// @cond QA
00025 
00026 #include <fvutils/system/camargp.h>
00027 
00028 #include <iostream>
00029 
00030 using namespace std;
00031 using namespace firevision;
00032 
00033 int
00034 main(int argc, char **argv)
00035 {
00036   const char *s = "firewire:funny ID:mode=xy:test=test2:blub";
00037   if ( argc > 1 ) {
00038     s = argv[1];
00039   }
00040 
00041   CameraArgumentParser *argp = new CameraArgumentParser(s);
00042 
00043   cout << "Camera Type: " << argp->cam_type() << endl;
00044   cout << "Camera ID:   " << argp->cam_id() << endl;
00045 
00046   map<string, string> values = argp->parameters();
00047   map<string, string>::iterator i;
00048   for (i = values.begin(); i != values.end(); ++i) {
00049     cout << "values[" << (*i).first << "] = " << (*i).second << endl;
00050   }
00051 
00052   vector<string> args = argp->arguments();
00053   vector<string>::iterator j;
00054   for (j = args.begin(); j != args.end(); ++j) {
00055     cout << "arg: " << (*j) << endl;
00056   }
00057 
00058   delete argp;
00059 
00060   return 0;
00061 }
00062 
00063 
00064 
00065 /// @endcond