|
Pakman
|
#include <AbstractController.h>

Public Member Functions | |
| AbstractController ()=default | |
| virtual | ~AbstractController ()=default |
| void | assignMaster (std::shared_ptr< AbstractMaster > p_master) |
| virtual void | iterate ()=0 |
| virtual Command | getSimulator () const =0 |
Static Public Member Functions | |
| static controller_t | getController (const std::string &arg) |
| static std::string | help (controller_t controller) |
| static void | addLongOptions (controller_t controller, LongOptions &lopts) |
| static AbstractController * | makeController (controller_t controller, const Arguments &args) |
Protected Attributes | |
| std::shared_ptr< AbstractMaster > | m_p_master |
An abstract class for submitting simulation tasks.
AbstractControllers are responsible for submitting simulation tasks to an instantiation of AbstractMaster, as part of some algorithm.
The AbstractController::assignMaster() and AbstractMaster::assignController() methods are used for assigning AbstractMaster and AbstractController objects to each other.
AbstractControllers are designed for use in an event loop. The AbstractController::iterate() method should be called repeatedly by AbstractMaster. The AbstractController should call AbstractMaster::terminate() on its assigned AbstractMaster when the algorithm has finished.
From the perspective of AbstractController, the AbstractMaster is a black box that it pushes tasks to (via AbstractMaster::pushPendingTask()), and retrieves finished tasks from (via AbstractMaster::frontFinishedTask()). This simplifies the design of Controller classes to implement new algorithms, since the programmer does not need to worry about the execution of the tasks.
The use of AbstractController is governed by static methods. The static addLongOptions() and help() methods determine which command-line options the Controller accepts and return a help message explaining the options, respectively. The static makeController() method is a factory method that creates a Controller from command-line arguments.
Definition at line 44 of file AbstractController.h.
|
default |
Default constructor does nothing.
|
virtualdefault |
Default destructor does nothing.
|
static |
Add Controller-specific long command-line options to the given LongOptions object.
When subclassing AbstractController, be sure to include a static method with the signature
and add an entry in the switch statement of AbstractController::addLongOptions().
| controller | Controller type. |
| lopts | long command-line options that the Controller needs. |
Definition at line 50 of file AbstractControllerStatic.cc.
| void AbstractController::assignMaster | ( | std::shared_ptr< AbstractMaster > | p_master | ) |
Assign pointer to AbstractMaster.
| p_master | pointer to AbstractMaster object to be assigned to AbstractController. |
Definition at line 6 of file AbstractController.cc.
|
static |
Interpret string as Controller type.
The controller_t enumeration type is defined in common.h.
| arg | string to be interpreted. |
Definition at line 16 of file AbstractControllerStatic.cc.
|
pure virtual |
Implemented in ABCRejectionController, ABCSMCController, and SweepController.
|
static |
Return help message based on Controller type.
When subclassing AbstractController, be sure to include a static method with the signature
and add an entry in the switch statement of AbstractController::help().
| controller | Controller type. |
Definition at line 34 of file AbstractControllerStatic.cc.
|
pure virtual |
Iterates the AbstractController. Should be called by a Master.
Implemented in ABCRejectionController, ABCSMCController, and SweepController.
|
static |
Create Controller instance based on Controller type.
When subclassing AbstractController, be sure to include a static method with the signature
and add an entry in the switch statement of AbstractController::help()
| controller | Controller type. |
| args | command-line arguments. |
Definition at line 67 of file AbstractControllerStatic.cc.
|
protected |
Shared pointer to AbstractMaster.
Definition at line 137 of file AbstractController.h.