joque
task orchestration library
task.hpp File Reference
#include "job.hpp"
#include <functional>
#include <map>
#include <memory>
#include <span>
#include <string>
#include <type_traits>
#include <vector>
+ Include dependency graph for task.hpp:

Go to the source code of this file.

Classes

struct  joque::resource
 Abstraction to model resource used by tasks. More...
 
struct  joque::task
 Single task that should be executed by the system. More...
 
struct  joque::task_set
 A set of tasks that contains either tasks or another sets. More...
 

Namespaces

 joque
 MIT License.
 

Typedefs

template<typename T >
using joque::ref_vec = std::vector< std::reference_wrapper< const T > >
 

Functions

template<typename T , typename Fun >
 joque::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. More...
 
void joque::for_each_add_dep (task_set &ts, const task &dep)
 Recursively adds dependency on dep for each task in ts, except for dep itself. More...
 
void joque::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. More...
 
void joque::run_each_after (task_set &ts, const task &t)
 Recursively adds run after relationship so that all tasks in ts are run after t. More...
 
void joque::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. More...
 
void joque::invalidated_by_all_of (task &t, const task_set &ts)
 
template<typename T , typename Fun >
void joque::for_each_task_impl (T &ts, Fun &&f, const std::string &prefix)
 

Variables

Fun && joque::f
 

Class Documentation

◆ joque::resource

struct joque::resource

Abstraction to model resource used by tasks.

Out of all tasks that reference single resource, only one may be executed at any point in time.

+ Collaboration diagram for joque::resource:
Class Members
string name

◆ joque::task

struct joque::task

Single task that should be executed by the system.

+ Collaboration diagram for joque::task:
Class Members
job_ptr job Job being executed for the task.
ref_vec< task > depends_on Dependencies of the task - all of these should be executed before this task.

In case any of these is invalidated, this task is also invalidated.

ref_vec< task > run_after Tasks that should be executed before this task.

(depends_on task are implicitly included)

ref_vec< task > invalidated_by Tasks which invalidation also invalidates this task.
ref_vec< resource > resources Resources used by this task, only one task can access any resource at single point in time.
bool hidden In case this is set to true, this task should not be visible in standard reports.

◆ joque::task_set

struct joque::task_set

A set of tasks that contains either tasks or another sets.

This forms a tree representing the entire task set.

Convention is that names inside the structure are concatenated to form a full path. Task x in root set is referred as //x. Task y in subset z is referred as //z/y.

+ Collaboration diagram for joque::task_set:
Class Members
map< string, task > tasks Tasks of this set.
map< string, task_set > sets Subsets of this set.