Cheeze/src/domain/Controller.cpp

30 lines
491 B
C++

#include "domain/Controller.h"
Controller Controller::_instance;
Controller::Controller() : _strategy(nullptr) {}
void Controller::setStrategy(BaseStrategy* newStrategy) {
if (_strategy) {
delete _strategy;
}
_strategy = newStrategy;
if (_strategy) {
_strategy->setup();
}
}
Controller::~Controller() {
if (_strategy) {
delete _strategy;
}
}
Controller& Controller::getInstance() {
return _instance;
}
void Controller::process() {
_strategy->process();
}