00001 #ifndef _MRTA_SYSTEM_H_ 00002 #define _MRTA_SYSTEM_H_ 00003 00004 #include <QMap> 00005 #include <QObject> 00006 #include <QVector> 00007 #include "mrta/taxonomy.h" 00008 00009 namespace utilities 00010 { 00011 class MessageSubscriberRegistry; 00012 } 00013 00014 namespace rqt_mrta 00015 { 00016 namespace config 00017 { 00018 namespace application 00019 { 00020 class Robot; 00021 class RqtMrtaApplication; 00022 } 00023 00024 namespace architecture 00025 { 00026 class RqtMrtaArchitecture; 00027 } 00028 } 00029 } 00030 00031 namespace mrta 00032 { 00033 typedef rqt_mrta::config::application::Robot RobotConfig; 00034 typedef rqt_mrta::config::application::RqtMrtaApplication ApplicationConfig; 00035 typedef rqt_mrta::config::architecture::RqtMrtaArchitecture ArchitectureConfig; 00036 class Allocation; 00037 class Monitor; 00038 class Problem; 00039 class Robot; 00040 class RobotMonitor; 00041 class Task; 00042 class System : public QObject 00043 { 00044 Q_OBJECT 00045 public: 00046 System(QObject* parent, ApplicationConfig* application_config, 00047 ArchitectureConfig* architecture_config, 00048 utilities::MessageSubscriberRegistry* registry); 00049 virtual ~System(); 00050 Robot* getRobot(const QString& id); 00051 Task* getTask(const QString& id); 00052 Allocation* getAllocation(const QString& id); 00053 QList<Robot*> getRobots() const; 00054 QList<Task*> getTasks() const; 00055 QList<Allocation*> getAllocations() const; 00056 void setRegistry(utilities::MessageSubscriberRegistry* registry); 00057 00058 signals: 00059 void changed(); 00060 void added(const QString& id); 00061 void robotStateChanged(const QString& id, int state); 00062 void taskStateChanged(const QString& id, int state); 00063 void allocationStateChanged(const QString& id, int state); 00064 00065 private: 00066 typedef QMap<QString, Robot*> RobotMap; 00067 RobotMap robots_; 00068 Problem* problem_; 00069 ApplicationConfig* application_config_; 00070 ArchitectureConfig* architecture_config_; 00071 QVector<Monitor*> monitors_; 00072 Robot* addRobot(RobotConfig* config); 00073 00074 private slots: 00075 void robotStateChanged(int state); 00076 }; 00077 } 00078 00079 #endif // _MRTA_SYSTEM_H_