Frobby  0.9.5
TaskEngine.h
Go to the documentation of this file.
1 /* Frobby: Software for monomial ideal computations.
2  Copyright (C) 2009 University of Aarhus
3  Contact Bjarke Hammersholt Roune for license information (www.broune.com)
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see http://www.gnu.org/licenses/.
17 */
18 #ifndef TASK_ENGINE_GUARD
19 #define TASK_ENGINE_GUARD
20 
21 #include <vector>
22 
23 class Task;
24 
40 class TaskEngine {
41  public:
42  TaskEngine();
43  ~TaskEngine();
44 
52  void addTask(Task* task);
53 
59  bool runNextTask();
60 
65  void runTasks();
66 
71  size_t getTotalTasksEver();
72 
73  private:
74  void dispose(Task* task);
75 
79 
80  vector<Task*> _tasks;
81 };
82 
83 #endif
TaskEngine handles a list of tasks that are to be carried out.
Definition: TaskEngine.h:40
void dispose(Task *task)
Definition: TaskEngine.cpp:70
void addTask(Task *task)
Add a task at the head of the list of pending tasks.
Definition: TaskEngine.cpp:35
size_t getTotalTasksEver()
Returns the number of times addTask has been successfully called.
Definition: TaskEngine.cpp:66
bool runNextTask()
Run the most recently added task that has not been run yet.
Definition: TaskEngine.cpp:50
vector< Task * > _tasks
Definition: TaskEngine.h:80
size_t _totalTasksEver
This is used for statistics so that it is not a disaster if this overflows for very long-running comp...
Definition: TaskEngine.h:78
void runTasks()
Runs all pending tasks.
Definition: TaskEngine.cpp:61
A Task object represents a unit of work that is performed when the method run() is called.
Definition: Task.h:27