#ifndef PARAMPARSER_H_
#define PARAMPARSER_H_

#include <string>
#include <map>
#include "paramObj.h"
#include "parseObj.h"

typedef map<string, paramObj*> tParamObjList;  // map of parameter objects
typedef map<string, paramObj*>::iterator tParamObjListIt;
typedef vector<parseObj*> tParseObjList;
typedef vector<parseObj*>::iterator tParseObjListIt;

class paramParser
{
 public:
  paramParser();
  void init();
  virtual ~paramParser();
  
  void addParam(string);
  void addParam(string, int);
  void addParam(string, int, int);
  void addParam(string, string);
  void addParam(string, string, int);
  void addParam(string, string, int, int);
  paramObj* findParameter(string, string s2="");
  parseObj* findOption(string, string s2="");
  //  void addParseObject(paramObj*);
  parseObj* getOption();
  parseObj* getNextOption();
  //  void setParamDone(parseObj*);
  
  //  void setOptionUsed(bool b) { setUsed = b; }
  // bool isOptionUsedSet() { return setUsed; }
  void restartParsing();
  void resetParser();
  void parseCommandLine(int, char**);
  void parseFile(string, parseObj*);
  //  void strToChr(char*, string);
  void setParamChar(string);
  void setFileHeaderLine(string);
  void setCommentTag(string);
  void setVerbose(bool b) { verbose = b; }
  bool getVerbose() { return verbose; }
  
  int size() { return parseList->size(); }
  void clearParseList();
  
 protected:
  void addCreatedParseObject(parseObj*);  
  // bool setUsed;                    // set options to used after being processed (default true)
  tParamObjList *paramList;        // list of allowed/ possible options
  tParseObjList *parseList;        // list of command line/ file options
  string pre;                      // first character of parameter (default: "-")
  string header;                   // file header for parameter files (optional!)	
  string ctag;                     // tag for comments if parameter files (default: "#"), can be an arbitrary string!
  string fileError;                // a string printed out before warnings when parsing files. Used internally only.
  bool verbose;                    // true: do not print warnings
  tParseObjListIt searchIt;        // iterator for search operation
  tParseObjListIt travIt;
};

#endif /*PARAMPARSER_H_*/
