automatic commit
[folded-ctf.git] / param_parser.h
diff --git a/param_parser.h b/param_parser.h
new file mode 100644 (file)
index 0000000..57d0082
--- /dev/null
@@ -0,0 +1,44 @@
+
+///////////////////////////////////////////////////////////////////////////
+// This program is free software: you can redistribute it and/or modify  //
+// it under the terms of the version 3 of the GNU General Public License //
+// as published by the Free Software Foundation.                         //
+//                                                                       //
+// This program is distributed in the hope that it will be useful, but   //
+// WITHOUT ANY WARRANTY; without even the implied warranty of            //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      //
+// General Public License for more details.                              //
+//                                                                       //
+// You should have received a copy of the GNU General Public License     //
+// along with this program. If not, see <http://www.gnu.org/licenses/>.  //
+//                                                                       //
+// Written by Francois Fleuret, (C) IDIAP                                //
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports        //
+///////////////////////////////////////////////////////////////////////////
+
+#ifndef PARAM_PARSER_H
+#define PARAM_PARSER_H
+
+#include <iostream>
+#include "misc.h"
+
+using namespace std;
+
+class ParamParser {
+  int _nb_max, _nb;
+  char **_names, **_values;
+  bool *_changed;
+public:
+  ParamParser();
+  ~ParamParser();
+  void add_association(const char *variable_name, const char *variable_value, bool change);
+  char *get_association(const char *variable_name);
+  int get_association_int(const char *variable_name);
+  scalar_t get_association_scalar(const char *variable_name);
+  bool get_association_bool(const char *variable_name);
+
+  void parse_options(int argc, char **argv, bool allow_undefined, int *new_argc, char **new_argv);
+  void print_all(ostream *os);
+};
+
+#endif