1 #include "artdaq-core/Data/ContainerFragment.hh"
2 #include "artdaq/ArtModules/ArtdaqFragmentNamingService.h"
4 #include "TRACE/tracemf.h"
5 #define TRACE_NAME "ArtdaqFragmentNamingService"
10 TLOG(TLVL_DEBUG) <<
"ArtdaqFragmentNamingService CONSTRUCTOR START";
11 TLOG(TLVL_DEBUG) <<
"ArtdaqFragmentNamingService CONSTRUCTOR END";
26 std::set<std::string> output;
29 std::string instance_name = map_iter.second;
30 if (!output.count(instance_name))
32 output.insert(instance_name);
33 TLOG(TLVL_TRACE) <<
"Adding product instance name \"" << map_iter.second
34 <<
"\" to list of expected names";
38 auto container_type = type_map_.find(artdaq::Fragment::type_t(artdaq::Fragment::ContainerFragmentType));
39 if (container_type != type_map_.end())
41 std::string container_type_name = container_type->second;
42 std::set<std::string> tmp_copy = output;
43 for (
const auto& set_iter : tmp_copy)
45 output.insert(container_type_name + set_iter);
52 std::pair<bool, std::string>
56 bool success_code =
true;
57 std::string instance_name;
59 auto primary_type =
type_map_.find(fragment.type());
60 if (primary_type != type_map_end)
62 TLOG(TLVL_TRACE) <<
"Found matching instance name " << primary_type->second <<
" for Fragment type " << fragment.type();
63 instance_name = primary_type->second;
64 if (fragment.type() == artdaq::Fragment::ContainerFragmentType)
66 artdaq::ContainerFragment cf(fragment);
67 auto contained_type =
type_map_.find(cf.fragment_type());
68 if (contained_type != type_map_end)
70 instance_name += contained_type->second;
81 return std::make_pair(success_code, instance_name);
virtual std::pair< bool, std::string > GetInstanceNameForFragment(artdaq::Fragment const &fragment)
Returns the product instance name for the specified fragment, based on the types that have been speci...
virtual std::string GetInstanceNameForType(artdaq::Fragment::type_t type_id)
Returns the basic translation for the specified type. Defaults to the specified unidentified_instance...
virtual std::set< std::string > GetAllProductInstanceNames()
Returns the full set of product instance names which may be present in the data, based on the types t...
ArtdaqFragmentNamingService(fhicl::ParameterSet const &pset, art::ActivityRegistry &)
NetMonTransportService Constructor.
std::map< artdaq::Fragment::type_t, std::string > type_map_
Map relating Fragment Type to strings.
ArtdaqFragmentNamingService extends ArtdaqFragmentNamingServiceInterface. This implementation uses th...
virtual ~ArtdaqFragmentNamingService()
DefaultArtdaqFragmentNamingService Destructor.
Interface for ArtdaqFragmentNamingService. This interface is declared to art as part of the required ...
std::string unidentified_instance_name_
The name to use for unknown Fragment types.