31 #include <type_traits>
44 template <
typename T >
45 using ref_vec = std::vector< std::reference_wrapper< const T > >;
83 std::map< std::string, task >
tasks;
85 std::map< std::string, task_set >
sets;
91 template <
typename T,
typename Fun >
93 void for_each_task( T& ts, Fun&&
f );
113 template < typename T, typename Fun >
116 for (
auto& [name, t] : ts.tasks )
117 f( ( prefix +
"/" ).append( name ), t );
118 for (
auto& [name, s] : ts.sets )
122 template <
typename T,
typename Fun >
123 requires( std::same_as< std::remove_cvref_t< T >, task_set > )
124 void for_each_task( T& ts, Fun&&
f )
MIT License.
Definition: dag.hpp:27
std::string name
Definition: task.hpp:41
std::vector< std::reference_wrapper< const T > > ref_vec
Definition: task.hpp:45
ref_vec< resource > resources
Resources used by this task, only one task can access any resource at single point in time.
Definition: task.hpp:67
ref_vec< task > run_after
Tasks that should be executed before this task.
Definition: task.hpp:60
void add_dep_to_each(task &t, const task_set &ts)
Recursively adds dependency on each task in ts to task t, except for t itself.
bool hidden
In case this is set to true, this task should not be visible in standard reports.
Definition: task.hpp:71
void invalidated_by_all_of(task &t, const task_set &ts)
std::map< std::string, task > tasks
Tasks of this set.
Definition: task.hpp:83
void for_each_add_dep(task_set &ts, const task &dep)
Recursively adds dependency on dep for each task in ts, except for dep itself.
void run_after_all_of(task &t, const task_set &ts)
Recursively adds run after relationship so that task t is run after all tasks in set ts.
std::map< std::string, task_set > sets
Subsets of this set.
Definition: task.hpp:85
job_ptr job
Job being executed for the task.
Definition: task.hpp:51
ref_vec< task > invalidated_by
Tasks which invalidation also invalidates this task.
Definition: task.hpp:63
Fun && f
Definition: task.hpp:93
void run_each_after(task_set &ts, const task &t)
Recursively adds run after relationship so that all tasks in ts are run after t.
ref_vec< task > depends_on
Dependencies of the task - all of these should be executed before this task.
Definition: task.hpp:56
void for_each_task_impl(T &ts, Fun &&f, const std::string &prefix)
Definition: task.hpp:114
requires(std::same_as< std::remove_cvref_t< T >, task_set >) void for_each_task(T &ts
Recursively executes function f for each task in set ts.
Abstraction to model resource used by tasks.
Definition: task.hpp:40
Single task that should be executed by the system.
Definition: task.hpp:49
A set of tasks that contains either tasks or another sets.
Definition: task.hpp:81
Custom unique_ptr wrapper that simplifies syntax of tasks.
Definition: job.hpp:73