85 lines
1.5 KiB
C++
85 lines
1.5 KiB
C++
/*
|
|
* Copyright (c) 2025 Fraunhofer IESE. All rights reserved.
|
|
*
|
|
* Authors:
|
|
* Iron Prando da Silva
|
|
*/
|
|
|
|
#include "poolcontrollermap.h"
|
|
|
|
PoolControllerMap::PoolControllerMap(const std::map<StringMapper, PoolController>& pools)
|
|
{
|
|
mPools.clear();
|
|
mPools.insert(pools.begin(), pools.end());
|
|
}
|
|
|
|
void PoolControllerMap::clear()
|
|
{
|
|
for (auto& p : mPools)
|
|
{
|
|
p.second.clear();
|
|
}
|
|
}
|
|
|
|
void PoolControllerMap::push(const StringMapper& poolName, DBDependencyEntry dep)
|
|
{
|
|
auto pool = mPools.find(poolName);
|
|
if (pool != mPools.end())
|
|
{
|
|
pool->second.push(dep);
|
|
}
|
|
else
|
|
{
|
|
// TODO throw?
|
|
}
|
|
}
|
|
|
|
void PoolControllerMap::increment(const StringMapper& poolName)
|
|
{
|
|
auto pool = mPools.find(poolName);
|
|
if (pool != mPools.end())
|
|
{
|
|
pool->second.increment();
|
|
}
|
|
else
|
|
{
|
|
// TODO throw?
|
|
}
|
|
}
|
|
|
|
void PoolControllerMap::merge(std::vector<DBDependencyEntry>& depEntries)
|
|
{
|
|
for (auto& p : mPools)
|
|
{
|
|
p.second.merge(depEntries);
|
|
}
|
|
}
|
|
|
|
uint PoolControllerMap::getBusyTime(const StringMapper& poolName, const StringMapper& phaseName)
|
|
{
|
|
auto pool = mPools.find(poolName);
|
|
if (pool != mPools.end())
|
|
{
|
|
return pool->second.getBusyTime(phaseName);
|
|
}
|
|
else
|
|
{
|
|
// TODO throw?
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
size_t PoolControllerMap::count(const StringMapper& poolName)
|
|
{
|
|
auto pool = mPools.find(poolName);
|
|
if (pool != mPools.end())
|
|
{
|
|
return pool->second.count();
|
|
}
|
|
else
|
|
{
|
|
// TODO throw?
|
|
return 0;
|
|
}
|
|
}
|