LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
DumpAssociations.h
Go to the documentation of this file.
1 
8 #ifndef UTIL_DUMPASSOCIATIONS_H
9 #define UTIL_DUMPASSOCIATIONS_H 1
10 
11 // C//C++ standard libraries
12 #include <type_traits> // std::is_same<>
13 #include <typeinfo>
14 
15 // framework and supporting libraries
17 #include "cetlib_except/demangle.h"
18 
19 namespace util {
20 
30  template <typename Stream, typename Left, typename Right, typename Data>
31  void DumpAssociationsIntro(Stream&& out, art::Assns<Left, Right, Data> const& assns)
32  {
33  out << "Association between '" << cet::demangle_symbol(typeid(Left).name()) << "' and '"
34  << cet::demangle_symbol(typeid(Right).name()) << "'";
35  if (std::is_same<Data, void>()) {
36  out << " with '" << cet::demangle_symbol(typeid(Data).name()) << "' metadata";
37  }
38  if (assns.size() > 0) { out << " contains " << assns.size() << " relations"; }
39  else {
40  out << " is empty";
41  }
42  } // DumpAssociationsIntro<Data>()
43 
44 } // namespace util
45 
46 #endif // UTIL_DUMPASSOCIATIONS_H
Namespace for general, non-LArSoft-specific utilities.
Definition: PIDAAlg.h:26
void DumpAssociationsIntro(Stream &&out, art::Assns< Left, Right, Data > const &assns)
Dumps a short introduction about specified association.
size_type size() const
Definition: Assns.h:500