Task Scheduler designed for execution of data-related tasks. It creates a computation oriented graph where each nodes represents a task. Useful for optimizing computations that would otherwise be redundantly calculated, such as mathematics equations.
add
: Adds task to sheduler, returns pointer to TaskBase classgetFutureResult
: Returns future task object from which the result can be obtained latergetResult
: Returns result of task after executing allexecuteAll
: Executes all scheduled tasks
Function<float(float, float)> f([](float a, float b) { return a * b; });
TTaskScheduler scheduler;
float a = 1.f;
float b = -2.f;
float c = 0;
auto id1 = scheduler.add([](float a, float c){return -4 * a * c;}, a, c);
auto id2 = scheduler.add([](float b, float v){return b * b + v;}, b, scheduler.getFutureResult<float>(id1));
auto id3 = scheduler.add([](float b, float d){return -b + std::sqrt(d);}, b, scheduler.getFutureResult<float>(id2));
auto id4 = scheduler.add([](float b, float d){return -b - std::sqrt(d);}, b, scheduler.getFutureResult<float>(id2));
auto id5 = scheduler.add([](float a, float v){return v/(2*a);}, a, scheduler.getFutureResult<float>(id3));
auto id6 = scheduler.add([](float a, float v){return v/(2*a);},a, scheduler.getFutureResult<float>(id4));
scheduler.executeAll();
auto r = scheduler.getResult<float>(id5);
std::cout << r << '\n';
std::cout << scheduler.getResult<float>(id6);
- Self implemented
Any
type erasure data type - Self implemented
Function
type for comfortable function handling