WRENCH  1.11
Cyberinfrastructure Simulation Workbench
Overview Installation Getting Started WRENCH 101 WRENCH 102
CustomAction.h
1 
10 #ifndef WRENCH_CUSTOM_ACTION_H
11 #define WRENCH_CUSTOM_ACTION_H
12 
13 #include <string>
14 
15 #include "wrench/action/Action.h"
16 
17 namespace wrench {
18 
22  class CustomAction : public Action {
23 
24  public:
25 
26  protected:
27  friend class CompoundJob;
28 
29  CustomAction(const std::string& name, std::shared_ptr<CompoundJob> job,
30  double ram,
31  unsigned long num_cores,
32  const std::function<void (std::shared_ptr<ActionExecutor> action_executor)> &lambda_execute,
33  const std::function<void (std::shared_ptr<ActionExecutor> action_executor)> &lambda_terminate);
34 
35  unsigned long getMinNumCores() const override;
36  unsigned long getMaxNumCores() const override;
37  double getMinRAMFootprint() const override;
38 
39  void execute(std::shared_ptr<ActionExecutor> action_executor) override;
40  void terminate(std::shared_ptr<ActionExecutor> action_executor) override;
41 
42  private:
43  double ram;
44  unsigned long num_cores;
45 
46  std::function<void (std::shared_ptr<ActionExecutor> action_executor)> lambda_execute;
47  std::function<void (std::shared_ptr<ActionExecutor> action_executor)> lambda_terminate;
48  };
49 }
50 
51 #endif //WRENCH_CUSTOM_ACTION_H
wrench::CustomAction::execute
void execute(std::shared_ptr< ActionExecutor > action_executor) override
Method to execute the action.
Definition: CustomAction.cpp:39
wrench::CustomAction
A class that implements a custom action.
Definition: CustomAction.h:22
wrench::CustomAction::CustomAction
CustomAction(const std::string &name, std::shared_ptr< CompoundJob > job, double ram, unsigned long num_cores, const std::function< void(std::shared_ptr< ActionExecutor > action_executor)> &lambda_execute, const std::function< void(std::shared_ptr< ActionExecutor > action_executor)> &lambda_terminate)
Constructor.
Definition: CustomAction.cpp:27
wrench::CustomAction::terminate
void terminate(std::shared_ptr< ActionExecutor > action_executor) override
Method called when the action terminates.
Definition: CustomAction.cpp:47
wrench::CustomAction::getMaxNumCores
unsigned long getMaxNumCores() const override
Returns the action's maximum number of required cores.
Definition: CustomAction.cpp:63
wrench
Definition: Action.cpp:28
wrench::CustomAction::getMinNumCores
unsigned long getMinNumCores() const override
Returns the action's minimum number of required cores.
Definition: CustomAction.cpp:55
wrench::CustomAction::getMinRAMFootprint
double getMinRAMFootprint() const override
Returns the action's minimum required memory footprint.
Definition: CustomAction.cpp:71
wrench::Action
An abstract class that implements the concept of an action.
Definition: Action.h:28