ppap4lmp  0.7.2
invoker.cpp
Go to the documentation of this file.
1 
9 #include "invoker.h"
10 #include "../utils/message.h"
11 
12 namespace ut = utils;
13 
14 /* ------------------------------------------------------------------ */
15 
17 {
18  for (const auto &p : procs)
19  {
20  p->startup();
21  }
22 
23  try
24  {
25  for (const auto &p : procs)
26  {
27  p->prepare();
28  }
29 
30  execute_impl(procs);
31 
32  for (const auto &p : procs)
33  {
34  p->finish();
35  }
36  }
37  catch (std::runtime_error &e)
38  {
39  // NOTE: Error message can also be seen as Python's exception.
40  ut::log("ERROR - " + Str(e.what()));
41  }
42 }
std::string Str
Str is an alias for string.
Definition: std.h:21
void execute(const Vec< ShPtr< Processor >> &procs)
Execute analysis programmed in given Processor objects.
Definition: invoker.cpp:16
std::vector< T > Vec
Vec is an alias for vector (same as list in Python).
Definition: std.h:27
void runtime_error(const Str &msg)
Raise (for Python) and throw (for C++) a runtime error.
void log(const Str &msg)
Logging a message.
Definition: message.cpp:29
Namespace for utility functions.
Definition: join.h:14
virtual void execute_impl(const Vec< ShPtr< Processor >> &procs)=0
Implementation how to execute a main part of analysis.
std::shared_ptr< T > ShPtr
ShPtr is an alias for shared pointer.
Definition: std.h:16
This file has a definition of Invoker class, which executes one or more analysis. ...