1 #include "artdaq-core/Data/ContainerFragment.hh"
2 #include "artdaq-core/Data/FragmentNameHelper.hh"
9 TLOG(TLVL_DEBUG) <<
"ArtdaqFragmentNameHelper CONSTRUCTOR START";
10 TLOG(TLVL_DEBUG) <<
"ArtdaqFragmentNameHelper CONSTRUCTOR END";
23 std::set<std::string> output;
26 std::string instance_name = map_iter.second;
27 if (output.count(instance_name) == 0u)
29 output.insert(instance_name);
30 TLOG(TLVL_TRACE) <<
"Adding product instance name \"" << map_iter.second <<
"\" to list of expected names";
35 if (container_type != type_map_.end())
37 std::string container_type_name = container_type->second;
38 std::set<std::string> tmp_copy = output;
39 for (
const auto& set_iter : tmp_copy)
41 output.insert(container_type_name + set_iter);
48 std::pair<bool, std::string>
52 bool success_code =
true;
53 std::string instance_name;
56 if (primary_type != type_map_end)
58 TLOG(TLVL_TRACE) <<
"Found matching instance name " << primary_type->second <<
" for Fragment type " << fragment.
type();
59 instance_name = primary_type->second;
64 if (contained_type != type_map_end)
66 instance_name += contained_type->second;
77 return std::make_pair(success_code, instance_name);
virtual ~ArtdaqFragmentNameHelper()
DefaultArtdaqFragmentNameHelper Destructor.
The artdaq::ContainerFragment class represents a Fragment which contains other Fragments.
std::string unidentified_instance_name_
The name to use for unknown Fragment types.
virtual std::set< std::string > GetAllProductInstanceNames() const
Returns the full set of product instance names which may be present in the data, based on the types t...
Default implementation of FragmentNameHelper.
detail::RawFragmentHeader::type_t type_t
typedef for type_t from RawFragmentHeader
std::map< artdaq::Fragment::type_t, std::string > type_map_
Map relating Fragment Type to strings.
Fragment::type_t fragment_type() const
Get the Fragment::type_t of stored Fragment objects.
The FragmentNameHelper translates between Fragments and their instance names (usually by type...
static constexpr type_t ContainerFragmentType
Copy ContainerFragmentType from RawFragmentHeader.
type_t type() const
Type of the Fragment, from the Fragment header.
virtual std::pair< bool, std::string > GetInstanceNameForFragment(artdaq::Fragment const &fragment) const
Returns the product instance name for the specified fragment, based on the types that have been speci...
A Fragment contains the data from one piece of the DAQ system for one event The artdaq::Fragment is t...
ArtdaqFragmentNameHelper(std::string unidentified_instance_name, std::vector< std::pair< artdaq::Fragment::type_t, std::string >> extraTypes)
ArtdaqFragmentNameHelper Constructor.
virtual std::string GetInstanceNameForType(artdaq::Fragment::type_t type_id) const
Returns the basic translation for the specified type. Defaults to the specified unidentified_instance...