Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkRoundRobinSchedulingAlgorithm.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #include "mitkSchedulableProcess.h"
19 
21 {
22 }
23 
25 {
26 }
27 
28 mitk::SchedulableProcess* mitk::RoundRobinSchedulingAlgorithm::GetNextProcess(std::vector<SchedulableProcess*>& processQueue)
29 {
30  size_t numProcesses = processQueue.size();
31 
32  if (numProcesses == 0)
33  return nullptr;
34 
35  mitk::SchedulableProcess* process = processQueue[0];
36 
37  if (numProcesses > 1)
38  {
39  processQueue.erase(processQueue.begin());
40  processQueue.push_back(process);
41  }
42 
43  return process;
44 }
SchedulableProcess * GetNextProcess(std::vector< SchedulableProcess * > &processQueue) override