diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2012-05-04 11:41:03 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2012-05-04 11:41:03 +0200 |
commit | 9ae5c9eaaf8f2fe815f4cbda9fb8487e694aa1ee (patch) | |
tree | 145c262376fb58170014d1fc159371b07f80585f /src/taskmanager.cc | |
parent | 1e766529818c36dd49827745649f7893fc45884e (diff) |
Added subTasks method.
Diffstat (limited to 'src/taskmanager.cc')
-rw-r--r-- | src/taskmanager.cc | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/src/taskmanager.cc b/src/taskmanager.cc index f757694..b1fa34e 100644 --- a/src/taskmanager.cc +++ b/src/taskmanager.cc @@ -64,6 +64,10 @@ TaskManager::TaskManager() { TaskManager::~TaskManager() { } +task_t TaskManager::task(taskid_t t) { + return tree.getData(t); +} + taskid_t TaskManager::createId() { return idCount++; } @@ -82,13 +86,11 @@ TaskIdList TaskManager::moveTask(taskid_t id, taskid_t to) try { affectedTasks = tree.move(id, to); - goto finish; } catch (std::exception& e) { throw e; } - finish: return affectedTasks; } @@ -98,13 +100,11 @@ TaskIdList TaskManager::deleteTask(taskid_t id) try { affectedTasks = tree.remove(id); - goto finish; } catch(std::exception& e) { throw e; } - finish: return affectedTasks; } @@ -115,13 +115,11 @@ TaskIdList TaskManager::updateTask(taskid_t id, task_t t) try { affectedTasks = tree.updateData(id, t); - goto finish; } catch (std::exception& e) { throw e; } - finish: return affectedTasks; } @@ -133,14 +131,26 @@ TaskIdList TaskManager::addTask(task_t t, taskid_t parentid) try { affectedTasks = tree.insertAsChild(parentid, id, t); - goto finish; } catch (std::exception& e) { throw e; } - finish: - printf("Returning %d nodes\n", affectedTasks.size()); + return affectedTasks; +} + +TaskIdList TaskManager::subTasks(taskid_t t) + throw (std::exception) { + + TaskIdList affectedTasks; + + try { + affectedTasks = tree.bfs(t); + } + catch (std::exception& e) { + throw e; + } + return affectedTasks; } |