Pakman
AbstractControllerStatic.cc
1 #include <vector>
2 #include <string>
3 
4 #include "core/common.h"
5 #include "core/LongOptions.h"
6 #include "core/Arguments.h"
7 #include "core/Command.h"
8 
9 #include "SweepController.h"
10 #include "ABCRejectionController.h"
11 #include "ABCSMCController.h"
12 
13 #include "AbstractController.h"
14 
15 // Return controller type based on string
17 {
18  // Check for sweep controller
19  if (arg.compare("sweep") == 0)
20  return sweep;
21 
22  // Check for rejection controller
23  else if (arg.compare("rejection") == 0)
24  return rejection;
25 
26  // Check for smc controller
27  else if (arg.compare("smc") == 0)
28  return smc;
29 
30  // Else return no_controller
31  return no_controller;
32 }
33 
34 std::string AbstractController::help(controller_t controller)
35 {
36  switch (controller)
37  {
38  case sweep:
39  return SweepController::help();
40  case rejection:
42  case smc:
43  return ABCSMCController::help();
44  default:
45  throw std::runtime_error("Invalid controller type in "
46  "AbstractController::help");
47  }
48 }
49 
51  LongOptions& lopts)
52 {
53  switch (controller)
54  {
55  case sweep:
56  return SweepController::addLongOptions(lopts);
57  case rejection:
59  case smc:
61  default:
62  throw std::runtime_error("Invalid controller type in "
63  "AbstractController::makeController");
64  }
65 }
66 
68  const Arguments& args)
69 {
70  switch (controller)
71  {
72  case sweep:
74  case rejection:
76  case smc:
78  default:
79  throw std::runtime_error("Invalid controller type in "
80  "AbstractController::makeController");
81  }
82 }
static std::string help()
static ABCSMCController * makeController(const Arguments &args)
static controller_t getController(const std::string &arg)
static SweepController * makeController(const Arguments &args)
controller_t
Definition: common.h:45
static std::string help(controller_t controller)
static ABCRejectionController * makeController(const Arguments &args)
static void addLongOptions(LongOptions &lopts)
static void addLongOptions(LongOptions &lopts)
static void addLongOptions(LongOptions &lopts)
static AbstractController * makeController(controller_t controller, const Arguments &args)
static std::string help()
static void addLongOptions(controller_t controller, LongOptions &lopts)