00001 #ifndef _MRTA_ROBOT_H_ 00002 #define _MRTA_ROBOT_H_ 00003 00004 #include <QMap> 00005 #include <QVector> 00006 #include <QObject> 00007 #include "mrta/taxonomy.h" 00008 00009 namespace rqt_mrta 00010 { 00011 namespace config 00012 { 00013 class ParamsArray; 00014 namespace application 00015 { 00016 class Robot; 00017 } 00018 } 00019 } 00020 00021 namespace mrta 00022 { 00023 class History; 00024 class StateMonitor; 00025 class System; 00026 class Task; 00027 class Robot : public QObject 00028 { 00029 Q_OBJECT 00030 public: 00031 typedef QList<Task*>::iterator iterator; 00032 typedef QList<Task*>::const_iterator const_iterator; 00033 typedef rqt_mrta::config::application::Robot Config; 00034 typedef Taxonomy::RobotType Type; 00035 enum State 00036 { 00037 Idle, 00038 Busy, 00039 Offline, 00040 STATE_COUNT 00041 }; 00042 Robot(System* parent = NULL, Config* config = NULL); 00043 Robot(const Robot& robot); 00044 virtual ~Robot(); 00045 Config* getConfig() const; 00046 QString getId() const; 00047 Type getType() const; 00048 State getState() const; 00049 History* getHistory() const; 00050 StateMonitor* getStateMonitor() const; 00051 void setState(State state); 00052 void setConfig(Config* config); 00053 size_t count() const; 00054 Task* getTask(int index) const; 00055 void addTask(Task* task); 00056 void removeTask(Task* task); 00057 void clearTasks(); 00058 Robot& operator=(const Robot& robot); 00059 00060 public slots: 00061 void setId(const QString& id); 00062 00063 signals: 00064 void changed(); 00065 void idChanged(const QString& id); 00066 void stateChanged(int state); 00067 void idle(); 00068 void busy(); 00069 void offline(); 00070 void added(size_t index); 00071 void removed(const QString& task_id); 00072 void taskChanged(); 00073 void taskIdChanged(const QString& task_id); 00074 00075 private: 00076 QString id_; 00077 Type type_; 00078 State state_; 00079 QVector<Task*> tasks_; 00080 Config* config_; 00081 History* history_; 00082 StateMonitor* monitor_; 00083 00084 private slots: 00085 void configDestroyed(); 00086 void taskDestroyed(); 00087 void monitorUpdated(size_t index, bool up_to_date); 00088 }; 00089 } 00090 00091 #endif // _MRTA_ROBOT_H_