##// END OF EJS Templates
Removed bad dependency between VC and VariableModel, moved mime stuff...
Removed bad dependency between VC and VariableModel, moved mime stuff from VC to static Variable methods Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>

File last commit:

r12:4e36a737f884
r27:c08d1b8ad297
Show More
VariableCacheStrategyFactory.h
48 lines | 1.3 KiB | text/x-c | CLexer
/ include / Variable / VariableCacheStrategyFactory.h
#ifndef SCIQLOP_VARIABLECACHESTRATEGYFACTORY_H
#define SCIQLOP_VARIABLECACHESTRATEGYFACTORY_H
#include <memory>
#include <stdexcept>
#include "VariableCacheStrategy.h"
#include "ProportionalCacheStrategy.h"
#include "SingleThresholdCacheStrategy.h"
#include <Common/debug.h>
#include <QString>
enum class CacheStrategy { Proportional, SingleThreshold, TwoThreshold };
class VariableCacheStrategyFactory {
using cacheStratPtr = std::unique_ptr<VariableCacheStrategy>;
public:
static cacheStratPtr createCacheStrategy(CacheStrategy specificStrategy)
{
switch (specificStrategy) {
case CacheStrategy::Proportional: {
return std::unique_ptr<VariableCacheStrategy>{
new ProportionalCacheStrategy{}};
}
case CacheStrategy::SingleThreshold: {
return std::unique_ptr<VariableCacheStrategy>{
new SingleThresholdCacheStrategy{}};
}
case CacheStrategy::TwoThreshold: {
SCIQLOP_ERROR(VariableCacheStrategyFactory, "CacheStrategy::TwoThreshold not implemented yet");
break;
}
default:
SCIQLOP_ERROR(VariableCacheStrategyFactory, "Unknown cache strategy");
break;
}
return nullptr;
}
};
#endif // VARIABLECACHESTRATEGYFACTORY_H