00001 #include "Conventions/RunType.h" 00002 00003 #include <cctype> 00004 #include <string> 00005 #include <algorithm> 00006 using namespace std; 00007 using namespace DayaBay; 00008 00009 static const char* names[] = { 00010 "Unknown", 00011 "Physics", 00012 "Pedestal", 00013 "Calibration", 00014 "ElecCalib", 00015 "Debug", 00016 0 00017 }; 00018 00019 const char* RunType::AsString(RunType_t id) 00020 { 00021 if (id < 0 || id > kDebug) return names[0]; 00022 return names[id]; 00023 } 00024 00025 RunType::RunType_t RunType::FromString(const char* str) 00026 { 00027 string s = str; 00028 00029 for (int ind=1; names[ind]; ++ind) { 00030 if (s == names[ind]) return (RunType::RunType_t)ind; 00031 } 00032 return kUnknown; 00033 }