00001 #include "mrta/architecture.h" 00002 #include "mrta/architecture_config.h" 00003 #include "utilities/exception.h" 00004 00005 namespace mrta 00006 { 00007 ArchitectureConfig::ArchitectureConfig(QObject* parent) 00008 : AbstractConfig(parent), architecture_(NULL) 00009 { 00010 } 00011 00012 Architecture* ArchitectureConfig::getArchitecture() const 00013 { 00014 return architecture_; 00015 } 00016 00017 void ArchitectureConfig::setArchitecture(Architecture* architecture) 00018 { 00019 architecture_ = architecture; 00020 } 00021 00022 void ArchitectureConfig::load(QSettings& settings) 00023 { 00024 if (!architecture_) 00025 { 00026 throw utilities::Exception("Architecture must not be NULL."); 00027 } 00028 settings.beginGroup("architecture"); 00029 architecture_->setName(settings.value("name").toString()); 00030 architecture_->setAllocationType(Taxonomy::getAllocationType( 00031 settings.value("allocations/type", "").toString())); 00032 architecture_->setRobotType(Taxonomy::getRobotType( 00033 settings.value("robots/type", "").toString())); 00034 architecture_->setTaskType(Taxonomy::getTaskType( 00035 settings.value("tasks/type", "").toString())); 00036 settings.endGroup(); 00037 } 00038 }