A class which represents a task manager. More...
#include <TaskManager.h>
Public Slots | |
bool | addTask (QObject *obj) |
Slot which will check if obj is a task and register it if needed. | |
void | removeTask (const int task_id) |
Removes the task specified by task_id if it exists. | |
void | removeTask (QObject *obj) |
Slot which will check if obj is a task and remove it if needed. |
Signals | |
void | newTaskAdded (ITask *new_task) |
Called when a new task is registered in the global object pool. | |
void | taskRemoved (ITask *task_removed) |
Called when a task if removed from the global object pool. |
Public Member Functions | |
QList< int > | allTaskIDs () const |
Returns the IDs of all tasks. | |
QList< ITask * > | allTasks () const |
Returns all the tasks managed by the task manager. | |
bool | assignIdToTask (ITask *task) |
Function which can be used to assign an ID to a new task. | |
bool | forwardTaskMessagesToQtMsgEngine () const |
Gets if tasks should forward messages logged to them to the qtMsgEngineActive() on the Logger. | |
ITask * | hasTask (const int task_id) const |
Checks if a specific task exists and returns a reference to it when found, 0 otherwise. | |
ITask * | hasTask (const QString &task_name) const |
Checks if a task with the specified task name exists. | |
void | setForwardTaskMessagesToQtMsgEngine (bool is_enabled) |
Sets if tasks should forward messages logged to them to the qtMsgEngineActive() on the Logger. | |
int | taskID (const QString &task_name) |
Maps a task name to the corresponding task ID. | |
QString | taskName (const int task_id, bool *ok=0) const |
Maps a task ID to the corresponding task string. | |
QStringList | taskNames () const |
Returns the names of all tasks. |
A class which represents a task manager.
The task manager is responsible to monitor the global object pool for tasks registered in it and to provide information about these tasks.
See the Tasking article for more information on tasking.
This class was added in Qtilities v1.0.
|
slot |
Slot which will check if obj is a task and register it if needed.
bool TaskManager::assignIdToTask | ( | ITask * | task | ) |
Function which can be used to assign an ID to a new task.
New tasks does not have a unique ID by default. The standard way to assign tasks IDs are to register them in the global object pool (using OBJECT_MANAGER->registerObject()).
However, in cases where the task is local and you don't want to register it in the global object pool, but you still need an ID, you can assign an ID to the task manually using this function.
This function was added in Qtilities v1.3.
bool TaskManager::forwardTaskMessagesToQtMsgEngine | ( | ) | const |
Gets if tasks should forward messages logged to them to the qtMsgEngineActive() on the Logger.
Disabled by default.
This function was added in Qtilities v1.3.
ITask * Qtilities::Core::TaskManager::hasTask | ( | const QString & | task_name | ) | const |
Checks if a task with the specified task name exists.
If multiple tasks with task_name exists this function will returns the ID of the first one found.
void TaskManager::setForwardTaskMessagesToQtMsgEngine | ( | bool | is_enabled | ) |
Sets if tasks should forward messages logged to them to the qtMsgEngineActive() on the Logger.
Disabled by default.
This function was added in Qtilities v1.3.
int Qtilities::Core::TaskManager::taskID | ( | const QString & | task_name | ) |
Maps a task name to the corresponding task ID.
If multiple tasks with task_name exists this function will returns the ID of the first one found.
If no task with task_name
exists, -1 will be returned.
QString Qtilities::Core::TaskManager::taskName | ( | const int | task_id, |
bool * | ok = 0 |
||
) | const |
Maps a task ID to the corresponding task string.
ok | Will return true if a task existed with the specified task_id, false otherwise. |
Qtilities : Reference Documentation | Back to top |
Copyright © 2009-2013, Jaco Naudé
|