ui: split steps of indexing files and saving the last few batches of data

* implemented showing dialog for database injection
* implemented easy-to-read way of creating behavior tree structures
* moved injector wait logic out of injection task
This commit is contained in:
malte_langkabel
2016-11-11 15:40:28 +01:00
parent 65eca50be4
commit fb72f73567
20 changed files with 431 additions and 108 deletions
@@ -0,0 +1,56 @@
#include "utility/scheduling/TaskGroupSelector.h"
TaskGroupSelector::TaskGroupSelector()
{
}
TaskGroupSelector::~TaskGroupSelector()
{
}
void TaskGroupSelector::addTask(std::shared_ptr<Task> task)
{
m_taskRunners.push_back(std::make_shared<TaskRunner>(task));
}
void TaskGroupSelector::doEnter(std::shared_ptr<Blackboard> blackboard)
{
m_taskIndex = 0;
}
Task::TaskState TaskGroupSelector::doUpdate(std::shared_ptr<Blackboard> blackboard)
{
if (m_taskIndex >= int(m_taskRunners.size()))
{
return STATE_FAILURE;
}
else if (m_taskIndex < 0)
{
return STATE_SUCCESS;
}
TaskState state = m_taskRunners[m_taskIndex]->update(blackboard);
if (state == STATE_FAILURE)
{
m_taskIndex++;
}
else if (state == STATE_SUCCESS)
{
m_taskIndex = -1;
}
return STATE_RUNNING;
}
void TaskGroupSelector::doExit(std::shared_ptr<Blackboard> blackboard)
{
}
void TaskGroupSelector::doReset(std::shared_ptr<Blackboard> blackboard)
{
for (size_t i = 0; i < m_taskRunners.size(); i++)
{
m_taskRunners[i]->reset();
}
}