]> git.donarmstrong.com Git - mothur.git/blob - optionparser.cpp
created mothurOut class to handle logfiles
[mothur.git] / optionparser.cpp
1 /*
2  *  optionparser.cpp
3  *  Mothur
4  *
5  *  Created by Sarah Westcott on 6/8/09.
6  *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
7  *
8  */
9
10 #include "optionparser.h"
11
12 /***********************************************************************/
13
14 OptionParser::OptionParser(string option) {
15         try {
16                 m = MothurOut::getInstance();
17                 if (option != "") {
18                         
19                         string key, value;              
20                         //reads in parameters and values
21                         while((option.find_first_of(',') != -1)) {  //while there are parameters
22                                 splitAtComma(value, option);
23                                 splitAtEquals(key, value);
24                                 parameters[key] = value;
25                         }
26                         
27                         //in case there is no comma and to get last parameter after comma
28                         splitAtEquals(key, option);
29                         parameters[key] = option;
30                 }
31         }
32         catch(exception& e) {
33                 m->errorOut(e, "OptionParser", "parse");
34                 exit(1);
35         }
36 }
37
38 /***********************************************************************/
39
40 map<string, string> OptionParser::getParameters() {     return parameters;      }
41
42 /***********************************************************************/