00001 #ifndef _MRTA_PROBLEM_H_ 00002 #define _MRTA_PROBLEM_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 namespace architecture 00014 { 00015 class RqtMrtaArchitecture; 00016 } 00017 } 00018 } 00019 00020 namespace mrta 00021 { 00022 typedef rqt_mrta::config::architecture::RqtMrtaArchitecture ArchitectureConfig; 00023 class Allocation; 00024 class Architecture; 00025 class Robot; 00026 class System; 00027 class Task; 00028 class Problem : public QObject 00029 { 00030 Q_OBJECT 00031 public: 00032 Problem(System* system, const QString& name, ArchitectureConfig* architecture_config); 00033 virtual ~Problem(); 00034 QString getName() const; 00035 Architecture* getArchitecture() const; 00036 Task* getTask(const QString& id) const; 00037 Allocation* getAllocation(const QString& id) const; 00038 QList<Task*> getTasks() const; 00039 QList<Allocation*> getAllocations() const; 00040 void setArchitecture(Architecture* architecture); 00041 Allocation* addAllocation(Task* task, const QVector<Robot*>& robots); 00042 bool isValid(Taxonomy::AllocationType type) const; 00043 bool isValid(Taxonomy::RobotType type) const; 00044 bool isValid(Taxonomy::TaskType type) const; 00045 00046 signals: 00047 void changed(); 00048 void taskStateChanged(const QString& task, int state); 00049 void allocationAdded(const QString& id); 00050 void allocationStateChanged(const QString& id, int state); 00051 00052 private: 00053 typedef QMap<QString, Task*> TaskMap; 00054 typedef QMap<QString, Allocation*> AllocationMap; 00055 QString name_; 00056 System* system_; 00057 Architecture* architecture_; 00058 TaskMap tasks_; 00059 AllocationMap allocations_; 00060 00061 private: 00062 void taskStateChanged(int state); 00063 void allocationStateChanged(int state); 00064 }; 00065 } 00066 00067 #endif // _MRTA_PROBLEM_H_