VOX
A little voxel engine
Loading...
Searching...
No Matches
Task.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "tasks.hpp"
4#include "Node.hpp"
5
6
7namespace task
8{
9class Task
10{
11public:
12 Task(TaskNode * node)
13 {
14 m_node = node;
15 };
16 ~Task(){};
17 Task(const Task &) = default;
18 Task & operator=(const Task &) = default;
19 Task(Task &&) = default;
20 Task & operator=(Task &&) = default;
21
28 Task & precede(Task & t) {
29 m_node->addSuccessor(*t.m_node);
30 t.m_node->addDependent(*m_node);
31
32 return *this;
33 }
34
42 t.precede(*this);
43 return *this;
44 }
45
52 template<typename F>
53 void set_task(F && f);
54
55 Task & Name(const std::string & name)
56 {
57 m_node->setName(name);
58 return *this;
59 }
60 std::string getName() const { return m_node->getName(); }
61
62 void *getData() const;
63 void setData(void * data);
64
65 void reset();
66 void resetTask();
67
68 bool isEmpty() const;
69 bool hasTask() const;
70private:
71 TaskNode * m_node;
72};
73}
Definition: Node.hpp:16
std::string getName() const
Definition: Node.hpp:55
void addSuccessor(TaskNode &node)
Definition: Node.hpp:44
void addDependent(TaskNode &node)
Definition: Node.hpp:41
void setName(const std::string &name)
Definition: Node.hpp:54
Definition: Task.hpp:10
Task & operator=(const Task &)=default
bool hasTask() const
~Task()
Definition: Task.hpp:16
void resetTask()
bool isEmpty() const
Task & operator=(Task &&)=default
Task & precede(Task &t)
add a precedence link from this task to
Definition: Task.hpp:28
void setData(void *data)
Task & succceed(Task &t)
add a successor link from this task to t
Definition: Task.hpp:41
Task(TaskNode *node)
Definition: Task.hpp:12
std::string getName() const
Definition: Task.hpp:60
Task & Name(const std::string &name)
Definition: Task.hpp:55
void reset()
void set_task(F &&f)
Set the underlying task.
void * getData() const
Task(Task &&)=default
Task(const Task &)=default
Definition: Executor.cpp:5