summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/task/function-task.hh
diff options
context:
space:
mode:
Diffstat (limited to 'tiger-compiler/src/task/function-task.hh')
-rw-r--r--tiger-compiler/src/task/function-task.hh31
1 files changed, 31 insertions, 0 deletions
diff --git a/tiger-compiler/src/task/function-task.hh b/tiger-compiler/src/task/function-task.hh
new file mode 100644
index 0000000..a08b285
--- /dev/null
+++ b/tiger-compiler/src/task/function-task.hh
@@ -0,0 +1,31 @@
+/**
+ ** \file task/function-task.hh
+ ** \brief Declare the task::FunctionTask class.
+ **
+ */
+#pragma once
+
+#include <task/simple-task.hh>
+
+namespace task
+{
+ /// A simple Task that invokes a callback function.
+ class FunctionTask : public SimpleTask
+ {
+ public:
+ using callback_type = auto() -> void;
+
+ FunctionTask(callback_type& callback,
+ const char* module_name,
+ const char* desc,
+ const char* name,
+ std::string deps);
+
+ public:
+ void execute() const override;
+
+ private:
+ callback_type& execute_;
+ };
+
+} //namespace task