FragmentType.cc
Go to the documentation of this file.
2 
3 #include <algorithm>
4 #include <cassert>
5 #include <string>
6 #include <vector>
7 
8 
11 {
12  std::transform(t_string.begin(),
13  t_string.end(),
14  t_string.begin(),
15  toupper);
16  auto it = std::find(names.begin(), names.end(), t_string);
17  return (it == names.end()) ?
19  static_cast<FragmentType>(artdaq::Fragment::FirstUserFragmentType +
20  (it - names.begin()));
21 }
22 
25 {
26  if (val < FragmentType::INVALID) {
27  return names[val - FragmentType::MISSED];
28  }
29  else {
30  return "INVALID/UNKNOWN";
31  }
32 }
33 
34 
35 std::map<artdaq::Fragment::type_t, std::string> dune::makeFragmentTypeMap()
36 {
37  auto output = artdaq::Fragment::MakeSystemTypeMap();
38  for (auto name : names)
39  {
41  }
42  return output;
43 }
static QCString name
Definition: declinfo.cpp:673
std::string string
Definition: nybbler.cc:12
FragmentType toFragmentType(std::string t_string)
Definition: FragmentType.cc:10
std::string fragmentTypeToString(FragmentType val)
Definition: FragmentType.cc:24
std::map< artdaq::Fragment::type_t, std::string > makeFragmentTypeMap()
Definition: FragmentType.cc:35
static std::vector< std::string > const names
Definition: FragmentType.hh:8