1 #ifndef artdaq_ArtModules_ArtdaqFragmentNamingService_h
2 #define artdaq_ArtModules_ArtdaqFragmentNamingService_h
4 #include "art/Framework/Services/Registry/ServiceMacros.h"
5 #include "artdaq-core/Data/Fragment.hh"
6 #include "fhiclcpp/types/Atom.h"
31 auto extraTypes = ps.get<std::vector<std::pair<artdaq::Fragment::type_t, std::string>>>(
"fragment_type_map", std::vector<std::pair<artdaq::Fragment::type_t, std::string>>());
32 for (
auto it = extraTypes.begin(); it != extraTypes.end(); ++it)
41 void SetBasicTypes(std::map<artdaq::Fragment::type_t, std::string>
const& type_map)
43 for (
auto& type_pair : type_map)
45 type_map_[type_pair.first] = type_pair.second;
52 void AddExtraType(artdaq::Fragment::type_t type_id, std::string type_name)
83 virtual std::pair<bool, std::string>
87 std::map<artdaq::Fragment::type_t, std::string>
type_map_;
116 virtual std::string GetInstanceNameForType(artdaq::Fragment::type_t type_id);
123 virtual std::set<std::string> GetAllProductInstanceNames();
131 virtual std::pair<bool, std::string>
132 GetInstanceNameForFragment(artdaq::Fragment
const& fragment);
ArtdaqFragmentNamingServiceInterface(fhicl::ParameterSet const &ps)
ArtdaqFragmentNamingServiceInterface constructor.
void SetBasicTypes(std::map< artdaq::Fragment::type_t, std::string > const &type_map)
Sets the basic types to be translated. (Should not include "container" types.)
virtual std::pair< bool, std::string > GetInstanceNameForFragment(artdaq::Fragment const &fragment)=0
Returns the product instance name for the specified fragment, based on the types that have been speci...
void AddExtraType(artdaq::Fragment::type_t type_id, std::string type_name)
Adds an additional type to be translated.
virtual ~ArtdaqFragmentNamingServiceInterface()=default
Default virtual destructor.
virtual std::set< std::string > GetAllProductInstanceNames()=0
Returns the full set of product instance names which may be present in the data, based on the types t...
std::map< artdaq::Fragment::type_t, std::string > type_map_
Map relating Fragment Type to strings.
ArtdaqFragmentNamingService extends ArtdaqFragmentNamingServiceInterface. This implementation uses th...
Interface for ArtdaqFragmentNamingService. This interface is declared to art as part of the required ...
virtual std::string GetInstanceNameForType(artdaq::Fragment::type_t type_id)=0
Returns the basic translation for the specified type. Must be implemented by derived classes...
std::string unidentified_instance_name_
The name to use for unknown Fragment types.
std::string GetUnidentifiedInstanceName()
Get the configured unidentified_instance_name.