architecture.cpp
Go to the documentation of this file.
00001 #include "rqt_mrta/config/architecture/architecture.h"
00002 
00003 namespace rqt_mrta
00004 {
00005 namespace config
00006 {
00007 namespace architecture
00008 {
00009 Architecture::Architecture(QObject* parent)
00010     : AbstractConfig(parent), allocations_(new Allocations(this)),
00011       robots_(new Robots(this)), tasks_(new Tasks(this))
00012 {
00013   connect(allocations_, SIGNAL(changed()), this, SIGNAL(changed()));
00014   connect(robots_, SIGNAL(changed()), this, SIGNAL(changed()));
00015   connect(tasks_, SIGNAL(changed()), this,SIGNAL(changed()));
00016 }
00017 
00018 Architecture::~Architecture()
00019 {
00020   if (allocations_)
00021   {
00022     delete allocations_;
00023     allocations_ = NULL;
00024   }
00025   if (robots_)
00026   {
00027     delete robots_;
00028     robots_ = NULL;
00029   }
00030   if (tasks_)
00031   {
00032     delete tasks_;
00033     tasks_ = NULL;
00034   }
00035 }
00036 
00037 Allocations* Architecture::getAllocations() const { return allocations_; }
00038 
00039 QString Architecture::getName() const { return name_; }
00040 
00041 Robots* Architecture::getRobots() const { return robots_; }
00042 
00043 Tasks* Architecture::getTasks() const { return tasks_; }
00044 
00045 void Architecture::setName(const QString& name)
00046 {
00047   if (name != name_)
00048   {
00049     name_ = name;
00050     emit nameChanged(name);
00051     emit changed();
00052   }
00053 }
00054 
00055 void Architecture::save(QSettings& settings) const
00056 {
00057   settings.beginGroup("architecture");
00058   settings.setValue("name", name_);
00059   allocations_->save(settings);
00060   robots_->save(settings);
00061   tasks_->save(settings);
00062   settings.endGroup();
00063 }
00064 
00065 void Architecture::load(QSettings& settings)
00066 {
00067   settings.beginGroup("architecture");
00068   setName(settings.value("name").toString());
00069   allocations_->load(settings);
00070   robots_->load(settings);
00071   tasks_->load(settings);
00072   settings.endGroup();
00073 }
00074 
00075 void Architecture::reset()
00076 {
00077   setName("");
00078   allocations_->reset();
00079   robots_->reset();
00080   tasks_->reset();
00081 }
00082 
00083 void Architecture::write(QDataStream& stream) const
00084 {
00085   stream << name_;
00086   allocations_->write(stream);
00087   robots_->write(stream);
00088   tasks_->write(stream);
00089 }
00090 
00091 void Architecture::read(QDataStream& stream)
00092 {
00093   QString name;
00094   stream >> name;
00095   setName(name);
00096   allocations_->read(stream);
00097   robots_->read(stream);
00098   tasks_->read(stream);
00099 }
00100 
00101 Architecture& Architecture::operator=(const Architecture& config)
00102 {
00103   setName(config.name_);
00104   *allocations_ = *config.allocations_;
00105   *robots_ = *config.robots_;
00106   *tasks_ = *config.tasks_;
00107   return *this;
00108 }
00109 }
00110 }
00111 }


rqt_mrta
Author(s): Adriano Henrique Rossette Leite
autogenerated on Thu Jun 6 2019 18:50:52