tdaq-develop-2025-02-12
FragmentType.hh
1 #ifndef artdaq_ots_Overlays_FragmentType_hh
2 #define artdaq_ots_Overlays_FragmentType_hh
3 #include "artdaq-core/Data/Fragment.hh"
4 
5 namespace ots
6 {
7 static std::vector<std::string> const names{"MISSED", "UDP", "UNKNOWN"};
8 
9 namespace detail
10 {
11 enum FragmentType : artdaq::Fragment::type_t
12 {
13  MISSED = artdaq::Fragment::FirstUserFragmentType,
14  UDP,
15  INVALID // Should always be last.
16 };
17 
19 static_assert(artdaq::Fragment::isUserFragmentType(FragmentType::INVALID - 1),
20  "Too many user-defined fragments!");
21 } // namespace detail
22 
23 using detail::FragmentType;
24 
30 FragmentType toFragmentType(std::string t_string);
31 
37 std::string fragmentTypeToString(FragmentType val);
38 
43 std::map<artdaq::Fragment::type_t, std::string> makeFragmentTypeMap();
44 } // namespace ots
45 #endif /* artdaq_ots_core_Overlays_FragmentType_hh */
FragmentType toFragmentType(std::string t_string)
Lookup the type code for a fragment by its string name.
Definition: FragmentType.cc:8
std::string fragmentTypeToString(FragmentType val)
Look up the name of the given FragmentType.
Definition: FragmentType.cc:18
std::map< artdaq::Fragment::type_t, std::string > makeFragmentTypeMap()
Create a list of all Fragment types defined by this package, in the format that RawInput expects.
Definition: FragmentType.cc:30