00001
00007 #ifndef EXAMPLES_H
00008 #define EXAMPLES_H
00009
00010 #include "defines.h"
00011 #include <map>
00012
00013 namespace annie
00014 {
00015
00016
00017
00018
00019
00020 struct NumberParameter {
00021 const char *name, * desc;
00022 real def;
00023 };
00024
00026 struct StringParameter {
00027 const char *name, * desc;
00028 const std::string def;
00029 std::string value;
00030 };
00031
00032 class ArgParser {
00033 public:
00039 ArgParser(const NumberParameter *numeric, StringParameter *string, PublicValues &ctrl=defaultControl);
00040 void parse(int argc, char *argv[]);
00041
00043 void print();
00044 protected:
00045 void error(const std::string txt);
00046 void help();
00047 typedef std::map<std::string, const NumberParameter*> Mn;
00048 typedef std::map<std::string, StringParameter*> Ms;
00049 Mn mn;
00050 Ms ms;
00051 PublicValues &control;
00052 };
00053
00055 void parseArgs(int argc, char *argv[], const NumberParameter *numeric, StringParameter *strin);
00056
00057 }
00058
00059 #endif