-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscheduler.h
60 lines (45 loc) · 1.11 KB
/
scheduler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// -*- C++ -*-
#pragma once
#include "job.h"
#include "dbl.h"
class Scheduler;
class JobCmp
{
private:
Scheduler *sched;
int crit;
public:
JobCmp(Scheduler *s, int c) : sched(s), crit(c)
{}
~JobCmp()
{}
int operator () (Job *j1, Job *j2);
};
class Scheduler
{
public:
std::vector<Task*> tasks;
std::vector<Job*> jobs;
double hp;
int max_crit;
Scheduler(std::vector<Task*> const & t);
~Scheduler();
virtual int prioLessThanEq(Job const *j1, Job const *j2, int crit) = 0;
static Scheduler *create(char c, std::vector<Task*> const & t);
JobCmp jobCmp(int crit)
{ return JobCmp(this, crit); }
};
class DefaultScheduler : public Scheduler
{
public:
DefaultScheduler(std::vector<Task*> const & t) : Scheduler(t)
{}
int prioLessThanEq(Job const *j1, Job const *j2, int);
};
class EDFScheduler : public Scheduler
{
public:
EDFScheduler(std::vector<Task*> const & t) : Scheduler(t)
{}
int prioLessThanEq(Job const *j1, Job const *j2, int crit);
};