TaskEngine.h
Go to the documentation of this file.
/* Frobby: Software for monomial ideal computations.
Copyright (C) 2009 University of Aarhus
Contact Bjarke Hammersholt Roune for license information (www.broune.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.
*/
#ifndef TASK_ENGINE_GUARD
#define TASK_ENGINE_GUARD
#include <vector>
class Task;
class TaskEngine {
public:
TaskEngine();
~TaskEngine();
void addTask(Task* task);
bool runNextTask();
void runTasks();
size_t getTotalTasksEver();
private:
void dispose(Task* task);
size_t _totalTasksEver;
vector<Task*> _tasks;
};
#endif
TaskEngine::dispose
void dispose(Task *task)
Definition TaskEngine.cpp:70
TaskEngine::addTask
void addTask(Task *task)
Add a task at the head of the list of pending tasks.
Definition TaskEngine.cpp:35
TaskEngine::getTotalTasksEver
size_t getTotalTasksEver()
Returns the number of times addTask has been successfully called.
Definition TaskEngine.cpp:66
TaskEngine::TaskEngine
TaskEngine()
Definition TaskEngine.cpp:24
TaskEngine::runNextTask
bool runNextTask()
Run the most recently added task that has not been run yet.
Definition TaskEngine.cpp:50
TaskEngine::~TaskEngine
~TaskEngine()
Definition TaskEngine.cpp:28
TaskEngine::_tasks
vector< Task * > _tasks
Definition TaskEngine.h:80
TaskEngine::_totalTasksEver
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
TaskEngine::runTasks
void runTasks()
Runs all pending tasks.
Definition TaskEngine.cpp:61
Task
A Task object represents a unit of work that is performed when the method run() is called.
Definition Task.h:27