taxonomy.cpp
Go to the documentation of this file.
00001 #include "mrta/taxonomy.h"
00002 #include "mrta/architecture.h"
00003 
00004 namespace mrta
00005 {
00006 Taxonomy::AllocationType Taxonomy::getAllocationType(const QString& type)
00007 {
00008   if (type == "instantaneous_assignment" || type == "IA" || type == "ia" ||
00009       type == "INSTANTANEOUS_ASSIGNMENT" || type == "InstantaneousAssignment" ||
00010       type == "Instantaneous Assignment" ||
00011       type == "Instantaneous Assignment (IA)")
00012   {
00013     return Taxonomy::InstantaneousAssignment;
00014   }
00015   else if (type == "time_extended_assignment" || type == "TA" || type == "ta" ||
00016            type == "TIME_EXTENDED_ASSIGNMENT" ||
00017            type == "TimeExtendedAssignment" ||
00018            type == "Time-Extended Assignment" ||
00019            type == "Time-Extended Assignment (TA)")
00020   {
00021     return Taxonomy::TimeExtendedAssignment;
00022   }
00023   return Taxonomy::UnknownAllocationType;
00024 }
00025 
00026 Taxonomy::RobotType Taxonomy::getRobotType(const QString& type)
00027 {
00028   if (type == "single_task" || type == "ST" || type == "st" ||
00029       type == "SINGLE_TASK" || type == "SingleTask" || type == "Single Task" ||
00030       type == "Single Task (ST)")
00031   {
00032     return Taxonomy::SingleTask;
00033   }
00034   else if (type == "multi_task" || type == "MT" || type == "mt" ||
00035            type == "MULTI_TASK" || type == "MultiTask" ||
00036            type == "Multi Task" || type == "Multi Task (MT)")
00037   {
00038     return Taxonomy::MultiTask;
00039   }
00040   return Taxonomy::UnknownRobotType;
00041 }
00042 
00043 Taxonomy::TaskType Taxonomy::getTaskType(const QString& type)
00044 {
00045   if (type == "single_robot" || type == "SR" || type == "sr" ||
00046       type == "SINGLE_ROBOT" || type == "SingleRobot" ||
00047       type == "Single Robot" || type == "Single Robot (SR)")
00048   {
00049     return Taxonomy::SingleRobot;
00050   }
00051   else if (type == "multi_robot" || type == "MR" || type == "mr" ||
00052            type == "MULTI_ROBOT" || type == "MultiRobot" ||
00053            type == "Multi Robot" || type == "Multi Robot (MR)")
00054   {
00055     return Taxonomy::MultiRobot;
00056   }
00057   return Taxonomy::UnknownTaskType;
00058 }
00059 
00060 QString Taxonomy::toQString(const Taxonomy::AllocationType& type)
00061 {
00062   return type == Taxonomy::InstantaneousAssignment
00063              ? "IA"
00064              : type == Taxonomy::TimeExtendedAssignment ? "TA" : "";
00065 }
00066 
00067 QString Taxonomy::toQString(const Taxonomy::RobotType& type)
00068 {
00069   return type == Taxonomy::SingleTask ? "ST"
00070                                       : type == Taxonomy::MultiTask ? "MT" : "";
00071 }
00072 
00073 QString Taxonomy::toQString(const Taxonomy::TaskType& type)
00074 {
00075   return type == Taxonomy::SingleRobot ? "SR" : type == Taxonomy::MultiRobot
00076                                                     ? "MR"
00077                                                     : "";
00078 }
00079 
00080 QString Taxonomy::toQString(const Architecture& architecture)
00081 {
00082   return Taxonomy::toQString(architecture.getRobotType()) + "-" +
00083          Taxonomy::toQString(architecture.getTaskType()) + "-" +
00084          Taxonomy::toQString(architecture.getAllocationType());
00085 }
00086 
00087 std::string Taxonomy::toString(const Taxonomy::AllocationType& type)
00088 {
00089   return Taxonomy::toQString(type).toStdString();
00090 }
00091 
00092 std::string Taxonomy::toString(const Taxonomy::RobotType& type)
00093 {
00094   return Taxonomy::toQString(type).toStdString();
00095 }
00096 
00097 std::string Taxonomy::toString(const Taxonomy::TaskType& type)
00098 {
00099   return Taxonomy::toQString(type).toStdString();
00100 }
00101 
00102 std::string Taxonomy::toString(const Architecture& architecture)
00103 {
00104   return Taxonomy::toQString(architecture).toStdString();
00105 }
00106 
00107 const char* Taxonomy::toCString(const Taxonomy::AllocationType& type)
00108 {
00109   return Taxonomy::toString(type).c_str();
00110 }
00111 
00112 const char* Taxonomy::toCString(const Taxonomy::RobotType& type)
00113 {
00114   return Taxonomy::toString(type).c_str();
00115 }
00116 
00117 const char* Taxonomy::toCString(const Taxonomy::TaskType& type)
00118 {
00119   return Taxonomy::toString(type).c_str();
00120 }
00121 
00122 const char* Taxonomy::toCString(const Architecture& architecture)
00123 {
00124   return Taxonomy::toString(architecture).c_str();
00125 }
00126 }


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