#include "Command.h" #include "Exception.h" Command::Command(const Command * c) { this->set_museum(*c->museum); this->set_view(*c->view); this->set_controller(*c->controller); } Command::Command(Museum & m, View & v, ViewController & c) { this->set_museum(m); this->set_view(v); this->set_controller(c); } Command::Command(Museum & m, View & v) { this->set_museum(m); this->set_view(v); } Command::Command(Museum & m) { this->set_museum(m); } Museum & Command::get_museum() { if (this->museum == nullptr) throw Exception("Command error: command needs museum"); return *this->museum; } View & Command::get_view() { if (this->view == nullptr) throw Exception("Command error: command needs view"); return *this->view; } ViewController & Command::get_controller() { if (this->controller == nullptr) throw Exception("Command error: command needs controller"); return *this->controller; } void Command::set_museum(Museum & museum) { this->museum = &museum; } void Command::set_view(View & view) { this->view = &view; } void Command::set_controller(ViewController & controller) { this->controller = &controller; }