Index: lemon/arg_parser.cc
===================================================================
--- lemon/arg_parser.cc	(revision 2391)
+++ lemon/arg_parser.cc	(revision 2402)
@@ -29,5 +29,5 @@
   ArgParser::ArgParser(int argc, char **argv) :_argc(argc), _argv(argv),
 					       _command_name(argv[0]) {
-    option("-help","Print a short help message",_showHelp,this);
+    refOption("-help","Print a short help message",_showHelp,this);
     synonym("help","-help");
     synonym("h","-help");
@@ -35,5 +35,90 @@
   }
 
-  ArgParser &ArgParser::option(const std::string &name,
+  ArgParser::~ArgParser()
+  {
+    for(Opts::iterator i=_opts.begin();i!=_opts.end();++i)
+      if(i->second.self_delete)
+	switch(i->second.type) {
+	case BOOL:
+	  delete i->second.bool_p;
+	  break;
+	case STRING:
+	  delete i->second.string_p;
+	  break;
+	case DOUBLE:
+	  delete i->second.double_p;
+	  break;
+	case INTEGER:
+	  delete i->second.int_p;
+	  break;
+	case UNKNOWN:
+	  break;
+	case FUNC:
+	  break;
+	}
+  }
+  
+
+  ArgParser &ArgParser::intOption(const std::string &name,
+			       const std::string &help,
+			       int value, bool obl)
+  {
+    ParData p;
+    p.int_p=new int(value);
+    p.self_delete=true;
+    p.help=help;
+    p.type=INTEGER;
+    p.mandatory=obl;
+    p.self_delete=true;
+    _opts[name]=p;
+    return *this;
+  }
+
+  ArgParser &ArgParser::doubleOption(const std::string &name,
+			       const std::string &help,
+			       double value, bool obl)
+  {
+    ParData p;
+    p.double_p=new double(value);
+    p.self_delete=true;
+    p.help=help;
+    p.type=DOUBLE;
+    p.mandatory=obl;
+    _opts[name]=p;
+    return *this;
+  }
+
+  ArgParser &ArgParser::boolOption(const std::string &name,
+			       const std::string &help,
+			       bool value, bool obl)
+  {
+    ParData p;
+    p.bool_p=new bool(value);
+    p.self_delete=true;
+    p.help=help;
+    p.type=BOOL;
+    p.mandatory=obl;
+    _opts[name]=p;
+
+    value = false;
+
+    return *this;
+  }
+
+  ArgParser &ArgParser::stringOption(const std::string &name,
+			       const std::string &help,
+			       std::string value, bool obl)
+  {
+    ParData p;
+    p.string_p=new std::string(value);
+    p.self_delete=true;
+    p.help=help;
+    p.type=STRING;
+    p.mandatory=obl;
+    _opts[name]=p;
+    return *this;
+  }
+
+  ArgParser &ArgParser::refOption(const std::string &name,
 			       const std::string &help,
 			       int &value, bool obl)
@@ -41,4 +126,5 @@
     ParData p;
     p.int_p=&value;
+    p.self_delete=false;
     p.help=help;
     p.type=INTEGER;
@@ -48,5 +134,5 @@
   }
 
-  ArgParser &ArgParser::option(const std::string &name,
+  ArgParser &ArgParser::refOption(const std::string &name,
 			       const std::string &help,
 			       double &value, bool obl)
@@ -54,4 +140,5 @@
     ParData p;
     p.double_p=&value;
+    p.self_delete=false;
     p.help=help;
     p.type=DOUBLE;
@@ -61,5 +148,5 @@
   }
 
-  ArgParser &ArgParser::option(const std::string &name,
+  ArgParser &ArgParser::refOption(const std::string &name,
 			       const std::string &help,
 			       bool &value, bool obl)
@@ -67,4 +154,5 @@
     ParData p;
     p.bool_p=&value;
+    p.self_delete=false;
     p.help=help;
     p.type=BOOL;
@@ -77,5 +165,5 @@
   }
 
-  ArgParser &ArgParser::option(const std::string &name,
+  ArgParser &ArgParser::refOption(const std::string &name,
 			       const std::string &help,
 			       std::string &value, bool obl)
@@ -83,4 +171,5 @@
     ParData p;
     p.string_p=&value;
+    p.self_delete=false;
     p.help=help;
     p.type=STRING;
@@ -90,5 +179,5 @@
   }
 
-  ArgParser &ArgParser::option(const std::string &name,
+  ArgParser &ArgParser::refOption(const std::string &name,
 			       const std::string &help,
 			       void (*func)(void *),void *data)
@@ -97,4 +186,5 @@
     p.func_p.p=func;
     p.func_p.data=data;
+    p.self_delete=false;
     p.help=help;
     p.type=FUNC;
@@ -103,4 +193,5 @@
     return *this;
   }
+
   ArgParser &ArgParser::optionGroup(const std::string &group,
 				    const std::string &opt)
@@ -378,4 +469,4 @@
     return *this;
   }  
-    
+
 }
Index: lemon/arg_parser.h
===================================================================
--- lemon/arg_parser.h	(revision 2391)
+++ lemon/arg_parser.h	(revision 2402)
@@ -71,7 +71,7 @@
       bool has_syn;
       bool syn;
