//
// CRAM: CREATE Real-time Applications Manager
// See the copyright and acknowledgment of authors in the file COPYRIGHT
//
//// Options.h: the CRAM class for parsing input arguments, based on the MICOGetOpt class ////
//

#ifndef __CRAM_OPTIONS_H__
#define __CRAM_OPTIONS_H__

#include "CRAM.h"
#include <function.h>
#include <map>
#include <vector>
#include <string>

using namespace std;

namespace cram {

class Options {
	
public:
	typedef map<string, string, less<string> > OptMap;
	typedef vector<pair<string,string> > OptVec;

	Options (const OptMap &opts);
	~Options ();

	bool parse (char *, bool ignore=false);
	bool parse (int &argc, char *argv[], bool ignore = false);
	bool parse (const vector<string> &args, bool ignore = false);
	bool parse (const string &filename,bool ignore = false);

	OptVec::iterator  find (string option,string &result);
	
	const OptVec &opts () const;
	
private:
	OptMap mInOpts;
	OptVec mOutOpts;
	bool parse (const vector<string> &args, vector<int> &erase,bool ignore = false);
};

}

#endif

