
#ifndef PLS_LAMBDA_TASK_H_
#define PLS_LAMBDA_TASK_H_

#include "pls/internal/scheduling/task.h"

namespace pls {
namespace internal {
namespace scheduling {

template<typename Function>
class lambda_task_by_reference : public task {
  const Function &function_;

 public:
  explicit lambda_task_by_reference(const Function &function) : task{}, function_{function} {};

 protected:
  void execute_internal() override {
    function_();
  }
};

template<typename Function>
class lambda_task_by_value : public task {
  const Function function_;

 public:
  explicit lambda_task_by_value(const Function &function) : task{}, function_{function} {};

 protected:
  void execute_internal() override {
    function_();
  }
};

}
}
}

#endif //PLS_LAMBDA_TASK_H_
