All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ArtServiceHelper.cxx
Go to the documentation of this file.
1 #include "art/Framework/Services/Registry/ServiceRegistry.h"
2 #include "fhiclcpp/intermediate_table.h"
3 
5 
6 namespace {
7  auto fully_processed(fhicl::ParameterSet&& pset)
8  {
9  // Make sure each service has a value for the "service_type" parameter
10  fhicl::ParameterSet result;
11  auto const& input = pset.has_key("services") ? pset.get<fhicl::ParameterSet>("services") : pset;
12  auto const service_names = input.get_pset_names();
13  for (auto const& service_name : service_names) {
14  auto service_pset = input.get<fhicl::ParameterSet>(service_name);
15  service_pset.put("service_type", service_name);
16  result.put(service_name, service_pset);
17  }
18  return result;
19  }
20 }
21 
22 ArtServiceHelper::ArtServiceHelper(fhicl::ParameterSet&& pset) :
23  activityRegistry_{},
24  sharedResources_{},
25  servicesManager_{std::move(pset), activityRegistry_, sharedResources_}
26 {
27  servicesManager_.forceCreation();
28 }
29 
30 void ArtServiceHelper::load_services(std::string const& config)
31 {
32  cet::filepath_lookup lookup{"FHICL_FILE_PATH"};
33  std::istringstream is{config};
34  auto table = fhicl::parse_document(is, lookup);
35  static ArtServiceHelper helper{fully_processed(fhicl::ParameterSet::make(table))};
36 }
static void load_services(std::string const &config)
ArtServiceHelper(fhicl::ParameterSet &&pset)