Tomographer  v1.0a
Tomographer C++ Framework Documentation
Task Interface

A task which may be repeated in parallel with different inputs.

Task should represent an instance of the task to complete (e.g. a Metropolis-Hastings random walk). It should provide the following methods.

In the following, ConstantDataType is some type that was specified to the task dispatcher.

typedef .. ResultType
An alias for the type of, e.g. a structure, which contains the result of the given task. See Task::getResult().
static InputType get_input(unsigned int k, const ConstantDataType * pcdata)
Provide input to a new task. k is the task iteration number and pcdata is a pointer to the shared const data.
The return value may be any type. It will be passed directly to the first argument of the constructor.
Task(InputType input, const ConstantDataType * pcdata)
Task constructor: construct a Task instance which will solve the task for the given input. The input parameter is whatever Task::get_input() returned.
void run(const ConstantDataType * pcdata, LoggerType & logger, TaskManagerIface * tmgriface)
Actually runs the task. It can log to the given logger (see Tomographer::Logger::LoggerBase). Note that the logger need NOT be the logger that may have been specified, e.g., to the task dispatcher: it could be, for example, an internal thread-safe wrapper to your original logger. To be sure, you should make this a template method with parameters LoggerType and TaskManagerIface.
The code in run() should poll tmgriface->status_report_requested() and provide a status report if requested to do so via tmgriface->status_report(const TaskStatusReportType &). See documentation for TaskManagerIface Interface.
ResultType getResult()
Return a custom type which holds the result for the given task. This will be given to the result collector (see ResultsCollector Interface).