00001 #include "Conventions/Reconstruction.h" 00002 00003 #include <cctype> 00004 #include <string> 00005 #include <algorithm> 00006 using namespace std; 00007 00008 00009 static const char* names[] = { 00010 "Unknown", 00011 "Good", 00012 "NotProcessed", 00013 "BadReadout", 00014 "NoHits", 00015 "NotConverged", 00016 0 00017 }; 00018 00019 const char* ReconStatus::AsString(ReconStatus_t id) 00020 { 00021 00022 if (id < 0 || id > kNotConverged) return names[0]; 00023 return names[id]; 00024 } 00025 00026 ReconStatus::ReconStatus_t ReconStatus::FromString(const char* str) 00027 { 00028 string s = str; 00029 transform(s.begin(),s.end(),s.begin(),::toupper); 00030 00031 for (int ind=1; names[ind]; ++ind) { 00032 if (s == names[ind]) return (ReconStatus::ReconStatus_t)ind; 00033 } 00034 return kUnknown; 00035 }