LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
checkDictionaries.cc
Go to the documentation of this file.
2 // vim: set sw=2:
3 
6 #include "canvas_root_io/Streamers/AssnsStreamer.h"
7 #include "canvas_root_io/Streamers/BranchDescriptionStreamer.h"
8 #include "canvas_root_io/Utilities/DictionaryChecker.h"
9 #include "canvas_root_io/Utilities/TypeTools.h"
10 #include "cetlib/assert_only_one_thread.h"
11 
12 void
14 {
15  CET_ASSERT_ONLY_ONE_THREAD();
16 
17  // Make sure we populate the ROOT-related transient information. If
18  // this is not done, then TBranch-related quantities will not be set
19  // correctly.
20  detail::BranchDescriptionStreamer::fluffRootTransients(productDesc);
21  auto const isTransient = productDesc.transient();
22 
23  // Check product dictionaries.
24  static root::DictionaryChecker dictChecker{};
25  dictChecker.checkDictionaries(productDesc.wrappedName(), false);
26  dictChecker.checkDictionaries(productDesc.producedClassName(), !isTransient);
27 
28  // Check dictionaries for assnsPartner, if appropriate. This is only
29  // necessary for top-level checks so appropriate here rather than
30  // checkDictionaries itself.
31  if (!isTransient) {
32  auto const assnsPartner =
34  if (!assnsPartner.empty()) {
35  dictChecker.checkDictionaries(wrappedClassName(assnsPartner), true);
36  }
37  }
38  dictChecker.reportMissingDictionaries();
39 
40  // Make sure that the AssnsStreamer is appropropriately setup--must
41  // be done after we are sure that there is matching dictionary for
42  // the partner.
43  if (!is_assns(productDesc.producedClassName()))
44  return;
45 
46  detail::AssnsStreamer::init_streamer(productDesc.producedClassName());
47 }
std::string const & wrappedName() const
std::string wrappedClassName(std::string const &className)
std::string name_of_assns_partner(std::string assns_type_name)
Definition: TypeID.cc:99
std::string const & producedClassName() const
bool is_assns(TypeID const &tid)
Definition: TypeID.h:145
void checkDictionaries(BranchDescription const &productDesc)