LArSoft  v07_13_02
Liquid Argon Software toolkit - http://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 <typeinfo>
13 #include <type_traits> // std::is_same<>
14 
15 // framework and supporting libraries
16 #include "cetlib_except/demangle.h"
18 
19 
20 namespace util {
21 
31  template <typename Stream, typename Left, typename Right, typename Data>
33  (Stream&& out, art::Assns<Left, Right, Data> const& assns)
34  {
35  out << "Association between '" << cet::demangle_symbol(typeid(Left).name())
36  << "' and '" << cet::demangle_symbol(typeid(Right).name()) << "'";
37  if (std::is_same<Data, void>()) {
38  out << " with '" << cet::demangle_symbol(typeid(Data).name())
39  << "' metadata";
40  }
41  if (assns.size() > 0) {
42  out << " contains " << assns.size() << " relations";
43  }
44  else {
45  out << " is empty";
46  }
47  } // DumpAssociationsIntro<Data>()
48 
49 
50 
51 } // namespace util
52 
53 #endif // UTIL_DUMPASSOCIATIONS_H
size_type size() const
Definition: Assns.h:440
Namespace for general, non-LArSoft-specific utilities.
Definition: PIDAAlg.h:17
void DumpAssociationsIntro(Stream &&out, art::Assns< Left, Right, Data > const &assns)
Dumps a short introduction about specified association.