-	     
+      bool self_delete;
       ParData() : mandatory(false), type(UNKNOWN), set(false), ingroup(false),
-		  has_syn(false), syn(false) {}
+		  has_syn(false), syn(false), self_delete(false) {}
     };
 
@@ -109,4 +109,6 @@
     ArgParser(int argc, char **argv);
 
+    ~ArgParser();
+
     ///Add a new integer type option
 
@@ -115,5 +117,49 @@
     ///\retval value The value of the argument will be written to this variable.
     ///\param obl Indicate if the option is mandatory.
-    ArgParser &option(const std::string &name,
+    ArgParser &intOption(const std::string &name,
+		    const std::string &help,
+		    int value=0, bool obl=false);
+
+    ///Add a new floating type option
+
+    ///\param name The name of the option. The leading '-' must be omitted.
+    ///\param help A help string.
+    ///\retval value The value of the argument will be written to this variable.
+    ///\param obl Indicate if the option is mandatory.
+    ArgParser &doubleOption(const std::string &name,
+		      const std::string &help,
+		      double value=0, bool obl=false);
+
+    ///Add a new bool type option
+
+    ///\param name The name of the option. The leading '-' must be omitted.
+    ///\param help A help string.
+    ///\retval value The value of the argument will be written to this variable.
+    ///\param obl Indicate if the option is mandatory.
+    ////\note A mandatory bool obtion is of very little use.)
+    ArgParser &boolOption(const std::string &name,
+		      const std::string &help,
+		      bool value=false, bool obl=false);
+
+    ///Add a new string type option
+
+    ///\param name The name of the option. The leading '-' must be omitted.
+    ///\param help A help string.
+    ///\retval value The value of the argument will be written to this variable.
+    ///\param obl Indicate if the option is mandatory.
+    ArgParser &stringOption(const std::string &name,
+		      const std::string &help,
+		      std::string value="", bool obl=false);
+    
+
+
+
+    ///Add a new integer type option
+
+    ///\param name The name of the option. The leading '-' must be omitted.
+    ///\param help A help string.
+    ///\retval value The value of the argument will be written to this variable.
+    ///\param obl Indicate if the option is mandatory.
+    ArgParser &refOption(const std::string &name,
 		    const std::string &help,
 		    int &value, bool obl=false);
@@ -125,5 +171,5 @@
     ///\retval value The value of the argument will be written to this variable.
     ///\param obl Indicate if the option is mandatory.
-    ArgParser &option(const std::string &name,
+    ArgParser &refOption(const std::string &name,
 		      const std::string &help,
 		      double &value, bool obl=false);
@@ -136,5 +182,5 @@
     ///\param obl Indicate if the option is mandatory.
     ////\note A mandatory bool obtion is of very little use.)
-    ArgParser &option(const std::string &name,
+    ArgParser &refOption(const std::string &name,
 		      const std::string &help,
 		      bool &value, bool obl=false);
@@ -146,5 +192,5 @@
     ///\retval value The value of the argument will be written to this variable.
     ///\param obl Indicate if the option is mandatory.
-    ArgParser &option(const std::string &name,
+    ArgParser &refOption(const std::string &name,
 		      const std::string &help,
 		      std::string &value, bool obl=false);
@@ -157,5 +203,5 @@
     ///  must be of type "void f(void *)"
     ///\param data Data to be passed to \c func
-    ArgParser &option(const std::string &name,
+    ArgParser &refOption(const std::string &name,
 		    const std::string &help,
 		    void (*func)(void *),void *data);
@@ -233,5 +279,49 @@
       return i!=_opts.end()?i->second.set:false;
     }
-    
+
+
+    class RefType 
+    {
+      ArgParser &_parser;
+      std::string _name;
+    public:
+      RefType(ArgParser &p,const std::string &n) :_parser(p),_name(n) {}
+      operator bool() 
+      {
+	Opts::iterator i = _parser._opts.find(_name);
+	if(i==_parser._opts.end()) exit(3); ///\todo throw exception instead
+	else if(i->second.type!=ArgParser::BOOL) exit(3);
+	else return *(i->second.bool_p);
+      }
+      operator std::string()
+      {
+	Opts::iterator i = _parser._opts.find(_name);
+	if(i==_parser._opts.end()) exit(3); ///\todo throw exception instead
+	else if(i->second.type!=ArgParser::STRING) exit(3);
+	else return *(i->second.string_p);
+      }
+      operator double() 
+      {
+	Opts::iterator i = _parser._opts.find(_name);
+	if(i==_parser._opts.end()) exit(3); ///\todo throw exception instead
+	else if(i->second.type!=ArgParser::DOUBLE) exit(3);
+	else return *(i->second.double_p);
+      }
+      operator int() 
+      {
+	Opts::iterator i = _parser._opts.find(_name);
+	if(i==_parser._opts.end()) exit(3); ///\todo throw exception instead
+	else if(i->second.type!=ArgParser::INTEGER) exit(3);
+	else return *(i->second.int_p);
+      }
+
+    };
+
+    RefType operator[](const std::string &n)
+    {
+      return RefType(*this, n);
+    }
+    
+      
   };
 }
