summaryrefslogtreecommitdiff
path: root/Simulator/include/simulation/workloads/WorkloadPool.h
blob: 28a2ad047c28fc495f25af07c8f8733ecf412ecc (plain)
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
#pragma once
#include "simulation/workloads/Workload.h"
#include <vector>

namespace Simulation
{
	class WorkloadPool
	{
	public:
		/*
			Adds the given workload to this pool of workloads.
		*/
		void addWorkload(Workload w);

		/*
			Returns a reference to the vector of workloads.
		*/
		std::vector<Workload*> getWorkloads(uint32_t currentTick);

		/*
			Returns a reference to the workload with the given id.
		*/
		Workload& getWorkload(int id);

		/*
			Removes all workloads that are finished.
		*/
		void clearFinishedWorkloads();

		/*
			Returns true if the workloads vector of this pool is empty.
		*/
		bool isEmpty();

	private:
		/*
			Sets all dependencyFinished to true of workloads with the given id as dependency.
		*/
		void setDependenciesFinished(int id);

		std::vector<Workload> workloads;
	};
}