00001 #include "rqt_mrta/config/architecture/allocations.h" 00002 00003 namespace rqt_mrta 00004 { 00005 namespace config 00006 { 00007 namespace architecture 00008 { 00009 Allocations::Allocations(QObject* parent) 00010 : AbstractConfig(parent), allocated_tasks_(new AllocatedTasks(this)) 00011 { 00012 connect(allocated_tasks_, SIGNAL(changed()), this, SIGNAL(changed())); 00013 } 00014 00015 Allocations::~Allocations() 00016 { 00017 if (allocated_tasks_) 00018 { 00019 delete allocated_tasks_; 00020 allocated_tasks_ = NULL; 00021 } 00022 } 00023 00024 QString Allocations::getType() const 00025 { 00026 return type_; 00027 } 00028 00029 AllocatedTasks* Allocations::getAllocatedTasks() const 00030 { 00031 return allocated_tasks_; 00032 } 00033 00034 void Allocations::setType(const QString &type) 00035 { 00036 if (type != type_) 00037 { 00038 type_ = type; 00039 emit typeChanged(type); 00040 emit changed(); 00041 } 00042 } 00043 00044 void Allocations::save(QSettings& settings) const 00045 { 00046 settings.beginGroup("allocations"); 00047 settings.setValue("type", type_); 00048 allocated_tasks_->save(settings); 00049 settings.endGroup(); 00050 } 00051 00052 void Allocations::load(QSettings& settings) 00053 { 00054 settings.beginGroup("allocations"); 00055 setType(settings.value("type").toString()); 00056 allocated_tasks_->load(settings); 00057 settings.endGroup(); 00058 } 00059 00060 void Allocations::reset() 00061 { 00062 setType(""); 00063 allocated_tasks_->reset(); 00064 } 00065 00066 void Allocations::write(QDataStream& stream) const 00067 { 00068 stream << type_; 00069 allocated_tasks_->write(stream); 00070 } 00071 00072 void Allocations::read(QDataStream& stream) 00073 { 00074 QString type; 00075 stream >> type; 00076 setType(type); 00077 allocated_tasks_->read(stream); 00078 } 00079 00080 Allocations& Allocations::operator=(const Allocations& config) 00081 { 00082 setType(config.type_); 00083 *allocated_tasks_ = *config.allocated_tasks_; 00084 return *this; 00085 } 00086 } 00087 } 00088 }