GENIEGenerator
Loading...
Searching...
No Matches
CmdLnArgParser.h
Go to the documentation of this file.
1//____________________________________________________________________________
2/*!
3
4\class genie::CmdLnArgParser
5
6\brief Command line argument parser
7
8\author Costas Andreopoulos <c.andreopoulos \at cern.ch>
9 University of Liverpool
10
11\created July 23, 2010
12
13\cpright Copyright (c) 2003-2025, The GENIE Collaboration
14 For the full text of the license visit http://copyright.genie-mc.org
15*/
16//____________________________________________________________________________
17
18#ifndef _CMD_LINE_ARG_PARSER_H_
19#define _CMD_LINE_ARG_PARSER_H_
20
21#include <string>
22#include <vector>
23
24using std::string;
25using std::vector;
26
27namespace genie {
28
30
31public:
32 CmdLnArgParser(int argc, char **argv);
34
35 // Methods to check the existence of single character switches (eg -f, -s)
36 // and retrieve the command-line argument following the switch
37
38 bool OptionExists (char opt); ///< was option set?
39 char * Arg (char opt); ///< return argument following -`opt'
40
41 string ArgAsString (char opt);
42 vector<string> ArgAsStringTokens (char opt, string delimeter);
43 double ArgAsDouble (char opt);
44 vector<double> ArgAsDoubleTokens (char opt, string delimeter);
45 int ArgAsInt (char opt);
46 vector<int> ArgAsIntTokens (char opt, string delimeter);
47 long ArgAsLong (char opt);
48 vector<long> ArgAsLongTokens (char opt, string delimeter);
49
50 // As above, but supporting multi-character switches (eg --with-x-file )
51
52 bool OptionExists (string opt); ///< was option set?
53 char * Arg (string opt); ///< return argument following --`opt'
54
55 string ArgAsString (string opt);
56 double ArgAsDouble (string opt);
57 int ArgAsInt (string opt);
58 long ArgAsLong (string opt);
59
60private:
61
62 int fArgc;
63 char **fArgv;
64
65};
66
67} // genie namespace
68
69#endif // _CMD_LINE_ARG_PARSER_H_
string ArgAsString(char opt)
vector< int > ArgAsIntTokens(char opt, string delimeter)
double ArgAsDouble(char opt)
bool OptionExists(char opt)
was option set?
char * Arg(char opt)
return argument following -‘opt’
vector< double > ArgAsDoubleTokens(char opt, string delimeter)
vector< string > ArgAsStringTokens(char opt, string delimeter)
vector< long > ArgAsLongTokens(char opt, string delimeter)
CmdLnArgParser(int argc, char **argv)
THE MAIN GENIE PROJECT NAMESPACE
Definition AlgCmp.h:25