CMS 3D CMS Logo

CmsRunParser.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_CmsRunParser_h
2 #define FWCore_Framework_CmsRunParser_h
3 
4 #include "boost/program_options.hpp"
5 
6 #include <variant>
7 
8 namespace edm {
9  class CmsRunParser {
10  public:
11  using MapOrExit = std::variant<boost::program_options::variables_map, int>;
12  CmsRunParser(const char* name);
13  MapOrExit parse(int argc, const char* argv[]) const;
14  //variant helpers
15  static bool hasVM(const MapOrExit& output) {
16  return std::holds_alternative<boost::program_options::variables_map>(output);
17  }
18  static boost::program_options::variables_map getVM(const MapOrExit& output) {
19  return std::get<boost::program_options::variables_map>(output);
20  }
21  static bool hasExit(const MapOrExit& output) { return std::holds_alternative<int>(output); }
22  static int getExit(const MapOrExit& output) { return std::get<int>(output); }
23 
24  private:
25  boost::program_options::options_description desc_;
26  boost::program_options::options_description all_options_;
27  boost::program_options::positional_options_description pos_options_;
28 
29  public:
30  //Command line parameters
31  static inline const char* const kParameterSetOpt = "parameter-set";
32  static inline const char* const kPythonOpt = "pythonOptions";
33  static inline const char* const kPythonOptDefault = "CMSRUN_PYTHONOPT_DEFAULT";
34  static inline const char* const kCmdCommandOpt = "command,c";
35  static inline const char* const kCmdOpt = "command";
36  static inline const char* const kJobreportCommandOpt = "jobreport,j";
37  static inline const char* const kJobreportOpt = "jobreport";
38  static inline const char* const kEnableJobreportCommandOpt = "enablejobreport,e";
39  static inline const char* const kEnableJobreportOpt = "enablejobreport";
40  static inline const char* const kJobModeCommandOpt = "mode,m";
41  static inline const char* const kJobModeOpt = "mode";
42  static inline const char* const kNumberOfThreadsCommandOpt = "numThreads,n";
43  static inline const char* const kNumberOfThreadsOpt = "numThreads";
44  static inline const char* const kSizeOfStackForThreadCommandOpt = "sizeOfStackForThreadsInKB,s";
45  static inline const char* const kSizeOfStackForThreadOpt = "sizeOfStackForThreadsInKB";
46  static inline const char* const kHelpOpt = "help";
47  static inline const char* const kHelpCommandOpt = "help,h";
48  static inline const char* const kStrictOpt = "strict";
49  };
50 } // namespace edm
51 
52 #endif
static const char *const kEnableJobreportCommandOpt
Definition: CmsRunParser.h:38
boost::program_options::options_description desc_
Definition: CmsRunParser.h:25
static const char *const kJobModeCommandOpt
Definition: CmsRunParser.h:40
static const char *const kStrictOpt
Definition: CmsRunParser.h:48
static boost::program_options::variables_map getVM(const MapOrExit &output)
Definition: CmsRunParser.h:18
static const char *const kCmdOpt
Definition: CmsRunParser.h:35
boost::program_options::positional_options_description pos_options_
Definition: CmsRunParser.h:27
static const char *const kHelpOpt
Definition: CmsRunParser.h:46
static int getExit(const MapOrExit &output)
Definition: CmsRunParser.h:22
static const char *const kEnableJobreportOpt
Definition: CmsRunParser.h:39
static const char *const kJobreportOpt
Definition: CmsRunParser.h:37
static const char *const kParameterSetOpt
Definition: CmsRunParser.h:31
static const char *const kHelpCommandOpt
Definition: CmsRunParser.h:47
std::variant< boost::program_options::variables_map, int > MapOrExit
Definition: CmsRunParser.h:11
static const char *const kJobModeOpt
Definition: CmsRunParser.h:41
static const char *const kCmdCommandOpt
Definition: CmsRunParser.h:34
static const char *const kSizeOfStackForThreadOpt
Definition: CmsRunParser.h:45
static const char *const kSizeOfStackForThreadCommandOpt
Definition: CmsRunParser.h:44
CmsRunParser(const char *name)
Definition: CmsRunParser.cc:53
boost::program_options::options_description all_options_
Definition: CmsRunParser.h:26
static const char *const kPythonOpt
Definition: CmsRunParser.h:32
static bool hasVM(const MapOrExit &output)
Definition: CmsRunParser.h:15
HLT enums.
static const char *const kJobreportCommandOpt
Definition: CmsRunParser.h:36
static const char *const kNumberOfThreadsOpt
Definition: CmsRunParser.h:43
Definition: output.py:1
static const char *const kPythonOptDefault
Definition: CmsRunParser.h:33
static const char *const kNumberOfThreadsCommandOpt
Definition: CmsRunParser.h:42
MapOrExit parse(int argc, const char *argv[]) const
Definition: CmsRunParser.cc:90
static bool hasExit(const MapOrExit &output)
Definition: CmsRunParser.h:21