Added functionality for named sequences to be created

This commit is contained in:
Alejandro Saucedo 2020-08-28 15:19:39 +01:00
parent c8db55aa1b
commit b91c392f5e
15 changed files with 299 additions and 173 deletions

View file

@ -71,16 +71,25 @@ Manager::~Manager()
}
std::weak_ptr<Sequence>
Manager::managedSequence()
Manager::getOrCreateManagedSequence(std::string sessionName)
{
SPDLOG_DEBUG("Kompute Manager creating Sequence object");
std::shared_ptr<Sequence> sq = std::make_shared<Sequence>(
this->mPhysicalDevice,
this->mDevice,
this->mComputeQueue,
this->mComputeQueueFamilyIndex);
this->mManagedSequences.push_back(sq);
return sq;
std::unordered_map<std::string, std::shared_ptr<Sequence>>::iterator
found = this->mManagedSequences.find(sessionName);
if (found == this->mManagedSequences.end()) {
std::shared_ptr<Sequence> sq =
std::make_shared<Sequence>(this->mPhysicalDevice,
this->mDevice,
this->mComputeQueue,
this->mComputeQueueFamilyIndex);
sq->init();
this->mManagedSequences.insert({sessionName, sq});
return sq;
}
else {
return found->second;
}
}
void