* replaced parser arguments by project specific IndexerCommands that know everything the indexer needs to know to do its job * added different language and project specific indexers that know how to handle a certain kind of indexer command * refactored FileManager and FileRegister to have less overhead * removed no-rtti restriction for clang files in lib cxx * uncommented deprecated interprocess code. fortune cookie message = Happiness will bring you good luck.
49 lines
1008 B
C++
49 lines
1008 B
C++
#include "data/TaskInjectStorage.h"
|
|
|
|
#include <chrono>
|
|
#include <thread>
|
|
|
|
#include "data/Storage.h"
|
|
#include "data/StorageProvider.h"
|
|
|
|
TaskInjectStorage::TaskInjectStorage(
|
|
std::shared_ptr<StorageProvider> storageProvider,
|
|
std::shared_ptr<Storage> target
|
|
)
|
|
: m_storageProvider(storageProvider)
|
|
, m_target(target)
|
|
{
|
|
}
|
|
|
|
void TaskInjectStorage::doEnter(std::shared_ptr<Blackboard> blackboard)
|
|
{
|
|
}
|
|
|
|
Task::TaskState TaskInjectStorage::doUpdate(std::shared_ptr<Blackboard> blackboard)
|
|
{
|
|
if (m_storageProvider->getStorageCount() > 0)
|
|
{
|
|
std::shared_ptr<IntermediateStorage> source = m_storageProvider->consumeLargestStorage();
|
|
if (source)
|
|
{
|
|
m_target->inject(source.get());
|
|
return STATE_SUCCESS;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
const int SLEEP_TIME_MS = 25;
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_MS));
|
|
}
|
|
|
|
return STATE_FAILURE;
|
|
}
|
|
|
|
void TaskInjectStorage::doExit(std::shared_ptr<Blackboard> blackboard)
|
|
{
|
|
}
|
|
|
|
void TaskInjectStorage::doReset(std::shared_ptr<Blackboard> blackboard)
|
|
{
|
|
}
|